From 9cff7e030025689c8ef03b9aae076c539473cd4a Mon Sep 17 00:00:00 2001 From: Alejandro R Mosteo Date: Thu, 22 Jun 2023 14:41:33 +0200 Subject: [PATCH] Indicators in solution diff about non-source dependencies (#1395) * Warn about non-source dependencies * Disable fail-fast in workflow * Create virtual environment --- .github/workflows/ci-docker.yml | 1 + .gitmodules | 3 ++ alire.toml | 2 +- alr_env.gpr | 1 + deps/aaa | 2 +- deps/umwi | 1 + src/alire/alire-solutions-diffs.adb | 55 ++++++++++++++++++++++++----- 7 files changed, 55 insertions(+), 10 deletions(-) create mode 160000 deps/umwi diff --git a/.github/workflows/ci-docker.yml b/.github/workflows/ci-docker.yml index 833d9a7f3..6327c3960 100644 --- a/.github/workflows/ci-docker.yml +++ b/.github/workflows/ci-docker.yml @@ -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 diff --git a/.gitmodules b/.gitmodules index ac85d15f7..5e29816b2 100644 --- a/.gitmodules +++ b/.gitmodules @@ -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 diff --git a/alire.toml b/alire.toml index ec059b8ca..84a85a42e 100644 --- a/alire.toml +++ b/alire.toml @@ -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" } diff --git a/alr_env.gpr b/alr_env.gpr index cf880371f..974c61fa7 100644 --- a/alr_env.gpr +++ b/alr_env.gpr @@ -23,6 +23,7 @@ aggregate project Alr_Env is "deps/spdx", "deps/stopwatch", "deps/toml_slicer", + "deps/umwi", "deps/uri-ada", "deps/xmlezout" ); diff --git a/deps/aaa b/deps/aaa index 906d9eaf4..f60254934 160000 --- a/deps/aaa +++ b/deps/aaa @@ -1 +1 @@ -Subproject commit 906d9eaf4fb8efabfbc3d8cfb34d04ceec340e13 +Subproject commit f60254934a7d6e39b72380b496527295602f75e3 diff --git a/deps/umwi b/deps/umwi new file mode 160000 index 000000000..c8aabdc73 --- /dev/null +++ b/deps/umwi @@ -0,0 +1 @@ +Subproject commit c8aabdc73a6cd2d46d80175944dd7d47e090d1b7 diff --git a/src/alire/alire-solutions-diffs.adb b/src/alire/alire-solutions-diffs.adb index 57e3d1198..fc2d921c8 100644 --- a/src/alire/alire-solutions-diffs.adb +++ b/src/alire/alire-solutions-diffs.adb @@ -1,3 +1,4 @@ +with Alire.Origins; with Alire.Utils.Tables; with Alire.User_Pins; with Alire.Utils.TTY; @@ -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 ); ---------- @@ -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 ("+"), @@ -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 @@ -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 @@ -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 @@ -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 (",") & ")");