From 1c3f57e8f13d4f6dc818bdf06c3a40f768ef1ce5 Mon Sep 17 00:00:00 2001 From: Raman Tenneti Date: Tue, 4 May 2021 12:32:13 -0700 Subject: manifest_xml: initial support for It will be used to let manifest authors self-register contact info. This element can be repeated, and any later entries will clobber earlier ones. This would allow manifest authors who extend manifests to specify their own contact info. It would have 1 required attribute: bugurl. "bugurl" specifies the URL to file a bug against the manifest owner. TODO: This CL only implements the parsing logic and further work will be in followup CLs. Tested the code with the following commands. $ ./run_tests tests/test_manifest_xml.py $ ./run_tests -v Bug: [google internal] b/186220520. Change-Id: I47e765ba2dab5cdf850191129f4d4cd6b803f451 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/305203 Tested-by: Raman Tenneti Reviewed-by: Mike Frysinger --- manifest_xml.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'manifest_xml.py') diff --git a/manifest_xml.py b/manifest_xml.py index 73556a5e..e1d630b3 100644 --- a/manifest_xml.py +++ b/manifest_xml.py @@ -479,6 +479,12 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md e.setAttribute('remote', remoteName) root.appendChild(e) + if self._contactinfo: + root.appendChild(doc.createTextNode('')) + e = doc.createElement('contactinfo') + e.setAttribute('bugurl', self._contactinfo['bugurl']) + root.appendChild(e) + return doc def ToDict(self, **kwargs): @@ -490,6 +496,7 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md 'manifest-server', 'repo-hooks', 'superproject', + 'contactinfo', } # Elements that may be repeated. MULTI_ELEMENTS = { @@ -565,6 +572,11 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md self._Load() return self._superproject + @property + def contactinfo(self): + self._Load() + return self._contactinfo + @property def notice(self): self._Load() @@ -634,6 +646,7 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md self._default = None self._repo_hooks_project = None self._superproject = {} + self._contactinfo = {} self._notice = None self.branch = None self._manifest_server = None @@ -876,6 +889,10 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md raise ManifestParseError("no remote for superproject %s within %s" % (name, self.manifestFile)) self._superproject['remote'] = remote.ToRemoteSpec(name) + if node.nodeName == 'contactinfo': + bugurl = self._reqatt(node, 'bugurl') + # This element can be repeated, later entries will clobber earlier ones. + self._contactinfo['bugurl'] = bugurl if node.nodeName == 'remove-project': name = self._reqatt(node, 'name') -- cgit v1.2.3-54-g00ecf