summaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
authorJagadeesh Krishnanjanappa <jkrishnanjanappa@mvista.com>2015-11-28 13:39:54 +0530
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-03-15 11:29:04 +0000
commit4823395a7d073796945133e824c697d1c5ded8b1 (patch)
tree2a824ea9e5137c493a029d50581acbd277d850e5 /meta/classes
parent4a4fde53bd905f334643557ba3b0171c20dfc8f3 (diff)
downloadpoky-4823395a7d073796945133e824c697d1c5ded8b1.tar.gz
license.bbclass: fix host contamination warnings for license files
We get below host contamination warnings of license files for each recipe, when we try to create a separate ${PN}-lic package (which contains license files), by setting LICENSE_CREATE_PACKAGE equal to "1" in local.conf. -- snip -- WARNING: QA Issue: libcgroup: /libcgroup-lic/usr/share/licenses/libcgroup/generic_LGPLv2.1 is owned by uid 5001, which is the same as the user running bitbake. This may be due to host contamination [host-user-contaminated] WARNING: QA Issue: attr: /attr-lic/usr/share/licenses/attr/libattr.c is owned by uid 5001, which is the same as the user running bitbake. This may be due to host contamination [host-user-contaminated] WARNING: QA Issue: bash: /bash-lic/usr/share/licenses/bash/COPYING is owned by uid 5001, which is the same as the user running bitbake. This may be due to host contamination [host-user-contaminated] -- CUT -- Since the license files from source and OE-core, are populated in a normal shell environment rather in pseudo environment (fakeroot); the ownership of these files will be same as host user running bitbake. During the do_package task (which runs in pseudo environment (fakeroot)), os.link preserves the ownership of these license files as host user instead of root user. This causes license files to have UID same as host user id and resulting in above warnings during do_package_qa task. Changing ownership of license files to root user (which has UID and GID as 0) under pseudo environment will solve above warnings, and on exiting pseudo environment the license files will continue to be owned by host user. Perform this manipulation within try/except statements, as tasks which are not exected under pseudo (such as do_populate_lic) result in OSError when trying to change ownership of license files. (From OE-Core master rev: a411e96c3989bc9ffbd870b54cd6a7ad2e9f2c61) (From OE-Core rev: c87a3507c4557827b3a495a876cf6411ce225407) Signed-off-by: Jagadeesh Krishnanjanappa <jkrishnanjanappa@mvista.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/license.bbclass10
1 files changed, 10 insertions, 0 deletions
diff --git a/meta/classes/license.bbclass b/meta/classes/license.bbclass
index 8ad4614d61..c714da31f4 100644
--- a/meta/classes/license.bbclass
+++ b/meta/classes/license.bbclass
@@ -185,6 +185,16 @@ def copy_license_files(lic_files_paths, destdir):
185 os.remove(dst) 185 os.remove(dst)
186 if os.access(src, os.W_OK) and (os.stat(src).st_dev == os.stat(destdir).st_dev): 186 if os.access(src, os.W_OK) and (os.stat(src).st_dev == os.stat(destdir).st_dev):
187 os.link(src, dst) 187 os.link(src, dst)
188 try:
189 os.chown(dst,0,0)
190 except OSError as err:
191 import errno
192 if err.errno == errno.EPERM:
193 # suppress "Operation not permitted" error, as
194 # sometimes this function is not executed under pseudo
195 pass
196 else:
197 raise
188 else: 198 else:
189 shutil.copyfile(src, dst) 199 shutil.copyfile(src, dst)
190 except Exception as e: 200 except Exception as e: