Inject the project name into each projects groups.

For CrOS, we have scenarios were people checkout a smaller version
of our manifest via groups, and enable individual repositories as
needed for their work.  Previously this was via local_manifest
manipulation, which breaks via manifest-groups would require a
remove-project tag.

Via injecting the projects name into the projects groups, this
allows us to instead manipulate the configured groups allowing
the user to turn on/off projects as necessary.

Change-Id: I07b7918e16cc9dc28eb47e19a46a04dc4fd0be74
This commit is contained in:
Brian Harring 2012-06-15 02:24:20 -07:00 committed by Shawn O. Pearce
parent 435370c6f0
commit 7da1314e38
2 changed files with 8 additions and 3 deletions

View File

@ -171,7 +171,11 @@ the default element is used.
Attribute `groups`: List of groups to which this project belongs, Attribute `groups`: List of groups to which this project belongs,
whitespace or comma separated. All projects belong to the group whitespace or comma separated. All projects belong to the group
"default". "default", and each project automatically belongs to a group of
it's name:`name` and path:`path`. E.g. for
<project name="monkeys" path="barrel-of"/>, that project
definition is implicitly in the following manifest groups:
default, name:monkeys, and path:barrel-of.
Element annotation Element annotation
------------------ ------------------

View File

@ -566,8 +566,9 @@ class XmlManifest(object):
if node.hasAttribute('groups'): if node.hasAttribute('groups'):
groups = node.getAttribute('groups') groups = node.getAttribute('groups')
groups = [x for x in re.split('[,\s]+', groups) if x] groups = [x for x in re.split('[,\s]+', groups) if x]
if 'default' not in groups:
groups.append('default') default_groups = ['default', 'name:%s' % name, 'path:%s' % path]
groups.extend(set(default_groups).difference(groups))
if self.IsMirror: if self.IsMirror:
relpath = None relpath = None