ungoogled-chromium: Support automatic updates via update.py
This commit is contained in:
parent
9b846b9600
commit
94bee10904
2 changed files with 38 additions and 9 deletions
|
@ -67,9 +67,9 @@ def get_matching_chromedriver(version):
|
|||
}
|
||||
|
||||
|
||||
def get_channel_dependencies(channel):
|
||||
def get_channel_dependencies(version):
|
||||
"""Gets all dependencies for the given Chromium version."""
|
||||
deps = get_file_revision(channel['version'], 'DEPS')
|
||||
deps = get_file_revision(version, 'DEPS')
|
||||
gn_pattern = b"'gn_version': 'git_revision:([0-9a-f]{40})'"
|
||||
gn_commit = re.search(gn_pattern, deps).group(1).decode()
|
||||
gn = nix_prefetch_git('https://gn.googlesource.com/gn', gn_commit)
|
||||
|
@ -82,6 +82,35 @@ def get_channel_dependencies(channel):
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
def get_latest_ungoogled_chromium_tag():
|
||||
"""Returns the latest ungoogled-chromium tag using the GitHub API."""
|
||||
api_tag_url = 'https://api.github.com/repos/Eloston/ungoogled-chromium/tags?per_page=1'
|
||||
with urlopen(api_tag_url) as http_response:
|
||||
tag_data = json.load(http_response)
|
||||
return tag_data[0]['name']
|
||||
|
||||
|
||||
def get_ungoogled_chromium_channel():
|
||||
"""Returns a dictionary for the ungoogled-chromium channel."""
|
||||
latest_tag = get_latest_ungoogled_chromium_tag()
|
||||
version = latest_tag.split('-')[0]
|
||||
if version == last_channels['ungoogled-chromium']['version']:
|
||||
# No update available -> keep the cached information (no refetching required):
|
||||
return last_channels['ungoogled-chromium']
|
||||
channel = {
|
||||
'version': version,
|
||||
'sha256': nix_prefetch_url(f'{BUCKET_URL}/chromium-{version}.tar.xz'),
|
||||
'deps': get_channel_dependencies(version)
|
||||
}
|
||||
repo_url = 'https://github.com/Eloston/ungoogled-chromium.git'
|
||||
channel['deps']['ungoogled-patches'] = {
|
||||
'rev': latest_tag,
|
||||
'sha256': nix_prefetch_git(repo_url, latest_tag)['sha256']
|
||||
}
|
||||
return channel
|
||||
|
||||
|
||||
channels = {}
|
||||
last_channels = load_json(JSON_PATH)
|
||||
|
||||
|
@ -117,7 +146,7 @@ with urlopen(HISTORY_URL) as resp:
|
|||
# the next one.
|
||||
continue
|
||||
|
||||
channel['deps'] = get_channel_dependencies(channel)
|
||||
channel['deps'] = get_channel_dependencies(channel['version'])
|
||||
if channel_name == 'stable':
|
||||
channel['chromedriver'] = get_matching_chromedriver(channel['version'])
|
||||
|
||||
|
@ -138,8 +167,8 @@ with open(JSON_PATH, 'w') as out:
|
|||
return 3
|
||||
print(f'Error: Unexpected channel: {channel_name}', file=sys.stderr)
|
||||
sys.exit(1)
|
||||
# Keep ungoogled-chromium unchanged:
|
||||
channels['ungoogled-chromium'] = last_channels['ungoogled-chromium']
|
||||
# Get the special ungoogled-chromium channel:
|
||||
channels['ungoogled-chromium'] = get_ungoogled_chromium_channel()
|
||||
sorted_channels = OrderedDict(sorted(channels.items(), key=get_channel_key))
|
||||
json.dump(sorted_channels, out, indent=2)
|
||||
out.write('\n')
|
||||
|
|
|
@ -47,15 +47,15 @@
|
|||
"version": "87.0.4280.88",
|
||||
"sha256": "1h09g9b2zxad85vd146ymvg3w2kpngpi78yig3dn1vrmhwr4aiiy",
|
||||
"deps": {
|
||||
"ungoogled-patches": {
|
||||
"rev": "87.0.4280.88-1",
|
||||
"sha256": "0w2137w8hfcgl6f938hqnb4ffp33v5r8vdzxrvs814w7dszkiqgg"
|
||||
},
|
||||
"gn": {
|
||||
"version": "2020-09-09",
|
||||
"url": "https://gn.googlesource.com/gn",
|
||||
"rev": "e002e68a48d1c82648eadde2f6aafa20d08c36f2",
|
||||
"sha256": "0x4c7amxwzxs39grqs3dnnz0531mpf1p75niq7zhinyfqm86i4dk"
|
||||
},
|
||||
"ungoogled-patches": {
|
||||
"rev": "87.0.4280.88-1",
|
||||
"sha256": "0w2137w8hfcgl6f938hqnb4ffp33v5r8vdzxrvs814w7dszkiqgg"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue