diff options
4 files changed, 30 insertions, 1 deletions
diff --git a/meta-selftest/recipes-test/devtool/devtool-test-reset-re++.bb b/meta-selftest/recipes-test/devtool/devtool-test-reset-re++.bb new file mode 100644 index 0000000000..35672a5265 --- /dev/null +++ b/meta-selftest/recipes-test/devtool/devtool-test-reset-re++.bb | |||
| @@ -0,0 +1,9 @@ | |||
| 1 | LICENSE = "CLOSED" | ||
| 2 | INHIBIT_DEFAULT_DEPS = "1" | ||
| 3 | |||
| 4 | SRC_URI = "file://file1" | ||
| 5 | |||
| 6 | S = "${WORKDIR}/sources" | ||
| 7 | UNPACKDIR = "${S}" | ||
| 8 | |||
| 9 | EXCLUDE_FROM_WORLD = "1" | ||
diff --git a/meta-selftest/recipes-test/devtool/devtool-test-reset-re++/file1 b/meta-selftest/recipes-test/devtool/devtool-test-reset-re++/file1 new file mode 100644 index 0000000000..51f466f2e4 --- /dev/null +++ b/meta-selftest/recipes-test/devtool/devtool-test-reset-re++/file1 | |||
| @@ -0,0 +1 @@ | |||
| A file | |||
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 |
diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py index 0cdb9c6cfb..cdfdba43ee 100644 --- a/scripts/lib/devtool/standard.py +++ b/scripts/lib/devtool/standard.py | |||
| @@ -1951,7 +1951,7 @@ def _reset(recipes, no_clean, remove_work, config, basepath, workspace): | |||
| 1951 | lines = f.readlines() | 1951 | lines = f.readlines() |
| 1952 | with open(new_layerconf_file, 'a') as nf: | 1952 | with open(new_layerconf_file, 'a') as nf: |
| 1953 | for line in lines: | 1953 | for line in lines: |
| 1954 | pprovider_exp = r'^PREFERRED_PROVIDER_.*? = "' + pn + r'"$' | 1954 | pprovider_exp = r'^PREFERRED_PROVIDER_.*? = "' + re.escape(pn) + r'"$' |
| 1955 | if not re.match(pprovider_exp, line): | 1955 | if not re.match(pprovider_exp, line): |
| 1956 | nf.write(line) | 1956 | nf.write(line) |
| 1957 | else: | 1957 | else: |
