diff options
author | Jooncheol Park <jooncheol@gmail.com> | 2012-08-27 02:25:59 +0900 |
---|---|---|
committer | gerrit code review <noreply-gerritcodereview@google.com> | 2012-09-07 08:38:08 -0700 |
commit | 34acdd253439448b6c08c3abfc5e7b8bd03f383f (patch) | |
tree | f3290384d6d47fa8187678f75ed9885dbbfad20e /manifest_xml.py | |
parent | d94aaef39e301cc912968c07d1783232bf34a174 (diff) | |
download | git-repo-34acdd253439448b6c08c3abfc5e7b8bd03f383f.tar.gz |
Fix ManifestParseError when first child node is commentv1.10.4
If the first line of manifest.xml is a XML comment, root.childNodes[0]
is not a 'manifest' element node. The python minidom module will makes
a 'Comment' node as root.childNodes[0]. Since the original code only
checks whether the first child node is 'manifest', it couldn't do any
command including 'sync' due to the 'ManifestParseError' exception. This
patch could allow the comments between '<?xml ...?>' and '<manifest>' in
the manifest.xml file.
Change-Id: I0b81dea4f806965eca90f704c8aa7df49c579402
Diffstat (limited to 'manifest_xml.py')
-rw-r--r-- | manifest_xml.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/manifest_xml.py b/manifest_xml.py index 65b76379..8e9efd13 100644 --- a/manifest_xml.py +++ b/manifest_xml.py | |||
@@ -309,12 +309,14 @@ class XmlManifest(object): | |||
309 | if not root or not root.childNodes: | 309 | if not root or not root.childNodes: |
310 | raise ManifestParseError("no root node in %s" % (path,)) | 310 | raise ManifestParseError("no root node in %s" % (path,)) |
311 | 311 | ||
312 | config = root.childNodes[0] | 312 | for manifest in root.childNodes: |
313 | if config.nodeName != 'manifest': | 313 | if manifest.nodeName == 'manifest': |
314 | break | ||
315 | else: | ||
314 | raise ManifestParseError("no <manifest> in %s" % (path,)) | 316 | raise ManifestParseError("no <manifest> in %s" % (path,)) |
315 | 317 | ||
316 | nodes = [] | 318 | nodes = [] |
317 | for node in config.childNodes: | 319 | for node in manifest.childNodes: |
318 | if node.nodeName == 'include': | 320 | if node.nodeName == 'include': |
319 | name = self._reqatt(node, 'name') | 321 | name = self._reqatt(node, 'name') |
320 | fp = os.path.join(include_root, name) | 322 | fp = os.path.join(include_root, name) |