aboutsummaryrefslogtreecommitdiff
path: root/build-scripts/rewrite-manifest.py
diff options
context:
space:
mode:
authorDanilo Šegan <danilo.segan@linaro.org>2012-11-22 10:22:58 +0100
committerDanilo Šegan <danilo.segan@linaro.org>2012-11-22 10:22:58 +0100
commiteb45c6a5c2c138a6b2dedbe8070ad4862afae48b (patch)
tree04b883053b547c85f121ba31ad98c47578a618ea /build-scripts/rewrite-manifest.py
parent168d23517d1d7fc187b8a8e39e7ebcad34b9fc9e (diff)
Rename sanitize-manifest to rewrite-manifest.
Diffstat (limited to 'build-scripts/rewrite-manifest.py')
-rwxr-xr-xbuild-scripts/rewrite-manifest.py37
1 files changed, 37 insertions, 0 deletions
diff --git a/build-scripts/rewrite-manifest.py b/build-scripts/rewrite-manifest.py
new file mode 100755
index 0000000..ebf5f7e
--- /dev/null
+++ b/build-scripts/rewrite-manifest.py
@@ -0,0 +1,37 @@
+#!/usr/bin/env python
+
+from xml.etree.cElementTree import (
+ ElementTree,
+ tostring,
+)
+import sys
+
+
+et = ElementTree()
+doc = open(sys.argv[1])
+root = et.parse(doc)
+
+remotes_to_handle = set([])
+default_remote = root.find('default').get('remote', None)
+
+for remote in root.findall("remote"):
+ if default_remote is None:
+ default_remote = remote.get('name')
+
+ if remote.get('fetch').startswith('git://git.linaro.org'):
+ remote.set('fetch', 'http://git.linaro.org/git-ro/')
+ remotes_to_handle.add(remote.get('name'))
+ elif remote.get('fetch').startswith('git://android.git.linaro.org'):
+ remote.set('fetch', 'http://android.git.linaro.org/git-ro/')
+ remotes_to_handle.add(remote.get('name'))
+
+remotes_to_handle.remove(default_remote)
+
+for project in root.findall("project"):
+ if (project.get('remote') in remotes_to_handle or
+ project.get('remote') is None and default_remote in remotes_to_handle):
+ if not project.get('name').endswith('.git'):
+ project.set('name', project.get('name') + '.git')
+
+
+print tostring(root, 'UTF-8').decode('utf-8')