/* * Copyright (c) 2018, 2022, 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 * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions.
*/
/** * Test --license-file parameter. Output of the test should be commonlicensetest*.* * package bundle. The output package should provide the same functionality as * the default package and also incorporate license information from * test/jdk/tools/jpackage/resources/license.txt file from OpenJDK repo. * * deb: * * Package should install license file /opt/commonlicensetest/share/doc/copyright * file. * * rpm: * * Package should install license file in * %{_defaultlicensedir}/licensetest-1.0/license.txt file. * * Mac: * * Windows * * Installer should display license text matching contents of the license file * during installation.
*/
if (installDir.equals(Path.of("/")) || installDir.startsWith("/usr")) { // Package is in '/usr' tree return Path.of("/usr/share/doc/", LinuxHelper.getPackageName(cmd), "copyright");
}
privatestaticvoid verifyLicenseFileInstalledRpm(Path licenseFile) throws
IOException {
TKit.assertStringListEquals(Files.readAllLines(LICENSE_FILE),
Files.readAllLines(licenseFile), String.format( "Check contents of package license file [%s] are the same as contents of source license file [%s]",
licenseFile, LICENSE_FILE));
}
List<String> actualLines = Files.readAllLines(licenseFile).stream().dropWhile(
line -> !line.startsWith("License:")).collect(
Collectors.toList()); // Remove leading `License:` followed by the whitespace from the first text line.
actualLines.set(0, actualLines.get(0).split("\\s+", 2)[1]);
TKit.assertNotEquals(0, String.join("\n", actualLines).length(), "Check stripped license text is not empty");
TKit.assertStringListEquals(DEBIAN_COPYRIGT_FILE_STRIPPER.apply(
Files.readAllLines(LICENSE_FILE)), actualLines, String.format( "Check subset of package license file [%s] is a match of the source license file [%s]",
licenseFile, LICENSE_FILE));
}
CustomDebianCopyrightTest withSubstitution(boolean v) {
withSubstitution = v; // Different values just to make easy to figure out from the test log which test was executed. if (v) {
copyright = "Duke (C)";
licenseText = "The quick brown fox\n jumps over the lazy dog";
} else {
copyright = "Java (C)";
licenseText = "How vexingly quick daft zebras jump!";
} returnthis;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.