mirror of https://github.com/CalyxOS/scripts
pixel: Handle googlesource 429s
* We gotta do this better but for now let's just band-aid it Change-Id: I0d23c0813f0b8d7948907a3b0e0acd9917ee2a9c
This commit is contained in:
parent
4e37bf383f
commit
175eb30f4b
|
@ -44,47 +44,61 @@ def handle_ota(html_id):
|
|||
|
||||
def get_all_aosp_branches(branch_filter):
|
||||
all_branches = []
|
||||
for line in cmd.Git().ls_remote("--sort=v:refname", PLATFORM_BUILD_URL, branch_filter, tags=False, refs=True).split('\n'):
|
||||
try:
|
||||
(ref, branch) = line.split('\t')
|
||||
except ValueError:
|
||||
pass
|
||||
all_branches.append(branch.replace("refs/heads/", ""))
|
||||
return all_branches
|
||||
try:
|
||||
for line in cmd.Git().ls_remote("--sort=v:refname", PLATFORM_BUILD_URL, branch_filter, tags=False, refs=True).split('\n'):
|
||||
try:
|
||||
(ref, branch) = line.split('\t')
|
||||
except ValueError:
|
||||
pass
|
||||
all_branches.append(branch.replace("refs/heads/", ""))
|
||||
return all_branches
|
||||
except Exception as e:
|
||||
return all_branches
|
||||
|
||||
def get_aosp_branch_for_build_id(aosp_branches, wanted_build_id):
|
||||
for aosp_branch in aosp_branches:
|
||||
output = base64.decodebytes(urllib.request.urlopen(BUILD_ID_URL.format("heads/" + aosp_branch)).read()).decode()
|
||||
for line in output.split('\n'):
|
||||
if BUILD_ID_FILTER in line:
|
||||
found_build_id = line.split("=")[1]
|
||||
if found_build_id == wanted_build_id:
|
||||
print('new_aosp_branch="{0}"'.format(aosp_branch))
|
||||
return aosp_branch
|
||||
print('new_aosp_branch="unknown"')
|
||||
return 'unknown'
|
||||
try:
|
||||
for aosp_branch in aosp_branches:
|
||||
output = base64.decodebytes(urllib.request.urlopen(BUILD_ID_URL.format("heads/" + aosp_branch)).read()).decode()
|
||||
for line in output.split('\n'):
|
||||
if BUILD_ID_FILTER in line:
|
||||
found_build_id = line.split("=")[1]
|
||||
if found_build_id == wanted_build_id:
|
||||
print('new_aosp_branch="{0}"'.format(aosp_branch))
|
||||
return aosp_branch
|
||||
print('new_aosp_branch="unknown"')
|
||||
return 'unknown'
|
||||
except Exception as e:
|
||||
print('new_aosp_branch="unknown"')
|
||||
return 'unknown'
|
||||
|
||||
def get_all_aosp_tags(tag_filter):
|
||||
all_tags = []
|
||||
for line in cmd.Git().ls_remote("--sort=v:refname", PLATFORM_BUILD_URL, tag_filter, tags=True, refs=True).split('\n'):
|
||||
try:
|
||||
(ref, tag) = line.split('\t')
|
||||
except ValueError:
|
||||
pass
|
||||
all_tags.append(tag.replace("refs/tags/", ""))
|
||||
return all_tags
|
||||
try:
|
||||
for line in cmd.Git().ls_remote("--sort=v:refname", PLATFORM_BUILD_URL, tag_filter, tags=True, refs=True).split('\n'):
|
||||
try:
|
||||
(ref, tag) = line.split('\t')
|
||||
except ValueError:
|
||||
pass
|
||||
all_tags.append(tag.replace("refs/tags/", ""))
|
||||
return all_tags
|
||||
except Exception as e:
|
||||
return all_tags
|
||||
|
||||
def get_aosp_tag_for_build_id(aosp_tags, wanted_build_id):
|
||||
for aosp_tag in aosp_tags:
|
||||
output = base64.decodebytes(urllib.request.urlopen(BUILD_ID_URL.format("tags/" + aosp_tag)).read()).decode()
|
||||
for line in output.split('\n'):
|
||||
if BUILD_ID_FILTER in line:
|
||||
found_build_id = line.split("=")[1]
|
||||
if found_build_id == wanted_build_id:
|
||||
print('new_aosp_tag="{0}"'.format(aosp_tag))
|
||||
return aosp_tag
|
||||
print('new_aosp_tag="unknown"')
|
||||
return 'unknown'
|
||||
try:
|
||||
for aosp_tag in aosp_tags:
|
||||
output = base64.decodebytes(urllib.request.urlopen(BUILD_ID_URL.format("tags/" + aosp_tag)).read()).decode()
|
||||
for line in output.split('\n'):
|
||||
if BUILD_ID_FILTER in line:
|
||||
found_build_id = line.split("=")[1]
|
||||
if found_build_id == wanted_build_id:
|
||||
print('new_aosp_tag="{0}"'.format(aosp_tag))
|
||||
return aosp_tag
|
||||
print('new_aosp_tag="unknown"')
|
||||
return 'unknown'
|
||||
except Exception as e:
|
||||
print('new_aosp_tag="unknown"')
|
||||
return 'unknown'
|
||||
|
||||
def get_security_patch_for_aosp_tag(aosp_tag):
|
||||
try:
|
||||
|
|
Loading…
Reference in New Issue