[jdk19] RFR: 8289030: [macos] app image signature invalid when creating DMG or PKG [v2]
Alexey Semenyuk
asemenyuk at openjdk.org
Thu Jul 7 19:56:46 UTC 2022
On Thu, 7 Jul 2022 19:30:07 GMT, Alexander Matveev <almatvee at openjdk.org> wrote:
>> src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacBaseInstallerBundler.java line 171:
>>
>>> 169: Files.deleteIfExists(AppImageFile.getPathInAppImage(appDir));
>>> 170: }
>>> 171:
>>
>> I think there is no need to modify AbstractAppImageBuilder.java, and AppImageBundler.java.
>> It is sufficient to modify the condition controlling the creation of `.package` file:
>>
>> if (predefinedImage == null || (!StandardBundlerParam.isRuntimeInstaller(params) && !AppImageFile.load(predefinedImage).isSigned())) {
>> new PackageFile(APP_NAME.fetchFrom(params)).save(
>> ApplicationLayout.macAppImage().resolveAt(appDir));
>> Files.deleteIfExists(AppImageFile.getPathInAppImage(appDir));
>> }
>>
>> Besides `.package` file logically doesn't belong to app image, it belongs to the installed application, so it must not be referenced from the classes creating app images.
>
> We need to add `.package` file during app image creation, since we need to sign it. With your proposed change we will add `.package` file to already signed app image.
Oh, right.
Anyways let's keep `.package`-related stuff away from AbstractAppImageBuilder.java, and AppImageBundler.java.
I'd move `.package`-related logic from AbstractAppImageBuilder to MacAppImageBuilder and change
public MacAppBundler() {
setAppImageSupplier(MacAppImageBuilder::new);
setParamsValidator(MacAppBundler::doValidate);
}
to something like this
public MacAppBundler() {
public MacAppBundler() {
setAppImageSupplier(imageOutDir -> {
return new MacAppImageBuilder(imageOutDir, isDependentTask());
});
setParamsValidator(MacAppBundler::doValidate);
}
Need to add `AppImageBundler.sDependentTask()` method and change signature if MacAppImageBuilder ctor from `MacAppImageBuilder(Path imageOutDir)` to `MacAppImageBuilder(Path imageOutDir, boolean withPackageFile)`
-------------
PR: https://git.openjdk.org/jdk19/pull/89
More information about the core-libs-dev
mailing list