Bug 12057 - Package license wrong in RPM for ${PN} when ${LICENSE_${PN}} != ${LICENSE}
Summary: Package license wrong in RPM for ${PN} when ${LICENSE_${PN}} != ${LICENSE}
Status: RESOLVED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: core (show other bugs)
Version: 2.4
Hardware: x86 Multiple
: Medium+ normal
Target Milestone: 2.5 M2
Assignee: Ross Burton
QA Contact:
URL:
Whiteboard: Backport 2.4.2
Depends on:
Blocks:
 
Reported: 2017-09-06 10:39 UTC by Peter Kjellerstedt
Modified: 2018-02-05 14:16 UTC (History)
2 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: Don't know


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Kjellerstedt 2017-09-06 10:39:33 UTC
For a recipe with LICENSE containing multiple licenses and then individual packages having their own LICENSE_ settings, the license information in the RPM for ${PN} is ${LICENSE}, not ${LICENSE_${PN}} as it should be. It works correctly for all other packages.

To reproduce:

1) Create "recipes-support/licensetest/licensetest_1.0.bb":

LICENSE = "GPL-3.0 & LGPL-2.1"
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/GPL-3.0;md5=c79ff39f19dfec6d293b95dea7b07891 \
                    file://${COREBASE}/meta/files/common-licenses/LGPL-2.1;md5=1a6d268fd218675ffea8be556788b780"

inherit allarch

do_install() {
    mkdir -p ${D}${bindir} ${D}${libdir}
    touch ${D}${bindir}/licensetest
    touch ${D}${libdir}/licensetest.so.1.0.0
}


PACKAGE_BEFORE_PN += "${PN}-libs"

LICENSE_${PN} = "GPL-3.0"
LICENSE_${PN}-dbg = "GPL-3.0"
LICENSE_${PN}-dev = "GPL-3.0"
LICENSE_${PN}-libs = "LGPL-2.1"

FILES_${PN}-libs = "${libdir}"

2) Make sure package_rpm is included in PACKAGE_CLASSES, e.g. by adding 

PACKAGE_CLASSES += "package_rpm"

to "conf/local.conf".

3) Build licensetest: 

bitbake licensetest

4) Extract license information from the built packages:

rpm -qilp tmp/deploy/rpm/*/licensetest*|grep 'Name\|License'

This gives:

Name        : licensetest
License     : GPL-3.0 & LGPL-2.1
Name        : licensetest-dbg
License     : GPL-3.0
Name        : licensetest-dev
License     : GPL-3.0
Name        : licensetest-libs
License     : LGPL-2.1

and as can be seen, the licenses are correct for licensetest-dbg, licensetest-dev and licensetest-libs, but wrong for licensetest.
Comment 1 Ross Burton 2018-01-22 14:26:04 UTC
$ dpkg -I licensetest_1.0-r0_all.ipk|grep License
 License: GPL-3.0

$ rpm -qilp licensetest-1.0-r0.noarch.rpm |grep License
License     : GPL-3.0 & LGPL-2.1

So it's a package_rpm thing.
Comment 2 Ross Burton 2018-01-22 15:44:41 UTC
$ rpm -qilp *|grep 'Name\|License'
Name        : licensetest
License     : GPL-3.0
Name        : licensetest-dbg
License     : GPL-3.0
Name        : licensetest-dev
License     : GPL-3.0
Name        : licensetest-libs
License     : LGPL-2.1

Patch (package_rpm: correctly handle LICENSE_${PN}) is on the list now.
Comment 3 Ross Burton 2018-02-05 14:16:34 UTC
Fixed in oe-core 42e0de37d18f072dc5dcf5dc45cb441e4c2110d8.