Skip to content

Commit

Permalink
Indicators in solution diff about non-source dependencies (#1395)
Browse files Browse the repository at this point in the history
* Warn about non-source dependencies

* Disable fail-fast in workflow

* Create virtual environment
  • Loading branch information
mosteo authored Jun 22, 2023
1 parent 4d8b818 commit 9cff7e0
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 10 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
tag: # Those are our ghcr.io/alire-project/docker/gnat:tag machines
- centos-stream-fsf-latest # Test unsupported package manager
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,6 @@
[submodule "deps/clic"]
path = deps/clic
url = https://github.com/alire-project/clic.git
[submodule "deps/umwi"]
path = deps/umwi
url = https://github.com/mosteo/umwi
2 changes: 1 addition & 1 deletion alire.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ windows = { ALIRE_OS = "windows" }

# Some dependencies require precise versions during the development cycle:
[[pins]]
aaa = { url = "https://github.com/mosteo/aaa", commit = "906d9eaf4fb8efabfbc3d8cfb34d04ceec340e13" }
aaa = { url = "https://github.com/mosteo/aaa", commit = "f60254934a7d6e39b72380b496527295602f75e3" }
ada_toml = { url = "https://github.com/mosteo/ada-toml", commit = "da4e59c382ceb0de6733d571ecbab7ea4919b33d" }
clic = { url = "https://github.com/alire-project/clic", commit = "8d26222de71014554999e48c821906fca0e3dc41" }
gnatcoll = { url = "https://github.com/alire-project/gnatcoll-core.git", commit = "403efe11405113cf12ae3d014df474cf7a046176" }
Expand Down
1 change: 1 addition & 0 deletions alr_env.gpr
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ aggregate project Alr_Env is
"deps/spdx",
"deps/stopwatch",
"deps/toml_slicer",
"deps/umwi",
"deps/uri-ada",
"deps/xmlezout"
);
Expand Down
2 changes: 1 addition & 1 deletion deps/aaa
1 change: 1 addition & 0 deletions deps/umwi
Submodule umwi added at c8aabd
55 changes: 47 additions & 8 deletions src/alire/alire-solutions-diffs.adb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
with Alire.Origins;
with Alire.Utils.Tables;
with Alire.User_Pins;
with Alire.Utils.TTY;
Expand All @@ -21,7 +22,8 @@ package body Alire.Solutions.Diffs is
Unpinned, -- A release being unpinned
Unchanged, -- An unchanged dependency/release
Missing, -- A missing dependency
Shared -- A release used from the shared installed releases
Shared, -- A release used from the shared installed releases
Binary -- A binary, system or external release
);

----------
Expand All @@ -33,14 +35,15 @@ package body Alire.Solutions.Diffs is
(case Change is
when Added => TTY.OK (U ("+")),
when Removed => TTY.Emph (U ("")),
when Hinted => TTY.Warn (U ("")),
when Hinted => TTY.Warn (U ("🔎")), -- alts: 💡🔍🔎
when Upgraded => TTY.OK (U ("")),
when Downgraded => TTY.Warn (U ("")),
when Pinned => TTY.OK (U ("")),
when Unpinned => TTY.Emph (U ("𐩒")),
when Pinned => TTY.OK (U ("📌")), -- alts: ⊙📍📌
when Unpinned => TTY.Emph (U ("🎈")), -- alts: 𐩒🎈
when Unchanged => TTY.OK (U ("=")),
when Missing => TTY.Error (U ("")),
when Shared => TTY.Emph (U ("")))
when Missing => TTY.Error (U ("")), -- alts: ⚠️❗‼️
when Shared => TTY.Emph (U ("♻️ ")), -- alts: ♻️♼
when Binary => TTY.Warn (U ("📦")))
else
(case Change is
when Added => U ("+"),
Expand All @@ -52,7 +55,8 @@ package body Alire.Solutions.Diffs is
when Unpinned => U ("o"),
when Unchanged => U ("="),
when Missing => U ("!"),
when Shared => U ("i")
when Shared => U ("i"),
when Binary => U ("b")
));

-- This type is used to summarize every detected change
Expand Down Expand Up @@ -322,6 +326,39 @@ package body Alire.Solutions.Diffs is

end Determine_Relevant_Version;

------------------------------
-- Releases_Without_Sources --
------------------------------

procedure Releases_Without_Sources is
use all type Origins.Kinds;
subtype Report_Kinds is Origins.Kinds with Static_Predicate =>
Report_Kinds in Binary_Archive | External | System;
begin
-- For "special" releases, show extra info: binaries that can
-- be very large, or releases that are not from sources (so
-- harder to audit, intrinsically shared, ...)

if not Has_Latter or else not Latter.Has_Release then
return;
end if;

declare
Rel : constant Alire.Releases.Release :=
This.Latter.Releases.Element (Crate);
begin
if Rel.Origin.Kind in Report_Kinds then
Add_Change (Chg, Icon (Binary),
TTY.Warn
(case Rel.Origin.Kind is
when Binary_Archive => "binary",
when External => "executable in path",
when System => "system package",
when others => raise Program_Error));
end if;
end;
end Releases_Without_Sources;

begin

-- Go through possible changes and add each marker
Expand All @@ -342,6 +379,8 @@ package body Alire.Solutions.Diffs is

Determine_Relevant_Version;

Releases_Without_Sources;

-- Final fill-in for no changes

if Length (Chg.Icon) = 0 then
Expand Down Expand Up @@ -412,7 +451,7 @@ package body Alire.Solutions.Diffs is

Table.Append (+Changes.Best_Version);

-- Finally show an explanation of the change depending on
-- Show an explanation of the change depending on
-- status changes.

Table.Append ("(" & Changes.Detail.Flatten (",") & ")");
Expand Down

0 comments on commit 9cff7e0

Please sign in to comment.