Skip to content

Commit 5d2d898

Browse files
authored
Merge pull request #370 from yma955/main
Add the single tarball extract logic to avoid unnecessary merge files copy
2 parents 903022b + 289d9eb commit 5d2d898

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

charon/pkgs/maven.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -718,6 +718,21 @@ def _extract_tarballs(repos: List[str], root: str, prefix="", dir__=None) -> str
718718
# Create final merge directory
719719
final_tmp_root = mkdtemp(prefix=f"charon-{prefix}-final-", dir=dir__)
720720

721+
if len(repos) == 1:
722+
if os.path.exists(repos[0]):
723+
try:
724+
logger.info("Extracting the single tarball %s", repos[0])
725+
repo_zip = ZipFile(repos[0])
726+
extract_zip_all(repo_zip, final_tmp_root)
727+
728+
except BadZipFile as e:
729+
logger.error("Tarball extraction error for repo %s: %s", repos[0], e)
730+
sys.exit(1)
731+
else:
732+
logger.error("Error: archive %s does not exist", repos[0])
733+
sys.exit(1)
734+
return final_tmp_root
735+
721736
total_copied = 0
722737
total_duplicated = 0
723738
total_merged = 0

0 commit comments

Comments
 (0)