diff --git a/pkgs/applications/networking/browsers/chromium/common.nix b/pkgs/applications/networking/browsers/chromium/common.nix index 3b22761cbc01..993f95a6bfff 100644 --- a/pkgs/applications/networking/browsers/chromium/common.nix +++ b/pkgs/applications/networking/browsers/chromium/common.nix @@ -160,6 +160,10 @@ let ./patches/no-build-timestamps.patch # For bundling Widevine (DRM), might be replaceable via bundle_widevine_cdm=true in gnFlags: ./patches/widevine-79.patch + ] ++ optionals (versionRange "102" "103") [ + # https://dawn-review.googlesource.com/c/dawn/+/88582 + # Wrap get_gitHash in try-catch to prevent failures in tarball builds. + ./patches/m102-fix-dawn_version_generator-failure.patch ]; postPatch = optionalString (chromiumVersionAtLeast "102") '' diff --git a/pkgs/applications/networking/browsers/chromium/patches/m102-fix-dawn_version_generator-failure.patch b/pkgs/applications/networking/browsers/chromium/patches/m102-fix-dawn_version_generator-failure.patch new file mode 100644 index 000000000000..e9391541e435 --- /dev/null +++ b/pkgs/applications/networking/browsers/chromium/patches/m102-fix-dawn_version_generator-failure.patch @@ -0,0 +1,43 @@ +From e9ffd084ec1ff9f7bfc86879732953dc58256958 Mon Sep 17 00:00:00 2001 +From: Loko Kung +Date: Tue, 3 May 2022 00:28:53 +0000 +Subject: [PATCH] Wrap get_gitHash in try-catch to prevent failures in tarball + builds. + +Bug: chromium:1321370 +Change-Id: If39d2236d1b4d965f7bd189f6bd1cdc70436c41d +Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/88582 +Commit-Queue: Loko Kung +Reviewed-by: Austin Eng +Kokoro: Kokoro +(cherry picked from commit 03ddfbb81fb4127ca37ea53e70fcb34fe851e24e) +--- + third_party/dawn/generator/dawn_version_generator.py | 13 ++++++++----- + 1 file changed, 8 insertions(+), 5 deletions(-) + +diff --git a/third_party/dawn/generator/dawn_version_generator.py b/third_party/dawn/generator/dawn_version_generator.py +index 1907e88da..3c1927bee 100644 +--- a/third_party/dawn/generator/dawn_version_generator.py ++++ b/third_party/dawn/generator/dawn_version_generator.py +@@ -23,11 +23,14 @@ def get_git(): + + + def get_gitHash(dawnDir): +- result = subprocess.run([get_git(), 'rev-parse', 'HEAD'], +- stdout=subprocess.PIPE, +- cwd=dawnDir) +- if result.returncode == 0: +- return result.stdout.decode('utf-8').strip() ++ try: ++ result = subprocess.run([get_git(), "rev-parse", "HEAD"], ++ stdout=subprocess.PIPE, ++ cwd=dawnDir) ++ if result.returncode == 0: ++ return result.stdout.decode("utf-8").strip() ++ except Exception: ++ return "" + # No hash was available (possibly) because the directory was not a git checkout. Dawn should + # explicitly handle its absenece and disable features relying on the hash, i.e. caching. + return '' +-- +2.36.0