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

8266179: [macos] jpackage should specify architecture for produced pkg files #3807

Closed
wants to merge 4 commits into from

Conversation

@sashamatveev
Copy link
Member

@sashamatveev sashamatveev commented Apr 30, 2021

jpackage should specify architecture for produced PKG files via hostArchitectures="x86_x64 or arm64". aarch64 installer will be installable on x64 without specifying hostArchitectures which is not correct and if install on arm Mac it will request Rosetta 2. With proposed fix by setting hostArchitectures="x86_x64" if installer contains x64 binaries, it will be installable on x64 Mac and will require Rosetta 2 on arm Mac. hostArchitectures will be set to arm64 if installer contain aarch64 binaries and will gave error when run on x64 Mac and will be installable on arm Mac without triggering installation of Rosetta 2.


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-8266179: [macos] jpackage should specify architecture for produced pkg files

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/3807/head:pull/3807
$ git checkout pull/3807

Update a local copy of the PR:
$ git checkout pull/3807
$ git pull https://git.openjdk.java.net/jdk pull/3807/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 3807

View PR using the GUI difftool:
$ git pr show -t 3807

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/3807.diff

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Apr 30, 2021

👋 Welcome back almatvee! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot added the rfr label Apr 30, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Apr 30, 2021

@sashamatveev The following label will be automatically applied to this pull request:

  • core-libs

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the core-libs label Apr 30, 2021
@mlbridge
Copy link

@mlbridge mlbridge bot commented Apr 30, 2021

Copy link
Member

@kevinrushforth kevinrushforth left a comment

The fix looks good. Would it be feasible to include an automated test for this?

@openjdk
Copy link

@openjdk openjdk bot commented Apr 30, 2021

@sashamatveev This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8266179: [macos] jpackage should specify architecture for produced pkg files

Reviewed-by: herrick, kcr, asemenyuk

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 118 new commits pushed to the master branch:

  • aa90df6: 8266187: Memory leak in appendBootClassPath()
  • b651904: 8266438: Compile::remove_useless_nodes does not remove opaque nodes
  • 141cc2f: 8261527: Record page size used for underlying mapping in ReservedSpace
  • 8e071c4: 8265784: [C2] Hoisting of DecodeN leaves MachTemp inputs behind
  • ce1bc9d: 8266432: ZGC: GC allocation stalls can trigger deadlocks
  • 30ccd80: 8264950: Set opaque for JTooltip in config file of NimbusLookAndFeel
  • cfdf4a7: 8266449: cleanup jtreg tags in compiler/intrinsics/sha/cli tests
  • 3544a9d: 8266391: Replace use of reflection in jdk.internal.platform.Metrics
  • 020236c: 8264786: [macos] All Swing/AWT apps cause Allow Notifications prompt to appear when app is launched
  • 45760d4: 8266320: (bf) ReadOnlyBufferException in heap buffer put(String,int,int) should not be conditional
  • ... and 108 more: https://git.openjdk.java.net/jdk/compare/7f4a9f68bfd6fd002f79ac989155550db0bcdd20...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready label Apr 30, 2021
@sashamatveev
Copy link
Member Author

@sashamatveev sashamatveev commented May 1, 2021

Added HostArchPkgTest test to verify hostArchitectures attribute.

}
}

public static void main(String[] args) throws Exception {

This comment has been minimized.

@alexeysemenyukoracle

alexeysemenyukoracle May 3, 2021
Member

Please don't use direct TKit.run() call. Use jdk.jpackage.test.Annotations.Test annotation for test method. You can use SimplePackageTest jtreg test as an example

This comment has been minimized.

@sashamatveev

sashamatveev May 3, 2021
Author Member

I will fix it. Do we have a bug or I can file one to fix other tests? We have several tests such as SigningPackageTest which uses TKit.run() call and I just copy paste it.

This comment has been minimized.

@alexeysemenyukoracle

alexeysemenyukoracle May 3, 2021
Member

No, we don't have a CR to track replacement of direct TKit.run() calls. Please feel free to file one.

public class HostArchPkgTest {

private static void verifyHostArch(JPackageCommand cmd) throws Exception {
Path distributionFile = cmd.unpackedPackageDirectory()

This comment has been minimized.

@alexeysemenyukoracle

alexeysemenyukoracle May 3, 2021
Member

I think cmd.pathToUnpackedPackageFile("/") would be the equivalent to cmd.unpackedPackageDirectory(). If it is, there would be no need for changes to JPackageCommand.

This comment has been minimized.

@sashamatveev

sashamatveev May 3, 2021
Author Member

Fixed.

private static void verifyHostArch(JPackageCommand cmd) throws Exception {
Path distributionFile = cmd.unpackedPackageDirectory()
.toAbsolutePath()
.getParent()

This comment has been minimized.

@alexeysemenyukoracle

alexeysemenyukoracle May 3, 2021
Member

Why .getParent() is needed here?

This comment has been minimized.

@sashamatveev

sashamatveev May 3, 2021
Author Member

Unpacking pkg is two stage process. First we unpack it to unpacked-pkg/data which contains Distribution file, pkg background images and tar archive with app itself. Then we unpack app tar archive to unpacked-pkg/unpacked. Test needs to check unpacked-pkg/data/Distribution and cmd.pathToUnpackedPackageFile("/") returns path to unpacked-pkg/unpacked. Thus getParent() is used to move up.

This comment has been minimized.

@alexeysemenyukoracle

alexeysemenyukoracle May 3, 2021
Member

Understood. Thank you for explanation!

@openjdk openjdk bot added ready and removed ready labels May 3, 2021
new PackageTest()
.excludeTypes(PackageType.MAC_DMG) // Not valid case
.configureHelloApp()
.forTypes(PackageType.MAC_PKG)
.addInstallVerifier(HostArchPkgTest::verifyHostArch)
.run();
Comment on lines 88 to 93

This comment has been minimized.

@alexeysemenyukoracle

alexeysemenyukoracle May 3, 2021
Member

The test is applicable only to the scenario when .pkg installer is unpacked and not when it is installed. So PackageTest.run() is not quite a good fit for this execution scenario as it depends on the value of jpackage.test.action system property (its default value is indeed to create and unpack installer, but can be overriden). The better option would be to use PackageTest.run() with explicit list of actions the test should perform. Suggested fix:

new PackageTest()
                .forTypes(PackageType.MAC_PKG)
                .configureHelloApp()
                .addInstallVerifier(HostArchPkgTest::verifyHostArch)
                .run(PackageTest.Action.CREATE_AND_UNPACK);

This comment has been minimized.

@alexeysemenyukoracle

alexeysemenyukoracle May 3, 2021
Member

Sorry for the inconvenience, I didn't include this comment in my initial review.

@kevinrushforth
Copy link
Member

@kevinrushforth kevinrushforth commented May 3, 2021

I presume you've done a CI test build on machines of both architectures?

@sashamatveev
Copy link
Member Author

@sashamatveev sashamatveev commented May 4, 2021

Yes, it was tested on both x64 and arm.

@sashamatveev
Copy link
Member Author

@sashamatveev sashamatveev commented May 4, 2021

/integrate

@openjdk openjdk bot closed this May 4, 2021
@openjdk openjdk bot added integrated and removed ready rfr labels May 4, 2021
@openjdk
Copy link

@openjdk openjdk bot commented May 4, 2021

@sashamatveev Since your change was applied there have been 129 commits pushed to the master branch:

  • d282799: 8255566: Add size validation when parsing values from VersionProps
  • 61365d5: 8266465: Add wildcard to JTwork/JTreport exclude in jib-profiles.js
  • f00b70e: 8266527: RandomTestCoverage.java failing due to API removal
  • c53dee7: 8266227: Fix help text for --mac-signing-keychain
  • 80323b7: 8261169: Upgrade HarfBuzz to the latest 2.8.0
  • 9c4efdd: 8263124: Missed initialization of baselineY in sun.font.StrikeMetrics
  • 4e96b31: 8265989: System property for the native character encoding name
  • 8b37d48: 8255493: Support for pre-generated java.lang.invoke classes in CDS dynamic archive
  • 770dfc1: 8265279: Remove unused RandomGeneratorFactory.all(Class category)
  • ee5bba0: 8265767: compiler/eliminateAutobox/TestIntBoxing.java crashes on arm32 after 8264649 in debug VMs
  • ... and 119 more: https://git.openjdk.java.net/jdk/compare/7f4a9f68bfd6fd002f79ac989155550db0bcdd20...master

Your commit was automatically rebased without conflicts.

Pushed as commit 2c53654.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

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