From df1c436f660af2b85b80e74b903961c6910a633e Mon Sep 17 00:00:00 2001 From: "Alejandro R. Mosteo" Date: Fri, 15 Dec 2023 14:37:40 +0100 Subject: [PATCH] Bump CLIC dependency --- src/alire/alire-publish.adb | 8 ++++---- src/alire/alire-utils-tools.adb | 16 ++++++++++++++++ src/alire/alire-utils-tools.ads | 3 +++ testsuite/drivers/asserts.py | 1 + testsuite/tests/index/env-path/test.py | 5 +++-- 5 files changed, 27 insertions(+), 6 deletions(-) diff --git a/src/alire/alire-publish.adb b/src/alire/alire-publish.adb index 91ed002a5..f19d9f058 100644 --- a/src/alire/alire-publish.adb +++ b/src/alire/alire-publish.adb @@ -25,6 +25,7 @@ with Alire.TOML_Index; with Alire.TOML_Keys; with Alire.TOML_Load; with Alire.User_Pins.Maps; +with Alire.Utils.Tools; with Alire.Utils.TTY; with Alire.Utils.User_Input.Query_Config; with Alire.VCSs.Git; @@ -32,8 +33,6 @@ with Alire.VFS; with CLIC.User_Input; -with GNATCOLL.OS.Constants; - with Semantic_Versioning; with TOML.File_IO; @@ -672,8 +671,9 @@ package body Alire.Publish is & String'("--exclude=./alire") -- Exclude top-level alire folder, before applying prefix - -- exclude .git and the like, with workaround for macOS bsd tar - & (if GNATCOLL.OS.Constants.OS in GNATCOLL.OS.MacOS + -- exclude .git and the like, with workaround for bsdtar used by + -- macOS and Windows without MSYS2 + & (if Utils.Tools.Is_BSD_Tar then Empty_Vector & "--exclude=./.git" & "--exclude=./.hg" diff --git a/src/alire/alire-utils-tools.adb b/src/alire/alire-utils-tools.adb index ce79cb2f1..e92b8dfe1 100644 --- a/src/alire/alire-utils-tools.adb +++ b/src/alire/alire-utils-tools.adb @@ -1,3 +1,5 @@ +with AAA.Strings; + with Alire.OS_Lib.Subprocess; use Alire.OS_Lib.Subprocess; with Alire.OS_Lib; with Alire.Platforms.Current; @@ -157,4 +159,18 @@ package body Alire.Utils.Tools is Install_From_Distrib (Tool, Fail); end Check_Tool; + ---------------- + -- Is_BSD_Tar -- + ---------------- + + function Is_BSD_Tar return Boolean is + use AAA.Strings; + begin + return Contains + (To_Lower_Case + (Checked_Spawn_And_Capture + ("tar", To_Vector ("--version")).Flatten), + "bsdtar"); + end Is_BSD_Tar; + end Alire.Utils.Tools; diff --git a/src/alire/alire-utils-tools.ads b/src/alire/alire-utils-tools.ads index 09093ae65..19a6a38fa 100644 --- a/src/alire/alire-utils-tools.ads +++ b/src/alire/alire-utils-tools.ads @@ -18,4 +18,7 @@ package Alire.Utils.Tools is -- Check if a required executable tool is available in PATH. -- If not, try to install it. If unable and Fail, abort, otherwise return + function Is_BSD_Tar return Boolean; + -- Say if the tar in PATH is the bsdtar variant, which lacks some features + end Alire.Utils.Tools; diff --git a/testsuite/drivers/asserts.py b/testsuite/drivers/asserts.py index 2cc332349..75726798f 100644 --- a/testsuite/drivers/asserts.py +++ b/testsuite/drivers/asserts.py @@ -7,6 +7,7 @@ import os import re import difflib +import sys from drivers.alr import run_alr from drivers.helpers import contents, lines_of diff --git a/testsuite/tests/index/env-path/test.py b/testsuite/tests/index/env-path/test.py index 16e391f4b..ee1f246a6 100644 --- a/testsuite/tests/index/env-path/test.py +++ b/testsuite/tests/index/env-path/test.py @@ -4,6 +4,7 @@ """ import os +import re from drivers.alr import crate_dirname, run_alr from drivers.asserts import assert_match @@ -13,7 +14,7 @@ # Show uses the path with portable separators, as the conversion is done just # for printenv output. -assert_match(f".*{os.sep}crate_test_bin", +assert_match(f".*/crate_test_bin", run_alr("show", "crate").out) # Similarly, if we retrieve the crate, the output to the manifest must be in @@ -24,7 +25,7 @@ # When obtained via printenv, the path must be native os.chdir(crate_dirname('crate')) -assert_match(f".*PATH=[^\n]*{os.sep}crate_test_bin", +assert_match(".*PATH=[^\n]*" + re.escape(f"{os.sep}crate_test_bin"), run_alr("printenv").out) print('SUCCESS')