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-11 10:06:13 +0100 |
| commit | a04b59c40b38e74aa3a76740065598e256e50f2c (patch) | |
| tree | b0de60acfe6d0f0a7254e53ebc30815b7f81a6e2 | |
| parent | 5c04e06d768bd98f5203bebdf9134f92ace55a03 (diff) | |
| download | poky-a04b59c40b38e74aa3a76740065598e256e50f2c.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: 3001199ca8da38208649e8016e77880690835706)
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.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: |
