license.bbclass: fix copying license directories failed
cover license.bbclass: fix copying license directories failed
The following changes since commit 215dab864e7cf74394840621ad0754db593708f1:
bitbake: fetch2: Fix handling of SCM mirrors in MIRRORS (2013-11-19 13:22:48 +0000)
are available in the git repository at:
git://git.pokylinux.org/poky-contrib hongxu/fix-license
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=hongxu/fix-license
Hongxu Jia (1):
license.bbclass: fix copying license directories failed
meta/classes/license.bbclass | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
Signature · 1 line
1.8.1.2
PATCH 1/1 license.bbclass: fix copying license directories failed
For each recipe, it populated license files to ${LICENSE_DIRECTORY}/${PN}, such as kernel's license dir was ${LICENSE_DIRECTORY}/kernel-3.10.17-yocto-standard;
In do_rootfs task, it copied license directories from ${LICENSE_DIRECTORY}/ ${pkg}, and ${pkg} was listed in ${INSTALLED_PKGS};
We got ${INSTALLED_PKGS} by rpm query, such as the kernel were 'kernel-*', but the kernel's PN was linux-yocto, so searching ${LICENSE_DIRECTORY}/ kernel-* failed.
Copied license directories from ${LICENSE_DIRECTORY}/${PN} fixed this issue.
[YOCTO #5572]
--- meta/classes/license.bbclass | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
meta/classes/license.bbclass +6 -3
@@ -68,15 +68,18 @@ license_create_manifest() { if [ "${COPY_LIC_DIRS}" = "1" ]; then for pkg in ${INSTALLED_PKGS}; do mkdir -p ${IMAGE_ROOTFS}/usr/share/common-licenses/${pkg} - for lic in `ls ${LICENSE_DIRECTORY}/${pkg}`; do + pkged_pn="$(sed -n "/^PACKAGE NAME: ${pkg}$/,/^$/ \ + {s/^RECIPE NAME: //; /^PACKAGE NAME:/d; /^PACKAGE VERSION:/d; /^LICENSE:/d; p}" \ + ${LICENSE_MANIFEST})" + for lic in `ls ${LICENSE_DIRECTORY}/${pkged_pn}`; do # Really don't need to copy the generics as they're # represented in the manifest and in the actual pkg licenses # Doing so would make your image quite a bit larger if [[ "${lic}" != "generic_"* ]]; then - cp ${LICENSE_DIRECTORY}/${pkg}/${lic} ${IMAGE_ROOTFS}/usr/share/common-licenses/${pkg}/${lic} + cp ${LICENSE_DIRECTORY}/${pkged_pn}/${lic} ${IMAGE_ROOTFS}/usr/share/common-licenses/${pkg}/${lic} elif [[ "${lic}" == "generic_"* ]]; then if [ ! -f ${IMAGE_ROOTFS}/usr/share/common-licenses/${lic} ]; then - cp ${LICENSE_DIRECTORY}/${pkg}/${lic} ${IMAGE_ROOTFS}/usr/share/common-licenses/ + cp ${LICENSE_DIRECTORY}/${pkged_pn}/${lic} ${IMAGE_ROOTFS}/usr/share/common-licenses/ fi ln -s ../${lic} ${IMAGE_ROOTFS}/usr/share/common-licenses/${pkg}/${lic} fi
Signature · 1 line
1.8.1.2
Hi Hongxu,
Quoted 33 lines · On Wednesday 20 November 2013 18:39:02 Hongxu Jia wrote:
For each recipe, it populated license files to ${LICENSE_DIRECTORY}/${PN}, such as kernel's license dir was ${LICENSE_DIRECTORY}/kernel-3.10.17-yocto-standard;
In
do_rootfstask, it copied license directories from ${LICENSE_DIRECTORY}/ ${pkg}, and ${pkg} was listed in ${INSTALLED_PKGS};We got ${INSTALLED_PKGS} by rpm query, such as the kernel were 'kernel-*', but the kernel's PN was linux-yocto, so searching ${LICENSE_DIRECTORY}/ kernel-* failed.
Copied license directories from ${LICENSE_DIRECTORY}/${PN} fixed this issue.
[YOCTO #5572]
Signed-off-by Hongxu Jia <[email protected]>--- meta/classes/license.bbclass | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)meta/classes/license.bbclass +2
-1@@ -68,15 +68,18 @@ license_create_manifest() { if [ "${COPY_LIC_DIRS}" = "1" ]; then for pkg in ${INSTALLED_PKGS}; do mkdir -p ${IMAGE_ROOTFS}/usr/share/common-licenses/${pkg} - for lic in `ls ${LICENSE_DIRECTORY}/${pkg}`; do + pkged_pn="$(sed -n "/^PACKAGE NAME: ${pkg}$/,/^$/ \ + {s/^RECIPE NAME: //; /^PACKAGENAME:/d; /^PACKAGE VERSION:/d; /^LICENSE:/d; p}" \ +
${LICENSE_MANIFEST})"
meta/classes/license.bbclass license_create_manifest() { · line 74
Quoted 1 line
meta/classes/license.bbclass +1
-0+ for lic in `ls ${LICENSE_DIRECTORY}/${pkged_pn}`; do
This isn't the right way to do this. If you need to look up the recipe name from the target package name, in master you can now use:
oe-pkgdata-util lookup-recipe ${PKGDATA_DIR} "<list of packages>"Cheers,
Paul
Signature · 2 lines
Paul Eggleton Intel Open Source Technology Centre
Hi Paul,
Quoted 40 lines · Paul Eggleton
Hi Hongxu,
Quoted 33 lines · On Wednesday 20 November 2013 18:39:02 Hongxu Jia wrote:
For each recipe, it populated license files to ${LICENSE_DIRECTORY}/${PN}, such as kernel's license dir was ${LICENSE_DIRECTORY}/kernel-3.10.17-yocto-standard;
In
do_rootfstask, it copied license directories from ${LICENSE_DIRECTORY}/ ${pkg}, and ${pkg} was listed in ${INSTALLED_PKGS};We got ${INSTALLED_PKGS} by rpm query, such as the kernel were 'kernel-*', but the kernel's PN was linux-yocto, so searching ${LICENSE_DIRECTORY}/ kernel-* failed.
Copied license directories from ${LICENSE_DIRECTORY}/${PN} fixed this issue.
[YOCTO #5572]
Signed-off-by Hongxu Jia <[email protected]>--- meta/classes/license.bbclass | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)meta/classes/license.bbclass +2
-1@@ -68,15 +68,18 @@ license_create_manifest() { if [ "${COPY_LIC_DIRS}" = "1" ]; then for pkg in ${INSTALLED_PKGS}; do mkdir -p ${IMAGE_ROOTFS}/usr/share/common-licenses/${pkg} - for lic in `ls ${LICENSE_DIRECTORY}/${pkg}`; do + pkged_pn="$(sed -n "/^PACKAGE NAME: ${pkg}$/,/^$/ \ + {s/^RECIPE NAME: //; /^PACKAGENAME:/d; /^PACKAGE VERSION:/d; /^LICENSE:/d; p}" \ +
${LICENSE_MANIFEST})"meta/classes/license.bbclass license_create_manifest() { · line 74
Quoted 1 line
meta/classes/license.bbclass +1
-0+ for lic in `ls ${LICENSE_DIRECTORY}/${pkged_pn}`; doThis isn't the right way to do this. If you need to look up the recipe name from the target package name, in master you can now use:
Quoted 1 line
oe-pkgdata-util lookup-recipe ${PKGDATA_DIR} "<list of packages>"I am afraid to use oe-pkgdata-util here is not a good idea:
- everything we need has been listed in ${LICENSE_MANIFEST}, we just need to sort them out;
- the oe-pkgdata-util utility only support to search the specific ${PKGDATA_DIR} directory which was ${TMPDIR}/pkgdata/ ${MULTIMACH_TARGET_SYS}, but we need to search multiple ${MULTIMACH_TARGET_SYS} directories;
Such as "base-passwd in x86_64" and "base-files in qemux86_64";
//Hongxu
Quoted 3 lines
Cheers,
Paul
Quoted 61 lines · On Friday 22 November 2013 14:06:01 Hongxu Jia wrote:
Hi Paul,
Quoted 48 lines · Paul Eggleton
Hi Hongxu,
Quoted 45 lines · On Wednesday 20 November 2013 18:39:02 Hongxu Jia wrote:
For each recipe, it populated license files to ${LICENSE_DIRECTORY}/${PN},
such as kernel's license dir was ${LICENSE_DIRECTORY}/kernel-3.10.17-yocto-standard;In
do_rootfstask, it copied license directories from ${LICENSE_DIRECTORY}/
${pkg}, and ${pkg} was listed in ${INSTALLED_PKGS};We got ${INSTALLED_PKGS} by rpm query, such as the kernel were 'kernel-*',
but the kernel's PN was linux-yocto, so searching ${LICENSE_DIRECTORY}/ kernel-* failed.Copied license directories from ${LICENSE_DIRECTORY}/${PN} fixed this issue.
[YOCTO #5572]
Signed-off-by Hongxu Jia <[email protected]>---
meta/classes/license.bbclass | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)meta/classes/license.bbclass +2
-1@@ -68,15 +68,18 @@ license_create_manifest() { if [ "${COPY_LIC_DIRS}" = "1" ]; then for pkg in ${INSTALLED_PKGS}; do mkdir -p ${IMAGE_ROOTFS}/usr/share/common-licenses/${pkg} - for lic in `ls ${LICENSE_DIRECTORY}/${pkg}`; do + pkged_pn="$(sed -n "/^PACKAGE NAME: ${pkg}$/,/^$/ \ + {s/^RECIPE NAME: //;/^PACKAGE
NAME:/d; /^PACKAGE VERSION:/d; /^LICENSE:/d; p}" \ +${LICENSE_MANIFEST})"Quoted 7 lines
meta/classes/license.bbclass license_create_manifest() { · line 74
Quoted 1 line
meta/classes/license.bbclass +1
-0+ for lic in `ls ${LICENSE_DIRECTORY}/${pkged_pn}`; doThis isn't the right way to do this. If you need to look up the recipe name
from the target package name, in master you can now use:
oe-pkgdata-util lookup-recipe ${PKGDATA_DIR} "<list of packages>"I am afraid to use oe-pkgdata-util here is not a good idea:
Quoted 7 lines
- everything we need has been listed in ${LICENSE_MANIFEST}, we just need to sort them out;
- the oe-pkgdata-util utility only support to search the specific ${PKGDATA_DIR} directory which was ${TMPDIR}/pkgdata/ ${MULTIMACH_TARGET_SYS}, but we need to search multiple ${MULTIMACH_TARGET_SYS} directories;
Note that in 1.5 the pkgdata structure changed - it is now under the machine- specific sysroot, so there is only one directory to look in.
Cheers,
Paul
Signature · 2 lines
Paul Eggleton Intel Open Source Technology Centre
Hi Paul,
I have done as your suggestions:
meta/classes/license.bbclass +2 -1
@@ -68,15 +68,16 @@ license_create_manifest() { if [ "${COPY_LIC_DIRS}" = "1" ]; then for pkg in ${INSTALLED_PKGS}; do mkdir -p ${IMAGE_ROOTFS}/usr/share/common-licenses/${pkg} - for lic in `ls ${LICENSE_DIRECTORY}/${pkg}`; do + pkged_pn="$(oe-pkgdata-util lookup-recipe ${PKGDATA_DIR} ${pkg})" + for lic in `ls ${LICENSE_DIRECTORY}/${pkged_pn}`; do # Really don't need to copy the generics as they're # represented in the manifest and in the actual
pkg licenses
# Doing so would make your image quite a bit larger if [ "${lic#generic_}" = "${lic}" ]; then
- cp ${LICENSE_DIRECTORY}/${pkg}/${lic} ${IMAGE_ROOTFS}/usr/share/common-licenses/${pkg}/${lic}
+ cp ${LICENSE_DIRECTORY}/${pkged_pn}/${lic} ${IMAGE_ROOTFS}/usr/share/common-licenses/${pkg}/${lic}
else
if [ ! -f
${IMAGE_ROOTFS}/usr/share/common-licenses/${lic} ]; then
- cp ${LICENSE_DIRECTORY}/${pkg}/${lic} ${IMAGE_ROOTFS}/usr/share/common-licenses/
+ cp ${LICENSE_DIRECTORY}/${pkged_pn}/${lic} ${IMAGE_ROOTFS}/usr/share/common-licenses/
fi
ln -s ../${lic} ${IMAGE_ROOTFS}/usr/share/common-licenses/${pkg}/${lic}
fi
//Hongxu
Quoted 73 lines · Paul Eggleton
Quoted 59 lines · On Friday 22 November 2013 14:06:01 Hongxu Jia wrote:
Hi Paul,
Quoted 46 lines · Paul Eggleton
Hi Hongxu,
Quoted 43 lines · On Wednesday 20 November 2013 18:39:02 Hongxu Jia wrote:
For each recipe, it populated license files to ${LICENSE_DIRECTORY}/${PN},
such as kernel's license dir was ${LICENSE_DIRECTORY}/kernel-3.10.17-yocto-standard;In
do_rootfstask, it copied license directories from ${LICENSE_DIRECTORY}/
${pkg}, and ${pkg} was listed in ${INSTALLED_PKGS};We got ${INSTALLED_PKGS} by rpm query, such as the kernel were 'kernel-*',
but the kernel's PN was linux-yocto, so searching ${LICENSE_DIRECTORY}/ kernel-* failed.Copied license directories from ${LICENSE_DIRECTORY}/${PN} fixed this issue.
[YOCTO #5572]
Signed-off-by Hongxu Jia <[email protected]>---
meta/classes/license.bbclass | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)meta/classes/license.bbclass +2
-1@@ -68,15 +68,18 @@ license_create_manifest() { if [ "${COPY_LIC_DIRS}" = "1" ]; then for pkg in ${INSTALLED_PKGS}; do mkdir -p ${IMAGE_ROOTFS}/usr/share/common-licenses/${pkg} - for lic in `ls ${LICENSE_DIRECTORY}/${pkg}`; do + pkged_pn="$(sed -n "/^PACKAGE NAME: ${pkg}$/,/^$/ \ + {s/^RECIPE NAME: //;/^PACKAGE
NAME:/d; /^PACKAGE VERSION:/d; /^LICENSE:/d; p}" \ +Quoted 8 lines
meta/classes/license.bbclass
Quoted 3 lines
${LICENSE_MANIFEST})"meta/classes/license.bbclass +1
-0+ for lic in `ls ${LICENSE_DIRECTORY}/${pkged_pn}`; doThis isn't the right way to do this. If you need to look up the recipe name
from the target package name, in master you can now use:
oe-pkgdata-util lookup-recipe ${PKGDATA_DIR} "<list of packages>"I am afraid to use oe-pkgdata-util here is not a good idea:
Quoted 7 lines
- everything we need has been listed in ${LICENSE_MANIFEST},
we just need to sort them out;- the oe-pkgdata-util utility only support to search the specific
${PKGDATA_DIR} directory which was ${TMPDIR}/pkgdata/ ${MULTIMACH_TARGET_SYS}, but we need to search multiple ${MULTIMACH_TARGET_SYS} directories;Note that in 1.5 the pkgdata structure changed - it is now under the machine- specific sysroot, so there is only one directory to look in.
Cheers,
Paul