[oe-commits] [openembedded-core] 11/63: license.bbclass: fix host contamination warnings for license files

git at git.openembedded.org git at git.openembedded.org
Wed Mar 9 16:40:05 UTC 2016


rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit 3357fc81065311f2cabbe3d41202fe3c1063d784
Author: Jagadeesh Krishnanjanappa <jkrishnanjanappa at mvista.com>
AuthorDate: Sat Nov 28 13:39:54 2015 +0530

    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.
    
    Signed-off-by: Jagadeesh Krishnanjanappa <jkrishnanjanappa at mvista.com>
    Signed-off-by: Ross Burton <ross.burton at intel.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 meta/classes/license.bbclass | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/meta/classes/license.bbclass b/meta/classes/license.bbclass
index a7f3773..ba95c9a 100644
--- a/meta/classes/license.bbclass
+++ b/meta/classes/license.bbclass
@@ -350,6 +350,16 @@ def copy_license_files(lic_files_paths, destdir):
                 os.remove(dst)
             if os.access(src, os.W_OK) and (os.stat(src).st_dev == os.stat(destdir).st_dev):
                 os.link(src, dst)
+                try:
+                    os.chown(dst,0,0)
+                except OSError as err:
+                    import errno
+                    if err.errno == errno.EPERM:
+                        # suppress "Operation not permitted" error, as
+                        # sometimes this function is not executed under pseudo
+                        pass
+                    else:
+                        raise
             else:
                 shutil.copyfile(src, dst)
         except Exception as e:

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list