Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Unified Diff: android_webview/buildbot/generate_local_manifest.py

Issue 14669003: [android_webview] Deps whitelist and scripts for AOSP builder (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « android_webview/buildbot/deps_whitelist.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/buildbot/generate_local_manifest.py
diff --git a/android_webview/buildbot/generate_local_manifest.py b/android_webview/buildbot/generate_local_manifest.py
new file mode 100755
index 0000000000000000000000000000000000000000..59cb2de1dc6d1ddb87eda477e76ea2b706528199
--- /dev/null
+++ b/android_webview/buildbot/generate_local_manifest.py
@@ -0,0 +1,100 @@
+#!/usr/bin/env python
+# Copyright (c) 2013 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""Generate local manifest in an Android repository.
+
+This is used to generate a local manifest in an Android repository. The purpose
+of the generated manifest is to remove the set of projects that exist under a
+certain path.
+"""
+
+from optparse import OptionParser
+import os
+import xml.etree.ElementTree as ET
+
+def createLocalManifest(manifest_path, local_manifest_path, path_to_exclude,
+ pinned_projects=None):
+ manifest_tree = ET.parse(manifest_path)
+ local_manifest_root = ET.Element('manifest')
+
+ def remove_project(project):
+ remove_project = ET.SubElement(local_manifest_root, 'remove-project')
+ remove_project.set('name', project.get('name'))
+
+ def pin_project(project, revision):
+ pin_project = ET.SubElement(local_manifest_root, 'project')
+ pin_project.set('name', project.get('name'))
+ if project.get('path') != None:
+ pin_project.set('path', project.get('path'))
+ pin_project.set('revision', revision)
+
+ for project in manifest_tree.getroot().findall('project'):
+ project_path = project.get('path')
+ project_name = project.get('name')
+ exclude_project = ((project_path != None and
+ project_path.startswith(path_to_exclude)) or
+ (project_path == None and
+ project_name.startswith(path_to_exclude)))
+ if exclude_project:
+ print 'Excluding project name="%s" path="%s"' % (project_name,
+ project_path)
+ remove_project(project)
+ continue
+
+ pinned_projects = pinned_projects or []
+ for pinned in pinned_projects:
+ if pinned['path'] == project_path and pinned['name'] == project_name:
+ remove_project(project)
+ pin_project(project, pinned['revision'])
+ break
+
+ local_manifest_tree = ET.ElementTree(local_manifest_root)
+ local_manifest_dir = os.path.dirname(local_manifest_path)
+ if not os.path.exists(local_manifest_dir):
+ os.makedirs(local_manifest_dir)
+ local_manifest_tree.write(local_manifest_path,
+ xml_declaration=True,
+ encoding='UTF-8',
+ method='xml')
+
+def main():
+ usage = 'usage: %prog [options] <android_build_top> <path_to_exclude>'
+ parser = OptionParser(usage=usage)
+ parser.add_option('--ndk-revision', dest='ndk_revision',
+ help='pin the ndk project at a particular REVISION',
+ metavar='REVISION', default=None)
+ parser.add_option('--manifest_filename', dest='manifest_filename',
+ help='name of the manifest file', default='default.xml')
+ (options, args) = parser.parse_args()
+
+ if len(args) != 2:
+ parser.error('Wrong number of arguments.')
+
+ android_build_top = args[0]
+ path_to_exclude = args[1]
+
+ manifest_filename = options.manifest_filename
+
+ manifest_path = os.path.join(android_build_top, '.repo/manifests',
+ manifest_filename)
+ local_manifest_path = os.path.join(android_build_top,
+ '.repo/local_manifest.xml')
+
+ pinned_projects = []
+ if options.ndk_revision:
+ pinned_projects = [{
+ 'path': 'ndk',
+ 'name': 'platform/ndk',
+ 'revision' : options.ndk_revision,
+ },]
+
+ print 'Path to exclude: %s' % path_to_exclude
+ print 'Path to manifest file: %s' % manifest_path
+ createLocalManifest(manifest_path, local_manifest_path, path_to_exclude,
+ pinned_projects)
+ print 'Local manifest created in: %s' % local_manifest_path
+
+if __name__ == '__main__':
+ main()
« no previous file with comments | « android_webview/buildbot/deps_whitelist.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698