diff options
author | Peter Kjellerstedt <pkj@axis.com> | 2025-03-19 00:25:39 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-03-20 11:29:04 +0000 |
commit | c0f3bc79b3e5d5b13c950cadfe558bbcd10187a0 (patch) | |
tree | 68323a91fb924088b144fd9d16c539a3b38c18ea /meta/lib | |
parent | 0e32e1cb260aac59cabbbeba26f8f844978a75a0 (diff) | |
download | poky-c0f3bc79b3e5d5b13c950cadfe558bbcd10187a0.tar.gz |
devtool: reset: Escape command line input used in regular expression
Running, e.g., `devtool reset sdbus-c++` would result in the following
error:
re.error: multiple repeat at position 35
This was due to the ++ in the recipe name, which would be treated as an
incorrect regular expression in _reset().
Use re.escape() to make sure all characters in the recipe name are
treated literally.
(From OE-Core rev: 6e73bd9b3e6d529752db93879f2c0ed53873dd1a)
Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r-- | meta/lib/oeqa/selftest/cases/devtool.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/meta/lib/oeqa/selftest/cases/devtool.py b/meta/lib/oeqa/selftest/cases/devtool.py index 115dc24d87..ddbc554af0 100644 --- a/meta/lib/oeqa/selftest/cases/devtool.py +++ b/meta/lib/oeqa/selftest/cases/devtool.py | |||
@@ -1757,6 +1757,8 @@ class DevtoolExtractTests(DevtoolBase): | |||
1757 | self.assertExists(os.path.join(tempdir, 'Makefile.am'), 'Extracted source could not be found') | 1757 | self.assertExists(os.path.join(tempdir, 'Makefile.am'), 'Extracted source could not be found') |
1758 | self._check_src_repo(tempdir) | 1758 | self._check_src_repo(tempdir) |
1759 | 1759 | ||
1760 | class DevtoolResetTests(DevtoolBase): | ||
1761 | |||
1760 | def test_devtool_reset_all(self): | 1762 | def test_devtool_reset_all(self): |
1761 | tempdir = tempfile.mkdtemp(prefix='devtoolqa') | 1763 | tempdir = tempfile.mkdtemp(prefix='devtoolqa') |
1762 | self.track_for_cleanup(tempdir) | 1764 | self.track_for_cleanup(tempdir) |
@@ -1783,6 +1785,21 @@ class DevtoolExtractTests(DevtoolBase): | |||
1783 | matches2 = glob.glob(stampprefix2 + '*') | 1785 | matches2 = glob.glob(stampprefix2 + '*') |
1784 | self.assertFalse(matches2, 'Stamp files exist for recipe %s that should have been cleaned' % testrecipe2) | 1786 | self.assertFalse(matches2, 'Stamp files exist for recipe %s that should have been cleaned' % testrecipe2) |
1785 | 1787 | ||
1788 | def test_devtool_reset_re_plus_plus(self): | ||
1789 | tempdir = tempfile.mkdtemp(prefix='devtoolqa') | ||
1790 | self.track_for_cleanup(tempdir) | ||
1791 | self.track_for_cleanup(self.workspacedir) | ||
1792 | self.add_command_to_tearDown('bitbake-layers remove-layer */workspace') | ||
1793 | testrecipe = 'devtool-test-reset-re++' | ||
1794 | result = runCmd('devtool modify %s' % testrecipe) | ||
1795 | result = runCmd('devtool reset -n %s' % testrecipe) | ||
1796 | self.assertIn(testrecipe, result.output) | ||
1797 | result = runCmd('devtool status') | ||
1798 | self.assertNotIn(testrecipe, result.output) | ||
1799 | self.assertNotExists(os.path.join(self.workspacedir, 'recipes', testrecipe), 'Recipe directory should not exist after resetting') | ||
1800 | |||
1801 | class DevtoolDeployTargetTests(DevtoolBase): | ||
1802 | |||
1786 | @OETestTag("runqemu") | 1803 | @OETestTag("runqemu") |
1787 | def test_devtool_deploy_target(self): | 1804 | def test_devtool_deploy_target(self): |
1788 | self._check_runqemu_prerequisites() | 1805 | self._check_runqemu_prerequisites() |
@@ -1850,6 +1867,8 @@ class DevtoolExtractTests(DevtoolBase): | |||
1850 | result = runCmd('ssh %s root@%s %s' % (sshargs, qemu.ip, testcommand), ignore_status=True) | 1867 | result = runCmd('ssh %s root@%s %s' % (sshargs, qemu.ip, testcommand), ignore_status=True) |
1851 | self.assertNotEqual(result, 0, 'undeploy-target did not remove command as it should have') | 1868 | self.assertNotEqual(result, 0, 'undeploy-target did not remove command as it should have') |
1852 | 1869 | ||
1870 | class DevtoolBuildImageTests(DevtoolBase): | ||
1871 | |||
1853 | def test_devtool_build_image(self): | 1872 | def test_devtool_build_image(self): |
1854 | """Test devtool build-image plugin""" | 1873 | """Test devtool build-image plugin""" |
1855 | # Check preconditions | 1874 | # Check preconditions |