summaryrefslogtreecommitdiffstats
path: root/manifest_xml.py
diff options
context:
space:
mode:
Diffstat (limited to 'manifest_xml.py')
-rw-r--r--manifest_xml.py24
1 files changed, 22 insertions, 2 deletions
diff --git a/manifest_xml.py b/manifest_xml.py
index fdc31778..bd1ab69b 100644
--- a/manifest_xml.py
+++ b/manifest_xml.py
@@ -164,6 +164,9 @@ class XmlManifest(object):
164 if r.revision is not None: 164 if r.revision is not None:
165 e.setAttribute('revision', r.revision) 165 e.setAttribute('revision', r.revision)
166 166
167 def _ParseGroups(self, groups):
168 return [x for x in re.split(r'[,\s]+', groups) if x]
169
167 def Save(self, fd, peg_rev=False, peg_rev_upstream=True): 170 def Save(self, fd, peg_rev=False, peg_rev_upstream=True):
168 """Write the current manifest out to the given file descriptor. 171 """Write the current manifest out to the given file descriptor.
169 """ 172 """
@@ -171,7 +174,7 @@ class XmlManifest(object):
171 174
172 groups = mp.config.GetString('manifest.groups') 175 groups = mp.config.GetString('manifest.groups')
173 if groups: 176 if groups:
174 groups = [x for x in re.split(r'[,\s]+', groups) if x] 177 groups = self._ParseGroups(groups)
175 178
176 doc = xml.dom.minidom.Document() 179 doc = xml.dom.minidom.Document()
177 root = doc.createElement('manifest') 180 root = doc.createElement('manifest')
@@ -505,6 +508,23 @@ class XmlManifest(object):
505 if node.nodeName == 'project': 508 if node.nodeName == 'project':
506 project = self._ParseProject(node) 509 project = self._ParseProject(node)
507 recursively_add_projects(project) 510 recursively_add_projects(project)
511 if node.nodeName == 'extend-project':
512 name = self._reqatt(node, 'name')
513
514 if name not in self._projects:
515 raise ManifestParseError('extend-project element specifies non-existent '
516 'project: %s' % name)
517
518 path = node.getAttribute('path')
519 groups = node.getAttribute('groups')
520 if groups:
521 groups = self._ParseGroups(groups)
522
523 for p in self._projects[name]:
524 if path and p.relpath != path:
525 continue
526 if groups:
527 p.groups.extend(groups)
508 if node.nodeName == 'repo-hooks': 528 if node.nodeName == 'repo-hooks':
509 # Get the name of the project and the (space-separated) list of enabled. 529 # Get the name of the project and the (space-separated) list of enabled.
510 repo_hooks_project = self._reqatt(node, 'in-project') 530 repo_hooks_project = self._reqatt(node, 'in-project')
@@ -745,7 +765,7 @@ class XmlManifest(object):
745 groups = '' 765 groups = ''
746 if node.hasAttribute('groups'): 766 if node.hasAttribute('groups'):
747 groups = node.getAttribute('groups') 767 groups = node.getAttribute('groups')
748 groups = [x for x in re.split(r'[,\s]+', groups) if x] 768 groups = self._ParseGroups(groups)
749 769
750 if parent is None: 770 if parent is None:
751 relpath, worktree, gitdir, objdir = self.GetProjectPaths(name, path) 771 relpath, worktree, gitdir, objdir = self.GetProjectPaths(name, path)