mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
Fix ManifestParseError when first child node is comment
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
This commit is contained in:
parent
d94aaef39e
commit
34acdd2534
@ -309,12 +309,14 @@ class XmlManifest(object):
|
|||||||
if not root or not root.childNodes:
|
if not root or not root.childNodes:
|
||||||
raise ManifestParseError("no root node in %s" % (path,))
|
raise ManifestParseError("no root node in %s" % (path,))
|
||||||
|
|
||||||
config = root.childNodes[0]
|
for manifest in root.childNodes:
|
||||||
if config.nodeName != 'manifest':
|
if manifest.nodeName == 'manifest':
|
||||||
|
break
|
||||||
|
else:
|
||||||
raise ManifestParseError("no <manifest> in %s" % (path,))
|
raise ManifestParseError("no <manifest> in %s" % (path,))
|
||||||
|
|
||||||
nodes = []
|
nodes = []
|
||||||
for node in config.childNodes:
|
for node in manifest.childNodes:
|
||||||
if node.nodeName == 'include':
|
if node.nodeName == 'include':
|
||||||
name = self._reqatt(node, 'name')
|
name = self._reqatt(node, 'name')
|
||||||
fp = os.path.join(include_root, name)
|
fp = os.path.join(include_root, name)
|
||||||
|
Loading…
Reference in New Issue
Block a user