diff --git a/build/tools/roomservice.py b/build/tools/roomservice.py index 7060ee3c..bf8f1f0a 100755 --- a/build/tools/roomservice.py +++ b/build/tools/roomservice.py @@ -72,18 +72,17 @@ 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:LineageOS+in:name+fork:true" % device) - add_auth(githubreq) + githubreq = urllib.request.Request("https://raw.githubusercontent.com/LineageOS/mirror/master/default.xml") try: - result = json.loads(urllib.request.urlopen(githubreq).read().decode()) + result = ElementTree.fromstring(urllib.request.urlopen(githubreq).read().decode()) except urllib.error.URLError: - print("Failed to search GitHub") + print("Failed to fetch data from GitHub") sys.exit(1) except ValueError: print("Failed to parse return data from GitHub") sys.exit(1) - for res in result.get('items', []): - repositories.append(res) + for res in result.findall('.//project'): + repositories.append(res.attrib['name'][10:]) local_manifests = r'.repo/local_manifests' if not os.path.exists(local_manifests): os.makedirs(local_manifests) @@ -289,10 +288,9 @@ if depsonly: sys.exit() else: - for repository in repositories: - repo_name = repository['name'] + for repo_name in repositories: if re.match(r"^android_device_[^_]*_" + device + "$", repo_name): - print("Found repository: %s" % repository['name']) + print("Found repository: %s" % repo_name) manufacturer = repo_name.replace("android_device_", "").replace("_" + device, "") repo_path = "device/%s/%s" % (manufacturer, device)