Skip to content

Commit 8060775

Browse files
committed
Merge branch 'main' into release
2 parents 904533a + 2257875 commit 8060775

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

charon/cmd/cmd_merge.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ def _create_merged_zip(
151151
for file in files:
152152
file_path = os.path.join(root, file)
153153
# Calculate relative path to preserve directory structure
154-
arcname = os.path.relpath(file_path, root_path)
154+
merged_repos_path = os.path.join(root_path, "merged_repositories")
155+
arcname = os.path.relpath(file_path, merged_repos_path)
155156
zipf.write(file_path, arcname)
156157
logger.info("Done for the merged zip generation: %s", zip_path)

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)