Remove some unnecessary code after Solution changes (#431)
The solution stores platform-dependent releases, hence the Environment
parameter is not needed at the moment of writing the corresponding lockfile.
A stray exception handler in Alr.Commands.Withing was unneeded and masking as a
regular error some Constraint_Errors that should escalate to the main handler
to be reported as unexpected internal errors.
Dead code in Alire.Utils that is not going to be useful again has been removed.
Safeguards for changes in lockfile/crate format (#436)
If the lockfile is not loadable we presume it is in an old format. In this case
we recreate it from scratch, which entails the loss of any stored pins. If the
alire/crate.toml file is not loadable we advice the user to recreate the
workspace from scratch.
Note that both crate.toml and crate.lock use the index format to store
releases. Hence, any change in index format may impact these files. While the
lockfile is not that problematic, for the crate.toml file we have no easy
workaround since we cannot know to which crate the workspace belongs.
There are possible mitigations but as long as we don't have stable releases the
complexity/benefit ratio is unclear. If we eventually make the crate.toml file
only manually editable that could also impact how to deal with this issue, so
not doing anything about it yet.
Internal enhancements to Solution and Dependency states (#429)
* Remove obsolete Alire.Dependencies.Unavailable
This fake dependency was used in the old Ada index to store an unavailable
dependency. There is no longer any use for this constant.
* Image functions for newly tagged Alire.Milestones
Make the type tagged to gain dot notation, and add [TTY_]Image subprograms for
simpler printing elsewhere.
* New Alire.Dependencies.States type
This type is used to store the actual way in which a dependency was solved. All
possibilities are stored, which allows to properly cache a solution, and detect
changes in solutions across operations that modify the solution: pinning,
withing, updating...
* New Alire.Dependencies.States.Maps
A crate name -> dep state mapping which is at the core of the cached Solution,
with a couple of functional-style modifiers for use in expression functions.
* Remove pinning info from Releases
This information is now stored in the dependency State where it better belongs.
This way it doesn't matter if the solution contains a release for the pinned
dependency; the pinning information is always preserved.
* Reworked Solution internals to use States
(Doesn't build.) Changes to Alire.Solutions to use the new dependency states.
With these changes there is no loss of information when going from a valid to
an invalid solution (information about partial solutions is stored the same as
for complete solutions), which enables down the road better feedback to users
and simpler implementation of other improvements, like pinning of crates to
local folders.
* Solver improvements based on new dependency states
(Only alire-solver.adb builds.) With these changes, the solver needs not to
check the complete validity of a solution once all dependencies are processed
(which is an expensive test), because validity is guaranteed for any partial
solution (that is, no incompatible release can make into the solution). Also,
while the solver was previously complete in regard to valid solutions (with
releases or hints), now it is also complete for invalid solutions (those
missing releases and hints for some dependency). This means that the solver
will return the "best" incomplete solution when a complete one cannot be found.
* Tweaks to achieve build with new Solution
A few minor changes due to changes in the Solution public methods are needed
here and there, without functional implications.
* Tweaks for testsuite compliance
A few changes are needed to ensure the same output as before is produced, or to
adapt a few tests to minimal output changes caused by the homogenization of
dependency images.
* Make Alire.Crate_Name a proper private type
Our Dynamic_Predicate in the publicly defined Crate_Name as new String is
rejected by GNAT 9, and I couldn't find a workaround short of making all of
Alire.* non-preelaborable. Defining privately Crate_Name as new String in turn
caused numerous errors in child packages due to some mixing between the public
and private views. In the end, making it a record was the simplest change
without introducing the risk of missing checks (as if we had made it simply a
subtype of String).
So, given the change, I bit the bullet to make it tagged and provide a couple
of convenience functions.
This global modifier is available in Alire.Force. Other candidate locations,
like Alire.Config, Alire.Errors, Alire.Utils.User_Input cannot be used because
they bring in non-preelaborable units and it snowballs from there.
The recommended usage is through Alire.Recoverable_Error, which will warn or
raise appropriately depending on the flag. The boolean Alire.Force is also
available for less straightforward situations (interaction defaults for
example).
Exit code fix for `get --build` with build failure (#428)
We were not erroring if the build failed, which is counterintuitive. We now
require successful retrieval and build to exit with code 0. A test to verify
this situation has been added.
Remove unnecessary forced exit from `Alr.Main` (#425)
Historically, something was causing an extra empty line in the output of every
command. At some point this has been fixed inadvertently, so we can remove the
forced exit call, which in turn will allow finalization to complete normally,
if it were ever needed.
The images for CentOS (unsupported Linux) and debian+community have been
upgraded to use GNAT CE 2020. A few minor errors newly detected have been
fixed, related to anonymous access types and explicit aliased arguments.
Show changes to dependencies/solutions in relevant commands (#397)
* Show dependency changes in applicable commands
By relying on the lockfile we can easily summarize changes to the user. There
are no functional changes, except for some no-op updates that can now be omitted
altogether instead of simply blindly redeploying the same exact dependencies.
Fix: use local dependencies in `alr show --solve` (#400)
When the command was run for the local workspace (without explicit crate name),
the dependencies were being taken from the index instead of the local release.
This also manifested as not solvable dependencies for local releases without a
counterpart in the index.
This message is generally not wanted in the final output, since it's used only
to signal alr is not dead/stuck, but busy. Also, it must be entirely removed
from some commands like `alr setenv` or the output is no longer parseable.
* Detect output redirection to adjust logging
* Switch --no-tty to disable control chars in output
Windows CI: Force the installation for tar in msys2
The tar executable provided by Git install in GitHub Action Windows VM
doesn't seem to work. This patch forces the installation of tar in msys2
which is going to be used first by alr.
Alire.Origins.Deployers.System.Pacman: fix version detection
The dash in pacman version is does not correspond to sementic versioning definition.
It is the release number that comes from fixes in the build recipe.
The system crates rework done by ae81cbd introduced a few changes
that were not updated in the docs. Namely, the concept of system
compiler which was lost during the TOML index transition is brought
back so system crates are properly [un]available depending on the
compiler in use.
* Child output was not logged on Checked_Error
* Regular child failures were reported as errors in `alr test` itself
* Crates without regular releases broke `alr test`