Commit e94c8be5 authored by Jakub Ružička's avatar Jakub Ružička
Browse files

Merge branch 'deb-archive' into 'master'

deb: improve archive handling

See merge request !49
parents 3dc924a4 b9511e21
Pipeline #81254 passed with stage
in 16 minutes and 16 seconds
......@@ -93,12 +93,11 @@ def build_srcpkg(
"""
archive_path = archive_paths[0]
nv, _ = parse.split_archive_ext(archive_path.name)
source_path = build_path / nv
log.info("building deb source package: %s", nv)
log.info("unpacking archive: %s", archive_path)
source_path.mkdir(parents=True)
unpack_path = unpack_archive(archive_path, build_path)
if unpack_path != source_path or not source_path.exists():
source_path = unpack_archive(archive_path, build_path)
log.verbose("source package root dir: %s", source_path)
if not source_path or not source_path.exists():
msg = "archive unpack didn't result in expected dir: %s" % source_path
raise ex.UnexpectedCommandOutput(msg=msg)
# render template
......
......@@ -23,6 +23,6 @@ def unpack_archive(archive_path, out_path):
root_files = list(out_path.glob("*"))
n_root_files = len(root_files)
if n_root_files != 1:
fmt = "Expected a single root dir but insteat got %d files in root"
fmt = "Expected a single root dir but instead got %d files in root"
raise ex.InvalidArchiveFormat(fmt=fmt % n_root_files)
return root_files[0]
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment