summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa
diff options
context:
space:
mode:
authorPeter Kjellerstedt <peter.kjellerstedt@axis.com>2024-02-19 02:28:32 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2024-02-19 16:02:20 +0000
commitf5e6183b9557477bef74024a587de0bfcc2b7c0d (patch)
tree219903e5f443b01ee09ac46ffc365bcc002b8d6c /meta/lib/oeqa
parent2393dc35a93546eccee0dd313a6927c7d1512c3b (diff)
downloadopenembedded-core-f5e6183b9557477bef74024a587de0bfcc2b7c0d.tar.gz
lib/oe/patch: Use git notes to store the filenames for the patches
The old way of keeping track of the filenames for the patches that correspond to the commits was to add a special comment line to the end of the commit message, e.g., "%% original patch: <filename>", using a temporary git hook. This method had some drawbacks, e.g.: * It caused problems if one wanted to push the commits upstream as the comment line had to be manually removed. * The comment line would end up in patches if someone used git format-path rather than devtool finish to generate the patches. * The comment line could interfere with global Git hooks used to validate the format of the Git commit message. * When regenerating patches with `devtool finish --force-patch-refresh`, the process typically resulted in adding empty lines to the end of the commit messages in the updated patches. A better way of keeping track of the patch filenames is to use Git notes. This way the commit messages remain unaffected, but the information is still shown when, e.g., doing `git log`. A special Git notes space, refs/notes/devtool, is used to not intefere with the default Git notes. It is configured to be shown in, e.g., `git log` and to survive rewrites (i.e., `git commit --amend` and `git rebase`). Since there is no longer any need for a temporary Git hook, the code that manipulated the .git/hooks directory has also been removed. To avoid potential problems due to global Git hooks, --no-verify was added to the `git commit` command. To not cause troubles for those who have done `devtool modify` for a recipe with the old solution and then do `devtool finish` with the new solution, the code will fall back to look for the old strings in the commit message if no Git note can be found. While not technically motivated like above, the way to keep track of ignored commits is also changed to use Git notes to avoid having different methods to store similar information. Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa')
-rw-r--r--meta/lib/oeqa/selftest/cases/devtool.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/meta/lib/oeqa/selftest/cases/devtool.py b/meta/lib/oeqa/selftest/cases/devtool.py
index c4dcdb4550..d37848bdef 100644
--- a/meta/lib/oeqa/selftest/cases/devtool.py
+++ b/meta/lib/oeqa/selftest/cases/devtool.py
@@ -989,9 +989,10 @@ class DevtoolModifyTests(DevtoolBase):
self.assertIn(tempdir, result.output)
# Check git repo
self._check_src_repo(tempdir)
- # Check that the patch is correctly applied
- # last commit message in the tree must contain
- # %% original patch: <patchname>
+ # Check that the patch is correctly applied.
+ # The last commit message in the tree must contain the following note:
+ # Notes (devtool):
+ # original patch: <patchname>
# ..
patchname = None
for uri in src_uri:
@@ -999,7 +1000,7 @@ class DevtoolModifyTests(DevtoolBase):
patchname = uri.replace("file://", "").partition('.patch')[0] + '.patch'
self.assertIsNotNone(patchname)
result = runCmd('git -C %s log -1' % tempdir)
- self.assertIn("%%%% original patch: %s" % patchname, result.output)
+ self.assertIn("Notes (devtool):\n original patch: %s" % patchname, result.output)
# Configure the recipe to check that the git dependencies are correctly patched in cargo config
bitbake('-c configure %s' % testrecipe)