roomservice: Use mirror manifest instead of search API
Change-Id: Ifc64e42e1d443f36033756a6247a9f253b1ab82d
This commit is contained in:
parent
62c1374385
commit
7395c7f50e
1 changed files with 7 additions and 9 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue