This is to avoid `alr printenv` printing invalid
environment variable names, i.e. with leading dot.
* Fix typo in run_alr error message
* Simplify crate name validation test code
* Use two letters for min crate name length verification
* Test init with valid crate name
* Add more test cases for bad index name
* Use constant instead of dot literal
* Disallow dots in identifiers
Dots in identifiers are allowed by mistake.
This commit forbids them completely, instead
of just disallowing dots as the first character
in crate name.
Currently action usage output looks like:
`alr action [options] [post_fetch|pre_build|post_build|test]`,
but it should look like:
`alr action [options] [post-fetch|pre-build|post-build|test]`,
because TOML expects keys to be hyphenated.
This commit fixes the problem by replacing underscores with hyphens.
Fabien Chouteau [Thu, 17 Nov 2022 11:38:45 +0000 (12:38 +0100)]
Improve user experience with better manifest errors messages (#1229)
* Improve user experience with better manifest errors messages
This is patch introduces suggestions in various error messages
from the manifest parser. A potential suggestion is made using
edit distance computing from a list of possible values. If the
quality is not deemed good enough, the full list of values is
printed.
* Temp fix GNAT version to check error on macOS
* Revert "Temp fix GNAT version to check error on macOS"
* Implement Homebrew for MacOS: response to comments on PR#1185
* .github/workflows/ci-macos.yml (Run test script): renamed to
"Run test script (without Homebrew)".
(Run test script (with Homebrew)): added 'eval $(brew shellenv)' before
running the test script, so that HOMEBREW_PREFIX gets defined.
* src/alire/alire-origins-deployers-system-homebrew.adb
(Homebrew_Prefix, Homebrew_Present): removed.
(Get_Info): named the declare block. Removed commented-out exception
handler.
(Already_Installed): use Get_Info's returned Installed_Version's length
to determine the result.
(Detect): Get_Version_From_String uses Semantic_Versioning.Parse.
Don't check for Homebrew_Present, it has to be or we wouldn't be
called.
* src/alire/alire-platforms.ads (Distributions): rename MacOS to Homebrew.
(Distro_Manager): likewise.
* src/alire/alire-utils-tools.adb (System_Package_For_Tool): MacOS (in
'case Distribution)' changed to Homebrew.
* src/alire/os_macos/alire-platforms-current__macos.adb
(Homebrew_Prefix): new, gets the environment variable "HOMEBREW_PREFIX".
(Homebrew_Present): new, true if the environment variable is present.
(Detected_Distribution): checks Homebrew_Present, returns Homebrew
or Distro_Unknown accordingly.
(Distribution_Root): returns Homebrew_Prefix if present, otherwise "/".
* testsuite/drivers/helpers.py (distribution()): if on macOS, return
HOMEBREW if HOMEBREW_PREFIX is found, DISTRO_UNKNOWN otherwise.
* Remove improper pragma in response to comment on #1185
* src/alire/alire-origins-deployers-system-homebrew.adb: removed
the innefective pragma Warnings (Off).
Fail test if complain_on_error=False but no error (#1171)
This removes the need to assert that the expected failure indeed happened, and
hardens tests against situations where is unclear if an error should happen.
Stephane Carrez [Fri, 26 Aug 2022 12:51:49 +0000 (14:51 +0200)]
Add support for FreeBSD (#1148)
* Add support for FreeBSD (#22)
* update GNAT project to recognize -XOS=freebsd and configure accordingly
* add FreeBSD as a valid operating system
* add AMD64 as an alias for X86_64 because uname -m returns amd64 on FreeBSD
* add platform specific implementation for FreeBSD
A.J. Ianozi [Thu, 18 Aug 2022 10:58:56 +0000 (06:58 -0400)]
workaround for gnatcoll-core#64 / gnatstudio#128 (#1141)
This is a workaround for issue AdaCore/gnatstudio#128 and AdaCore/gnatcoll-core#64 where GNAT Studio fails to open recently-updated or newly-created alire files. Breaking the Ada_Compiler_Switches up into two statements resloves this problem.
Stephane Carrez [Wed, 3 Aug 2022 16:16:18 +0000 (18:16 +0200)]
Allow publishing to complete for an existing release with --force (#1130)
* Honor the --force option when publishing a crate (#1083)
When publishing and checking for existing crate with same version,
if the crate already exist and the force option is used,
emit a warning message and continue.
* Use Recoverable_Error to report that a crate version already exists
Minor improvements to solver progress output (#1117)
Remove duplicate messages, and add progress while we are still in the space of
complete solutions (as nothing was reported if no complete solution was found).
We now avoid earlier the solving of a dependency which has been already seen in
the search branch.
We also had a bug that was duplicating the search space with every extra
dependency. That meant an exponential increase in time for every extra
dependency. Fortunately, this only affected incomplete solutions.
In practice there are no visible changes as the solutions found are ultimately
the same.
* Avoid infinite recursion when no indexes configured
* Remove references to Requires_Full_Index
* Fixed issues pending "provides" redo
* Generate and use a providers cache file
This cache file, which is common to all indexes, tells us in advance which
crates have to be loaded because they provide some another crate. E.g., if
"gnat" is requested to be loaded, we need to load all gnat_native, and
x-compilers.
If this file doesn't exist, we can only be sure by loading the full index, at
which time the file is regenerated for future use.
* Fix bug where all crates with same prefix were loaded
E.g. we were loading all gn* when only gnat_native needed to be loaded
* Fix providers generation when no index configured
* Add spinner during index load
* Remove the now redundant external aliases collection
* Removed last instances of forced index loading
* Fix for older compilers
* Test for the generated metadata file
* publishing.md: note about private indexes and "provides"
Fabien Chouteau [Wed, 8 Jun 2022 09:24:39 +0000 (11:24 +0200)]
Alire.Crate.Configuration: disable style checks in generated code (#1047)
With the current style checks it is easy to break coding style by having
to many values in an enum for instance.
In theory we could generate better code for enums. But since users can
use their own coding style, it is impossible to be compatible with in
every situation.
So the best option is to disable all checks for this file.
Speed-up detection of installed externals in RPM-based distros (#1036)
* Speed-up detection of installed externals in RPM distros
Although the yum/dnf wrappers are needed for the installation proper, we can
speed up detections of already installed packages by using rpm directly.
Unfortunately, rpm cannot give info on not installed packages, but this still
speeds up things greatly for the usual case of gnat/gprbuild being installed.
We were recognizing them even after the subcommand. This also meant that it
would have been impossible to have regular output if a -v is intended for the
subcommand, e.g. in `alr exec -- whatever -v`.
This switch was always added to the init crates and should have been
included in the first version of build profiles. The warnings are only
displayed for embedded project based on run-times without exception
propagation, and can be very annoying.
This switch was always added to the init crates and should have been
included in the first version of build profiles. The warnings are only
displayed for embedded project based on run-times without exception
propagation, and can be very annoying.