Skip to content

Commit

Permalink
Workaround for macOS BSD tar
Browse files Browse the repository at this point in the history
  • Loading branch information
mosteo committed Sep 16, 2020
1 parent 05cddc8 commit 96daf43
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions src/alire/alire-publish.adb
Expand Up @@ -24,6 +24,8 @@ with Alire.Utils.TTY;
with Alire.Utils.User_Input;
with Alire.VCSs.Git;

with GNATCOLL.OS.Constants;

with Semantic_Versioning;

with TOML.File_IO;
Expand Down Expand Up @@ -320,21 +322,33 @@ package body Alire.Publish is

procedure Tar_Archive is
begin
pragma Warnings (Off, "condition is always");
-- To silence our below check for macOS

OS_Lib.Subprocess.Checked_Spawn
("tar",
Empty_Vector
& "cfj"
& Archive -- Destination file at alire/archives/crate-version.tbz2

& "--exclude-vcs" -- exclude .git and the like
& "--exclude-vcs-ignores" -- exclude from .gitignore and the like
& "--exclude-backups" -- exclude .#* *~ #*# patterns
& "--anchored" & "--exclude='./alire'" -- exclude alire folder

& String'("--transform=s,^\./," & Milestone & "/,")
-- Prepend empty milestone dir as required for our tars

-- exclude .git and the like, with workaround for macOS bsd tar
& (if GNATCOLL.OS.Constants.OS in GNATCOLL.OS.MacOS
then Empty_Vector
& "--exclude='./.git'"
& "--exclude='./.hg'"
& "--exclude='./.svn'"
& String'("-s,^\./," & Milestone & "/,")
-- Prepend empty milestone dir as required for our tars)
else Empty_Vector
& "--exclude-backups" -- exclude .#* *~ #*# patterns
& "--exclude-vcs" -- exclude .git, .hg, etc
& "--exclude-vcs-ignores" -- exclude from .gitignore, etc
& String'("--transform=s,^\./," & Milestone & "/,"))
-- Prepend empty milestone dir as required for our tars

& "--exclude='./alire'" -- exclude top-level alire folder
& ".");
pragma Warnings (On);
end Tar_Archive;

begin
Expand Down

0 comments on commit 96daf43

Please sign in to comment.