Skip to content

Commit

Permalink
chromium: use versionhistory.googleapis.com over omahaproxy.appspot.com
Browse files Browse the repository at this point in the history
Version information previously available at omahaproxy.appspot.com will
have to be retrieved from versionhistory.googleapis.com in the future.

See https://groups.google.com/a/chromium.org/g/chromium-dev/c/uH-nFrOLWtE/m/PhUj_inyAQAJ
See ungoogled-software/ungoogled-chromium#2260
  • Loading branch information
networkException committed Apr 21, 2023
1 parent 6f0cdea commit 93357be
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 21 deletions.
12 changes: 11 additions & 1 deletion pkgs/applications/networking/browsers/chromium/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
- Release updates: https://chromereleases.googleblog.com/
- Available as Atom or RSS feed (filter for
"Stable Channel Update for Desktop")
- Channel overview: https://omahaproxy.appspot.com/
- Release API: https://developer.chrome.com/docs/versionhistory/guide/
- Release schedule: https://chromiumdash.appspot.com/schedule

# Updating Chromium
Expand All @@ -39,6 +39,16 @@ update `upstream-info.json`. After updates it is important to test at least
`nixosTests.chromium` (or basic manual testing) and `google-chrome` (which
reuses `upstream-info.json`).

Note: Due to the script downloading many large tarballs it might be
necessary to adjust the available tmpfs size (it defaults to 10% of the
systems memory)

```nix
services.logind.extraConfig = ''
RuntimeDirectorySize=4G
'';
```

Note: The source tarball is often only available a few hours after the release
was announced. The CI/CD status can be tracked here:
- https://ci.chromium.org/p/infra/builders/cron/publish_tarball
Expand Down
39 changes: 19 additions & 20 deletions pkgs/applications/networking/browsers/chromium/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from os.path import abspath, dirname
from urllib.request import urlopen

HISTORY_URL = 'https://omahaproxy.appspot.com/history?os=linux'
RELEASES_URL = 'https://versionhistory.googleapis.com/v1/chrome/platforms/linux/channels/all/versions/all/releases'
DEB_URL = 'https://dl.google.com/linux/chrome/deb/pool/main/g'
BUCKET_URL = 'https://commondatastorage.googleapis.com/chromium-browser-official'

Expand Down Expand Up @@ -103,7 +103,7 @@ def get_latest_ungoogled_chromium_build():
tag = get_latest_ungoogled_chromium_tag()
version = tag.split('-')[0]
return {
'channel': 'ungoogled-chromium',
'name': 'chrome/platforms/linux/channels/ungoogled-chromium/versions/',
'version': version,
'ungoogled_tag': tag
}
Expand Down Expand Up @@ -159,27 +159,26 @@ def print_updates(channels_old, channels_new):
last_channels = load_json(JSON_PATH)


print(f'GET {HISTORY_URL}', file=sys.stderr)
with urlopen(HISTORY_URL) as resp:
builds = csv.DictReader(iterdecode(resp, 'utf-8'))
builds = list(builds)
builds.append(get_latest_ungoogled_chromium_build())
for build in builds:
channel_name = build['channel']
print(f'GET {RELEASES_URL}', file=sys.stderr)
with urlopen(RELEASES_URL) as resp:
releases = json.load(resp)['releases']
releases.append(get_latest_ungoogled_chromium_build())
for release in releases:
channel_name = re.findall("chrome\/platforms\/.*\/channels\/(.*)\/versions\/", release['name'])[0]

# If we've already found a newer build for this channel, we're
# If we've already found a newer release for this channel, we're
# no longer interested in it.
if channel_name in channels:
continue

# If we're back at the last build we used, we don't need to
# If we're back at the last release we used, we don't need to
# keep going -- there's no new version available, and we can
# just reuse the info from last time.
if build['version'] == last_channels[channel_name]['version']:
if release['version'] == last_channels[channel_name]['version']:
channels[channel_name] = last_channels[channel_name]
continue

channel = {'version': build['version']}
channel = {'version': release['version']}
if channel_name == 'dev':
google_chrome_suffix = 'unstable'
elif channel_name == 'ungoogled-chromium':
Expand All @@ -188,21 +187,21 @@ def print_updates(channels_old, channels_new):
google_chrome_suffix = channel_name

try:
channel['sha256'] = nix_prefetch_url(f'{BUCKET_URL}/chromium-{build["version"]}.tar.xz')
channel['sha256'] = nix_prefetch_url(f'{BUCKET_URL}/chromium-{release["version"]}.tar.xz')
channel['sha256bin64'] = nix_prefetch_url(
f'{DEB_URL}/google-chrome-{google_chrome_suffix}/' +
f'google-chrome-{google_chrome_suffix}_{build["version"]}-1_amd64.deb')
f'google-chrome-{google_chrome_suffix}_{release["version"]}-1_amd64.deb')
except subprocess.CalledProcessError:
if (channel_name == 'ungoogled-chromium' and 'sha256' in channel and
build['version'].split('.')[0] == last_channels['stable']['version'].split('.')[0]):
release['version'].split('.')[0] == last_channels['stable']['version'].split('.')[0]):
# Sometimes ungoogled-chromium is updated to a newer tag than
# the latest stable Chromium version. In this case we'll set
# sha256bin64 to null and the Nixpkgs code will fall back to
# the latest stable Google Chrome (only required for
# Widevine/DRM which is disabled by default):
channel['sha256bin64'] = None
else:
# This build isn't actually available yet. Continue to
# This release isn't actually available yet. Continue to
# the next one.
continue

Expand All @@ -212,11 +211,11 @@ def print_updates(channels_old, channels_new):
elif channel_name == 'ungoogled-chromium':
ungoogled_repo_url = 'https://github.com/Eloston/ungoogled-chromium.git'
channel['deps']['ungoogled-patches'] = {
'rev': build['ungoogled_tag'],
'sha256': nix_prefetch_git(ungoogled_repo_url, build['ungoogled_tag'])['sha256']
'rev': release['ungoogled_tag'],
'sha256': nix_prefetch_git(ungoogled_repo_url, release['ungoogled_tag'])['sha256']
}
with open(UNGOOGLED_FLAGS_PATH, 'w') as out:
out.write(get_ungoogled_chromium_gn_flags(build['ungoogled_tag']))
out.write(get_ungoogled_chromium_gn_flags(release['ungoogled_tag']))

channels[channel_name] = channel

Expand Down

0 comments on commit 93357be

Please sign in to comment.