aboutsummaryrefslogtreecommitdiff
path: root/build-scripts/rewrite-manifest.py
diff options
context:
space:
mode:
authorDanilo Šegan <danilo.segan@linaro.org>2012-11-22 15:39:42 +0100
committerDanilo Šegan <danilo.segan@linaro.org>2012-11-22 15:39:42 +0100
commit233bc2d8217f3bb24c2417b99bc0a94305f2b66e (patch)
tree3a0104a81cb47ecf1ddb3afd52b76b304b690f48 /build-scripts/rewrite-manifest.py
parent0ca28d7e6446f761309cf4cd20ffa6a41f43f9b7 (diff)
Split out URLs being rewritten into a dict as per review.
Diffstat (limited to 'build-scripts/rewrite-manifest.py')
-rwxr-xr-xbuild-scripts/rewrite-manifest.py24
1 files changed, 9 insertions, 15 deletions
diff --git a/build-scripts/rewrite-manifest.py b/build-scripts/rewrite-manifest.py
index 6e6a390..49146ce 100755
--- a/build-scripts/rewrite-manifest.py
+++ b/build-scripts/rewrite-manifest.py
@@ -6,6 +6,12 @@ from xml.etree.cElementTree import (
)
import sys
+rewrite_urls = {
+ 'git://git.linaro.org': 'http://git.linaro.org/git-ro',
+ 'git://git.linaro.org/': 'http://git.linaro.org/git-ro/',
+ 'git://android.git.linaro.org': 'http://android.git.linaro.org/git-ro',
+ 'git://android.git.linaro.org/': 'http://android.git.linaro.org/git-ro/',
+}
def rewrite_git_urls(root):
"""Rewrites all android.git.linaro.org and git.linaro.org URLs.
@@ -20,21 +26,9 @@ def rewrite_git_urls(root):
if default_remote is None:
default_remote = remote.get('name')
- # Replace git://git.linaro.org/ and http://git.linaro.org/git/
- # base URLs with the scalable http://git.linaro.org/git-ro/.
- if remote.get('fetch') in (
- 'git://git.linaro.org', 'git://git.linaro.org/',
- 'http://git.linaro.org/git', 'http://git.linaro.org/git/'):
- remote.set('fetch', 'http://git.linaro.org/git-ro/')
- remotes_to_handle.add(remote.get('name'))
- # Replace git://android.git.linaro.org/ and
- # http://android.git.linaro.org/git/ base URLs with the scalable
- # http://git.linaro.org/git-ro/.
- elif remote.get('fetch') in (
- 'git://android.git.linaro.org', 'git://android.git.linaro.org/',
- 'http://android.git.linaro.org/git',
- 'http://android.git.linaro.org/git/'):
- remote.set('fetch', 'http://android.git.linaro.org/git-ro/')
+ remote_url = remote.get('fetch')
+ if remote_url in rewrite_urls:
+ remote.set('fetch', rewrite_urls[remote_url])
remotes_to_handle.add(remote.get('name'))
for project in root.findall("project"):