The addition of more enum values to support other distributions is a
breaking change. This raises the question of whether we should simply drop
unknown enum values, as this could well work. But then, using an improper value
would silently fail. Perhaps the warning could be disabled for normal use and
re-enabled for publish?
Separate workflow to test unsupported package manager platform (#623)
* Workflow to test with unsupported package manager
* Add config option to disable distro detection
With test
* Fixes for circular elaboration
* Fix test for slight change in behavior
Before the last changes to break circularities, we tried to load the manifest
as part of the config loading process. Now we are satisfied with finding a
properly named file at the expected place. This causes one test to not detect
invalid TOML, since the manifest contents aren't really needed for the test.
Solver: Speed-up for impossible dependencies (#620)
* Solver: Speed-up for impossible dependencies
Whenever a solution is incomplete we keep looking for solutions. But if the
reason for incompleteness is an impossible request (non-existent crate or
version), this resulted on finding all combinations for the rest of crates that
do have satisfiable dependencies.
With this patch, impossible situations are considered part of the "complete"
solution (as there cannot be a more complete one), which allows the solver to
use complete the search much more quickly, as no pointless attempts for more
solutions are made.
* Fixes for problems caught by the test suite
The optimization was too aggressive, as it took place before detecting
externals. Also, it should only apply to direct unavoidable dependencies, as
indirect impossibilities can be avoided by other solutions.
Added alire.toml so alr can build/edit itself (#575)
* Added alire.toml so alr can build/edit itself
Also bumped the patch number, as code changes from now own should appear in a
future release, and 0.7-dev means pre-0.7 according to semantic versioning.
Fabien Chouteau [Wed, 4 Nov 2020 20:32:52 +0000 (21:32 +0100)]
Alire.Environment: load env context from the platform (#608)
* Alire.Environment: sort env list for predictable output
* Alire.Environment: load env context from the platform
For the moment this is only used on Windows for msys2. Before this patch the msys2 env was not included in `alr print` which means that the context was not complete.
* Alr.Platforms.Windows: do not install msys2 if pacman already in PATH
This makes alr usable when the user is already in an msys2 context.
And it alse makes possible to have an alire package in msys2.
Avoid unneeded requests to approve changes after editing the manifest (#591)
* Avoid unneeded requests to update when no changes
Changes in solutions were being spuriously detected, in situations in which
there were no changes. Also, when manual changes didn't affect dependencies,
the situation was not corrected either by manual update or automatic check.
Fabien Chouteau [Wed, 28 Oct 2020 19:27:46 +0000 (20:27 +0100)]
Alr.Commands.Init: warnings instead of fails for existing files (#599)
To make this command more usable when converting an existing Ada project
to Alire, existing source or gpr files are now reported as a warning
instead of an error.
Publish: Detect missing manifest in remote sources (#595)
This could escape our checks when the alire.toml file was in .gitignore, for
example, so we didn't detect the discrepancy between local and remote sources.
Use GitHub API for basic checks/info during publishing (#554)
* Use GitHub API for basic checks/info during publish
* Code review fix
* Fix: new config values unavailable during same run
New config entries were stored on disk but not added to the memory map. As the
Config.Set subprogram isn't aware of the level of configuration being set,
there is no direct way to both store to disk and to memory; instead the
solution is that the configuration is reloaded every time. This is a bit of
overkill and a candidate for later optimization.
Alire.Utils.User_Input: add function to query user's name, email and GitHub login (#461)
* Alire.Utils.User_Input: add function to query user's name, email and github login
* Break circular elaboration issue
Since Config uses Utils.User_Input indirectly via Deplyers.System, a
possibility is to move new User_Input functions that need Config into a new
package.
Co-authored-by: Alejandro R. Mosteo <amosteo@unizar.es>
It seems GNAT's Normalize_Arguments does its own escaping, so we do not need to
do it ourselves. Also, the test checks that indeed the `alire` folder is
excluded when tar'ing manually.
For fetching from github, it is safe to do this transformation, whereas users
working with the repo may find more convenient the use of private git@ URLs.
* Detect github URLs missing a trailing ".git"
* Testsuite: more cases for git remotes
* Allow controlling the git@ -> https:// transformation
* Generalize checks beyond github
* Unit test for Alire.VCSs.Git.Transform_To_Public
Use local repository as reference for publishing (#519)
* Publish using local repo and revision as reference
We still require the remote is ready (in essence, that the local repo is not
ahead of the remote), but now it is simply a matter of issuing `alr publish` or
`alr publish <commit|tag|branch>`, and the corresponding commit will be used.
* Refactor long function name to more sensible one
* Fix comments due to bad refactoring
* Test for publishing from inside a repo
* Fixes uncovered by testsuite
Adding defaults for <URL> <commit> complicates things somewhat as we use local
paths for testing that would otherwise be rejected, so a few corner cases have
to be explicitly considered now.
The extra indirection level was not required, as os.walk already gives us the
proper paths we need. This wasn't detected until we tried to build an unzipped
release zipped by ourselves.
After fixing the manifest file name to `alire.toml`, there is no possible
confusion with other toml files in the same directory, so we can explicitly
give .toml extension to config files.
Move out a possible upstream-provided manifest (#487)
When doing `alr get` we want to use the index-provided manifest for
reproducibility. So, an eventual upstream manifest provided with the sources is
renamed with an extra ".upstream" coda.
In most cases, the Root has to be valid so it can be used. This patch moves the
Is_Valid code smell to a separate child type (Alire.Roots.Optional.Root) that
can be used in the few cases where all the root states have to be treated
separately.
This is done by using newline characters to insert a new error prefix. A couple
of new facilities to encourage splitting of long errors are defined:
Errors.Wrap and Errors.Set (Wrapping_Message, Wrapped_Exception)
* Rename Last_Chance_Handler to Alr.Last_Chance_...
To avoid possible conflicts with other libraries and follow the naming of
other packages.
* Append new dependencies to the end of the manifest
* Conservative removal of dependencies in `alr with`
This action will also not touch lines that aren't involved in the deletion.
Only a simple dependency, and trivially empty [[depends-on]] array entries will
be removed. As an improvement over the previous situation, dynamic expressions
will not preclude using `alr with` for static dependencies, leaving the dynamic
ones untouched.
* Use lexicographical order for printing dependencies
This was happening before by chance in several tests. The `alr with` changes
have surfaced that the order on file is kept in tree; while this has no
secondary effects, for presentation to the user is better to be always
consistent. Solutions already use ordered sets, so for lists within conditional
trees we do the same (only for presentation).
Move origin information to its own top-level table (#480)
* Script to patch manifest with separate origin table
A self-contained origin table is cleaner and allow each origin kind to have its
own fields without polluting the rest of the properties top-level table
* Alire:Index: bump expected index version
* Load/Save new [origin] table
* Testsuite: migrated indexes to new [origin] format
* Migrate testsuite indexes to new split manifests
* Alire.Index: update community version
* Refactor Alr.OS_Lib.Traverse_Folder into Alire
As Alire.Directories.Traverse_Tree
* Alire.TOML_Index: traverse new folder structure
Also adapt the checks to the new structure, and double-check that the file name
matches the manifest contents (name, version).
* Refactor Crate internals for new flat manifests
Since now each release is truly independent, crates need not to store the
common information as previously. This is done now only for external
definitions in a narrower scope.
Several loading functions can also be streamlined since now it's simpler to get
a proper complete release without requiring its enclosing crate.
The bulk of the refactoring emanates from merging Alire.Crates.With_Releases
into simply Alire.Crates, and repurposing the Alire.Crates.Sections enum.
* Use new [[depends-on]] dependencies
Nothing outwards has changed yet; the manifest is still entirely machine
generated. This commit only changes the table [depends-on] into an array of
[[depends-on]] tables.
* Testsuite fixes for new format
Fixes in code detected by the testsuite, and small changes in output due to
code refactorings.