summaryrefslogtreecommitdiffstats
path: root/meta/classes/license.bbclass
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2017-02-22 17:26:50 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-03-01 23:27:09 +0000
commit6e1aad45967b1f4f52d919a886a2dd394e45e2d2 (patch)
treec3ec2aa982d9598fd4de9c21eb7b146e993e52e2 /meta/classes/license.bbclass
parent817f9b5899e386f4dd2f01d73dbda20ece7713b3 (diff)
downloadpoky-6e1aad45967b1f4f52d919a886a2dd394e45e2d2.tar.gz
license.bbclass: run chown only under pseudo
The copy_license_files() function in license.bbclass is called in two different contexts. First, it is run as part of the do_populate_lic task. In addition, it is called from do_package task when LICENSE_CREATE_PACKAGE is enabled. The function has code that changes the owner of license files to root which is meant only to happend in the latter case - i.e. under do_package which is run under pseudo. Previously, the code was blindly always running chown and just ignored errors that happened when running from do_populate_lic. This patch changes it to be more intelligent, only doing chown when running under pseudo. [YOCTO #10897] (From OE-Core rev: 19118a1408f32bb24d95ab3d7d7faed58cbae900) Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/license.bbclass')
-rw-r--r--meta/classes/license.bbclass15
1 files changed, 3 insertions, 12 deletions
diff --git a/meta/classes/license.bbclass b/meta/classes/license.bbclass
index f97e39f3c5..0ff6560a13 100644
--- a/meta/classes/license.bbclass
+++ b/meta/classes/license.bbclass
@@ -377,18 +377,9 @@ def copy_license_files(lic_files_paths, destdir):
377 canlink = False 377 canlink = False
378 else: 378 else:
379 raise 379 raise
380 try: 380 # Only chown if we did hardling, and, we're running under pseudo
381 if canlink: 381 if canlink and os.environ.get('PSEUDO_DISABLED') == '0':
382 os.chown(dst,0,0) 382 os.chown(dst,0,0)
383 except OSError as err:
384 if err.errno in (errno.EPERM, errno.EINVAL):
385 # Suppress "Operation not permitted" error, as
386 # sometimes this function is not executed under pseudo.
387 # Also ignore "Invalid argument" errors that happen in
388 # some (unprivileged) container environments (no root).
389 pass
390 else:
391 raise
392 if not canlink: 383 if not canlink:
393 begin_idx = int(beginline)-1 if beginline is not None else None 384 begin_idx = int(beginline)-1 if beginline is not None else None
394 end_idx = int(endline) if endline is not None else None 385 end_idx = int(endline) if endline is not None else None