Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvements to messages during dependency updates #1569

Merged
merged 5 commits into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/alire/alire-origins-deployers-system.ads
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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;
31 changes: 21 additions & 10 deletions src/alire/alire-releases.adb
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -316,23 +316,34 @@ 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 & "...");
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

Expand Down
11 changes: 11 additions & 0 deletions src/alire/alire-user_pins.adb
Original file line number Diff line number Diff line change
Expand Up @@ -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 /= ""
Expand Down Expand Up @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions src/alire/alire-vcss-git.ads
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Loading