Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support MacPorts as external provider. #1404

Merged
merged 1 commit into from
Jul 18, 2023

Conversation

simonjwright
Copy link
Contributor

In response to issue #1403 - this was a lot easier than I’d expected.

Github CI for macOS has Homebrew installed by default. There is unofficial Macports support, which I haven’t investigated yet.

  * src/alire/alire-origins-deployers-system-macports.adb: new.
  * src/alire/alire-origins-deployers-system-macports.ads: new.
  * src/alire/alire-origins-deployers-system.adb
    (context): add Alire.Origins.Deployers.System.Macports.
    (Platform_Deployer): Platforms.Macports => System.Macports.Deployer.
  * src/alire/alire-platforms.ads
    (Distributions): add Macports.
    (Package_Managers): likewise.
    (Distro_Manager): Macports => Macports.
  * src/alire/alire-utils-tools.adb (System_Package_For_Tool): add Macports,
      same as the other distributions.
  * src/alire/os_macos/alire-platforms-current__macos.adb:
    (context): add GNAT.OS_Lib.
    (Port_Access): new, access to Macports' 'port' executable.
    (Macports_Present): new, true if 'port' was found.
    (Detected_Distribution): first, check for Homebrew_Present, then, for
      Macports_Present. Return the corresponding Distribution if found.
@mosteo
Copy link
Member

mosteo commented Jul 18, 2023

I see that Homebrew gets priority over MacPorts. As a MacOS ignoramus, I seem to remember that Homebrew requires activation, so if a user wanted to use MacPorts having both, there would be no trouble, right?

@simonjwright
Copy link
Contributor Author

I see that Homebrew gets priority over MacPorts. As a MacOS ignoramus, I seem to remember that Homebrew requires activation, so if a user wanted to use MacPorts having both, there would be no trouble, right?

It would be quite unusual to have both - I do, for the moment, so as to be able to test this change!

Both HB & MP need root to install the tool; after that, MP needs root (sudo) to install packages, HB doesn’t.

HB needs you to source a shell setup script which puts brew on your PATH; it also sets up 3 environment variables, including HOMEBREW_PREFIX which is the one I check - not sure what happens if brew is on PATH but the env vars aren’t set. Note, on Intel HB is in /usr/local, on Apple silicon in /opt/homebrew.

MP just needs port to be on the PATH; normally in /opt/local but apparently you can even have multiple versions!! No idea how alr would tell if this (very advanced) usage was in place - not that it’d affect alr itself, but of course include and library paths would have to account for it.

So, I have both set up; if I want alr to use MP, I unset HOMEBREW_PREFIX.

@mosteo
Copy link
Member

mosteo commented Jul 18, 2023

I see, thanks for the thorough explanation. As long as there is a way to override the priority that's hardcoded, I think it's fine.

@mosteo mosteo merged commit fa6c67d into alire-project:master Jul 18, 2023
12 checks passed
@simonjwright simonjwright deleted the macports branch July 18, 2023 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants