Allow projects to be specified as notdefault

Instead of every group being in the group "default", every project
is now in the group "all".   A group that should not be downloaded
by default may be added to the group "notdefault".

This allows all group names to be positive (instead of removing groups
directly in the manifest with -default) and offers a clear way of
selecting every project (--groups all).

Change-Id: I99cd70309adb1f8460db3bbc6eff46bdcd22256f
This commit is contained in:
Conley Owens
2012-08-13 13:11:18 -07:00
committed by gerrit code review
parent e2126652a3
commit bb1b5f5f86
5 changed files with 18 additions and 16 deletions

View File

@ -632,20 +632,21 @@ class Project(object):
"""Returns true if the manifest groups specified at init should cause
this project to be synced.
Prefixing a manifest group with "-" inverts the meaning of a group.
All projects are implicitly labelled with "default".
All projects are implicitly labelled with "all".
labels are resolved in order. In the example case of
project_groups: "default,group1,group2"
project_groups: "all,group1,group2"
manifest_groups: "-group1,group2"
the project will be matched.
"""
if self.groups is None:
return True
expanded_manifest_groups = manifest_groups or ['all', '-notdefault']
expanded_project_groups = ['all'] + (self.groups or [])
matched = False
for group in manifest_groups:
if group.startswith('-') and group[1:] in self.groups:
for group in expanded_manifest_groups:
if group.startswith('-') and group[1:] in expanded_project_groups:
matched = False
elif group in self.groups:
elif group in expanded_project_groups:
matched = True
return matched