diff options
-rw-r--r-- | cerbero/packages/disttarball.py | 6 | ||||
-rw-r--r-- | cerbero/utils/shell.py | 5 |
2 files changed, 10 insertions, 1 deletions
diff --git a/cerbero/packages/disttarball.py b/cerbero/packages/disttarball.py index 29dd3658..f05ae986 100644 --- a/cerbero/packages/disttarball.py +++ b/cerbero/packages/disttarball.py @@ -175,7 +175,11 @@ class DistTarball(PackagerBase): shell.new_call(compress_cmd) def _write_tar(self, filename, package_prefix, files): - tar_cmd = [shell.get_tar_cmd(), '-C', self.prefix, '--checkpoint=.250'] + tar = shell.get_tar_cmd() + tar_cmd = [tar, '-C', self.prefix] + # --checkpoint is only supported by GNU tar + if tar == shell.HOMEBREW_TAR or (self.config.platform != Platform.DARWIN and tar == shell.TAR): + tar_cmd.append('--checkpoint=.250') # ensure we provide a unique list of files to tar to avoid # it creating hard links/copies files = sorted(set(files)) diff --git a/cerbero/utils/shell.py b/cerbero/utils/shell.py index 4e31464a..ff0729d5 100644 --- a/cerbero/utils/shell.py +++ b/cerbero/utils/shell.py @@ -42,6 +42,7 @@ from cerbero.errors import CommandError, FatalError PATCH = 'patch' TAR = 'tar' +HOMEBREW_TAR = 'gtar' TARBALL_SUFFIXES = ('tar.gz', 'tgz', 'tar.bz2', 'tbz2', 'tar.xz') SUBPROCESS_EXCEPTIONS = (FileNotFoundError, PermissionError, subprocess.CalledProcessError) @@ -662,6 +663,10 @@ def get_tar_cmd(): # https://github.com/msys2/MSYS2-packages/issues/1548 if DISTRO == Distro.MSYS2: return 'bsdtar' + # Allow using Homebrewed tar since it's GNU compatible + # (macOS uses FreeBSD tar) + elif shutil.which(HOMEBREW_TAR): + return HOMEBREW_TAR else: return TAR |