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

8267403: tools/jpackage/share/FileAssociationsTest.java#id0 failed with "Error: Bundler "Mac PKG Package" (pkg) failed to produce a package" #4139

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -451,7 +451,7 @@ private Path createPKG(Map<String, ? super Object> params,
"--analyze",
cpl.toAbsolutePath().toString());

IOUtils.exec(pb);
IOUtils.exec(pb, false, null, true, Executor.INFINITE_TIMEOUT);

patchCPLFile(cpl);

@@ -467,7 +467,7 @@ private Path createPKG(Map<String, ? super Object> params,
"--identifier",
MAC_CF_BUNDLE_IDENTIFIER.fetchFrom(params),
appPKG.toAbsolutePath().toString());
IOUtils.exec(pb);
IOUtils.exec(pb, false, null, true, Executor.INFINITE_TIMEOUT);
} else {
preparePackageScripts(params);
pb = new ProcessBuilder("/usr/bin/pkgbuild",
@@ -483,7 +483,7 @@ private Path createPKG(Map<String, ? super Object> params,
"--identifier",
MAC_CF_BUNDLE_IDENTIFIER.fetchFrom(params),
appPKG.toAbsolutePath().toString());
IOUtils.exec(pb);
IOUtils.exec(pb, false, null, true, Executor.INFINITE_TIMEOUT);
}

// build final package
@@ -541,7 +541,7 @@ private Path createPKG(Map<String, ? super Object> params,
commandLine.add(finalPKG.toAbsolutePath().toString());

pb = new ProcessBuilder(commandLine);
IOUtils.exec(pb);
IOUtils.exec(pb, false, null, true, Executor.INFINITE_TIMEOUT);

return finalPKG;
} catch (Exception ignored) {
Original file line number Diff line number Diff line change
@@ -33,7 +33,6 @@
import java.util.concurrent.TimeUnit;
import java.util.function.Consumer;
import java.util.function.Supplier;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public final class Executor {
@@ -182,7 +181,7 @@ int execute() throws IOException {
code = p.waitFor();
}
if (!quietCommand) {
Log.verbose(pb.command(), getOutput(), code);
Log.verbose(pb.command(), getOutput(), code, IOUtils.getPID(p));
}
return code;
} catch (InterruptedException ex) {
15 changes: 13 additions & 2 deletions src/jdk.jpackage/share/classes/jdk/jpackage/internal/IOUtils.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -243,7 +243,7 @@ public static int getProcessOutput(List<String> result, String... args)
t.start();

int ret = p.waitFor();
Log.verbose(pb.command(), list, ret);
Log.verbose(pb.command(), list, ret, IOUtils.getPID(p));

result.clear();
result.addAll(list);
@@ -335,6 +335,17 @@ public static Path getFileName(Path p) {
return filename;
}

public static long getPID(Process p) {
try {
return p.pid();
} catch (UnsupportedOperationException ex) {
Log.verbose(ex); // Just log exception and ignore it. This method
// is used for verbose output, so not a problem
// if unsupported.
return -1;
}
}

private static class PrettyPrintHandler implements InvocationHandler {

PrettyPrintHandler(XMLStreamWriter target) {
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -192,7 +192,7 @@ private static void runJLink(Path output, List<Path> modulePath,
String jlinkOut = writer.toString();

args.add(0, "jlink");
Log.verbose(args, List.of(jlinkOut), retVal);
Log.verbose(args, List.of(jlinkOut), retVal, -1);


if (retVal != 0) {
15 changes: 10 additions & 5 deletions src/jdk.jpackage/share/classes/jdk/jpackage/internal/Log.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -106,9 +106,13 @@ public void verbose(String msg) {
}

public void verbose(List<String> strings,
List<String> output, int returnCode) {
List<String> output, int returnCode, long pid) {
if (verbose) {
StringBuffer sb = new StringBuffer("Command:\n ");
StringBuffer sb = new StringBuffer();
sb.append("Command [PID: ");
sb.append(pid);
sb.append("]:\n ");

for (String s : strings) {
sb.append(" " + s);
}
@@ -174,7 +178,8 @@ public static void verbose(Throwable t) {
instance.get().verbose(t);
}

public static void verbose(List<String> strings, List<String> out, int ret) {
instance.get().verbose(strings, out, ret);
public static void verbose(List<String> strings, List<String> out,
int ret, long pid) {
instance.get().verbose(strings, out, ret, pid);
}
}