mirror of
https://git.yoctoproject.org/poky
synced 2026-09-19 18:49:32 +02:00
license.bbclass: Bound beginline and endline in copy_license_files()
Ensure that begin_idx (i.e., beginline - 1) and end_idx (i.e., endline) are positive numbers in copy_license_files(). This makes sure the same lines are copied as populate_lic_qa_checksum() uses when it calculates the checksum. Before, beginline=0 would typically lead to that no lines were copied at all. (From OE-Core rev: 27cd074d747c5ef4b475c8a62a8ede2bbe58f996) Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit ab3cc3651d08d226675c461da760cda0bb6c0ce0) Signed-off-by: Steve Sakoman <steve@sakoman.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
1487d68388
commit
f51a254415
@@ -91,17 +91,17 @@ def copy_license_files(lic_files_paths, destdir):
|
|||||||
os.link(src, dst)
|
os.link(src, dst)
|
||||||
except OSError as err:
|
except OSError as err:
|
||||||
if err.errno == errno.EXDEV:
|
if err.errno == errno.EXDEV:
|
||||||
# Copy license files if hard-link is not possible even if st_dev is the
|
# Copy license files if hardlink is not possible even if st_dev is the
|
||||||
# same on source and destination (docker container with device-mapper?)
|
# same on source and destination (docker container with device-mapper?)
|
||||||
canlink = False
|
canlink = False
|
||||||
else:
|
else:
|
||||||
raise
|
raise
|
||||||
# Only chown if we did hardling, and, we're running under pseudo
|
# Only chown if we did hardlink and we're running under pseudo
|
||||||
if canlink and os.environ.get('PSEUDO_DISABLED') == '0':
|
if canlink and os.environ.get('PSEUDO_DISABLED') == '0':
|
||||||
os.chown(dst,0,0)
|
os.chown(dst,0,0)
|
||||||
if not canlink:
|
if not canlink:
|
||||||
begin_idx = int(beginline)-1 if beginline is not None else None
|
begin_idx = max(0, int(beginline) - 1) if beginline is not None else None
|
||||||
end_idx = int(endline) if endline is not None else None
|
end_idx = max(0, int(endline)) if endline is not None else None
|
||||||
if begin_idx is None and end_idx is None:
|
if begin_idx is None and end_idx is None:
|
||||||
shutil.copyfile(src, dst)
|
shutil.copyfile(src, dst)
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user