From e2f122ff7dcee60b5facd53b527d4857677c72e1 Mon Sep 17 00:00:00 2001 From: "Alejandro R. Mosteo" Date: Thu, 18 Jan 2024 22:22:19 +0100 Subject: [PATCH 1/2] Test that fails prior to bugfix --- .../toolchain/missing-tool-redeploy/test.py | 24 +++++++++++++++++++ .../toolchain/missing-tool-redeploy/test.yaml | 4 ++++ 2 files changed, 28 insertions(+) create mode 100644 testsuite/tests/toolchain/missing-tool-redeploy/test.py create mode 100644 testsuite/tests/toolchain/missing-tool-redeploy/test.yaml diff --git a/testsuite/tests/toolchain/missing-tool-redeploy/test.py b/testsuite/tests/toolchain/missing-tool-redeploy/test.py new file mode 100644 index 000000000..937a023c4 --- /dev/null +++ b/testsuite/tests/toolchain/missing-tool-redeploy/test.py @@ -0,0 +1,24 @@ +""" +Verify that redeploying a missing tool works as intended. +As we cache the detected toolchains, if we fail to reload them on changes, we +could end trying to use a toolchain that is no longer available. +""" + +import os +from shutil import rmtree +from drivers.alr import init_local_crate, run_alr + +# We can trigger a buggy situation by configuring a toolchain, removing +# manually one tool (as if we had moved the cache), and running `alr printenv`. + +run_alr("toolchain", "--select", "gprbuild", "gnat_native") +init_local_crate() + +# Remove the tool manually through the filesystem +rmtree(os.path.join(os.environ["ALR_CONFIG"], "cache")) + +# This should not fail +run_alr("printenv") + + +print("SUCCESS") diff --git a/testsuite/tests/toolchain/missing-tool-redeploy/test.yaml b/testsuite/tests/toolchain/missing-tool-redeploy/test.yaml new file mode 100644 index 000000000..7d0e9fc67 --- /dev/null +++ b/testsuite/tests/toolchain/missing-tool-redeploy/test.yaml @@ -0,0 +1,4 @@ +driver: python-script +build_mode: both +indexes: + gnat_toolchain_index: {} \ No newline at end of file From 9f06b3ca013cfc23b19361476cff285da3f3a8cd Mon Sep 17 00:00:00 2001 From: "Alejandro R. Mosteo" Date: Thu, 18 Jan 2024 23:51:10 +0100 Subject: [PATCH 2/2] Fix for cache invalidation An unrelated bug is fixed that happened when not using an actual binary crate for a compiler in the testsuite. --- .github/workflows/ci-windows.yml | 10 ++--- src/alire/alire-builds-hashes.adb | 12 ++++++ src/alire/alire-directories.adb | 6 ++- src/alire/alire-directories.ads | 4 +- src/alire/alire-toolchains-solutions.adb | 1 - src/alire/alire-toolchains.adb | 35 +++++++++++------- src/alire/alire-toolchains.ads | 2 +- .../fixtures/crates/gnat_native_mock_1.0.zip | Bin 0 -> 5158 bytes .../fixtures/crates/gprbuild_mock_1.0.zip | Bin 0 -> 4991 bytes .../gn/gnat_native/gnat_native-1.0.0.toml | 6 ++- .../gp/gprbuild/gprbuild-1.0.0.toml | 6 ++- .../toolchain/missing-tool-redeploy/test.py | 9 +++-- 12 files changed, 60 insertions(+), 31 deletions(-) create mode 100644 testsuite/fixtures/crates/gnat_native_mock_1.0.zip create mode 100644 testsuite/fixtures/crates/gprbuild_mock_1.0.zip diff --git a/.github/workflows/ci-windows.yml b/.github/workflows/ci-windows.yml index 348c59801..e6adc0598 100644 --- a/.github/workflows/ci-windows.yml +++ b/.github/workflows/ci-windows.yml @@ -39,7 +39,7 @@ jobs: run: ./bin/alr --non-interactive help get - name: install tar from msys2 (Git tar in Actions VM does not seem to work) - run: C:\Users\runneradmin\.cache\alire\msys64\usr\bin\pacman --noconfirm -S tar + run: C:\Users\runneradmin\AppData\Local\alire\msys64\usr\bin\pacman --noconfirm -S tar - name: Install Python 3.x (required for the testsuite) uses: actions/setup-python@v2 @@ -57,17 +57,17 @@ jobs: run: gprinstall -p -P alr_env --prefix=${{ runner.temp }}/alr_install - name: Install qt-installer-framework in msys2 - run: C:\Users\runneradmin\.cache\alire\msys64\usr\bin\pacman --noconfirm -S mingw64/mingw-w64-x86_64-qt-installer-framework + run: C:\Users\runneradmin\AppData\Local\alire\msys64\usr\bin\pacman --noconfirm -S mingw64/mingw-w64-x86_64-qt-installer-framework - name: Add msys2 /mingw64/bin to the path (for qt-installer-framework) - run: echo 'C:\Users\runneradmin\.cache\alire\msys64\mingw64\bin' >> $GITHUB_PATH + run: echo 'C:\Users\runneradmin\AppData\Local\alire\msys64\mingw64\bin' >> $GITHUB_PATH shell: bash - name: Install zip in msys2 - run: C:\Users\runneradmin\.cache\alire\msys64\usr\bin\pacman --noconfirm -S zip + run: C:\Users\runneradmin\AppData\Local\alire\msys64\usr\bin\pacman --noconfirm -S zip - name: Add msys2 /usr/bin to the path (for zip) - run: echo 'C:\Users\runneradmin\.cache\alire\msys64\usr\bin' >> $GITHUB_PATH + run: echo 'C:\Users\runneradmin\AppData\Local\alire\msys64\usr\bin' >> $GITHUB_PATH shell: bash - name: Run installer build script diff --git a/src/alire/alire-builds-hashes.adb b/src/alire/alire-builds-hashes.adb index 012f0f588..793a92b3f 100644 --- a/src/alire/alire-builds-hashes.adb +++ b/src/alire/alire-builds-hashes.adb @@ -102,6 +102,12 @@ package body Alire.Builds.Hashes is Add ("profile", Rel.Name.As_String, Root.Configuration.Build_Profile (Rel.Name)'Image); + exception + when others => + Trace.Error + ("While hashing: missing build profile for " + & Rel.Milestone.TTY_Image); + raise; end Add_Profile; ------------------ @@ -123,6 +129,12 @@ package body Alire.Builds.Hashes is Add ("switches", Rel.Name.As_String, Switches.To_Vector.Flatten (",")); + exception + when others => + Trace.Error + ("While hashing: missing switches for " + & Rel.Milestone.TTY_Image); + raise; end Add_Switches; ------------------- diff --git a/src/alire/alire-directories.adb b/src/alire/alire-directories.adb index ba9182772..a73641521 100644 --- a/src/alire/alire-directories.adb +++ b/src/alire/alire-directories.adb @@ -1153,10 +1153,14 @@ package body Alire.Directories is -- Touch -- ----------- - procedure Touch (File : File_Path) is + procedure Touch (File : File_Path; Create_Tree : Boolean := False) is use GNAT.OS_Lib; Success : Boolean := False; begin + if Create_Tree then + Directories.Create_Tree (Parent (File)); + end if; + if Is_Regular_File (File) then Set_File_Last_Modify_Time_Stamp (File, Current_Time); elsif Ada.Directories.Exists (File) then diff --git a/src/alire/alire-directories.ads b/src/alire/alire-directories.ads index 452d42d73..64af2cd39 100644 --- a/src/alire/alire-directories.ads +++ b/src/alire/alire-directories.ads @@ -98,8 +98,8 @@ package Alire.Directories is -- the top-level only contains "doinstall", "README" and so on that -- are unusable and would be confusing in a binary prefix. - procedure Touch (File : File_Path) - with Pre => Is_Directory (Parent (File)); + procedure Touch (File : File_Path; Create_Tree : Boolean := False) + with Pre => Create_Tree or else Is_Directory (Parent (File)); -- If the file exists, update last edition time; otherwise create it. -- If File denotes anything else than a regular file, raise. diff --git a/src/alire/alire-toolchains-solutions.adb b/src/alire/alire-toolchains-solutions.adb index 288cf8ebc..af1e46a41 100644 --- a/src/alire/alire-toolchains-solutions.adb +++ b/src/alire/alire-toolchains-solutions.adb @@ -29,7 +29,6 @@ package body Alire.Toolchains.Solutions is -- It must be redeployed Put_Warning ("Tool " & Mil.TTY_Image & " is missing, redeploying..."); - Toolchains.Deploy (Index.Find (Mil.Crate, Mil.Version)); end Redeploy_If_Needed; diff --git a/src/alire/alire-toolchains.adb b/src/alire/alire-toolchains.adb index 0c6388a1c..8e1e1f26e 100644 --- a/src/alire/alire-toolchains.adb +++ b/src/alire/alire-toolchains.adb @@ -26,15 +26,19 @@ package body Alire.Toolchains is use Directories.Operators; - procedure Invalidate_Available_Cache; - -------------- -- Any_Tool -- -------------- -- crate=* dependency builder function Any_Tool (Crate : Crate_Name) return Dependencies.Dependency is (Dependencies.New_Dependency - (Crate, Semantic_Versioning.Extended.Any)); + (Crate, Semantic_Versioning.Extended.Any)); + + ---------------------- + -- Dirty_Cache_Flag -- + ---------------------- + + function Dirty_Cache_Flag return Absolute_Path is (Path / "must_reload"); --------------- -- Assistant -- @@ -382,8 +386,6 @@ package body Alire.Toolchains is Install (Release); end loop; - Invalidate_Available_Cache; - end Assistant; ---------------------- @@ -412,8 +414,6 @@ package body Alire.Toolchains is (Level, Key => Tool_Key (Release.Name, For_Is_External), Value => not Release.Origin.Is_Index_Provided); - - Invalidate_Available_Cache; end Set_As_Default; ----------------------------- @@ -487,11 +487,9 @@ package body Alire.Toolchains is end if; end; end if; - - Invalidate_Available_Cache; end Unconfigure; - Available_Cached : Releases.Containers.Release_Set; + Available_Cached : Releases.Containers.Release_Set; -------------------------------- -- Invalidate_Available_Cache -- @@ -545,9 +543,12 @@ package body Alire.Toolchains is begin -- Early exit with cached available toolchains. Looking for toolchains - -- on disk is expensive. We invalidate the cache on toolchain changes. + -- on disk is expensive. We rely on folder modification time to + -- re-detect available toolchains. - if not Available_Cached.Is_Empty then + if not Available_Cached.Is_Empty and then + not Ada.Directories.Exists (Dirty_Cache_Flag) + then return Available_Cached; end if; @@ -573,7 +574,11 @@ package body Alire.Toolchains is end loop; end loop; + -- Update cache and remove dirty flag + Available_Cached := Result; + Directories.Force_Delete (Dirty_Cache_Flag); + return Result; end Available; @@ -581,7 +586,7 @@ package body Alire.Toolchains is -- Path -- ---------- - function Path return String + function Path return Absolute_Path is (Config.Edit.Cache_Path / "toolchains"); ------------ @@ -620,6 +625,10 @@ package body Alire.Toolchains is & Release.Milestone.TTY_Image); end if; + -- Notify that releases must be reloaded + + Directories.Touch (Dirty_Cache_Flag, Create_Tree => True); + Put_Info (Release.Milestone.TTY_Image & " installed successfully."); end Deploy; diff --git a/src/alire/alire-toolchains.ads b/src/alire/alire-toolchains.ads index d2848e071..9dd52ac85 100644 --- a/src/alire/alire-toolchains.ads +++ b/src/alire/alire-toolchains.ads @@ -124,7 +124,7 @@ package Alire.Toolchains is -- Retrieve the release corresponding to Target, if it exists. Will raise -- Constraint_Error if not among Available. - function Path return Any_Path; + function Path return Absolute_Path; -- Returns the base folder in which all toolchain releases live, defaults -- to /toolchains diff --git a/testsuite/fixtures/crates/gnat_native_mock_1.0.zip b/testsuite/fixtures/crates/gnat_native_mock_1.0.zip new file mode 100644 index 0000000000000000000000000000000000000000..c9045484a778b82a7c747b6f5562ce808f46c0d8 GIT binary patch literal 5158 zcmb7H2|UyNAD=6pP4R>ja$hlLU6%3+0;pMw5SKs{o!U+-r zx#G}xdthNsIK$1&{s6IDNiTG!EWZE3NS1q51sF$Pe0f&b%JMTyZrW?Kn-l4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Dj(fLCK}k z>|{}WKU`*Bfl8Yg8E$Hru+`3rfxyrrxsB;v?QH_ zNyyt`IMtipyQo&iNlLyGc{o6^=i_4i;6;_A4`X%Z>%(%1oQ0Q)XB7SUyzgOG=Gji+ z?&13nyw++}@d9U<_ssIUB-k9kT<>6PWtFn| zVaW+%Cy|7{wPyg?P&@CTgWZ);6nd52|ETPMM7|7hYBu9hxIw;*l_SyAr;tNowofS|`4!~5YWnVH>jUr?QFH?qWRnni}AWox8uR>V+N1LwcFyeRP> zBl3#mpK$Qsn#+p`6&~NKtP#gOa_y?+{!NL;26$UI-t!b^KGL2t5hDkfr1hYZd1RLK z)dowBI~>iu;k_Z&EX7aeBGb9BMl&h*z5lCTWPfM_~S<%efjNss2EkZ?s_wm$z* z#HUUK>wei-?jv=z2t;aZ2>A4g8U?XnG$7tmDQ-C3zrcXr;WDz0@mD&@5o z$`tK%b3R~8X5dKigVIld7iQwW3_T4AIq-M@eSrfqs?D{e7_P1o>=n)?Dci?p5O9`{ zti>kSqs^kOVrfL%EY#&lHz)#PP}X+3V*G9CKYHYUXbZ7uU%dUAa9%#1E*Pw{sD`LG zRd1l7qidmi#K;(_YiK482GgFga@h|BM}QE_fh9yYjI~Z3>*@Fxqhn=i!7=lJ)52?R z-rF41IaL%=q!lMt1PcVizJWu&iGhn?Sz>`UHXU`JRj*2=eLh*rk#FY{VyEw}s}JQj zz5?B&TV;`Zr9de)daarLy&dT5hW7b;B4N-}(Z}Lmm#wdl>sx z!GDjAwm+bziv-$!D(vr~QGNA2x7BWe5gq*+ZKkOa82BS9Z1{I$WQ6;(M6|X@orVQn zTskJni0Eemw3b6nMVND#UQoCh^@I z{yQ!=O?7+L%Sw;|Kr5!M1@S PGdJ+V3A|(7MEUf8_}e2m literal 0 HcmV?d00001 diff --git a/testsuite/fixtures/crates/gprbuild_mock_1.0.zip b/testsuite/fixtures/crates/gprbuild_mock_1.0.zip new file mode 100644 index 0000000000000000000000000000000000000000..2223a28991087681b353722ccd5d6ad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ve#8%GdkvUqpxc z3KTv*J@43<(s?VEPp2V1`iy*90{&2n-dsl`K6<;7cu3p#{`?ZLMB;4$3pU~53gGA% zcN?4MDK%Eb$4P!XQhof=?G-TlePwmT#SUPpvt8%_U_-blSx^T#@D^OI!#~yfM}zw> zon5__EHX$>y0Jkk2qi_oPIvY6!Iao#C6IdP6J&>CK6pqRLfpnOLh~6B)dnw9GgT+k&g~pYDCxYzPa04xLN=9 zeOnm>rQfH!8}7H5pLX>=f)SCRRJ(tbYXL*+v5*#4maEAn16ri3gOEcTx}c=c3$E$c z$_}E@IxidEAID&7Wg6?A45AygFKHXOFZs3dJ~lJ#V^I*=5`MEKCT0=H5_9>0wi(>o z!o>@GS6%o|hh$kA*OrZH3%Gw9)|PPKDF<>d9j3?8k8ZyQFCTyC!Dx{GW1aNF5C~pj z5W;BxT=4>!aonK?=g@;`5tfFZ)zB;Z#S74DD+G3)G$QIpzrPyw=WEE=?b9#VdIc&i z3SIBNwlIthGJTla>y|J6*D&C-p~2b$F_v@sKn7rMP6N|aqCM00vsm0$3$(HwJPdX; zaL@&!RkPKgKiy!gW%R4x07j;*7PSOjp|Y(l3S*_9k0Q*qEDA&2SR0?Q643MGmhdvj9K>$N+%<1K?EMr2qf` literal 0 HcmV?d00001 diff --git a/testsuite/fixtures/gnat_toolchain_index/gn/gnat_native/gnat_native-1.0.0.toml b/testsuite/fixtures/gnat_toolchain_index/gn/gnat_native/gnat_native-1.0.0.toml index 1fda1870b..9bc8fba98 100644 --- a/testsuite/fixtures/gnat_toolchain_index/gn/gnat_native/gnat_native-1.0.0.toml +++ b/testsuite/fixtures/gnat_toolchain_index/gn/gnat_native/gnat_native-1.0.0.toml @@ -6,5 +6,7 @@ licenses = "GPL-3.0-only OR MIT" maintainers = ["some@bo.dy"] maintainers-logins = ["mylogin"] -[origin] -url = "file:." +# Conditional origin so it's considered a binary crate +[origin."case(os)"."..."] +url = "file:../../../crates/gnat_native_mock_1.0.zip" +hashes = ["sha256:db87865b59d7d733e4104b3c0f29c8bf590d5ff0b3ea2d61bded4e47beabf1a3"] diff --git a/testsuite/fixtures/gnat_toolchain_index/gp/gprbuild/gprbuild-1.0.0.toml b/testsuite/fixtures/gnat_toolchain_index/gp/gprbuild/gprbuild-1.0.0.toml index 5cb03b16e..eca56d3c0 100644 --- a/testsuite/fixtures/gnat_toolchain_index/gp/gprbuild/gprbuild-1.0.0.toml +++ b/testsuite/fixtures/gnat_toolchain_index/gp/gprbuild/gprbuild-1.0.0.toml @@ -5,5 +5,7 @@ licenses = "GPL-3.0-only OR MIT" maintainers = ["some@bo.dy"] maintainers-logins = ["mylogin"] -[origin] -url = "file:." +# Conditional origin so it's considered a binary crate +[origin."case(os)"."..."] +url = "file:../../../crates/gprbuild_mock_1.0.zip" +hashes = ["sha256:e3d52b4a441a56ab1c0175ee8ea407864b72879cf73184a9f7d68eef53a87451"] diff --git a/testsuite/tests/toolchain/missing-tool-redeploy/test.py b/testsuite/tests/toolchain/missing-tool-redeploy/test.py index 937a023c4..4e368e7e9 100644 --- a/testsuite/tests/toolchain/missing-tool-redeploy/test.py +++ b/testsuite/tests/toolchain/missing-tool-redeploy/test.py @@ -7,9 +7,10 @@ import os from shutil import rmtree from drivers.alr import init_local_crate, run_alr +from drivers.asserts import assert_match # We can trigger a buggy situation by configuring a toolchain, removing -# manually one tool (as if we had moved the cache), and running `alr printenv`. +# manually the tool (as if we had moved the cache), and running `alr printenv`. run_alr("toolchain", "--select", "gprbuild", "gnat_native") init_local_crate() @@ -17,8 +18,8 @@ # Remove the tool manually through the filesystem rmtree(os.path.join(os.environ["ALR_CONFIG"], "cache")) -# This should not fail -run_alr("printenv") - +# This should not fail. A message should warn of redeployments happening. +p = run_alr("printenv", quiet=False) +assert_match(".*Tool .* is missing, redeploying", p.out) print("SUCCESS")