From 81c33c7969cc63ad886fd9253ed1f3935ff4d455 Mon Sep 17 00:00:00 2001 From: Michael Weiss Date: Thu, 10 Jun 2021 19:37:39 +0200 Subject: [PATCH 01/13] chromium: Minimize the diff to nixos-unstable Keeping the diff minimal makes backporting updates easier. This is basically e9e5f5f84de backported for Chromium. --- pkgs/applications/networking/browsers/chromium/common.nix | 6 +++--- .../networking/browsers/google-chrome/default.nix | 4 ++-- pkgs/top-level/all-packages.nix | 1 + 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/pkgs/applications/networking/browsers/chromium/common.nix b/pkgs/applications/networking/browsers/chromium/common.nix index e24f15179f6..db554584392 100644 --- a/pkgs/applications/networking/browsers/chromium/common.nix +++ b/pkgs/applications/networking/browsers/chromium/common.nix @@ -9,7 +9,7 @@ , python2, python3, perl, pkg-config , nspr, systemd, libkrb5 -, util-linux, alsaLib +, util-linux, alsa-lib , bison, gperf , glib, gtk3, dbus-glib , glibc @@ -143,7 +143,7 @@ let buildInputs = defaultDependencies ++ [ nspr nss systemd - util-linux alsaLib + util-linux alsa-lib bison gperf libkrb5 glib gtk3 dbus-glib libXScrnSaver libXcursor libXtst libxshmfence libGLU libGL @@ -205,7 +205,7 @@ let substituteInPlace services/audio/audio_sandbox_hook_linux.cc \ --replace \ '/usr/share/alsa/' \ - '${alsaLib}/share/alsa/' \ + '${alsa-lib}/share/alsa/' \ --replace \ '/usr/lib/x86_64-linux-gnu/gconv/' \ '${glibc}/lib/gconv/' \ diff --git a/pkgs/applications/networking/browsers/google-chrome/default.nix b/pkgs/applications/networking/browsers/google-chrome/default.nix index e6e7629ea25..61d304becfd 100644 --- a/pkgs/applications/networking/browsers/google-chrome/default.nix +++ b/pkgs/applications/networking/browsers/google-chrome/default.nix @@ -3,7 +3,7 @@ # Linked dynamic libraries. , glib, fontconfig, freetype, pango, cairo, libX11, libXi, atk, gconf, nss, nspr , libXcursor, libXext, libXfixes, libXrender, libXScrnSaver, libXcomposite, libxcb -, alsaLib, libXdamage, libXtst, libXrandr, libxshmfence, expat, cups +, alsa-lib, libXdamage, libXtst, libXrandr, libxshmfence, expat, cups , dbus, gtk3, gdk-pixbuf, gcc-unwrapped, at-spi2-atk, at-spi2-core , libkrb5, libdrm, mesa , libxkbcommon, wayland # ozone/wayland @@ -59,7 +59,7 @@ let deps = [ glib fontconfig freetype pango cairo libX11 libXi atk gconf nss nspr libXcursor libXext libXfixes libXrender libXScrnSaver libXcomposite libxcb - alsaLib libXdamage libXtst libXrandr libxshmfence expat cups + alsa-lib libXdamage libXtst libXrandr libxshmfence expat cups dbus gdk-pixbuf gcc-unwrapped.lib systemd libexif pciutils diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index c48362d79d0..d7828347b8b 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -19970,6 +19970,7 @@ in alsa-firmware = callPackage ../os-specific/linux/alsa-firmware { }; alsaLib = callPackage ../os-specific/linux/alsa-lib { }; + alsa-lib = alsaLib; # New name on nixos-unstable alsaPlugins = callPackage ../os-specific/linux/alsa-plugins { }; From 4dbbc50b30b233d9f6fc00eacd986ab26bd1e927 Mon Sep 17 00:00:00 2001 From: Michael Weiss Date: Sun, 25 Jul 2021 13:53:59 +0200 Subject: [PATCH 02/13] chromium: Merge the installPhase command strings This wasn't done in 97570d30c7f to allow reusing chromiumBeta builds (without having to perform any changes) in the meantime. (cherry picked from commit 9ac31885527059cfc150343e576216e712408d1b) --- pkgs/applications/networking/browsers/chromium/browser.nix | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pkgs/applications/networking/browsers/chromium/browser.nix b/pkgs/applications/networking/browsers/chromium/browser.nix index e17f8ef7534..a86a82fcb5f 100644 --- a/pkgs/applications/networking/browsers/chromium/browser.nix +++ b/pkgs/applications/networking/browsers/chromium/browser.nix @@ -16,6 +16,7 @@ mkChromiumDerivation (base: rec { cp -v "$buildPath/"*.so "$buildPath/"*.pak "$buildPath/"*.bin "$libExecPath/" cp -v "$buildPath/icudtl.dat" "$libExecPath/" cp -vLR "$buildPath/locales" "$buildPath/resources" "$libExecPath/" + cp -v "$buildPath/crashpad_handler" "$libExecPath/" cp -v "$buildPath/chrome" "$libExecPath/$packageName" # Swiftshader @@ -62,9 +63,7 @@ mkChromiumDerivation (base: rec { -e '/\[Desktop Entry\]/a\' \ -e 'StartupWMClass=chromium-browser' \ $out/share/applications/chromium-browser.desktop - '' + '' - cp -v "$buildPath/crashpad_handler" "$libExecPath/" - ''; # TODO: Merge + ''; passthru = { inherit sandboxExecutableName; }; From cb026a4a09693e18f8bca400357817e641a4e231 Mon Sep 17 00:00:00 2001 From: Michael Weiss Date: Tue, 27 Jul 2021 19:46:41 +0200 Subject: [PATCH 03/13] chromiumDev: Fix the build Our system FFmpeg version is too outdated and Snappy causes a linking failure (I didn't have time to investigate yet). Hopefully we can revert this before the stable release of M93. (cherry picked from commit bd22d2425cb7f14b1f98f7432e6ad38208609adb) --- pkgs/applications/networking/browsers/chromium/common.nix | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/networking/browsers/chromium/common.nix b/pkgs/applications/networking/browsers/chromium/common.nix index db554584392..203875d1628 100644 --- a/pkgs/applications/networking/browsers/chromium/common.nix +++ b/pkgs/applications/networking/browsers/chromium/common.nix @@ -75,15 +75,16 @@ let in attrs: concatStringsSep " " (attrValues (mapAttrs toFlag attrs)); # https://source.chromium.org/chromium/chromium/src/+/master:build/linux/unbundle/replace_gn_files.py - gnSystemLibraries = [ + gnSystemLibraries = lib.optionals (!chromiumVersionAtLeast "93") [ "ffmpeg" + "snappy" + ] ++ [ "flac" "libjpeg" "libpng" "libwebp" "libxslt" "opus" - "snappy" "zlib" ]; From 1ffa4bbbd67a6d1616b98481de9ec9ad4a97cbdf Mon Sep 17 00:00:00 2001 From: Michael Weiss Date: Tue, 27 Jul 2021 20:20:25 +0200 Subject: [PATCH 04/13] chromiumDev: 93.0.4577.8 -> 93.0.4577.15 (cherry picked from commit 68adc7b81c4743f3314aa720c2ac2a0e6d7e44e1) --- .../networking/browsers/chromium/upstream-info.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/applications/networking/browsers/chromium/upstream-info.json b/pkgs/applications/networking/browsers/chromium/upstream-info.json index d53522cd448..7b1154a8423 100644 --- a/pkgs/applications/networking/browsers/chromium/upstream-info.json +++ b/pkgs/applications/networking/browsers/chromium/upstream-info.json @@ -31,9 +31,9 @@ } }, "dev": { - "version": "93.0.4577.8", - "sha256": "1x6i5bmcnj8bkpcb9gcyd1m9nzpq206yyprxrnpak117k7abr2b1", - "sha256bin64": "0qjfb9jxr2gmwb1dsvl6yzz06vsjny2l3icrsdcm0pl6r6davk2w", + "version": "93.0.4577.15", + "sha256": "07gbpa1z6cnbmv8008y92ldg53w48rjx0slvgsrw4gk9cnvmnpz0", + "sha256bin64": "0sb3m2mbq6g3mnps7g6xziziwv6sng34410ww5jyx82mw0q0sxig", "deps": { "gn": { "version": "2021-07-08", From e77d77484a844cc67e1a4d513ea95f593c66e0e4 Mon Sep 17 00:00:00 2001 From: Michael Weiss Date: Thu, 29 Jul 2021 23:09:58 +0200 Subject: [PATCH 05/13] chromiumDev: 93.0.4577.15 -> 93.0.4577.18 (cherry picked from commit 7f8de3536ab224357110274441c209f8291a6cbd) --- .../networking/browsers/chromium/upstream-info.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/applications/networking/browsers/chromium/upstream-info.json b/pkgs/applications/networking/browsers/chromium/upstream-info.json index 7b1154a8423..944b2a9350b 100644 --- a/pkgs/applications/networking/browsers/chromium/upstream-info.json +++ b/pkgs/applications/networking/browsers/chromium/upstream-info.json @@ -31,9 +31,9 @@ } }, "dev": { - "version": "93.0.4577.15", - "sha256": "07gbpa1z6cnbmv8008y92ldg53w48rjx0slvgsrw4gk9cnvmnpz0", - "sha256bin64": "0sb3m2mbq6g3mnps7g6xziziwv6sng34410ww5jyx82mw0q0sxig", + "version": "93.0.4577.18", + "sha256": "1h1ppyizj5vbnrv11iy9vlcpcv8mgb9r8m2zmz6vp7q1ch6w0w4x", + "sha256bin64": "14cw0k4gsilybg7gbbbmck62i0prq5rm6hwqalmmmiqcldrw05mq", "deps": { "gn": { "version": "2021-07-08", From aa0e9cfd1e4e346c484d44aa8e4776e402f8f602 Mon Sep 17 00:00:00 2001 From: Michael Weiss Date: Fri, 30 Jul 2021 09:17:18 +0200 Subject: [PATCH 06/13] chromiumBeta: 92.0.4515.107 -> 93.0.4577.18 (cherry picked from commit d7ab681b7aa525b4c3081473ab68dd13ae85c7b2) --- .../networking/browsers/chromium/upstream-info.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pkgs/applications/networking/browsers/chromium/upstream-info.json b/pkgs/applications/networking/browsers/chromium/upstream-info.json index 944b2a9350b..7b7254ea21b 100644 --- a/pkgs/applications/networking/browsers/chromium/upstream-info.json +++ b/pkgs/applications/networking/browsers/chromium/upstream-info.json @@ -18,15 +18,15 @@ } }, "beta": { - "version": "92.0.4515.107", - "sha256": "04khamgxwzgbm2rn7is53j5g55vm5qfyz7zwxqc51sd429jsqlbf", - "sha256bin64": "179i18lckd85i6cc60mqpvv2jqdshc338m686yackdgz9qjrrlwd", + "version": "93.0.4577.18", + "sha256": "1h1ppyizj5vbnrv11iy9vlcpcv8mgb9r8m2zmz6vp7q1ch6w0w4x", + "sha256bin64": "1s5qj0pd79qbchq3awhxc86l9vmi6304z7sd9ls9f8q138789cha", "deps": { "gn": { - "version": "2021-05-07", + "version": "2021-07-08", "url": "https://gn.googlesource.com/gn", - "rev": "39a87c0b36310bdf06b692c098f199a0d97fc810", - "sha256": "0x63jr5hssm9dl6la4q5ahy669k4gxvbapqxi5w32vv107jrj8v4" + "rev": "24e2f7df92641de0351a96096fb2c490b2436bb8", + "sha256": "1lwkyhfhw0zd7daqz466n7x5cddf0danr799h4jg3s0yvd4galjl" } } }, From 65b3f3f1868155795f3bca2c0b09127acb5066a4 Mon Sep 17 00:00:00 2001 From: Michael Weiss Date: Sat, 31 Jul 2021 12:36:49 +0200 Subject: [PATCH 07/13] chromium: Restructure gnFlags This doesn't cause any rebuilds because we use a set but should make it a bit easier to understand what's going on. This also moves two flags that where incorrectly in "optionalAttrs pulseSupport" (enabled by default) out of there. The native client deprecation is stated here: https://developer.chrome.com/docs/native-client/ (cherry picked from commit 555c3afaf2b17af6ad06ae82b545ca06e252bcd1) --- .../networking/browsers/chromium/common.nix | 50 ++++++++++--------- 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/pkgs/applications/networking/browsers/chromium/common.nix b/pkgs/applications/networking/browsers/chromium/common.nix index 203875d1628..10c7523241f 100644 --- a/pkgs/applications/networking/browsers/chromium/common.nix +++ b/pkgs/applications/networking/browsers/chromium/common.nix @@ -244,25 +244,12 @@ let ''; gnFlags = mkGnFlags ({ + # Main build and toolchain settings: is_official_build = true; custom_toolchain = "//build/toolchain/linux/unbundle:default"; host_toolchain = "//build/toolchain/linux/unbundle:default"; - system_wayland_scanner_path = "${wayland}/bin/wayland-scanner"; - use_sysroot = false; - use_gnome_keyring = gnomeKeyringSupport; - use_gio = gnomeSupport; - # ninja: error: '../../native_client/toolchain/linux_x86/pnacl_newlib/bin/x86_64-nacl-objcopy', - # needed by 'nacl_irt_x86_64.nexe', missing and no known rule to make it - enable_nacl = false; - # Enabling the Widevine component here doesn't affect whether we can - # redistribute the chromium package; the Widevine component is either - # added later in the wrapped -wv build or downloaded from Google. - enable_widevine = true; - use_cups = cupsSupport; - # Provides the enable-webrtc-pipewire-capturer flag to support Wayland screen capture. - rtc_use_pipewire = true; - + system_wayland_scanner_path = "${wayland}/bin/wayland-scanner"; treat_warnings_as_errors = false; clang_use_chrome_plugins = false; blink_symbol_level = 0; @@ -273,6 +260,31 @@ let # Note: The API key is for NixOS/nixpkgs use ONLY. # For your own distribution, please get your own set of keys. google_api_key = "AIzaSyDGi15Zwl11UNe6Y-5XW_upsfyw31qwZPI"; + + # Optional features: + use_cups = cupsSupport; + use_gio = gnomeSupport; + use_gnome_keyring = gnomeKeyringSupport; + + # Feature overrides: + # Native Client support was deprecated in 2020 and support will end in June 2021: + enable_nacl = false; + # Enabling the Widevine component here doesn't affect whether we can + # redistribute the chromium package; the Widevine component is either + # added later in the wrapped -wv build or downloaded from Google: + enable_widevine = true; + # Provides the enable-webrtc-pipewire-capturer flag to support Wayland screen capture: + rtc_use_pipewire = true; + + # TODOs: + # Disable PGO (defaults to 2 since M89) because it fails without additional changes: + # error: Could not read profile ../../chrome/build/pgo_profiles/chrome-linux-master-1610647094-405a32bcf15e5a84949640f99f84a5b9f61e2f2e.profdata: Unsupported instrumentation profile format version + chrome_pgo_phase = 0; # TODO + # Disable build with TFLite library because it fails without additional changes: + # ninja: error: '../../chrome/test/data/simple_test.tflite', needed by 'test_data/simple_test.tflite', missing and no known rule to make it + # Note: chrome/test/data/simple_test.tflite is in the Git repository but not in chromium-90.0.4400.8.tar.xz + # See also chrome/services/machine_learning/README.md + build_with_tflite_lib = false; # TODO } // optionalAttrs proprietaryCodecs { # enable support for the H.264 codec proprietary_codecs = true; @@ -281,14 +293,6 @@ let } // optionalAttrs pulseSupport { use_pulseaudio = true; link_pulseaudio = true; - # Disable PGO (defaults to 2 since M89) because it fails without additional changes: - # error: Could not read profile ../../chrome/build/pgo_profiles/chrome-linux-master-1610647094-405a32bcf15e5a84949640f99f84a5b9f61e2f2e.profdata: Unsupported instrumentation profile format version - chrome_pgo_phase = 0; - # Disable build with TFLite library because it fails without additional changes: - # ninja: error: '../../chrome/test/data/simple_test.tflite', needed by 'test_data/simple_test.tflite', missing and no known rule to make it - # Note: chrome/test/data/simple_test.tflite is in the Git repository but not in chromium-90.0.4400.8.tar.xz - # See also chrome/services/machine_learning/README.md - build_with_tflite_lib = false; } // optionalAttrs ungoogled { chrome_pgo_phase = 0; enable_hangout_services_extension = false; From 701cb526073a91b1c0d6e3ea01550bb6c4551b27 Mon Sep 17 00:00:00 2001 From: Michael Weiss Date: Sun, 1 Aug 2021 09:06:53 +0200 Subject: [PATCH 08/13] chromium: Drop two gn overrides that are not required anymore The chromium and chromiumBeta builds still succeed. (cherry picked from commit 2682531c67cefc5110adfa546bfdc66e6374e91f) --- .../networking/browsers/chromium/common.nix | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/pkgs/applications/networking/browsers/chromium/common.nix b/pkgs/applications/networking/browsers/chromium/common.nix index 10c7523241f..bddd2a4a9fb 100644 --- a/pkgs/applications/networking/browsers/chromium/common.nix +++ b/pkgs/applications/networking/browsers/chromium/common.nix @@ -275,16 +275,6 @@ let enable_widevine = true; # Provides the enable-webrtc-pipewire-capturer flag to support Wayland screen capture: rtc_use_pipewire = true; - - # TODOs: - # Disable PGO (defaults to 2 since M89) because it fails without additional changes: - # error: Could not read profile ../../chrome/build/pgo_profiles/chrome-linux-master-1610647094-405a32bcf15e5a84949640f99f84a5b9f61e2f2e.profdata: Unsupported instrumentation profile format version - chrome_pgo_phase = 0; # TODO - # Disable build with TFLite library because it fails without additional changes: - # ninja: error: '../../chrome/test/data/simple_test.tflite', needed by 'test_data/simple_test.tflite', missing and no known rule to make it - # Note: chrome/test/data/simple_test.tflite is in the Git repository but not in chromium-90.0.4400.8.tar.xz - # See also chrome/services/machine_learning/README.md - build_with_tflite_lib = false; # TODO } // optionalAttrs proprietaryCodecs { # enable support for the H.264 codec proprietary_codecs = true; From 3ababf6d04358aed6953a68af74874c1420292bc Mon Sep 17 00:00:00 2001 From: Michael Weiss Date: Sun, 1 Aug 2021 18:41:56 +0200 Subject: [PATCH 09/13] chromium: Drop our closure_compiler patch for Java Hopefully the Java dependency can be dropped soon: https://bugs.chromium.org/p/chromium/issues/detail?id=1192875#c5 (cherry picked from commit 8505750ac89a1aee154038f6ac9c30cbdd221cfe) --- .../networking/browsers/chromium/common.nix | 6 ++-- ...-Use-the-Java-binary-from-the-system.patch | 31 ------------------- 2 files changed, 2 insertions(+), 35 deletions(-) delete mode 100644 pkgs/applications/networking/browsers/chromium/patches/closure_compiler-Use-the-Java-binary-from-the-system.patch diff --git a/pkgs/applications/networking/browsers/chromium/common.nix b/pkgs/applications/networking/browsers/chromium/common.nix index bddd2a4a9fb..269645977cb 100644 --- a/pkgs/applications/networking/browsers/chromium/common.nix +++ b/pkgs/applications/networking/browsers/chromium/common.nix @@ -42,7 +42,6 @@ buildFun: with lib; let - jre = jre8; # TODO: remove override https://github.com/NixOS/nixpkgs/pull/89731 python2WithPackages = python2.withPackages(ps: with ps; [ ply jinja2 setuptools ]); @@ -150,7 +149,6 @@ let libXScrnSaver libXcursor libXtst libxshmfence libGLU libGL mesa # required for libgbm pciutils protobuf speechd libXdamage at-spi2-core - jre pipewire libva libdrm wayland mesa.drivers libxkbcommon @@ -165,7 +163,6 @@ let ./patches/widevine-79.patch # For bundling Widevine (DRM), might be replaceable via bundle_widevine_cdm=true in gnFlags # Fix the build by adding a missing dependency (s. https://crbug.com/1197837): ./patches/fix-missing-atspi2-dependency.patch - ./patches/closure_compiler-Use-the-Java-binary-from-the-system.patch ] ++ lib.optionals (chromiumVersionAtLeast "93") [ # We need to revert this patch to build M93 with LLVM 12. (githubPatch { @@ -227,9 +224,10 @@ let sed -i -e 's,/usr,/run/current-system/sw,' chrome/common/chrome_paths.cc patchShebangs . - # use our own nodejs + # Link to our own Node.js and Java (required during the build): mkdir -p third_party/node/linux/node-linux-x64/bin ln -s "$(command -v node)" third_party/node/linux/node-linux-x64/bin/node + ln -s "${jre8}/bin/java" third_party/jdk/current/bin/ # Allow building against system libraries in official builds sed -i 's/OFFICIAL_BUILD/GOOGLE_CHROME_BUILD/' tools/generate_shim_headers/generate_shim_headers.py diff --git a/pkgs/applications/networking/browsers/chromium/patches/closure_compiler-Use-the-Java-binary-from-the-system.patch b/pkgs/applications/networking/browsers/chromium/patches/closure_compiler-Use-the-Java-binary-from-the-system.patch deleted file mode 100644 index f6b10b679c7..00000000000 --- a/pkgs/applications/networking/browsers/chromium/patches/closure_compiler-Use-the-Java-binary-from-the-system.patch +++ /dev/null @@ -1,31 +0,0 @@ -From e031b8be0fb2a22f953c034cdf08ca9befe130d2 Mon Sep 17 00:00:00 2001 -From: Michael Weiss -Date: Sun, 11 Apr 2021 18:05:12 +0200 -Subject: [PATCH] closure_compiler: Use the Java binary from the system - -The bundled Java binary (third_party/jdk/current/bin/java) is missing in -the tarball and we want to use the one from the system anyway. -This reverts part of [0]. - -[0]: https://chromium-review.googlesource.com/c/chromium/src/+/2778794 ---- - third_party/closure_compiler/compiler.py | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - -diff --git a/third_party/closure_compiler/compiler.py b/third_party/closure_compiler/compiler.py -index 75690ceb9749..7b9c76f74290 100755 ---- a/third_party/closure_compiler/compiler.py -+++ b/third_party/closure_compiler/compiler.py -@@ -13,8 +13,7 @@ import subprocess - - - _CURRENT_DIR = os.path.join(os.path.dirname(__file__)) --_JAVA_PATH = os.path.join(_CURRENT_DIR, "..", "jdk", "current", "bin", "java") --assert os.path.isfile(_JAVA_PATH), "java only allowed in android builds" -+_JAVA_PATH = "java" - - class Compiler(object): - """Runs the Closure compiler on given source files to typecheck them --- -2.20.1 - From 1361a07a95010609564857839ff5b92ff95d953b Mon Sep 17 00:00:00 2001 From: Felix Buehler Date: Tue, 3 Aug 2021 23:22:55 +0200 Subject: [PATCH 10/13] chromium: remove phases (cherry picked from commit 2ae5f1a6b85dbc632ad3a800b2639e633dc6d89e) --- pkgs/applications/networking/browsers/chromium/default.nix | 2 -- 1 file changed, 2 deletions(-) diff --git a/pkgs/applications/networking/browsers/chromium/default.nix b/pkgs/applications/networking/browsers/chromium/default.nix index 33619f27350..c7be4663bbe 100644 --- a/pkgs/applications/networking/browsers/chromium/default.nix +++ b/pkgs/applications/networking/browsers/chromium/default.nix @@ -76,8 +76,6 @@ let src = chromeSrc; - phases = [ "unpackPhase" "patchPhase" "installPhase" "checkPhase" ]; - unpackCmd = let widevineCdmPath = if (channel == "stable" || channel == "ungoogled-chromium") then From c46ea2796f6a2319fc37da7d409df9ecd0129464 Mon Sep 17 00:00:00 2001 From: Michael Weiss Date: Mon, 2 Aug 2021 11:37:36 +0200 Subject: [PATCH 11/13] chromium: update.py: Implement automatic committing of the updates This functionality saves some unnecessary work. (cherry picked from commit e143dc53b23a56621a2da13cf8698bea7521f94a) --- .../networking/browsers/chromium/update.py | 61 +++++++++++++------ 1 file changed, 44 insertions(+), 17 deletions(-) diff --git a/pkgs/applications/networking/browsers/chromium/update.py b/pkgs/applications/networking/browsers/chromium/update.py index d6788fa4192..4f9f53bd02a 100755 --- a/pkgs/applications/networking/browsers/chromium/update.py +++ b/pkgs/applications/networking/browsers/chromium/update.py @@ -3,6 +3,7 @@ """This script automatically updates chromium, google-chrome, chromedriver, and ungoogled-chromium via upstream-info.json.""" +# Usage: ./update.py [--commit] import csv import json @@ -22,6 +23,7 @@ DEB_URL = 'https://dl.google.com/linux/chrome/deb/pool/main/g' BUCKET_URL = 'https://commondatastorage.googleapis.com/chromium-browser-official' JSON_PATH = dirname(abspath(__file__)) + '/upstream-info.json' +COMMIT_MESSAGE_SCRIPT = dirname(abspath(__file__)) + '/get-commit-message.py' def load_json(path): @@ -117,6 +119,21 @@ def channel_name_to_attr_name(channel_name): sys.exit(1) +def get_channel_key(item): + """Orders Chromium channels by their name.""" + channel_name = item[0] + if channel_name == 'stable': + return 0 + if channel_name == 'beta': + return 1 + if channel_name == 'dev': + return 2 + if channel_name == 'ungoogled-chromium': + return 3 + print(f'Error: Unexpected channel: {channel_name}', file=sys.stderr) + sys.exit(1) + + def print_updates(channels_old, channels_new): """Print a summary of the updates.""" print('Updates:') @@ -192,21 +209,31 @@ with urlopen(HISTORY_URL) as resp: channels[channel_name] = channel -with open(JSON_PATH, 'w') as out: - def get_channel_key(item): - """Orders Chromium channels by their name.""" - channel_name = item[0] - if channel_name == 'stable': - return 0 - if channel_name == 'beta': - return 1 - if channel_name == 'dev': - return 2 - if channel_name == 'ungoogled-chromium': - return 3 - print(f'Error: Unexpected channel: {channel_name}', file=sys.stderr) - sys.exit(1) - sorted_channels = OrderedDict(sorted(channels.items(), key=get_channel_key)) - json.dump(sorted_channels, out, indent=2) - out.write('\n') +sorted_channels = OrderedDict(sorted(channels.items(), key=get_channel_key)) +if len(sys.argv) == 2 and sys.argv[1] == '--commit': + for channel_name in sorted_channels.keys(): + version_old = last_channels[channel_name]['version'] + version_new = sorted_channels[channel_name]['version'] + if LooseVersion(version_old) < LooseVersion(version_new): + last_channels[channel_name] = sorted_channels[channel_name] + with open(JSON_PATH, 'w') as out: + json.dump(last_channels, out, indent=2) + out.write('\n') + attr_name = channel_name_to_attr_name(channel_name) + commit_message = f'{attr_name}: {version_old} -> {version_new}' + if channel_name == 'stable': + body = subprocess.check_output([COMMIT_MESSAGE_SCRIPT]).decode('utf-8') + prefix = f'chromium: TODO -> {version_new}' + if not body.startswith(prefix): + print("Error: Couldn't fetch the the release notes for the following update:") + print(commit_message) + sys.exit(1) + body = body.removeprefix(prefix) + commit_message += body + subprocess.run(['git', 'add', JSON_PATH], check=True) + subprocess.run(['git', 'commit', '--file=-'], input=commit_message.encode(), check=True) +else: + with open(JSON_PATH, 'w') as out: + json.dump(sorted_channels, out, indent=2) + out.write('\n') print_updates(last_channels, sorted_channels) From ba876b30f2f149666324393d4fdd84e14a98614f Mon Sep 17 00:00:00 2001 From: Michael Weiss Date: Wed, 4 Aug 2021 00:23:25 +0200 Subject: [PATCH 12/13] chromiumDev: 93.0.4577.18 -> 94.0.4595.0 (cherry picked from commit f9eb20c0a96c01f60a8162d228eede544f7e230e) --- .../networking/browsers/chromium/upstream-info.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pkgs/applications/networking/browsers/chromium/upstream-info.json b/pkgs/applications/networking/browsers/chromium/upstream-info.json index 7b7254ea21b..4c54a13e9ff 100644 --- a/pkgs/applications/networking/browsers/chromium/upstream-info.json +++ b/pkgs/applications/networking/browsers/chromium/upstream-info.json @@ -31,15 +31,15 @@ } }, "dev": { - "version": "93.0.4577.18", - "sha256": "1h1ppyizj5vbnrv11iy9vlcpcv8mgb9r8m2zmz6vp7q1ch6w0w4x", - "sha256bin64": "14cw0k4gsilybg7gbbbmck62i0prq5rm6hwqalmmmiqcldrw05mq", + "version": "94.0.4595.0", + "sha256": "0ksd7vqpbiplbg2xpm566z7p7qp57r27a3pk6ss1qz8v18490092", + "sha256bin64": "1kibyhgwcgby3hnhjdg2vrgbj4dvvbicqlcj4id9761zw1jhz8r4", "deps": { "gn": { - "version": "2021-07-08", + "version": "2021-07-31", "url": "https://gn.googlesource.com/gn", - "rev": "24e2f7df92641de0351a96096fb2c490b2436bb8", - "sha256": "1lwkyhfhw0zd7daqz466n7x5cddf0danr799h4jg3s0yvd4galjl" + "rev": "eea3906f0e2a8d3622080127d2005ff214d51383", + "sha256": "1wc969jrivb502c45wdcbgh0c5888nqxla05is9bimkrk9rqppw3" } } }, From 7ab6adf6086926e0365235e6f2c5131695ab37da Mon Sep 17 00:00:00 2001 From: Michael Weiss Date: Tue, 3 Aug 2021 13:20:15 +0200 Subject: [PATCH 13/13] chromium: get-commit-message.py: Support specifying a version This makes the usage from update.py more robust. It also adds a workaround for [0] which currently lacks a title. [0]: https://chromereleases.googleblog.com/2021/08/the-stable-channel-has-been-updated-to.html (cherry picked from commit 9bc2d82b55549f0786f729fdc080335d8aa4a8a8) --- .../browsers/chromium/get-commit-message.py | 25 +++++++++++++++---- .../networking/browsers/chromium/update.py | 10 ++------ 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/pkgs/applications/networking/browsers/chromium/get-commit-message.py b/pkgs/applications/networking/browsers/chromium/get-commit-message.py index 7a91b74c83d..b0fbe20db8e 100755 --- a/pkgs/applications/networking/browsers/chromium/get-commit-message.py +++ b/pkgs/applications/networking/browsers/chromium/get-commit-message.py @@ -2,8 +2,10 @@ #!nix-shell -i python3 -p python3Packages.feedparser python3Packages.requests # This script prints the Git commit message for stable channel updates. +# Usage: ./get-commit-message.py [version] import re +import sys import textwrap from collections import OrderedDict @@ -13,19 +15,29 @@ import requests feed = feedparser.parse('https://chromereleases.googleblog.com/feeds/posts/default') html_tags = re.compile(r'<[^>]+>') +target_version = sys.argv[1] if len(sys.argv) == 2 else None for entry in feed.entries: - if entry.title != 'Stable Channel Update for Desktop': - continue url = requests.get(entry.link).url.split('?')[0] + if entry.title != 'Stable Channel Update for Desktop': + if target_version and entry.title == '': + # Workaround for a special case (Chrome Releases bug?): + if not 'the-stable-channel-has-been-updated-to' in url: + continue + else: + continue content = entry.content[0].value content = html_tags.sub('', content) # Remove any HTML tags if re.search(r'Linux', content) is None: continue #print(url) # For debugging purposes version = re.search(r'\d+(\.\d+){3}', content).group(0) - print('chromium: TODO -> ' + version) - print('\n' + url) + if target_version: + if version != target_version: + continue + else: + print('chromium: TODO -> ' + version + '\n') + print(url) if fixes := re.search(r'This update includes .+ security fixes\.', content).group(0): zero_days = re.search(r'Google is aware( of reports)? that .+ in the wild\.', content) if zero_days: @@ -35,4 +47,7 @@ for entry in feed.entries: cve_list = list(OrderedDict.fromkeys(cve_list)) # Remove duplicates but preserve the order cve_string = ' '.join(cve_list) print("\nCVEs:\n" + '\n'.join(textwrap.wrap(cve_string, width=72))) - break # We only care about the most recent stable channel update + sys.exit(0) # We only care about the most recent stable channel update + +print("Error: No match.") +sys.exit(1) diff --git a/pkgs/applications/networking/browsers/chromium/update.py b/pkgs/applications/networking/browsers/chromium/update.py index 4f9f53bd02a..72d6df055b3 100755 --- a/pkgs/applications/networking/browsers/chromium/update.py +++ b/pkgs/applications/networking/browsers/chromium/update.py @@ -222,14 +222,8 @@ if len(sys.argv) == 2 and sys.argv[1] == '--commit': attr_name = channel_name_to_attr_name(channel_name) commit_message = f'{attr_name}: {version_old} -> {version_new}' if channel_name == 'stable': - body = subprocess.check_output([COMMIT_MESSAGE_SCRIPT]).decode('utf-8') - prefix = f'chromium: TODO -> {version_new}' - if not body.startswith(prefix): - print("Error: Couldn't fetch the the release notes for the following update:") - print(commit_message) - sys.exit(1) - body = body.removeprefix(prefix) - commit_message += body + body = subprocess.check_output([COMMIT_MESSAGE_SCRIPT, version_new]).decode('utf-8') + commit_message += '\n\n' + body subprocess.run(['git', 'add', JSON_PATH], check=True) subprocess.run(['git', 'commit', '--file=-'], input=commit_message.encode(), check=True) else: