diff options
Diffstat (limited to 'tools/roomservice.py')
-rwxr-xr-x | tools/roomservice.py | 46 |
1 files changed, 26 insertions, 20 deletions
diff --git a/tools/roomservice.py b/tools/roomservice.py index a1b69cd..691456e 100755 --- a/tools/roomservice.py +++ b/tools/roomservice.py @@ -1,5 +1,6 @@ #!/usr/bin/env python # Copyright (C) 2012-2013, The CyanogenMod Project +# (C) 2017, The LineageOS Project # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -51,7 +52,7 @@ except: device = product if not depsonly: - print("Device %s not found. Attempting to retrieve device repository from CyanogenMod Github (http://github.com/CyanogenMod)." % device) + print("Device %s not found. Attempting to retrieve device repository from LineageOS Github (http://github.com/LineageOS)." % device) repositories = [] @@ -71,7 +72,7 @@ def add_auth(githubreq): githubreq.add_header("Authorization","Basic %s" % githubauth) if not depsonly: - githubreq = urllib.request.Request("https://api.github.com/search/repositories?q=%s+user:CyanogenMod+in:name+fork:true" % device) + githubreq = urllib.request.Request("https://api.github.com/search/repositories?q=%s+user:LineageOS+in:name+fork:true" % device) add_auth(githubreq) try: result = json.loads(urllib.request.urlopen(githubreq).read().decode()) @@ -175,12 +176,12 @@ def add_to_manifest(repositories, fallback_branch = None): repo_target = repository['target_path'] print('Checking if %s is fetched from %s' % (repo_target, repo_name)) if is_in_manifest(repo_target): - print('CyanogenMod/%s already fetched to %s' % (repo_name, repo_target)) + print('LineageOS/%s already fetched to %s' % (repo_name, repo_target)) continue - print('Adding dependency: CyanogenMod/%s -> %s' % (repo_name, repo_target)) + print('Adding dependency: LineageOS/%s -> %s' % (repo_name, repo_target)) project = ElementTree.Element("project", attrib = { "path": repo_target, - "remote": "github", "name": "CyanogenMod/%s" % repo_name }) + "remote": "github", "name": "LineageOS/%s" % repo_name }) if 'branch' in repository: project.set('revision',repository['branch']) @@ -202,25 +203,30 @@ def add_to_manifest(repositories, fallback_branch = None): def fetch_dependencies(repo_path, fallback_branch = None): print('Looking for dependencies') - dependencies_path = repo_path + '/cm.dependencies' + dependencies_paths = [repo_path + '/lineage.dependencies', repo_path + '/cm.dependencies'] + found_dependencies = False syncable_repos = [] - if os.path.exists(dependencies_path): - dependencies_file = open(dependencies_path, 'r') - dependencies = json.loads(dependencies_file.read()) - fetch_list = [] + for dependencies_path in dependencies_paths: + if os.path.exists(dependencies_path): + dependencies_file = open(dependencies_path, 'r') + dependencies = json.loads(dependencies_file.read()) + fetch_list = [] - for dependency in dependencies: - if not is_in_manifest(dependency['target_path']): - fetch_list.append(dependency) - syncable_repos.append(dependency['target_path']) + for dependency in dependencies: + if not is_in_manifest(dependency['target_path']): + fetch_list.append(dependency) + syncable_repos.append(dependency['target_path']) - dependencies_file.close() + dependencies_file.close() + found_dependencies = True - if len(fetch_list) > 0: - print('Adding dependencies to manifest') - add_to_manifest(fetch_list, fallback_branch) - else: + if len(fetch_list) > 0: + print('Adding dependencies to manifest') + add_to_manifest(fetch_list, fallback_branch) + break + + if not found_dependencies: print('Dependencies file not found, bailing out.') if len(syncable_repos) > 0: @@ -294,4 +300,4 @@ else: print("Done") sys.exit() -print("Repository for %s not found in the CyanogenMod Github repository list. If this is in error, you may need to manually add it to your local_manifests/roomservice.xml." % device) +print("Repository for %s not found in the LineageOS Github repository list. If this is in error, you may need to manually add it to your local_manifests/roomservice.xml." % device) |