summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Kjellerstedt <peter.kjellerstedt@axis.com>2022-06-03 02:06:49 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-06-22 23:46:32 +0100
commitf51a25441545deb3f7cf0e30072e8f40ba41f2f6 (patch)
treeeae74bae4ebaa7f90271520fe7d44c8cefdb06c2
parent1487d683889194f1e7a17660685a0e95b3b5099d (diff)
downloadpoky-f51a25441545deb3f7cf0e30072e8f40ba41f2f6.tar.gz
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>
-rw-r--r--meta/classes/license.bbclass8
1 files changed, 4 insertions, 4 deletions
diff --git a/meta/classes/license.bbclass b/meta/classes/license.bbclass
index 6b03221c7f..806b5069fd 100644
--- a/meta/classes/license.bbclass
+++ b/meta/classes/license.bbclass
@@ -91,17 +91,17 @@ def copy_license_files(lic_files_paths, destdir):
91 os.link(src, dst) 91 os.link(src, dst)
92 except OSError as err: 92 except OSError as err:
93 if err.errno == errno.EXDEV: 93 if err.errno == errno.EXDEV:
94 # Copy license files if hard-link is not possible even if st_dev is the 94 # Copy license files if hardlink is not possible even if st_dev is the
95 # same on source and destination (docker container with device-mapper?) 95 # same on source and destination (docker container with device-mapper?)
96 canlink = False 96 canlink = False
97 else: 97 else:
98 raise 98 raise
99 # Only chown if we did hardling, and, we're running under pseudo 99 # Only chown if we did hardlink and we're running under pseudo
100 if canlink and os.environ.get('PSEUDO_DISABLED') == '0': 100 if canlink and os.environ.get('PSEUDO_DISABLED') == '0':
101 os.chown(dst,0,0) 101 os.chown(dst,0,0)
102 if not canlink: 102 if not canlink:
103 begin_idx = int(beginline)-1 if beginline is not None else None 103 begin_idx = max(0, int(beginline) - 1) if beginline is not None else None
104 end_idx = int(endline) if endline is not None else None 104 end_idx = max(0, int(endline)) if endline is not None else None
105 if begin_idx is None and end_idx is None: 105 if begin_idx is None and end_idx is None:
106 shutil.copyfile(src, dst) 106 shutil.copyfile(src, dst)
107 else: 107 else: