diff options
author | Peter Kjellerstedt <peter.kjellerstedt@axis.com> | 2022-06-03 02:06:49 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-06-06 13:36:05 +0100 |
commit | d79c5ee23368fe62bf06d81a886473132473dafb (patch) | |
tree | e3eecae08337b030ef414f9ca6d51c65c8d2e82c /meta/classes/license.bbclass | |
parent | d6092687d46e4558c2168fbf015c4d450e85b894 (diff) | |
download | poky-d79c5ee23368fe62bf06d81a886473132473dafb.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: ab3cc3651d08d226675c461da760cda0bb6c0ce0)
Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/license.bbclass')
-rw-r--r-- | meta/classes/license.bbclass | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/meta/classes/license.bbclass b/meta/classes/license.bbclass index 0c637e966e..4ebfc4fb92 100644 --- a/meta/classes/license.bbclass +++ b/meta/classes/license.bbclass | |||
@@ -84,17 +84,17 @@ def copy_license_files(lic_files_paths, destdir): | |||
84 | os.link(src, dst) | 84 | os.link(src, dst) |
85 | except OSError as err: | 85 | except OSError as err: |
86 | if err.errno == errno.EXDEV: | 86 | if err.errno == errno.EXDEV: |
87 | # Copy license files if hard-link is not possible even if st_dev is the | 87 | # Copy license files if hardlink is not possible even if st_dev is the |
88 | # same on source and destination (docker container with device-mapper?) | 88 | # same on source and destination (docker container with device-mapper?) |
89 | canlink = False | 89 | canlink = False |
90 | else: | 90 | else: |
91 | raise | 91 | raise |
92 | # Only chown if we did hardling, and, we're running under pseudo | 92 | # Only chown if we did hardlink and we're running under pseudo |
93 | if canlink and os.environ.get('PSEUDO_DISABLED') == '0': | 93 | if canlink and os.environ.get('PSEUDO_DISABLED') == '0': |
94 | os.chown(dst,0,0) | 94 | os.chown(dst,0,0) |
95 | if not canlink: | 95 | if not canlink: |
96 | begin_idx = int(beginline)-1 if beginline is not None else None | 96 | begin_idx = max(0, int(beginline) - 1) if beginline is not None else None |
97 | end_idx = int(endline) if endline is not None else None | 97 | end_idx = max(0, int(endline)) if endline is not None else None |
98 | if begin_idx is None and end_idx is None: | 98 | if begin_idx is None and end_idx is None: |
99 | shutil.copyfile(src, dst) | 99 | shutil.copyfile(src, dst) |
100 | else: | 100 | else: |