Skip to content

Commit

Permalink
Added .gz.xz support
Browse files Browse the repository at this point in the history
  • Loading branch information
ragusaa authored and micahsnyder committed Dec 7, 2023
1 parent 4f20b03 commit b8d0720
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions mussels/recipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,10 @@ def _extract_archive(self, rebuild: bool) -> bool:
self.builds[self.target] = os.path.join(
self.work_dir, self.target, f"{self.archive[:-len('.zip')]}"
)
elif self.archive.endswith(".tar.xz"):
self.builds[self.target] = os.path.join(
self.work_dir, self.target, f"{self.archive[:-len('.tar.xz')]}"
)
else:
self.logger.error(
f"Unexpected archive extension. Currently only supports .tar.gz and .zip!"
Expand Down Expand Up @@ -258,6 +262,15 @@ def _extract_archive(self, rebuild: bool) -> bool:
zip_ref = zipfile.ZipFile(self.download_path, "r")
zip_ref.extractall(os.path.join(self.work_dir, self.target))
zip_ref.close()
elif self.archive.endswith(".tar.xz"):
# Un-tar
self.logger.info(
f"Extracting tarball archive {self.archive} to {self.builds[self.target]} ..."
)

tar = tarfile.open(self.download_path, "r:xz")
tar.extractall(os.path.join(self.work_dir, self.target))
tar.close()

return True

Expand Down

0 comments on commit b8d0720

Please sign in to comment.