All of lore.kernel.org
 help / color / mirror / Atom feed
* [oe][Patch] package.bbclass: fix host contamination warnings for source files
@ 2016-04-03 20:57 Max Krummenacher
  2016-04-03 21:37 ` Andreas Müller
  2016-04-03 21:45 ` Richard Purdie
  0 siblings, 2 replies; 17+ messages in thread
From: Max Krummenacher @ 2016-04-03 20:57 UTC (permalink / raw)
  To: openembedded-core; +Cc: Max Krummenacher

Addresses https://bugzilla.yoctoproject.org/show_bug.cgi?id=8939

Source files deployed with the *-dbg packages are owned by the user
running bitbake leading to warnings as the one below.

WARNING: glibc-2.23-r0 do_package_qa: QA Issue: glibc: /glibc-dbg/usr/src/debug/glibc/2.23-r0/git/include/resolv.h is owned by uid 1000, which is the same as the user running bitbake. This may be due to host contamination
glibc: /glibc-dbg/usr/src/debug/glibc/2.23-r0/git/include/monetary.h is owned by uid 1000, which is the same as the user running bitbake. This may be due to host contamination
glibc: /glibc-dbg/usr/src/debug/glibc/2.23-r0/git/include/locale.h is owned by uid 1000, which is the same as the user running bitbake. This may be due to host contamination
...

The files are copied as part of the do_package task.
The patch chowns all file in packages/usr/src after cpio copied them into the
package directory.

Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
---


 meta/classes/package.bbclass | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index bdbe96d..d9ef62c 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -362,6 +362,7 @@ def copydebugsources(debugsrcdir, d):
     # and copied to the destination here.
 
     import stat
+    import subprocess
 
     sourcefile = d.expand("${WORKDIR}/debugsources.list")
     if debugsrcdir and os.path.isfile(sourcefile):
@@ -410,6 +411,28 @@ def copydebugsources(debugsrcdir, d):
         if retval:
             bb.fatal("debugsrc symlink fixup failed with exit code %s (cmd was %s)" % (retval, cmd))
 
+        # cpio --no-preserve-owner does not create the destination files with
+        # owner root even when run under pseudo, chown them explicitely.
+        fakerootcmd = d.getVar('FAKEROOTCMD', True)
+        if not os.path.exists(fakerootcmd):
+            logger.error('pseudo executable %s could not be found - have you run a build yet? pseudo-native should install this and if you have run any build then that should have been built')
+            return 2
+        # Set up the appropriate environment
+        newenv = dict(os.environ)
+        fakerootenv = d.getVar('FAKEROOTENV', True)
+        for varvalue in fakerootenv.split():
+            if '=' in varvalue:
+                splitval = varvalue.split('=', 1)
+                newenv[splitval[0]] = splitval[1]
+        kwargs = dict(env = newenv, shell = True)
+
+        cmd = "find '%s%s' -not -uid 0 -exec chown 0:0 {} \;" % (dvar, debugsrcdir)
+        if fakerootcmd is not None:
+            cmd = "%s %s" % (fakerootcmd, cmd)
+        retval = subprocess.call(cmd, **kwargs)
+        if retval:
+            bb.fatal("debugsrc chown failed with code %s (cmd was %s)" % (retval, cmd))
+
         # The copy by cpio may have resulted in some empty directories!  Remove these
         cmd = "find %s%s -empty -type d -delete" % (dvar, debugsrcdir)
         (retval, output) = oe.utils.getstatusoutput(cmd)
-- 
2.6.2



^ permalink raw reply related	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2016-07-18 20:07 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-03 20:57 [oe][Patch] package.bbclass: fix host contamination warnings for source files Max Krummenacher
2016-04-03 21:37 ` Andreas Müller
2016-04-03 21:45 ` Richard Purdie
2016-04-03 21:53   ` Khem Raj
2016-04-03 22:54     ` Max Krummenacher
2016-04-03 22:51   ` Max Krummenacher
2016-04-03 23:00     ` Richard Purdie
2016-04-04  2:36       ` Khem Raj
2016-04-04  7:49         ` Max Krummenacher
2016-04-04  7:56         ` Andreas Müller
2016-04-04  8:00           ` Max Krummenacher
2016-04-04  8:46             ` Andreas Müller
2016-04-04 21:12               ` Andreas Müller
2016-04-04 22:43                 ` Richard Purdie
2016-04-05  0:44           ` Khem Raj
2016-04-05  7:43             ` Max Krummenacher
2016-07-18 20:07   ` Max Krummenacher

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.