From 23c8525b7ff72a7786e2940b2677591075a0ef3d Mon Sep 17 00:00:00 2001 From: "Alejandro R. Mosteo" Date: Fri, 12 Jul 2024 14:35:28 +0200 Subject: [PATCH] Self-review --- .github/workflows/ci-docker.yml | 12 +++++++++++- alire.toml | 5 +++-- deps/cstrings | 2 +- deps/den | 2 +- scripts/ci-github.sh | 19 ++++++++++++++++--- src/alire/alire-directories.adb | 12 +++++++----- src/alire/alire-os_lib.ads | 6 ++---- src/alire/alire-roots.adb | 12 ++++++++---- testsuite/tests/install/softlinks/test.py | 4 +++- testsuite/tests/install/softlinks/test.yaml | 2 ++ 10 files changed, 54 insertions(+), 22 deletions(-) diff --git a/.github/workflows/ci-docker.yml b/.github/workflows/ci-docker.yml index a01ad2d05..590cb60c6 100644 --- a/.github/workflows/ci-docker.yml +++ b/.github/workflows/ci-docker.yml @@ -32,8 +32,18 @@ jobs: with: submodules: true + - name: OS information for ${{ matrix.tag }} + uses: mosteo-actions/docker-run@v2 + with: + image: ghcr.io/alire-project/docker/gnat:${{matrix.tag}} + command: | + lsb_release -a || \ + cat /etc/os-release || \ + cat /etc/system-release || \ + echo "No lsb_release information" + - name: Run test script (${{ matrix.tag }}) - uses: mosteo-actions/docker-run@v1 + uses: mosteo-actions/docker-run@v2 with: image: ghcr.io/alire-project/docker/gnat:${{matrix.tag}} command: scripts/ci-github.sh diff --git a/alire.toml b/alire.toml index 2cbbc4cad..9889ab02a 100644 --- a/alire.toml +++ b/alire.toml @@ -50,6 +50,7 @@ windows = { ALIRE_OS = "windows" } # Some dependencies require precise versions during the development cycle: [[pins]] + [pins.aaa] url = "https://github.com/mosteo/aaa" commit = "0c3b440ac183c450345d4a67d407785678779aae" @@ -60,7 +61,7 @@ commit = "da4e59c382ceb0de6733d571ecbab7ea4919b33d" [pins.c_strings] url = "https://github.com/mosteo/cstrings" -commit = "e5b1931d47b9fee273177773fb5e3f8979bc6076" +commit = "e4d58ad90bf32bc44304197e5906a519f5a9a7bf" [pins.clic] url = "https://github.com/alire-project/clic" @@ -68,7 +69,7 @@ commit = "56bbdc008e16996b6f76e443fd0165a240de1b13" [pins.den] url = "https://github.com/mosteo/den" -commit = "1f0fe7df0e479e1bf86edd607ffea6bfddb9352e" +commit = "a277b897c346e1ba326233b654354ff91ab93de0" [pins.dirty_booleans] url = "https://github.com/mosteo/dirty_booleans" diff --git a/deps/cstrings b/deps/cstrings index e5b1931d4..e4d58ad90 160000 --- a/deps/cstrings +++ b/deps/cstrings @@ -1 +1 @@ -Subproject commit e5b1931d47b9fee273177773fb5e3f8979bc6076 +Subproject commit e4d58ad90bf32bc44304197e5906a519f5a9a7bf diff --git a/deps/den b/deps/den index 203512fcb..a277b897c 160000 --- a/deps/den +++ b/deps/den @@ -1 +1 @@ -Subproject commit 203512fcb05ec0e837269f1f156dae513f605077 +Subproject commit a277b897c346e1ba326233b654354ff91ab93de0 diff --git a/scripts/ci-github.sh b/scripts/ci-github.sh index 06800270e..4320a1393 100755 --- a/scripts/ci-github.sh +++ b/scripts/ci-github.sh @@ -51,8 +51,13 @@ echo GNAT VERSION: gnatls -v echo ............................ -echo ALR VERSION: -alr version +echo "ALR VERSION (at $(which alr)):" +ls -alF bin +chmod +x bin/alr* +alr -d version || \ +alr -vv -d version || \ +bin/alr -d version || \ +bin/alr.exe -d version || true echo ............................ # Set up index if not default: @@ -61,9 +66,17 @@ if [ "${INDEX:-}" != "" ]; then alr index --name default --add "$INDEX" fi +echo "ALR SETTINGS (global):" +alr settings --global + echo ALR SEARCH: # List releases for the record -alr -q -d search --list --external +alr -q -d search --list --external || \ +{ + echo "Failed to list releases, retrying verbosely..." + alr -vv -d search --list --external + exit 1; +} echo ............................ echo TESTSUITE: diff --git a/src/alire/alire-directories.adb b/src/alire/alire-directories.adb index ef1de9da6..728a99e22 100644 --- a/src/alire/alire-directories.adb +++ b/src/alire/alire-directories.adb @@ -437,7 +437,9 @@ package body Alire.Directories is return Any_Path is begin - return AAA.Directories.Relative_Path (Parent, Child); + return AAA.Directories.Relative_Path + (Den.Absnormal (Den.Scrub (Parent)), + Den.Absnormal (Den.Scrub (Child))); end Find_Relative_Path; ---------------------- @@ -806,8 +808,8 @@ package body Alire.Directories is Remove_From_Source : Boolean) is - Base : constant Absolute_Path := Adirs.Full_Name (Src); - Target : constant Absolute_Path := Adirs.Full_Name (Dst); + Base : constant Absolute_Path := Den.Absolute (Src); + Target : constant Absolute_Path := Den.Absolute (Dst); ----------- -- Merge -- @@ -818,14 +820,14 @@ package body Alire.Directories is Stop : in out Boolean) is use all type Den.Kinds; + Src : constant Absolute_Path := Den.Absolute (Item); Rel_Path : constant Relative_Path := - Find_Relative_Path (Base, Den.Absolute (Item)); + Find_Relative_Path (Base, Src); -- If this proves to be too slow, we should do our own recursion, -- building the relative path along the way, as this is recomputing -- it for every file needlessly. Dst : constant Absolute_Path := Target / Rel_Path; - Src : constant Absolute_Path := Den.Absolute (Item); begin Stop := False; diff --git a/src/alire/alire-os_lib.ads b/src/alire/alire-os_lib.ads index b2c88852a..5b0b2b81a 100644 --- a/src/alire/alire-os_lib.ads +++ b/src/alire/alire-os_lib.ads @@ -65,9 +65,7 @@ private function To_Portable (Path : Any_Path) return Portable_Path_Like - is (case GNATCOLL.OS.Constants.OS is - when MacOS | Unix => Path, - when Windows => Replace (Path, "\", "/")); + is (Replace (Path, "\", "/")); -------------------- -- To_Native_Like -- @@ -75,7 +73,7 @@ private function To_Native (Path : Portable_Path_Like) return Native_Path_Like is (case GNATCOLL.OS.Constants.OS is - when MacOS | Unix => Path, + when MacOS | Unix => Replace (String (Path), "\", "/"), when Windows => Replace (String (Path), "/", "\")); end Alire.OS_Lib; diff --git a/src/alire/alire-roots.adb b/src/alire/alire-roots.adb index 45e6dd563..de9044ba8 100644 --- a/src/alire/alire-roots.adb +++ b/src/alire/alire-roots.adb @@ -19,6 +19,7 @@ with Alire.Toolchains.Solutions; with Alire.User_Pins.Maps; with Alire.Utils.TTY; with Alire.Utils.User_Input; +with Alire.VFS; with Den; @@ -1256,10 +1257,13 @@ package body Alire.Roots is begin if Opt.Is_Valid then Found.Insert - (TTY.URL (Directories.Find_Relative_Path - (Starting_Path, Den.Full_Name (Item))) & "/" - & Opt.Value.Release.Constant_Reference.Milestone.TTY_Image - & ": " & TTY.Emph + (TTY.URL (String (VFS.To_Portable + (Directories.Find_Relative_Path + (Starting_Path, Den.Full_Name (Item)))) + & "/" + & Opt.Value.Release.Constant_Reference.Milestone.TTY_Image) + & ": " + & TTY.Emph (if Opt.Value.Release.Constant_Reference.Description /= "" then Opt.Value.Release.Constant_Reference.Description else "(no description)")); diff --git a/testsuite/tests/install/softlinks/test.py b/testsuite/tests/install/softlinks/test.py index dcebdcca2..6a06b6460 100644 --- a/testsuite/tests/install/softlinks/test.py +++ b/testsuite/tests/install/softlinks/test.py @@ -1,6 +1,8 @@ """ Test that binary files containing softlinks can be installed properly. The test -crate contains all kinds of pernicious links (broken, recursive, etc.): +crate contains all kinds of pernicious links (broken, recursive, etc.). + +This test is Unix-only, as Windows' tar cannot recreate the broken links: crate/ ├── bin -> subdir/bin diff --git a/testsuite/tests/install/softlinks/test.yaml b/testsuite/tests/install/softlinks/test.yaml index 0a859639c..58bf7be7d 100644 --- a/testsuite/tests/install/softlinks/test.yaml +++ b/testsuite/tests/install/softlinks/test.yaml @@ -1,4 +1,6 @@ driver: python-script +control: + - [SKIP, "skip_unix", "Test is Unix-only"] indexes: my_index: in_fixtures: false