diff options
| author | Peter Kjellerstedt <peter.kjellerstedt@axis.com> | 2024-02-19 02:28:28 +0100 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-02-19 16:03:22 +0000 |
| commit | 24433ce8f9e091f04a18d2753347f32fb0860999 (patch) | |
| tree | 8581c0bbf911ca6bfd6c182dc1367e3373291e5f /meta/lib/oe | |
| parent | 1e6565402f93848796cb5f19154b6eb6866d6110 (diff) | |
| download | poky-24433ce8f9e091f04a18d2753347f32fb0860999.tar.gz | |
lib/oe/patch: Make extractPatches() not extract ignored commits
If a commit is marked with "%% ignore" it means it is used by devtool to
keep track of changes to the source code that are not the result of
running do_patch(). These changes need to actually be ignored when
extracting the patches as they typically make no sense as actual patches
in a recipe.
This also adds a new test for oe-selftest that verifies that there are
no patches generated from ignored commits.
(From OE-Core rev: c3d43de7e54189bf09fbe8e87ddb976e42ebf531)
Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oe')
| -rw-r--r-- | meta/lib/oe/patch.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/meta/lib/oe/patch.py b/meta/lib/oe/patch.py index d5ad4f3dc1..70cdb1d9c0 100644 --- a/meta/lib/oe/patch.py +++ b/meta/lib/oe/patch.py | |||
| @@ -474,9 +474,9 @@ class GitApplyTree(PatchTree): | |||
| 474 | out = runcmd(["sh", "-c", " ".join(shellcmd)], os.path.join(tree, name)) | 474 | out = runcmd(["sh", "-c", " ".join(shellcmd)], os.path.join(tree, name)) |
| 475 | if out: | 475 | if out: |
| 476 | for srcfile in out.split(): | 476 | for srcfile in out.split(): |
| 477 | outfile = os.path.basename(srcfile) | ||
| 477 | for encoding in ['utf-8', 'latin-1']: | 478 | for encoding in ['utf-8', 'latin-1']: |
| 478 | patchlines = [] | 479 | patchlines = [] |
| 479 | outfile = None | ||
| 480 | try: | 480 | try: |
| 481 | with open(srcfile, 'r', encoding=encoding, newline='') as f: | 481 | with open(srcfile, 'r', encoding=encoding, newline='') as f: |
| 482 | for line in f: | 482 | for line in f: |
| @@ -484,7 +484,8 @@ class GitApplyTree(PatchTree): | |||
| 484 | outfile = line.split()[-1].strip() | 484 | outfile = line.split()[-1].strip() |
| 485 | continue | 485 | continue |
| 486 | if line.startswith(GitApplyTree.ignore_commit_prefix): | 486 | if line.startswith(GitApplyTree.ignore_commit_prefix): |
| 487 | continue | 487 | outfile = None |
| 488 | break | ||
| 488 | patchlines.append(line) | 489 | patchlines.append(line) |
| 489 | except UnicodeDecodeError: | 490 | except UnicodeDecodeError: |
| 490 | continue | 491 | continue |
| @@ -492,12 +493,11 @@ class GitApplyTree(PatchTree): | |||
| 492 | else: | 493 | else: |
| 493 | raise PatchError('Unable to find a character encoding to decode %s' % srcfile) | 494 | raise PatchError('Unable to find a character encoding to decode %s' % srcfile) |
| 494 | 495 | ||
| 495 | if not outfile: | 496 | if outfile: |
| 496 | outfile = os.path.basename(srcfile) | 497 | bb.utils.mkdirhier(os.path.join(outdir, name)) |
| 497 | bb.utils.mkdirhier(os.path.join(outdir, name)) | 498 | with open(os.path.join(outdir, name, outfile), 'w') as of: |
| 498 | with open(os.path.join(outdir, name, outfile), 'w') as of: | 499 | for line in patchlines: |
| 499 | for line in patchlines: | 500 | of.write(line) |
| 500 | of.write(line) | ||
| 501 | finally: | 501 | finally: |
| 502 | shutil.rmtree(tempdir) | 502 | shutil.rmtree(tempdir) |
| 503 | 503 | ||
