From b8d07203272a61009576c98c2615f73faf28c6ba Mon Sep 17 00:00:00 2001 From: Andy Ragusa Date: Tue, 5 Dec 2023 15:16:02 -0800 Subject: [PATCH] Added .gz.xz support --- mussels/recipe.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/mussels/recipe.py b/mussels/recipe.py index ffa4909..e59ef2e 100644 --- a/mussels/recipe.py +++ b/mussels/recipe.py @@ -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!" @@ -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