mirror of
https://git.yoctoproject.org/poky
synced 2026-04-20 00:32:13 +02:00
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>
This commit is contained in:
committed by
Richard Purdie
parent
817f9b5899
commit
6e1aad4596
@@ -377,18 +377,9 @@ def copy_license_files(lic_files_paths, destdir):
|
||||
canlink = False
|
||||
else:
|
||||
raise
|
||||
try:
|
||||
if canlink:
|
||||
os.chown(dst,0,0)
|
||||
except OSError as err:
|
||||
if err.errno in (errno.EPERM, errno.EINVAL):
|
||||
# Suppress "Operation not permitted" error, as
|
||||
# sometimes this function is not executed under pseudo.
|
||||
# Also ignore "Invalid argument" errors that happen in
|
||||
# some (unprivileged) container environments (no root).
|
||||
pass
|
||||
else:
|
||||
raise
|
||||
# Only chown if we did hardling, and, we're running under pseudo
|
||||
if canlink and os.environ.get('PSEUDO_DISABLED') == '0':
|
||||
os.chown(dst,0,0)
|
||||
if not canlink:
|
||||
begin_idx = int(beginline)-1 if beginline is not None else None
|
||||
end_idx = int(endline) if endline is not None else None
|
||||
|
||||
Reference in New Issue
Block a user