Implement Homebrew as the system deployer for macOS. (#1185)
* Implement Homebrew as the system deployer for macOS.
* src/alire/alire-origins-deployers-system-homebrew.adb: new.
* src/alire/alire-origins-deployers-system-homebrew.ads: new.
* src/alire/alire-origins-deployers-system.adb (Platform_Deployer):
When the platform distro manager is Homebrew, return Homebrew.Deployer.
* src/alire/alire-platforms.ads (Distributions): include macOS.
(Package_Managers): add Homebrew.
(Distro_Manager): for macOS, use Homebrew.
* src/alire/alire-utils-tools.adb (System_Package_For_Tool): treat MacOS
like other distributions.
* src/alire/os_macos/alire-platforms-current__macos.adb
(Detected_Distribution): return Platforms.MacOS.
* testsuite/drivers/helpers.py (on_macos()): new.
(distribution()): return 'MACOS' if on_macos() is True.
; Squashed commit of the following:
; commit
0110299ceb66f58cd4793fd78a69fc5b100b4ccf
; Author: Simon Wright <simon@pushface.org>
; Date: Fri Sep 9 17:45:04 2022 +0100
; Restore test to correct sense.
; commit
d396b6b54a73bbbfd59071539bf6268bccce3cf0
; Author: Simon Wright <simon@pushface.org>
; Date: Fri Sep 9 17:34:54 2022 +0100
; Replace assertions in Homebrew deployer with exceptions
; commit
d7603110b9543bdaac9516fa844599e87fac70aa
; Author: Simon Wright <simon@pushface.org>
; Date: Mon Sep 5 14:14:03 2022 +0100
; Recognise macOS as a distribution.
; * testsuite/drivers/helpers.py (on_macos()): new.
; (distribution()): check on_macos(). Return 'MACOS' if true.
; commit
8703acfeb8fdf336d862cefc16706eac5d3f0758
; Author: Simon Wright <simon@pushface.org>
; Date: Sun Sep 4 17:33:13 2022 +0100
; Use 'brew info' to get available, installed versions.
; commit
8b22b904e19d64fecb89233e6527c2faf655d982
; Author: Simon Wright <simon@pushface.org>
; Date: Wed Aug 31 15:54:51 2022 +0100
; Continuing.
; commit
a9821ed9a605e30b5699a49df6fffd11224ab931
; Author: Simon Wright <simon@pushface.org>
; Date: Mon Aug 22 17:09:48 2022 +0100
; First changes for macOS Homebrew.
* 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).
* Merging with openSUSE changes in #1173.
* src/alire/alire-origins-deployers-system.adb: added Homebrew option.
* src/alire/alire-platforms.ads: likewise.
* src/alire/alire-utils-tools.adb: likewise.
Co-authored-by: John Serock <1468970+serock@users.noreply.github.com>
Co-authored-by: GHA <actions@github.com>