From 78f9f70ea5e7eb1e9d2bfdf36b1cc8f960999d71 Mon Sep 17 00:00:00 2001 From: "Alejandro R. Mosteo" Date: Sat, 27 Jan 2024 21:30:54 +0100 Subject: [PATCH 1/5] Fix bugs causing spurious diffs on update Solutions were the same, but some types internally where using pointers instead of pointed objects for comparison. WIP --- alire_common.gpr | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/alire_common.gpr b/alire_common.gpr index e479c0c38..daa3d55b9 100644 --- a/alire_common.gpr +++ b/alire_common.gpr @@ -31,7 +31,14 @@ abstract project Alire_Common is "-gnatyu", -- no unnecessary blank lines "-gnatyx", -- no extra parens around conditionals "-gnaty-s"); -- relax fwd decl - when "disabled" => Style_Check_Switches := (); + when "disabled" => Style_Check_Switches := + ("-gnat2022", + "-gnatx", + -- When no style checks are enforced, we are likely debugging, + -- commenting blocks, moving things around, etc. At these times we + -- may also benefit from some Ada 2022 features like Any_Type'Image. + "-gnatwJ" -- Disable warnings about obsolescent "()" + ); end case; type Any_Experimental_Ada_Features is ("enabled", "disabled"); From e8d4fb6728b668a903bfec6daebdf812484df83b Mon Sep 17 00:00:00 2001 From: "Alejandro R. Mosteo" Date: Sat, 27 Jan 2024 21:50:10 +0100 Subject: [PATCH 2/5] Don't attempt redundant system package installation --- alire_common.gpr | 9 +-------- src/alire/alire-origins-deployers-system.ads | 12 ++++++++++++ src/alire/alire-releases.adb | 14 +++++++++++++- 3 files changed, 26 insertions(+), 9 deletions(-) diff --git a/alire_common.gpr b/alire_common.gpr index daa3d55b9..e479c0c38 100644 --- a/alire_common.gpr +++ b/alire_common.gpr @@ -31,14 +31,7 @@ abstract project Alire_Common is "-gnatyu", -- no unnecessary blank lines "-gnatyx", -- no extra parens around conditionals "-gnaty-s"); -- relax fwd decl - when "disabled" => Style_Check_Switches := - ("-gnat2022", - "-gnatx", - -- When no style checks are enforced, we are likely debugging, - -- commenting blocks, moving things around, etc. At these times we - -- may also benefit from some Ada 2022 features like Any_Type'Image. - "-gnatwJ" -- Disable warnings about obsolescent "()" - ); + when "disabled" => Style_Check_Switches := (); end case; type Any_Experimental_Ada_Features is ("enabled", "disabled"); diff --git a/src/alire/alire-origins-deployers-system.ads b/src/alire/alire-origins-deployers-system.ads index c9d4c28c5..e3769bb7d 100644 --- a/src/alire/alire-origins-deployers-system.ads +++ b/src/alire/alire-origins-deployers-system.ads @@ -68,6 +68,11 @@ package Alire.Origins.Deployers.System is function Platform_Deployer (Package_Name : String) return Deployer'Class is (Platform_Deployer (Origins.New_System (Package_Name))); + -- Classwide facilities + + function Already_Installed (This : Origins.Origin) return Boolean + with Pre => This.Is_System; + function Executable_Name return String; -- Returns the simple name of the executable package manager on the system @@ -81,4 +86,11 @@ private Ask_Permission : Boolean := True; end record; + ----------------------- + -- Already_Installed -- + ----------------------- + + function Already_Installed (This : Origins.Origin) return Boolean + is (Platform_Deployer (This).Already_Installed); + end Alire.Origins.Deployers.System; diff --git a/src/alire/alire-releases.adb b/src/alire/alire-releases.adb index 4341e42e7..176d6bf9f 100644 --- a/src/alire/alire-releases.adb +++ b/src/alire/alire-releases.adb @@ -7,7 +7,7 @@ with Alire.Directories; with Alire.Defaults; with Alire.Errors; with Alire.Flags; -with Alire.Origins.Deployers; +with Alire.Origins.Deployers.System; with Alire.Paths; with Alire.Properties.Bool; with Alire.Properties.Scenarios; @@ -316,6 +316,18 @@ package body Alire.Releases is Trace.Detail ("Skipping checkout of already available " & This.Milestone.Image); + elsif This.Origin.Kind not in Origins.Deployable_Kinds then + Was_There := True; + Trace.Detail ("External requires no deployment for " & + This.Milestone.Image); + + elsif This.Origin.Is_System + and then Origins.Deployers.System.Already_Installed (This.Origin) + then + Was_There := True; + Trace.Detail ("Skipping install of already available system origin " & + This.Milestone.Image); + else Was_There := False; Put_Info ("Deploying " & This.Milestone.TTY_Image & "..."); From 17e2027548172eda0831b18dd36b4d20c000621f Mon Sep 17 00:00:00 2001 From: "Alejandro R. Mosteo" Date: Fri, 16 Feb 2024 14:07:05 +0100 Subject: [PATCH 3/5] Inform of pin checkouts/updates as for regular crates --- src/alire/alire-user_pins.adb | 11 +++++++++++ src/alire/alire-vcss-git.ads | 3 +++ 2 files changed, 14 insertions(+) diff --git a/src/alire/alire-user_pins.adb b/src/alire/alire-user_pins.adb index 966774620..ea0c9ffc3 100644 --- a/src/alire/alire-user_pins.adb +++ b/src/alire/alire-user_pins.adb @@ -158,6 +158,14 @@ package body Alire.User_Pins is -- Check out the branch or commit + Put_Info ("Deploying " & Utils.TTY.Name (Crate) + & (if Commit /= "" + then " commit " & TTY.URL (VCSs.Git.Short_Commit (Commit)) + elsif Branch /= "" + then " branch " & TTY.URL (Branch) + else " default branch") + & "..."); + if not VCSs.Git.Handler.Clone (From => URL (This) & (if Commit /= "" @@ -207,6 +215,9 @@ package body Alire.User_Pins is -- user in the manifest, the following call will also take care of -- it. + Put_Info ("Pulling " & Utils.TTY.Name (Crate) + & " branch " & TTY.URL (Branch) & "..."); + if not VCSs.Git.Handler.Update (Destination, Branch).Success then Raise_Checked_Error ("Update of repository at " & TTY.URL (Destination) diff --git a/src/alire/alire-vcss-git.ads b/src/alire/alire-vcss-git.ads index 30c52113a..da4d5d526 100644 --- a/src/alire/alire-vcss-git.ads +++ b/src/alire/alire-vcss-git.ads @@ -22,6 +22,9 @@ package Alire.VCSs.Git is function Git_Dir return Any_Path; -- ".git" unless overridden by GIT_DIR + function Short_Commit (Commit : Git_Commit) return String + is (Commit (Commit'First .. Commit'First + 7)); + type VCS (<>) is new VCSs.VCS with private; function Handler return VCS; From f0c23722e71a283ab7b46b10e8dc29e3d5239982 Mon Sep 17 00:00:00 2001 From: "Alejandro R. Mosteo" Date: Fri, 16 Feb 2024 14:14:59 +0100 Subject: [PATCH 4/5] Ensure created folders remain the same --- src/alire/alire-releases.adb | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/alire/alire-releases.adb b/src/alire/alire-releases.adb index 176d6bf9f..2b80486e6 100644 --- a/src/alire/alire-releases.adb +++ b/src/alire/alire-releases.adb @@ -332,19 +332,18 @@ package body Alire.Releases is Was_There := False; Put_Info ("Deploying " & This.Milestone.TTY_Image & "..."); Alire.Origins.Deployers.Deploy (This, Folder).Assert; + end if; - -- For deployers that do nothing, we ensure the folder exists so all - -- dependencies leave a trace in the cache/dependencies folder, and - -- a place from where to run their actions by default. - - Ada.Directories.Create_Path (Folder); + -- For deployers that do nothing, we ensure the folder exists so all + -- dependencies leave a trace in the cache/dependencies folder, and + -- a place from where to run their actions by default. - -- Backup a potentially packaged manifest, so our authoritative - -- manifest from the index is always used. + Ada.Directories.Create_Path (Folder); - Backup_Upstream_Manifest; + -- Backup a potentially packaged manifest, so our authoritative + -- manifest from the index is always used. - end if; + Backup_Upstream_Manifest; -- Create manifest if requested From e1a0783cbbb7fe92a4f07bbd027d3c17d258f68f Mon Sep 17 00:00:00 2001 From: "Alejandro R. Mosteo" Date: Fri, 16 Feb 2024 14:21:31 +0100 Subject: [PATCH 5/5] Fix testsuite index for deterministic make version --- .../gn/gnat_external/gnat_external-external.toml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/testsuite/fixtures/system_index/gn/gnat_external/gnat_external-external.toml b/testsuite/fixtures/system_index/gn/gnat_external/gnat_external-external.toml index f1171a6ba..6a899f8d1 100644 --- a/testsuite/fixtures/system_index/gn/gnat_external/gnat_external-external.toml +++ b/testsuite/fixtures/system_index/gn/gnat_external/gnat_external-external.toml @@ -6,7 +6,6 @@ maintainers-logins = ["mosteo"] [[external]] kind = "version-output" -# We look for make instead that should be always installed. -version-command = ["make", "--version"] -version-regexp = ".*Make ([\\d\\.]+).*" +version-command = ["echo", "1.0"] +version-regexp = "([\\d\\.]+).*" provides = "gnat"