JDK-8215447 : Investigate if current implementation of --license-file is correct for RPM packages
  • Type: Bug
  • Component: tools
  • Sub-Component: jpackage
  • Affected Version: internal
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2018-12-15
  • Updated: 2019-08-14
  • Resolved: 2019-08-14
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
internalFixed
Related Reports
Relates :  
Relates :  
Description
Same as JDK-8215381, but for RPM. As part of JDK-8214495 I implemented copying provided license file to app folder of image and adding it to %license section.
Comments
Review: http://cr.openjdk.java.net/~asemenyuk/8215447/webrev.00/
13-08-2019

There are two command line options to configure license information for RPM packaging: --linux-rpm-license-type and --license-file. Value of --linux-rpm-license-type command line option configures "License: " section of RPM spec. Value of --license-file command line option specifies a license file to be added to the package. License file is a sort of documentation file but it will be installed even in user selects an option to install the package without documentation. There is no 100% reliable way to detect what file(s) is(are) a license file(s) inspecting binary package. There are heuristics only, like file name (COPYRIGHT or LICENSE) or installation location (/usr/share/licenses). To query license information from the package one should use rpm -qp --queryformat '%{license}' command. This command reads value of "License:" section from package spec. This means that only --linux-rpm-license-type jpackage command line option controls license information. Usually value of "License:" section is an acronym of one of well known licenses, like GPLv2+, BSD. List of acronyms - https://fedoraproject.org/wiki/Licensing:Main?rd=Licensing#SoftwareLicenses. --linux-rpm-license-type is the primary option to set license information. --license-file makes little sense in case of RPM packaging. Also installing license file in application installation directory is not correct. The root folder for license files should be referenced in source rpm spec with %{_defaultlicensedir} macro. That said the suggested fix should be: - add javadoc comments about the roles of --linux-rpm-license-type and --license-file to LinuxRpmBundler.java; - fix RPM packaging to install license file in proper location; - add verification to LicenseBase.java that license file will be installed into the correct location; get the list of files of RPM package and make sure the expected file will be installed in %{_defaultlicensedir} directory; - add verification that RPM package includes expected license type in LicenseTypeBase.java; use rpm -qp --queryformat '%{license}' command.
08-08-2019

--- rpm -qp --queryformat '%{license}\n' rpm_file --- command will print license of the given rpm file. However seems like license is not properly set in rpm-s produced by jpackage: --- [asemenyu@spacewalk ~]$ rpm -qp --queryformat '%{license}\n' test_jpackage/licensetest-1.0-1.x86_64.rpm Unknown --- More over, license file is put into "app" subdirectory of installation directory. Which is not the right location. There is _defaultlicensedir rpm macro that holds the system directory where packages should store their licenses: --- [asemenyu@spacewalk ~]$ rpm --eval '%{_defaultlicensedir}' /usr/share/licenses ---
08-08-2019