diff options
-rw-r--r-- | build-scripts/helpers | 5 | ||||
-rwxr-xr-x | build-scripts/sanitize-manifest.py | 35 |
2 files changed, 40 insertions, 0 deletions
diff --git a/build-scripts/helpers b/build-scripts/helpers index be84f2c..bedb9a4 100644 --- a/build-scripts/helpers +++ b/build-scripts/helpers @@ -23,11 +23,16 @@ setup-repo-vars () { repo-sync-from-mirror () { setup-repo-vars + repo init $REPO_QUIET -u "${MANIFEST_REPO}" -b "${MANIFEST_BRANCH}" -m "${MANIFEST_FILENAME}" $REPO_MIRROR # Save input manifest as build artifact for reference mkdir -p out cp .repo/manifest.xml out/source-manifest.xml + echo Replace Linaro git URLs with lightweight http git URLs. + ${BUILD_SCRIPT_ROOT}/sanitize-manifest.py .repo/manifest.xml > out/processed-manifest.xml + cp out/processed_manifest.xml .repo/manifest.xml + echo ---------------------------- time repo sync $REPO_QUIET -j$SYNC_JOBS # Restore source manifest temporarily to create pinned manifest diff --git a/build-scripts/sanitize-manifest.py b/build-scripts/sanitize-manifest.py new file mode 100755 index 0000000..799f8f2 --- /dev/null +++ b/build-scripts/sanitize-manifest.py @@ -0,0 +1,35 @@ +#!/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 = 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')) + +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') |