8247734: [macos] jpackage fails to retrieve signing certificate when there are multiple

Reviewed-by: asemenyuk, almatvee
This commit is contained in:
Andy Herrick 2020-07-17 10:37:28 -04:00
parent 7339cf8f54
commit 59cd79a8f9
7 changed files with 13 additions and 11 deletions

View File

@ -63,8 +63,8 @@ public class MacAppBundler extends AppImageBundler {
String.class,
params -> {
String result = MacBaseInstallerBundler.findKey(
"Developer ID Application: "
+ SIGNING_KEY_USER.fetchFrom(params),
"Developer ID Application: ",
SIGNING_KEY_USER.fetchFrom(params),
SIGNING_KEYCHAIN.fetchFrom(params),
VERBOSE.fetchFrom(params));
if (result != null) {

View File

@ -54,7 +54,7 @@ public class MacAppStoreBundler extends MacBaseInstallerBundler {
String.class,
params -> {
String result = MacBaseInstallerBundler.findKey(
"3rd Party Mac Developer Application: " +
"3rd Party Mac Developer Application: ",
SIGNING_KEY_USER.fetchFrom(params),
SIGNING_KEYCHAIN.fetchFrom(params),
VERBOSE.fetchFrom(params));
@ -78,7 +78,7 @@ public class MacAppStoreBundler extends MacBaseInstallerBundler {
String.class,
params -> {
String result = MacBaseInstallerBundler.findKey(
"3rd Party Mac Developer Installer: " +
"3rd Party Mac Developer Installer: ",
SIGNING_KEY_USER.fetchFrom(params),
SIGNING_KEYCHAIN.fetchFrom(params),
VERBOSE.fetchFrom(params));

View File

@ -151,8 +151,11 @@ public abstract class MacBaseInstallerBundler extends AbstractBundler {
return "INSTALLER";
}
public static String findKey(String key, String keychainName,
public static String findKey(String keyPrefix, String teamName, String keychainName,
boolean verbose) {
String key = (teamName.startsWith(keyPrefix)
|| teamName.startsWith("3rd Party Mac Developer"))
? teamName : (keyPrefix + teamName);
if (Platform.getPlatform() != Platform.MAC) {
return null;
}
@ -183,7 +186,6 @@ public abstract class MacBaseInstallerBundler extends AbstractBundler {
if (m.find()) {
Log.error(MessageFormat.format(I18N.getString(
"error.multiple.certs.found"), key, keychainName));
return null;
}
Log.verbose("Using key '" + matchedKey + "'");
return matchedKey;

View File

@ -103,8 +103,8 @@ public class MacPkgBundler extends MacBaseInstallerBundler {
String.class,
params -> {
String result = MacBaseInstallerBundler.findKey(
"Developer ID Installer: "
+ SIGNING_KEY_USER.fetchFrom(params),
"Developer ID Installer: ",
SIGNING_KEY_USER.fetchFrom(params),
SIGNING_KEYCHAIN.fetchFrom(params),
VERBOSE.fetchFrom(params));
if (result != null) {

View File

@ -42,7 +42,7 @@ error.certificate.expired=Error: Certificate expired {0}
error.no.xcode.signing=Xcode with command line developer tools is required for signing
error.no.xcode.signing.advice=Install Xcode with command line developer tools.
error.cert.not.found=No certificate found matching [{0}] using keychain [{1}]
error.multiple.certs.found=Multiple certificates found matching [{0}] using keychain [{1}]
error.multiple.certs.found=WARNING: Multiple certificates found matching [{0}] using keychain [{1}], using first one
resource.bundle-config-file=Bundle config file
resource.app-info-plist=Application Info.plist
resource.runtime-info-plist=Java Runtime Info.plist

View File

@ -42,7 +42,7 @@ error.certificate.expired=\u30A8\u30E9\u30FC: \u8A3C\u660E\u66F8\u306F{0}\u306B\
error.no.xcode.signing=\u7F72\u540D\u306B\u306F\u3001Xcode\u3068\u30B3\u30DE\u30F3\u30C9\u30E9\u30A4\u30F3\u30FB\u30C7\u30D9\u30ED\u30C3\u30D1\u30FB\u30C4\u30FC\u30EB\u304C\u5FC5\u8981\u3067\u3059
error.no.xcode.signing.advice=Xcode\u3068\u30B3\u30DE\u30F3\u30C9\u30E9\u30A4\u30F3\u30FB\u30C7\u30D9\u30ED\u30C3\u30D1\u30FB\u30C4\u30FC\u30EB\u3092\u30A4\u30F3\u30B9\u30C8\u30FC\u30EB\u3057\u3066\u304F\u3060\u3055\u3044\u3002
error.cert.not.found=\u30AD\u30FC\u30C1\u30A7\u30FC\u30F3[{1}]\u3092\u4F7F\u7528\u3059\u308B[{0}]\u3068\u4E00\u81F4\u3059\u308B\u8A3C\u660E\u66F8\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093
error.multiple.certs.found=\u30AD\u30FC\u30C1\u30A7\u30FC\u30F3[{1}]\u3092\u4F7F\u7528\u3059\u308B[{0}]\u3068\u4E00\u81F4\u3059\u308B\u8907\u6570\u306E\u8A3C\u660E\u66F8\u304C\u898B\u3064\u304B\u308A\u307E\u3057\u305F
error.multiple.certs.found=WARNING: Multiple certificates found matching [{0}] using keychain [{1}], using first one
resource.bundle-config-file=\u30D0\u30F3\u30C9\u30EB\u69CB\u6210\u30D5\u30A1\u30A4\u30EB
resource.app-info-plist=\u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3\u306EInfo.plist
resource.runtime-info-plist=Java\u30E9\u30F3\u30BF\u30A4\u30E0\u306EInfo.plist

View File

@ -42,7 +42,7 @@ error.certificate.expired=\u9519\u8BEF: \u8BC1\u4E66\u5DF2\u5931\u6548 {0}
error.no.xcode.signing=\u9700\u8981\u4F7F\u7528\u5E26\u547D\u4EE4\u884C\u5F00\u53D1\u4EBA\u5458\u5DE5\u5177\u7684 Xcode \u8FDB\u884C\u7B7E\u540D
error.no.xcode.signing.advice=\u5B89\u88C5\u5E26\u547D\u4EE4\u884C\u5F00\u53D1\u4EBA\u5458\u5DE5\u5177\u7684 Xcode\u3002
error.cert.not.found=\u4F7F\u7528\u5BC6\u94A5\u94FE [{1}] \u627E\u4E0D\u5230\u4E0E [{0}] \u5339\u914D\u7684\u8BC1\u4E66
error.multiple.certs.found=\u4F7F\u7528\u5BC6\u94A5\u94FE [{1}] \u627E\u5230\u4E0E [{0}] \u5339\u914D\u7684\u591A\u4E2A\u8BC1\u4E66
error.multiple.certs.found=WARNING: Multiple certificates found matching [{0}] using keychain [{1}], using first one
resource.bundle-config-file=\u5305\u914D\u7F6E\u6587\u4EF6
resource.app-info-plist=\u5E94\u7528\u7A0B\u5E8F Info.plist
resource.runtime-info-plist=Java \u8FD0\u884C\u65F6 Info.plist