Loading envsetup.sh +2 −0 Original line number Diff line number Diff line Loading @@ -532,6 +532,8 @@ function lunch() build/tools/roomservice.py $product popd > /dev/null check_product $product else build/tools/roomservice.py $product true fi if [ $? -ne 0 ] then Loading tools/roomservice.py +66 −21 Original line number Diff line number Diff line Loading @@ -3,16 +3,24 @@ import os import sys import urllib2 import json import re from xml.etree import ElementTree product = sys.argv[1]; if len(sys.argv) > 2: depsonly = sys.argv[2] else: depsonly = None device = product[product.index("_") + 1:] if not depsonly: print "Device %s not found. Attempting to retrieve device repository from CyanogenMod Github (http://github.com/CyanogenMod)." % device repositories = [] page = 1 while True: while not depsonly: result = json.loads(urllib2.urlopen("http://github.com/api/v2/json/repos/show/CyanogenMod?page=%d" % page).read()) if len(result['repositories']) == 0: break Loading Loading @@ -41,6 +49,32 @@ def indent(elem, level=0): if level and (not elem.tail or not elem.tail.strip()): elem.tail = i def get_from_manifest(devicename): try: lm = ElementTree.parse(".repo/local_manifest.xml") lm = lm.getroot() except: lm = ElementTree.Element("manifest") for localpath in lm.findall("project"): if re.search("android_device_.*_%s$" % device, localpath.get("name")): return localpath.get("path") return None def is_in_manifest(projectname): try: lm = ElementTree.parse(".repo/local_manifest.xml") lm = lm.getroot() except: lm = ElementTree.Element("manifest") for localpath in lm.findall("project"): if localpath.get("name") == projectname: return 1 return None def add_to_manifest(repositories): try: lm = ElementTree.parse(".repo/local_manifest.xml") Loading Loading @@ -72,7 +106,7 @@ def add_to_manifest(repositories): f.write(raw_xml) f.close() def fetch_dependencies(repo_path, repositories): def fetch_dependencies(repo_path): print 'Looking for dependencies' dependencies_path = repo_path + '/cm.dependencies' syncable_repos = [] Loading @@ -81,14 +115,15 @@ def fetch_dependencies(repo_path, repositories): dependencies_file = open(dependencies_path, 'r') dependencies = json.loads(dependencies_file.read()) fetch_list = [] print dependencies for dependency in dependencies: if not is_in_manifest("CyanogenMod/%s" % dependency['repository']): fetch_list.append(dependency) syncable_repos.append(dependency['target_path']) dependencies_file.close() if len(fetch_list) > 0: print 'Adding dependencies to manifest' add_to_manifest(fetch_list) else: Loading @@ -98,6 +133,16 @@ def fetch_dependencies(repo_path, repositories): print 'Syncing dependencies' os.system('repo sync %s' % ' '.join(syncable_repos)) if depsonly: repo_path = get_from_manifest(device) if repo_path: fetch_dependencies(repo_path) else: print "Trying dependencies-only mode on a non-existing device tree?" sys.exit() else: for repository in repositories: repo_name = repository['name'] if repo_name.startswith("android_device_") and repo_name.endswith("_" + device): Loading @@ -112,7 +157,7 @@ for repository in repositories: os.system('repo sync %s' % repo_path) print "Repository synced!" fetch_dependencies(repo_path, repositories) fetch_dependencies(repo_path) print "Done" sys.exit() Loading Loading
envsetup.sh +2 −0 Original line number Diff line number Diff line Loading @@ -532,6 +532,8 @@ function lunch() build/tools/roomservice.py $product popd > /dev/null check_product $product else build/tools/roomservice.py $product true fi if [ $? -ne 0 ] then Loading
tools/roomservice.py +66 −21 Original line number Diff line number Diff line Loading @@ -3,16 +3,24 @@ import os import sys import urllib2 import json import re from xml.etree import ElementTree product = sys.argv[1]; if len(sys.argv) > 2: depsonly = sys.argv[2] else: depsonly = None device = product[product.index("_") + 1:] if not depsonly: print "Device %s not found. Attempting to retrieve device repository from CyanogenMod Github (http://github.com/CyanogenMod)." % device repositories = [] page = 1 while True: while not depsonly: result = json.loads(urllib2.urlopen("http://github.com/api/v2/json/repos/show/CyanogenMod?page=%d" % page).read()) if len(result['repositories']) == 0: break Loading Loading @@ -41,6 +49,32 @@ def indent(elem, level=0): if level and (not elem.tail or not elem.tail.strip()): elem.tail = i def get_from_manifest(devicename): try: lm = ElementTree.parse(".repo/local_manifest.xml") lm = lm.getroot() except: lm = ElementTree.Element("manifest") for localpath in lm.findall("project"): if re.search("android_device_.*_%s$" % device, localpath.get("name")): return localpath.get("path") return None def is_in_manifest(projectname): try: lm = ElementTree.parse(".repo/local_manifest.xml") lm = lm.getroot() except: lm = ElementTree.Element("manifest") for localpath in lm.findall("project"): if localpath.get("name") == projectname: return 1 return None def add_to_manifest(repositories): try: lm = ElementTree.parse(".repo/local_manifest.xml") Loading Loading @@ -72,7 +106,7 @@ def add_to_manifest(repositories): f.write(raw_xml) f.close() def fetch_dependencies(repo_path, repositories): def fetch_dependencies(repo_path): print 'Looking for dependencies' dependencies_path = repo_path + '/cm.dependencies' syncable_repos = [] Loading @@ -81,14 +115,15 @@ def fetch_dependencies(repo_path, repositories): dependencies_file = open(dependencies_path, 'r') dependencies = json.loads(dependencies_file.read()) fetch_list = [] print dependencies for dependency in dependencies: if not is_in_manifest("CyanogenMod/%s" % dependency['repository']): fetch_list.append(dependency) syncable_repos.append(dependency['target_path']) dependencies_file.close() if len(fetch_list) > 0: print 'Adding dependencies to manifest' add_to_manifest(fetch_list) else: Loading @@ -98,6 +133,16 @@ def fetch_dependencies(repo_path, repositories): print 'Syncing dependencies' os.system('repo sync %s' % ' '.join(syncable_repos)) if depsonly: repo_path = get_from_manifest(device) if repo_path: fetch_dependencies(repo_path) else: print "Trying dependencies-only mode on a non-existing device tree?" sys.exit() else: for repository in repositories: repo_name = repository['name'] if repo_name.startswith("android_device_") and repo_name.endswith("_" + device): Loading @@ -112,7 +157,7 @@ for repository in repositories: os.system('repo sync %s' % repo_path) print "Repository synced!" fetch_dependencies(repo_path, repositories) fetch_dependencies(repo_path) print "Done" sys.exit() Loading