Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multimanifest prep #266

Merged
merged 15 commits into from
May 20, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/west/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ def _load(self, data):
# Initialize this instance's fields from values given in the
# manifest data, which must be validated according to the schema.
projects = []
project_names = set()
project_abspaths = set()

manifest = data.get('manifest')
Expand Down Expand Up @@ -281,6 +282,10 @@ def _load(self, data):
except ValueError as ve:
self._malformed(ve.args[0])

# Project names must be unique.
if project.name in project_names:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't this fix a GitHub issue? I seem to recall there was one

Copy link
Contributor Author

@mbolivar mbolivar May 16, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is essential to the design of the multimanifest feature. Projects are identified by their names in that work; it's how we decide what projects to apply overrides of attributes like url, name, etc. to. This means it doesn't make sense to continue allowing two projects with the same "name" in a single manifest. Arguably it never did, but it was necessary before because some projects might have had the same final path component in a URL but different URL bases. That case can be handled now with an explicit url: for at least one of the two.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Understood, thanks for the explanation

self._malformed('project name {} is already used'.
format(project.name))
# Two projects cannot have the same path. We use absolute
# paths to check for collisions to ensure paths are
# normalized (e.g. for case-insensitive file systems or
Expand All @@ -290,6 +295,7 @@ def _load(self, data):
self._malformed('project {} path {} is already in use'.
format(project.name, project.path))

project_names.add(project.name)
project_abspaths.add(project.abspath)
projects.append(project)

Expand Down
1 change: 1 addition & 0 deletions tests/manifests/invalid_duplicate_name.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@