Skip to content

Commit

Permalink
Better skipping of non-compressed archive extensions (like .tar.gz.asc)
Browse files Browse the repository at this point in the history
  • Loading branch information
dirkmueller committed Mar 27, 2023
1 parent d522754 commit e8e245c
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions go_modules
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,9 @@ def archive_autodetect():
compression.
Use the name of the .spec file as the stem for the archive to detect.
Archive formats supported:
- .tar.bz2
- .tar.gz
- .tar.lz
- .tar.xz
- .tar.zstd
"""
Expand All @@ -129,17 +131,16 @@ def archive_autodetect():
archive = None
spec_dir = spec.parent # typically the same as cwd
# highest sorted archive under spec_dir
patterns = [
f"{spec.stem}*.tar.*",
f"{spec.stem}*.obscpio",
f"_service:*:{spec.stem}*tar.*",
f"_service:*:{spec.stem}*obscpio",
]
c_exts = ("gz", "xz", "zstd", "lz", "bz2")
patterns = (
[f"{spec.stem}*.tar.{c_ext}" for c_ext in c_exts]
+ [f"{spec.stem}*.obscpio"]
+ [f"_service:*:{spec.stem}*tar.{c_ext}" for c_ext in c_exts]
+ [f"_service:*:{spec.stem}*obscpio"]
)
for pattern in patterns:
log.debug(f"Trying to find archive name with pattern {pattern}")
archive = next(
reversed(sorted(Path(spec_dir).glob(pattern))), None
)
archive = next(reversed(sorted(Path(spec_dir).glob(pattern))), None)

if archive:
break
Expand Down

0 comments on commit e8e245c

Please sign in to comment.