From 35d86a08ef9248bb06ae8c1e1cafa9688b6e9a4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=AD=20Bol=C3=ADvar?= Date: Wed, 22 Jan 2020 13:01:24 -0800 Subject: [PATCH] manifest: remove support for rename key in map import MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This feature is an artifact of an abandoned design for manifest imports which now has unclear utility. Rip it out for now until we are sure we need it and have thought it through. Signed-off-by: Martí Bolívar --- src/west/manifest.py | 17 ++--------------- tests/test_manifest.py | 36 +++++++++++++++++------------------- 2 files changed, 19 insertions(+), 34 deletions(-) diff --git a/src/west/manifest.py b/src/west/manifest.py index 2806bcf..bebd28e 100644 --- a/src/west/manifest.py +++ b/src/west/manifest.py @@ -901,8 +901,6 @@ class Manifest: for name, project in all_imported.items(): if _is_imap_ok(project, imap): - if name in imap.rename: - project.name = imap.rename[name] self._add_project(project, projects) def _load_imap(self, project, imp): @@ -915,8 +913,7 @@ class Manifest: copy.pop('name-whitelist', []), copy.pop('path-whitelist', []), copy.pop('name-blacklist', []), - copy.pop('path-blacklist', []), - copy.pop('rename', {})) + copy.pop('path-blacklist', [])) # Find a useful name for the project on error. if isinstance(project, ManifestProject): @@ -940,15 +937,6 @@ class Manifest: elif not _is_imap_list(ret.path_blacklist): self._malformed(f'{what}: bad import path-blacklist ' f'{ret.path_blacklist}') - elif not isinstance(ret.rename, dict): - self._malformed(f'{what}: rename: {ret.rename} ' - f'expected a map, {type(ret.rename)}') - else: - err = f"{what}: import map's rename includes " - for f, t in ret.rename.items(): - if 'manifest' in [f, t]: - self._malformed(err + f'{f}: {t}; ' - '"manifest" is a reserved name') return ret @@ -1441,8 +1429,7 @@ _defaults = collections.namedtuple('_defaults', 'remote revision') _import_map = collections.namedtuple('_import_map', 'file ' 'name_whitelist path_whitelist ' - 'name_blacklist path_blacklist ' - 'rename') + 'name_blacklist path_blacklist') _YML_EXTS = ['yml', 'yaml'] _WEST_YML = 'west.yml' _SCHEMA_PATH = os.path.join(os.path.dirname(__file__), "manifest-schema.yml") diff --git a/tests/test_manifest.py b/tests/test_manifest.py index dfb126e..63f396f 100644 --- a/tests/test_manifest.py +++ b/tests/test_manifest.py @@ -1935,7 +1935,7 @@ def test_import_flags_ignore(tmpdir): ''', import_flags=ImportFlag.IGNORE) assert m.get_projects(['foo']) -def test_import_name_whitelist(fs_topdir): +def test_import_map_name_whitelist(fs_topdir): # This tests an example from the documentation which uses # name-whitelist. @@ -1948,11 +1948,9 @@ def test_import_name_whitelist(fs_topdir): url: https://git.example.com/mainline/manifest import: name-whitelist: - - app + - mainline-app - lib2 - rename: - app: mainline-app - - name: app + - name: downstream-app url: https://git.example.com/downstream/app - name: lib3 path: libraries/lib3 @@ -1969,7 +1967,7 @@ def test_import_name_whitelist(fs_topdir): ''' manifest: projects: - - name: app + - name: mainline-app path: examples/app url: https://git.example.com/mainline/app - name: lib @@ -1985,19 +1983,19 @@ def test_import_name_whitelist(fs_topdir): expected = M('''\ projects: - - name: mainline - url: https://git.example.com/mainline/manifest - - name: app - url: https://git.example.com/downstream/app - - name: lib3 - path: libraries/lib3 - url: https://git.example.com/downstream/lib3 - - name: mainline-app - path: examples/app - url: https://git.example.com/mainline/app - - name: lib2 - path: libraries/lib2 - url: https://git.example.com/mainline/lib2 + - name: mainline + url: https://git.example.com/mainline/manifest + - name: downstream-app + url: https://git.example.com/downstream/app + - name: lib3 + path: libraries/lib3 + url: https://git.example.com/downstream/lib3 + - name: mainline-app + path: examples/app + url: https://git.example.com/mainline/app + - name: lib2 + path: libraries/lib2 + url: https://git.example.com/mainline/lib2 ''', manifest_path='mp', topdir=fs_topdir).projects