diff options
author | David Pursehouse <david.pursehouse@sonymobile.com> | 2012-11-13 02:50:36 +0900 |
---|---|---|
committer | David Pursehouse <david.pursehouse@sonymobile.com> | 2012-11-13 08:19:51 +0900 |
commit | 2d5a0df798b7b16ccf9c17b2435a9640cf0d81c0 (patch) | |
tree | ca99d70bdf9e4602beff0181f29f36a9d28eec7d /manifest_xml.py | |
parent | f7fc8a95beb1337e23f146cad8086c1fc05902ee (diff) | |
download | git-repo-2d5a0df798b7b16ccf9c17b2435a9640cf0d81c0.tar.gz |
Add support for multiple local manifests
Add support for multiple local manifests stored in the local_manifests
folder under the .repo home directory.
Local manifests will be processed in addition to local_manifest.xml.
Change-Id: Ia0569cea7e9ae0fe3208a8ffef5d9679e14db03b
Diffstat (limited to 'manifest_xml.py')
-rw-r--r-- | manifest_xml.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/manifest_xml.py b/manifest_xml.py index bf981f03..4e476791 100644 --- a/manifest_xml.py +++ b/manifest_xml.py | |||
@@ -27,6 +27,7 @@ from error import ManifestParseError | |||
27 | 27 | ||
28 | MANIFEST_FILE_NAME = 'manifest.xml' | 28 | MANIFEST_FILE_NAME = 'manifest.xml' |
29 | LOCAL_MANIFEST_NAME = 'local_manifest.xml' | 29 | LOCAL_MANIFEST_NAME = 'local_manifest.xml' |
30 | LOCAL_MANIFESTS_DIR_NAME = 'local_manifests' | ||
30 | 31 | ||
31 | urlparse.uses_relative.extend(['ssh', 'git']) | 32 | urlparse.uses_relative.extend(['ssh', 'git']) |
32 | urlparse.uses_netloc.extend(['ssh', 'git']) | 33 | urlparse.uses_netloc.extend(['ssh', 'git']) |
@@ -301,6 +302,17 @@ class XmlManifest(object): | |||
301 | if os.path.exists(local): | 302 | if os.path.exists(local): |
302 | nodes.append(self._ParseManifestXml(local, self.repodir)) | 303 | nodes.append(self._ParseManifestXml(local, self.repodir)) |
303 | 304 | ||
305 | local_dir = os.path.abspath(os.path.join(self.repodir, LOCAL_MANIFESTS_DIR_NAME)) | ||
306 | try: | ||
307 | for local_file in os.listdir(local_dir): | ||
308 | if local_file.endswith('.xml'): | ||
309 | try: | ||
310 | nodes.append(self._ParseManifestXml(local_file, self.repodir)) | ||
311 | except ManifestParseError as e: | ||
312 | print >>sys.stderr, '%s' % str(e) | ||
313 | except OSError: | ||
314 | pass | ||
315 | |||
304 | self._ParseManifest(nodes) | 316 | self._ParseManifest(nodes) |
305 | 317 | ||
306 | if self.IsMirror: | 318 | if self.IsMirror: |
@@ -312,7 +324,7 @@ class XmlManifest(object): | |||
312 | def _ParseManifestXml(self, path, include_root): | 324 | def _ParseManifestXml(self, path, include_root): |
313 | try: | 325 | try: |
314 | root = xml.dom.minidom.parse(path) | 326 | root = xml.dom.minidom.parse(path) |
315 | except (OSError, xml.parsers.expat.ExpatError), e: | 327 | except (OSError, xml.parsers.expat.ExpatError) as e: |
316 | raise ManifestParseError("error parsing manifest %s: %s" % (path, e)) | 328 | raise ManifestParseError("error parsing manifest %s: %s" % (path, e)) |
317 | 329 | ||
318 | if not root or not root.childNodes: | 330 | if not root or not root.childNodes: |