summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa
diff options
context:
space:
mode:
authorPeter Kjellerstedt <peter.kjellerstedt@axis.com>2024-02-19 02:28:28 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2024-02-19 16:03:22 +0000
commit24433ce8f9e091f04a18d2753347f32fb0860999 (patch)
tree8581c0bbf911ca6bfd6c182dc1367e3373291e5f /meta/lib/oeqa
parent1e6565402f93848796cb5f19154b6eb6866d6110 (diff)
downloadpoky-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/oeqa')
-rw-r--r--meta/lib/oeqa/selftest/cases/devtool.py46
1 files changed, 46 insertions, 0 deletions
diff --git a/meta/lib/oeqa/selftest/cases/devtool.py b/meta/lib/oeqa/selftest/cases/devtool.py
index d76b974fbb..c4dcdb4550 100644
--- a/meta/lib/oeqa/selftest/cases/devtool.py
+++ b/meta/lib/oeqa/selftest/cases/devtool.py
@@ -2228,6 +2228,52 @@ class DevtoolUpgradeTests(DevtoolBase):
2228 if files: 2228 if files:
2229 self.fail('Unexpected file(s) copied next to bbappend: %s' % ', '.join(files)) 2229 self.fail('Unexpected file(s) copied next to bbappend: %s' % ', '.join(files))
2230 2230
2231 def test_devtool_finish_update_patch(self):
2232 # This test uses a modified version of the sysdig recipe from meta-oe.
2233 # - The patches have been renamed.
2234 # - The dependencies are commented out since the recipe is not being
2235 # built.
2236 #
2237 # The sysdig recipe is interesting in that it fetches two different Git
2238 # repositories, and there are patches for both. This leads to that
2239 # devtool will create ignore commits as it uses Git submodules to keep
2240 # track of the second repository.
2241 #
2242 # This test will verify that the ignored commits actually are ignored
2243 # when a commit in between is modified. It will also verify that the
2244 # updated patch keeps its original name.
2245
2246 # Check preconditions
2247 self.assertTrue(not os.path.exists(self.workspacedir), 'This test cannot be run with a workspace directory under the build directory')
2248 # Try modifying a recipe
2249 self.track_for_cleanup(self.workspacedir)
2250 recipe = 'sysdig-selftest'
2251 recipefile = get_bb_var('FILE', recipe)
2252 recipedir = os.path.dirname(recipefile)
2253 result = runCmd('git status --porcelain .', cwd=recipedir)
2254 if result.output.strip():
2255 self.fail('Recipe directory for %s contains uncommitted changes' % recipe)
2256 tempdir = tempfile.mkdtemp(prefix='devtoolqa')
2257 self.track_for_cleanup(tempdir)
2258 self.add_command_to_tearDown('bitbake-layers remove-layer */workspace')
2259 result = runCmd('devtool modify %s %s' % (recipe, tempdir))
2260 self.add_command_to_tearDown('cd %s; rm %s/*; git checkout %s %s' % (recipedir, recipe, recipe, os.path.basename(recipefile)))
2261 self.assertExists(os.path.join(tempdir, 'CMakeLists.txt'), 'Extracted source could not be found')
2262 # Make a change to one of the existing commits
2263 result = runCmd('echo "# A comment " >> CMakeLists.txt', cwd=tempdir)
2264 result = runCmd('git status --porcelain', cwd=tempdir)
2265 self.assertIn('M CMakeLists.txt', result.output)
2266 result = runCmd('git commit --fixup HEAD^ CMakeLists.txt', cwd=tempdir)
2267 result = runCmd('git show -s --format=%s', cwd=tempdir)
2268 self.assertIn('fixup! cmake: Pass PROBE_NAME via CFLAGS', result.output)
2269 result = runCmd('GIT_SEQUENCE_EDITOR=true git rebase -i --autosquash devtool-base', cwd=tempdir)
2270 result = runCmd('devtool finish %s meta-selftest' % recipe)
2271 result = runCmd('devtool status')
2272 self.assertNotIn(recipe, result.output, 'Recipe should have been reset by finish but wasn\'t')
2273 self.assertNotExists(os.path.join(self.workspacedir, 'recipes', recipe), 'Recipe directory should not exist after finish')
2274 expected_status = [(' M', '.*/0099-cmake-Pass-PROBE_NAME-via-CFLAGS.patch$')]
2275 self._check_repo_status(recipedir, expected_status)
2276
2231 def test_devtool_rename(self): 2277 def test_devtool_rename(self):
2232 # Check preconditions 2278 # Check preconditions
2233 self.assertTrue(not os.path.exists(self.workspacedir), 'This test cannot be run with a workspace directory under the build directory') 2279 self.assertTrue(not os.path.exists(self.workspacedir), 'This test cannot be run with a workspace directory under the build directory')