Skip to content

Commit

Permalink
Fix tools json generation
Browse files Browse the repository at this point in the history
  • Loading branch information
me-no-dev committed Jan 16, 2025
1 parent 3305cbe commit 43a1c25
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions tools/gen_tools_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ def replace_if_xz(system):
if not system['url'].endswith(".tar.xz"):
return system

new_url = system['url'].replace(".tar.xz", "_signed.tar.gz")
new_name = system['archiveFileName'].replace(".tar.xz", "_signed.tar.gz")
new_url = system['url'].replace(".tar.xz", ".tar.gz")
new_name = system['archiveFileName'].replace(".tar.xz", ".tar.gz")
new_signed_url = system['url'].replace(".tar.xz", "_signed.tar.gz")
new_signed_name = system['archiveFileName'].replace(".tar.xz", "_signed.tar.gz")
new_checksum = ""
new_size = 0

Expand All @@ -40,16 +42,8 @@ def replace_if_xz(system):
(owner, proj, version, filename) = urlx[0]
release_manifest_url = "https://github.com/%s/%s/releases/download/%s/%s-%s-checksum.sha256" % (owner, proj, version, proj, version)
else:
new_url = system['url'].replace(".tar.xz", ".tar.gz")
new_name = system['archiveFileName'].replace(".tar.xz", ".tar.gz")
# parse the download url to extract all info needed for the checksum file url
urlx = re.findall("^https://github.com/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/releases/download/([a-zA-Z0-9_\-.]+)/([a-zA-Z0-9_\-.]+)$", new_url)
if urlx and len(urlx) > 0:
(owner, proj, version, filename) = urlx[0]
release_manifest_url = "https://github.com/%s/%s/releases/download/%s/%s-%s-checksum.sha256" % (owner, proj, version, proj, version)
else:
print("No manifest match")
return system
print("No manifest match")
return system

# check if we have already downloaded and parsed that manifest
manifest_index = 0
Expand Down Expand Up @@ -84,6 +78,12 @@ def replace_if_xz(system):
release_manifests.append(manifest)

# find the new file in the list and get it's size and checksum
for file in release_manifests[manifest_index]['files']:
if file['name'] == new_signed_name:
print("Found a signed version of the file")
new_url = new_signed_url
new_name = new_signed_name
break
for file in release_manifests[manifest_index]['files']:
if file['name'] == new_name:
system['url'] = new_url
Expand Down

0 comments on commit 43a1c25

Please sign in to comment.