RFR: 8356047: [macos] jpackage produces confusing post- and pre- installation PKG scripts [v7]

Alexey Semenyuk asemenyuk at openjdk.org
Mon Oct 6 19:15:57 UTC 2025


On Fri, 3 Oct 2025 23:50:07 GMT, Alexander Matveev <almatvee at openjdk.org> wrote:

>> - Removed pre- and post- installation PKG scripts.
>> - This code is not needed and PKG should create destination folder and set correct permissions.
>> - If for some reason it is not happens, permissions issues should be fixed when jpackage prepares application bundle. PKG should keep all permissions unchanged when packaging and installing bundle.
>> - Users will have ability to provide pre- and post- installation PKG scripts if needed.
>> - `INSTALL_LOCATION` and `APP_LOCATION` substitution is removed, since `$2` argument in scripts is same as `INSTALL_LOCATION`.
>> - I think code in these scripts are some legacy leftovers.
>> - Added test to test that pre- and post-scripts are no longer exist and can be added via `--resource-dir`.
>
> Alexander Matveev has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8356047: [macos] jpackage produces confusing post- and pre- installation PKG scripts [v5]

test/jdk/tools/jpackage/macosx/PkgScriptsTest.java line 62:

> 60:     @Parameter({"TRUE", "FALSE"})
> 61:     @Parameter({"FALSE", "TRUE"})
> 62:     @Parameter({"FALSE", "FALSE"})

Why do we want to run the test without a custom installation script?

test/jdk/tools/jpackage/macosx/PkgScriptsTest.java line 80:

> 78:                 .forTypes(PackageType.MAC_PKG)
> 79:                 .configureHelloApp()
> 80:                 .addInitializer(cmd -> {

I'd add `.addInitializer(JPackageCommand::setFakeRuntime)` call to save time building and packaging the full Java runtime.

test/jdk/tools/jpackage/macosx/PkgScriptsTest.java line 86:

> 84:                 })
> 85:                 .addInstallVerifier(PkgScriptsTest::verifyPKG)
> 86:                 .setExpectedExitCode(0)

This call is redundant

test/jdk/tools/jpackage/macosx/PkgScriptsTest.java line 99:

> 97:         } catch (IOException ex) {
> 98:             throw new UncheckedIOException(ex);
> 99:         }

Can be simplified down to:

        TKit.createTextFile(scriptOutputFile, Stream.of(
                "#!/usr/bin/env sh",
                String.format("touch "%s"", scriptOutputFile),
                "exit 0"
        ));


With the benefit of adding the contents of the script file to the test log

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/25510#discussion_r2408066556
PR Review Comment: https://git.openjdk.org/jdk/pull/25510#discussion_r2408062858
PR Review Comment: https://git.openjdk.org/jdk/pull/25510#discussion_r2408055617
PR Review Comment: https://git.openjdk.org/jdk/pull/25510#discussion_r2408049612


More information about the core-libs-dev mailing list