Skip to content
Permalink
Browse files
8266603: jpackage: Add missing copyright file in Java runtime .deb in…
…stallers

Reviewed-by: almatvee, herrick
  • Loading branch information
Alexey Semenyuk committed May 10, 2021
1 parent c494efc commit c8b744743bd54a00a4f7bf1e852d454fcd942abd
Showing with 26 additions and 3 deletions.
  1. +4 −2 src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxDebBundler.java
  2. +22 −1 test/jdk/tools/jpackage/share/RuntimePackageTest.java
@@ -46,7 +46,6 @@
import java.util.stream.Collectors;
import java.util.stream.Stream;
import static jdk.jpackage.internal.OverridableResource.createResource;
import static jdk.jpackage.internal.StandardBundlerParam.APP_NAME;
import static jdk.jpackage.internal.StandardBundlerParam.INSTALLER_NAME;
import static jdk.jpackage.internal.StandardBundlerParam.VERSION;
import static jdk.jpackage.internal.StandardBundlerParam.RELEASE;
@@ -412,7 +411,10 @@ private void prepareProjectConfig(Map<String, String> data,
configDir.resolve("postrm"),
"resource.deb-postrm-script").setExecutable());

if (!StandardBundlerParam.isRuntimeInstaller(params)) {
final String installDir = LINUX_INSTALL_DIR.fetchFrom(params);

if (!StandardBundlerParam.isRuntimeInstaller(params)
|| (isInstallDirInUsrTree(installDir) || installDir.startsWith("/usr/"))) {
debianFiles.add(new DebianFile(
getConfig_CopyrightFile(params),
"resource.copyright-file"));
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 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
@@ -27,12 +27,16 @@
import java.util.HashSet;
import java.util.Optional;
import java.util.Set;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import jdk.jpackage.test.PackageType;
import jdk.jpackage.test.PackageTest;
import jdk.jpackage.test.JPackageCommand;
import jdk.jpackage.test.TKit;
import jdk.jpackage.test.Annotations.Test;
import jdk.jpackage.test.LinuxHelper;
import static jdk.jpackage.test.TKit.assertTrue;
import static jdk.jpackage.test.TKit.assertFalse;

/**
* Test --runtime-image parameter.
@@ -121,6 +125,23 @@ private static PackageTest init(Set<PackageType> types) {

assertFileListEmpty(srcRuntime, "Missing");
assertFileListEmpty(dstRuntime, "Unexpected");
})
.forTypes(PackageType.LINUX_DEB)
.addInstallVerifier(cmd -> {
String installDir = cmd.getArgumentValue("--install-dir", () -> "/opt");
Path copyright = Path.of("/usr/share/doc",
LinuxHelper.getPackageName(cmd), "copyright");
boolean withCopyright = LinuxHelper.getPackageFiles(cmd).anyMatch(
Predicate.isEqual(copyright));
if (installDir.startsWith("/usr/") || installDir.equals("/usr")) {
assertTrue(withCopyright, String.format(
"Check the package delivers [%s] copyright file",
copyright));
} else {
assertFalse(withCopyright, String.format(
"Check the package doesn't deliver [%s] copyright file",
copyright));
}
});
}

1 comment on commit c8b7447

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on c8b7447 May 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.