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

openjdk11-graalvm: clean up old files before installation, install files under ${prefix} #20036

Conversation

breun
Copy link
Member

@breun breun commented Aug 20, 2023

Description

  • Clean up old files before installation. This should fix https://trac.macports.org/ticket/67935.
  • Install all actual files under ${prefix}, only create a symlink under /Library/Java/JavaVirtualMachines.
Type(s)
  • bugfix
  • enhancement
Tested on

macOS 13.5.1 22G90 arm64
Xcode 14.3.1 14E300c

Verification

Have you

  • followed our Commit Message Guidelines?
  • squashed and minimized your commits?
  • checked that there aren't other open pull requests for the same change?
  • referenced existing tickets on Trac with full URL?
  • checked your Portfile with port lint --nitpick?
  • tried existing tests with sudo port test?
  • tried a full install with sudo port -vst install?
  • tested basic functionality of all binary files?
  • checked that the Portfile's most important variants haven't been broken?

@mascguy
Copy link
Member

mascguy commented Aug 20, 2023

It looks like the native image subport is failing, due to the following:

/Library/Java/JavaVirtualMachines/openjdk11-graalvm/Contents/Home/bin/gu: command not found

@breun
Copy link
Member Author

breun commented Aug 20, 2023

Hm, I don't really understand. openjdk11-graalvm installs /opt/local/Library/Java/JavaVirtualMachines/openjdk11-graalvm/Contents/Home/bin/gu and symlinks /Library/Java/JavaVirtualMachines/openjdk11-graalvm to /opt/local/Library/Java/JavaVirtualMachines/openjdk11-graalvm, so /Library/Java/JavaVirtualMachines/openjdk11-graalvm//Contents/Home/bin/gu should be there... And it is on my machine.

@breun
Copy link
Member Author

breun commented Aug 20, 2023

Or should gu be called as ${prefix}${jdk}/Contents/Home/bin/gu in this context without relying on the symlink?

@breun
Copy link
Member Author

breun commented Aug 20, 2023

Adding ${prefix} seems to help indeed. I'll fix up the PR.

@mascguy

This comment was marked as outdated.

@breun breun force-pushed the openjdk11-graalvm-cleanup-and-install-under-prefix branch from 187aed3 to 71e874f Compare August 20, 2023 15:14
@breun
Copy link
Member Author

breun commented Aug 20, 2023

It looks like you're installing ARM binary for Intel, and vice-versa.

Hm, no that looks fine to me actually.

@mascguy
Copy link
Member

mascguy commented Aug 20, 2023

It looks like you're installing ARM binary for Intel, and vice-versa.

Hm, no that looks fine to me actually.

Yep, my eyes are failing me again! Lol

I misread "amd64" as "arm64." Never Mind...

@breun
Copy link
Member Author

breun commented Aug 20, 2023

All checks passed now.

@mascguy mascguy merged commit 165df57 into macports:master Aug 20, 2023
3 checks passed
@breun breun deleted the openjdk11-graalvm-cleanup-and-install-under-prefix branch August 20, 2023 15:21
@breun
Copy link
Member Author

breun commented Aug 20, 2023

@mascguy I think we may have introduced a new issue with the pre-install block.

After installing sudo port install openjdk11-graalvm, everything seems fine. ls -l /Library/Java/JavaVirtualMachines shows that /Library/Java/JavaVirtualMachines/openjdk11-graalvm is a symlink to /opt/local/Library/Java/JavaVirtualMachines/openjdk11-graalvm.

But when you subsequently install openjdk11-graalvm-native-image, /Library/Java/JavaVirtualMachines/openjdk11-graalvm is gone. I guess pre-install also gets executed for the openjdk11-graalvm-native-image subport.

It looks like stuff like variants are also applied to the subport, which also shouldn't be happening. How can I make sure that particular sections only get applied for the main port?

@mascguy
Copy link
Member

mascguy commented Aug 20, 2023

@mascguy I think we may have introduced a new issue with the pre-install block.

After installing sudo port install openjdk11-graalvm, everything seems fine. ls -l /Library/Java/JavaVirtualMachines shows that /Library/Java/JavaVirtualMachines/openjdk11-graalvm is a symlink to /opt/local/Library/Java/JavaVirtualMachines/openjdk11-graalvm.

But when you subsequently install openjdk11-graalvm-native-image, /Library/Java/JavaVirtualMachines/openjdk11-graalvm is gone. I guess pre-install also gets executed for the openjdk11-graalvm-native-image subport.

It looks like stuff like variants are also applied to the subport, which also shouldn't be happening. How can I make sure that particular sections only get applied for the main port?

Ensure your pre-install block is only defined for your main port, like so:

if { ${subport} eq ${name} } {
    pre-install {
        [...]
    }
}

@mascguy
Copy link
Member

mascguy commented Aug 20, 2023

Ensure your pre-install block is only defined for your main port, like so:

if { ${subport} eq ${name} } {
    pre-install {
        [...]
    }
}

And also add your variants, etc, in that block [if they're only desired for the main port].

@breun
Copy link
Member Author

breun commented Aug 20, 2023

Check, new PR for that: #20045

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants