manifest: remove support for rename key in map import

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 <marti.bolivar@nordicsemi.no>
This commit is contained in:
Martí Bolívar 2020-01-22 13:01:24 -08:00 committed by Marti Bolivar
parent 23b8525181
commit 35d86a08ef
2 changed files with 19 additions and 34 deletions

View File

@ -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")

View File

@ -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