about summary refs log tree commit diff
path: root/pkgs/applications/networking/browsers
diff options
context:
space:
mode:
authornetworkException <git@nwex.de>2023-10-21 12:58:07 +0200
committernetworkException <git@nwex.de>2023-10-21 15:16:58 +0200
commit6e4796d619a52329db6ae9722a8ce8c4a037bcf1 (patch)
tree663d86c64ac75ad7815d06171e7a27f4667724d3 /pkgs/applications/networking/browsers
parentc0d50489613fff2cdc248efb04fa85612d228289 (diff)
chromium,electron: always output sri hashes from update scripts
this patch changes the update script to always output sri hashes
for all hashes written to chromium's `upstream-info.nix` and
electron's `info.json`. the keys have also been renamed from `sha256`
to `hash`.
Diffstat (limited to 'pkgs/applications/networking/browsers')
-rwxr-xr-xpkgs/applications/networking/browsers/chromium/update.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/pkgs/applications/networking/browsers/chromium/update.py b/pkgs/applications/networking/browsers/chromium/update.py
index fd8f367784059..60267331cc275 100755
--- a/pkgs/applications/networking/browsers/chromium/update.py
+++ b/pkgs/applications/networking/browsers/chromium/update.py
@@ -59,9 +59,9 @@ def prefetch_src_sri_hash(attr_path, version):
 
 def nix_prefetch_url(url, algo='sha256'):
     """Prefetches the content of the given URL."""
-    print(f'nix-prefetch-url {url}')
-    out = subprocess.check_output(['nix-prefetch-url', '--type', algo, url])
-    return out.decode('utf-8').rstrip()
+    print(f'nix store prefetch-file {url}')
+    out = subprocess.check_output(['nix', 'store', 'prefetch-file', '--json', '--hash-type', algo, url])
+    return json.loads(out)['hash']
 
 
 def nix_prefetch_git(url, rev):
@@ -96,9 +96,9 @@ def get_chromedriver(channel):
 
         return {
             'version': channel['version'],
-            'sha256_linux': nix_prefetch_url(get_chromedriver_url('linux64')),
-            'sha256_darwin': nix_prefetch_url(get_chromedriver_url('mac-x64')),
-            'sha256_darwin_aarch64': nix_prefetch_url(get_chromedriver_url('mac-arm64'))
+            'hash_linux': nix_prefetch_url(get_chromedriver_url('linux64')),
+            'hash_darwin': nix_prefetch_url(get_chromedriver_url('mac-x64')),
+            'hash_darwin_aarch64': nix_prefetch_url(get_chromedriver_url('mac-arm64'))
         }
 
 
@@ -113,7 +113,7 @@ def get_channel_dependencies(version):
             'version': datetime.fromisoformat(gn['date']).date().isoformat(),
             'url': gn['url'],
             'rev': gn['rev'],
-            'sha256': gn['sha256']
+            'hash': gn['hash']
         }
     }
 
@@ -222,11 +222,11 @@ with urlopen(RELEASES_URL) as resp:
             google_chrome_suffix = channel_name
 
         try:
-            channel['sha256'] = prefetch_src_sri_hash(
+            channel['hash'] = prefetch_src_sri_hash(
                 channel_name_to_attr_name(channel_name),
                 release["version"]
             )
-            channel['sha256bin64'] = nix_prefetch_url(
+            channel['hash_deb_amd64'] = nix_prefetch_url(
                 f'{DEB_URL}/google-chrome-{google_chrome_suffix}/' +
                 f'google-chrome-{google_chrome_suffix}_{release["version"]}-1_amd64.deb')
         except subprocess.CalledProcessError:
@@ -241,7 +241,7 @@ with urlopen(RELEASES_URL) as resp:
             ungoogled_repo_url = 'https://github.com/ungoogled-software/ungoogled-chromium.git'
             channel['deps']['ungoogled-patches'] = {
                 'rev': release['ungoogled_tag'],
-                'sha256': nix_prefetch_git(ungoogled_repo_url, release['ungoogled_tag'])['sha256']
+                'hash': nix_prefetch_git(ungoogled_repo_url, release['ungoogled_tag'])['hash']
             }
             with open(UNGOOGLED_FLAGS_PATH, 'w') as out:
                 out.write(get_ungoogled_chromium_gn_flags(release['ungoogled_tag']))