From 0233b06422f5995160937e36d3128f78b2553ac3 Mon Sep 17 00:00:00 2001 From: Alejandro R Mosteo Date: Sun, 16 May 2021 00:28:48 +0200 Subject: [PATCH] Synchronize alire metadata and git submodules (#720) * Sync submodules and alire metadata * Reenable self-build in all platforms * Feedback about build * Disable macOS Somehow apt-get ends being called. To be diagnosed. * Fix environment settings in manifest This should fix the problem with the macOS build * Identified and fixed issue with macOS build The problem is that the native package in the lockfile was being blindly used. This is a further hint that lockfiles require work to work better cross-platform. * Fix issue with indirect dependencies in test The self-build test has uncovered an issue already reported, and this commit also fixes minor differences in output for linked dependencies, depending on whether they contain alire metadata or not (the same information can be presented regardless) Also, disabled version printing on setup-alire, and moved here --- .github/workflows/ci-self.yml | 67 ++++++++ .github/workflows/ci-self.yml.disabled | 38 ----- .gitignore | 14 +- alire.lock | 207 +++++++++++++++++++++++++ alire.toml | 22 ++- alr_env.gpr | 6 +- deps/aaa | 2 +- deps/ajunitgen | 2 +- deps/ansi | 2 +- deps/gnatcoll-slim | 2 +- deps/minirest | 2 +- deps/semantic_versioning | 2 +- deps/simple_logging | 2 +- deps/uri-ada | 2 +- src/alire/alire-origins.ads | 9 +- src/alire/alire-roots.adb | 2 +- src/alire/alire-solutions.adb | 22 ++- 17 files changed, 332 insertions(+), 71 deletions(-) create mode 100644 .github/workflows/ci-self.yml delete mode 100644 .github/workflows/ci-self.yml.disabled create mode 100644 alire.lock diff --git a/.github/workflows/ci-self.yml b/.github/workflows/ci-self.yml new file mode 100644 index 00000000..e009f59c --- /dev/null +++ b/.github/workflows/ci-self.yml @@ -0,0 +1,67 @@ +# An action to ensure that alr can build itself by running `alr build`. +# In other words, a check that submodules are in sync with alire.toml + +name: CI alr build + +on: + pull_request: + paths-ignore: + - 'doc/**' + - '**.md' + - '**.rst' + - '**.txt' + release: + types: [created] + +jobs: + + build: + name: Self-build on ${{ matrix.os }} + + strategy: + matrix: + os: + - macos-latest + - ubuntu-latest + - windows-latest + + runs-on: ${{ matrix.os }} + + steps: + - name: Check out repository + uses: actions/checkout@v2 + with: + submodules: false # Not needed, should be retrieved by alr + + - name: Install toolchain + uses: ada-actions/toolchain@ce2020 + with: + distrib: community + + # We need the devel version to build with remote pins + - name: Install alr + uses: alire-project/setup-alire@latest-devel + + - run: alr version -n + + # The checked-in lockfile depends on the curl system package. Running a + # non-interactive update will fix this in Windows/macOS by detecting the + # external (version from command-line) alternative. We could also work + # around this by providing lockfiles for every platform and putting it in + # place before building. + - run: alr update -n + - run: alr update -n + # Two runs are needed because indirect dependencies aren't detected until + # remote pins have been fetched. This is an actual bug uncovered by this + # check that needs fixing (#736). + + # Check dependencies/pins that are going to be used + - run: alr with --solve + + - run: alr printenv + + - name: Self-build alr + run: alr build + + - name: Display built alr version + run: ./bin/alr version diff --git a/.github/workflows/ci-self.yml.disabled b/.github/workflows/ci-self.yml.disabled deleted file mode 100644 index 0535c425..00000000 --- a/.github/workflows/ci-self.yml.disabled +++ /dev/null @@ -1,38 +0,0 @@ -# An action to ensure that alr can build itself by running `alr build`. -# In other words, a check that submodules are in sync with alire.toml - -name: CI alr build - -on: - pull_request: - paths-ignore: - - 'doc/**' - - '**.md' - - '**.rst' - - '**.txt' - release: - types: [created] - -jobs: - - build: - name: Self-build with `alr build` - - runs-on: ubuntu-latest - - steps: - - name: Check out repository - uses: actions/checkout@v2 - with: - submodules: true - - - name: Install toolchain - uses: ada-actions/toolchain@ce2020 - with: - distrib: community - - - name: Install alr - uses: alire-project/setup-alire@latest-stable - - - name: Self-build alr - run: alr build diff --git a/.gitignore b/.gitignore index dad9a345..042604a5 100644 --- a/.gitignore +++ b/.gitignore @@ -11,11 +11,11 @@ .*sw? /alire/ -bin -lib -obj -stress/*/ -venv - +bin/ +/config/ +lib/ +obj/ out/ -testsuite/out/ +stress/*/ +/testsuite/out/ +venv/ diff --git a/alire.lock b/alire.lock new file mode 100644 index 00000000..e44fd326 --- /dev/null +++ b/alire.lock @@ -0,0 +1,207 @@ +# THIS IS A MACHINE-GENERATED FILE. DO NOT EDIT MANUALLY. + +[solution] +[solution.context] +solved = true +[[solution.state]] +crate = "aaa" +fulfilment = "linked" +pinned = false +transitivity = "direct" +versions = "~0.2.1" +[solution.state.link] +kind = "softlink" +path = "file:alire/cache/pins/aaa_0.2.3-dev_4b4aa047" +relative = true +remote = true +[solution.state.link.origin] +commit = "4b4aa047f29a4270c5b5003468617e153977ab97" +url = "git+https://github.com/mosteo/aaa.git" +[[solution.state]] +crate = "ada_toml" +fulfilment = "linked" +pinned = false +transitivity = "direct" +versions = "~0.1" +[solution.state.link] +kind = "softlink" +path = "file:alire/cache/pins/ada_toml_ade3cc90" +relative = true +remote = true +[solution.state.link.origin] +commit = "ade3cc905cef405dbf53e16a54f6fb458482710f" +url = "git+https://github.com/pmderodat/ada-toml.git" +[[solution.state]] +crate = "ajunitgen" +fulfilment = "linked" +pinned = false +transitivity = "direct" +versions = "^1.0.1" +[solution.state.link] +kind = "softlink" +path = "file:alire/cache/pins/ajunitgen_1.0.2-dev_e5d01db5" +relative = true +remote = true +[solution.state.link.origin] +commit = "e5d01db5e7834d15c4066f0a8e33d780deae3cc9" +url = "git+https://github.com/mosteo/ajunitgen.git" +[[solution.state]] +crate = "ansiada" +fulfilment = "linked" +pinned = false +transitivity = "direct" +versions = "~0.1" +[solution.state.link] +kind = "softlink" +path = "file:alire/cache/pins/ansiada_0.2.0-dev_acf9afca" +relative = true +remote = true +[solution.state.link.origin] +commit = "acf9afca3afe1f8b8843c061f3cef860d7567307" +url = "git+https://github.com/mosteo/ansi-ada.git" +[[solution.state]] +crate = "curl" +fulfilment = "solved" +pinned = false +transitivity = "indirect" +versions = "*" +[solution.state.release] +description = "Command-line tool for transferring data with URL syntax" +maintainers = [ +"alejandro@mosteo.com", +] +maintainers-logins = [ +"mosteo", +] +name = "curl" +notes = "Provided by system package: curl" +version = "7.68.0" +[solution.state.release.origin] +url = "system:curl" +[[solution.state]] +crate = "gnatcoll" +fulfilment = "linked" +pinned = false +transitivity = "direct" +versions = "^21" +[solution.state.link] +kind = "softlink" +path = "file:alire/cache/pins/gnatcoll_0.0.0_f3bd1c51" +relative = true +remote = true +[solution.state.link.origin] +commit = "f3bd1c51d12962879f52733e790b394f5bbfe05f" +url = "git+https://github.com/alire-project/gnatcoll-core.git" +[[solution.state]] +crate = "minirest" +fulfilment = "linked" +pinned = false +transitivity = "direct" +versions = "~0.2" +[solution.state.link] +kind = "softlink" +path = "file:alire/cache/pins/minirest_0.2.0-dev_4550aa35" +relative = true +remote = true +[solution.state.link.origin] +commit = "4550aa356d55b9cd55f26acd34701f646021c5ff" +url = "git+https://github.com/mosteo/minirest.git" +[[solution.state]] +crate = "semantic_versioning" +fulfilment = "linked" +pinned = false +transitivity = "direct" +versions = "^2" +[solution.state.link] +kind = "softlink" +path = "file:alire/cache/pins/semantic_versioning_2.0.0-dev_82c28f77" +relative = true +remote = true +[solution.state.link.origin] +commit = "82c28f773d0e3126d7cdf6e4ded228d2b733441e" +url = "git+https://github.com/alire-project/semantic_versioning.git" +[[solution.state]] +crate = "simple_logging" +fulfilment = "linked" +pinned = false +transitivity = "direct" +versions = "^1.2" +[solution.state.link] +kind = "softlink" +path = "file:alire/cache/pins/simple_logging_1.2.0-dev_02a7de75" +relative = true +remote = true +[solution.state.link.origin] +commit = "02a7de7568af6af7cedd1048901fae8e9477b1d9" +url = "git+https://github.com/alire-project/simple_logging.git" +[[solution.state]] +crate = "spdx" +fulfilment = "solved" +pinned = false +transitivity = "direct" +versions = "~0.2" +[solution.state.release] +authors = [ +"Fabien Chouteau", +] +description = "SPDX License Expression Validator" +licenses = "MIT" +maintainers = [ +"Fabien Chouteau ", +] +maintainers-logins = [ +"Fabien-Chouteau", +] +name = "spdx" +tags = [ +"spdx", +"license", +] +version = "0.2.0" +website = "https://github.com/Fabien-Chouteau/spdx_ada" +[solution.state.release.origin] +commit = "2df9b1182544359c751544e52e14c94830d99fa6" +url = "git+https://github.com/Fabien-Chouteau/spdx_ada.git" +[[solution.state]] +crate = "uri_ada" +fulfilment = "linked" +pinned = false +transitivity = "direct" +versions = "^1" +[solution.state.link] +kind = "softlink" +path = "file:alire/cache/pins/uri_ada_1.0.0-dev_b61eba59" +relative = true +remote = true +[solution.state.link.origin] +commit = "b61eba59099b3ab39e59e228fe4529927f9e849e" +url = "git+https://github.com/mosteo/uri-ada.git" +[[solution.state]] +crate = "xml_ez_out" +fulfilment = "solved" +pinned = false +transitivity = "indirect" +versions = "^1.6" +[solution.state.release] +authors = [ +"Marc A. Criley", +] +description = "Creation of XML-formatted output from Ada programs" +executables = [ +"tmeztf", +] +maintainers = [ +"alejandro@mosteo.com", +] +maintainers-logins = [ +"mosteo", +] +name = "xml_ez_out" +version = "1.6.0" +website = "http://www.mckae.com/xmlEz.html" +[solution.state.release.origin] +hashes = [ +"sha512:c90d08dcdb96bf39f1e06def716ea9936b2aec25fec2ea4f3314c53a2befefa4ea84c037c35abe6d7675af1c91a8847f6ce4e5e8dd32da1008f2ba43ed79151b", +] +url = "https://github.com/alire-project/xmlezout/archive/alr-1.6.tar.gz" + diff --git a/alire.toml b/alire.toml index bfdd222a..72f6ea0c 100644 --- a/alire.toml +++ b/alire.toml @@ -1,23 +1,17 @@ name = "alr" description = "Command-line tool from the Alire project" -# Since the solved dependencies may vary from the submodules pinned to a commit -# in ./deps, the result of `alr build` might differ from the same code built by -# GitHub actions. We might want to add, down the road, a way to propagate the -# version defined here into Ada code (perhaps by generating a metadata package -# before `alr build` that the code being built can "with" if so desired), so -# builds are uniquely identified without requiring manual editing or other -# preprocessing. We could also include info about all dependencies exact -# versions and environment used during the build. -version = "0.8-dev" +version = "1.1.0-dev" authors = ["Alejandro R. Mosteo", "Fabien Chouteau", "Pierre-Marie de Rodat"] maintainers = ["alejandro@mosteo.com", "chouteau@adacore.com"] maintainers-logins = ["mosteo", "Fabien-Chouteau"] # At some point we should have a separate alire/libalire crate for use of -# alire.gpr only. -project-files = ["alr.gpr"] +# alire.gpr only. For now this crate is not intended as a dependency but to be +# used to build alr. +auto-gpr-with = false +project-files = ["alr_env.gpr"] executables = ["alr"] [[depends-on]] @@ -26,8 +20,12 @@ ada_toml = "~0.1" ajunitgen = "^1.0.1" ansiada = "~0.1" gnatcoll = "^21" -minirest = "~0.1" +minirest = "~0.2" semantic_versioning = "^2" simple_logging = "^1.2" uri_ada = "^1" spdx = "~0.2" + +# Building alr requires the explicit setting of this variable +[gpr-set-externals."case(os)"] +macos = { OS = "macOS" } diff --git a/alr_env.gpr b/alr_env.gpr index 112acc56..16c7f08b 100644 --- a/alr_env.gpr +++ b/alr_env.gpr @@ -32,13 +32,13 @@ aggregate project Alr_Env is -- ALIRE_OS is used in alire_common.gpr. -- GNATCOLL_OS is used in gnatcoll.gpr. case Host_OS is - when "Windows_NT" => + when "Windows_NT" | "windows_nt" | "windows" | "Windows" => for External ("ALIRE_OS") use "windows"; for External ("GNATCOLL_OS") use "windows"; - when "macOS" => + when "macOS" | "macos" | "OSX" | "osx" => for External ("ALIRE_OS") use "osx"; for External ("GNATCOLL_OS") use "osx"; - when others => + when others => for External ("ALIRE_OS") use "unix"; for External ("GNATCOLL_OS") use "unix"; end case; diff --git a/deps/aaa b/deps/aaa index b0825ac9..4b4aa047 160000 --- a/deps/aaa +++ b/deps/aaa @@ -1 +1 @@ -Subproject commit b0825ac9373ed587394cf5e7ecf51fd7caf9290a +Subproject commit 4b4aa047f29a4270c5b5003468617e153977ab97 diff --git a/deps/ajunitgen b/deps/ajunitgen index d29579c3..e5d01db5 160000 --- a/deps/ajunitgen +++ b/deps/ajunitgen @@ -1 +1 @@ -Subproject commit d29579c3d8ec05fe9ec59794bf00257c5350ca2d +Subproject commit e5d01db5e7834d15c4066f0a8e33d780deae3cc9 diff --git a/deps/ansi b/deps/ansi index 27a89150..acf9afca 160000 --- a/deps/ansi +++ b/deps/ansi @@ -1 +1 @@ -Subproject commit 27a89150c1f5481a821722601a3b6d4a5368596c +Subproject commit acf9afca3afe1f8b8843c061f3cef860d7567307 diff --git a/deps/gnatcoll-slim b/deps/gnatcoll-slim index e14248fd..f3bd1c51 160000 --- a/deps/gnatcoll-slim +++ b/deps/gnatcoll-slim @@ -1 +1 @@ -Subproject commit e14248fd9b750f997080f94580aae68df2773c64 +Subproject commit f3bd1c51d12962879f52733e790b394f5bbfe05f diff --git a/deps/minirest b/deps/minirest index aa61437c..4550aa35 160000 --- a/deps/minirest +++ b/deps/minirest @@ -1 +1 @@ -Subproject commit aa61437c69435ee8fe952eacbc7f03c4ca661f17 +Subproject commit 4550aa356d55b9cd55f26acd34701f646021c5ff diff --git a/deps/semantic_versioning b/deps/semantic_versioning index ce88b0c7..82c28f77 160000 --- a/deps/semantic_versioning +++ b/deps/semantic_versioning @@ -1 +1 @@ -Subproject commit ce88b0c714f6c6860c689c977f372d3b517af798 +Subproject commit 82c28f773d0e3126d7cdf6e4ded228d2b733441e diff --git a/deps/simple_logging b/deps/simple_logging index 6030caf9..02a7de75 160000 --- a/deps/simple_logging +++ b/deps/simple_logging @@ -1 +1 @@ -Subproject commit 6030caf9c8e4a73b6aade2f543a53aefbd5a1b37 +Subproject commit 02a7de7568af6af7cedd1048901fae8e9477b1d9 diff --git a/deps/uri-ada b/deps/uri-ada index e045780b..b61eba59 160000 --- a/deps/uri-ada +++ b/deps/uri-ada @@ -1 +1 @@ -Subproject commit e045780bf2cacd6cb521da6b8eb8739632cdc5cd +Subproject commit b61eba59099b3ab39e59e228fe4529927f9e849e diff --git a/src/alire/alire-origins.ads b/src/alire/alire-origins.ads index 397a35d5..dd7e2898 100644 --- a/src/alire/alire-origins.ads +++ b/src/alire/alire-origins.ads @@ -86,12 +86,19 @@ package Alire.Origins is -- Helper types + subtype Hexadecimal_Character is Character with + Static_Predicate => Hexadecimal_Character in '0' .. '9' | 'a' .. 'f'; + subtype Git_Commit is String (1 .. 40) with Dynamic_Predicate => - (for all Char of Git_Commit => Char in '0' .. '9' | 'a' .. 'f'); + (for all Char of Git_Commit => Char in Hexadecimal_Character); subtype Hg_Commit is String (1 .. 40); + function Is_Valid_Commit (S : String) return Boolean + is (S'Length = Git_Commit'Length and then + (for all Char of S => Char in Hexadecimal_Character)); + -- Constructors function New_External (Description : String) return Origin; diff --git a/src/alire/alire-roots.adb b/src/alire/alire-roots.adb index 3115f841..35dad775 100644 --- a/src/alire/alire-roots.adb +++ b/src/alire/alire-roots.adb @@ -757,7 +757,7 @@ package body Alire.Roots is -- Identify the head commit/reference - if Commit = "" or else Commit not in Origins.Git_Commit then + if Commit = "" or else not Origins.Is_Valid_Commit (Commit) then declare Ref_Commit : constant String := VCSs.Git.Handler.Remote_Commit (URL, Ref => Commit); diff --git a/src/alire/alire-solutions.adb b/src/alire/alire-solutions.adb index 46e3d20b..861e91f4 100644 --- a/src/alire/alire-solutions.adb +++ b/src/alire/alire-solutions.adb @@ -438,12 +438,32 @@ package body Alire.Solutions is -- Show other dependencies with their status and hints + -- TODO: show these in line with the previous ones, as most of the info + -- is common. Just mark the true external (missing ones) better, see + -- #646 and #685. Now, pins without a release are shown here too, + -- although they're properly resolved. + if (for some Dep of This.Dependencies => not Dep.Has_Release) then Trace.Log ("Dependencies (external):", Level); for Dep of This.Dependencies loop if not This.State (Dep.Crate).Has_Release then - Trace.Log (" " & Dep.TTY_Image, Level); + Trace.Log + (" " + & Dep.TTY_Image + & (if Dep.Is_Pinned or else Dep.Is_Linked + then TTY.Emph (" (pinned)") + else "") + & (if Detailed and then Dep.Is_Linked + then " (origin: " + & TTY.URL (Dep.Link.Path) + & (if Dep.Link.Is_Remote + then " from " + & Dep.Link.Remote.TTY_URL_With_Commit + else "") -- no remote + & ")" -- origin completed + else ""), -- no details + Level); -- Look for hints. If we are relying on workspace information -- the index may not be loaded, or have changed, so we need to -- 2.39.5