Message ID | 20180122154442.23769-1-ross.burton@intel.com |
---|---|
State | Accepted |
Commit | 42e0de37d18f072dc5dcf5dc45cb441e4c2110d8 |
Headers | show |
Series | package_rpm: correctly handle LICENSE_${PN} | expand |
On 1/22/18 9:44 AM, Ross Burton wrote: > RPM spec files don't distinguish between spec-level license and the primary > package license, so always output the License for every package (defaulting to > the recipe-wide license) and use LICENSE_${PN} if set for the primary package. > > As the primary use of package_rpm is to generate built packages, this fixes the > license fields in the generated packages. > > [ YOCTO #12057 ] > > Signed-off-by: Ross Burton <ross.burton@intel.com> > --- > meta/classes/package_rpm.bbclass | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/meta/classes/package_rpm.bbclass b/meta/classes/package_rpm.bbclass > index b08608c8466..3cbbd1eb537 100644 > --- a/meta/classes/package_rpm.bbclass > +++ b/meta/classes/package_rpm.bbclass > @@ -382,6 +382,7 @@ python write_specfile () { For the specific problem reported, this is correct. However, it has an unintended side effect. When the archiver is enabled (with SRPM support), it uses the same function to generate the SRPM files. This will result in the SRPM not having the 'correct' "source code" license, but instead will end up having the license of the first package. At a minimum, we should detect this case and warn someone.. I.e. > > # Gather special src/first package data > if srcname == splitname: if d.getVarFlag('ARCHIVER_MODE', 'srpm') == '1' and \ bb.data.inherits_class('archiver', d) and \ srclicense != splitlicense: bb.warn("The SRPM produced may not have the correct overall source license in the LICENSE tag. This is due to the LICENSE for the primary package and SRPM conflicting.) > + srclicense = splitlicense > srcrdepends = splitrdepends > srcrrecommends = splitrrecommends > srcrsuggests = splitrsuggests An alternative (i -really- do not like) is to name the overall first entry as something like: ${PN}-archiver (or src, srpm, ... etc ...) Then in the later section add ${PN} as the first %package. I do suspect this will break some people's validation scripting though. So there does not appear to be a clear answer how to deal with this. (The behavior unfortunately does not appear to be allowed in upstream RPM.) > @@ -421,8 +422,7 @@ python write_specfile () { This hunk is absolutely correct in all cases. > spec_preamble_bottom.append('Release: %s' % splitrelease) > if srcepoch != splitepoch: > spec_preamble_bottom.append('Epoch: %s' % splitepoch) > - if srclicense != splitlicense: > - spec_preamble_bottom.append('License: %s' % splitlicense) > + spec_preamble_bottom.append('License: %s' % splitlicense) > spec_preamble_bottom.append('Group: %s' % splitsection) > > if srccustomtagschunk != splitcustomtagschunk: > -- _______________________________________________ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
On 22 January 2018 at 16:32, Mark Hatle <mark.hatle@windriver.com> wrote: > An alternative (i -really- do not like) is to name the overall first entry > as > something like: > I agree that's not a realistic alternative. I'll send a V2 with the warning added. Thanks, Ross <div dir="ltr">On 22 January 2018 at 16:32, Mark Hatle <span dir="ltr"><<a href="mailto:mark.hatle@windriver.com" target="_blank">mark.hatle@windriver.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">An alternative (i -really- do not like) is to name the overall first entry as<br> something like:<br></blockquote><div><br></div><div>I agree that's not a realistic alternative. I'll send a V2 with the warning added.</div><div><br></div><div>Thanks,</div><div>Ross</div></div></div></div> -- _______________________________________________ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
diff --git a/meta/classes/package_rpm.bbclass b/meta/classes/package_rpm.bbclass index b08608c8466..3cbbd1eb537 100644 --- a/meta/classes/package_rpm.bbclass +++ b/meta/classes/package_rpm.bbclass @@ -382,6 +382,7 @@ python write_specfile () { # Gather special src/first package data if srcname == splitname: + srclicense = splitlicense srcrdepends = splitrdepends srcrrecommends = splitrrecommends srcrsuggests = splitrsuggests @@ -421,8 +422,7 @@ python write_specfile () { spec_preamble_bottom.append('Release: %s' % splitrelease) if srcepoch != splitepoch: spec_preamble_bottom.append('Epoch: %s' % splitepoch) - if srclicense != splitlicense: - spec_preamble_bottom.append('License: %s' % splitlicense) + spec_preamble_bottom.append('License: %s' % splitlicense) spec_preamble_bottom.append('Group: %s' % splitsection) if srccustomtagschunk != splitcustomtagschunk:
RPM spec files don't distinguish between spec-level license and the primary package license, so always output the License for every package (defaulting to the recipe-wide license) and use LICENSE_${PN} if set for the primary package. As the primary use of package_rpm is to generate built packages, this fixes the license fields in the generated packages. [ YOCTO #12057 ] Signed-off-by: Ross Burton <ross.burton@intel.com> --- meta/classes/package_rpm.bbclass | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.11.0 -- _______________________________________________ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core