chromiumBeta: Fix the build

The build was failing with:
[4758/49762] ACTION //third_party/dawn/src/dawn/common:dawn_version_gen__json_tarball(//build/toolchain/linux/unbundle:default)Ke:default)ux/unbundle:default)[Kuide/optimization_guide_internals/resources/optimization_guide_internals.mojom-webui.js
FAILED: gen/third_party/dawn/dawn_version_gen.json_tarball
python3 ../../third_party/dawn/generator/dawn_version_generator.py --dawn-dir ../../third_party/dawn/ --template-dir /build/chromium-102.0.5005.49/third_party/dawn/generator/templates --jinja2-path /build/chromium-102.0.5005.49/third_party/jinja2 --output-json-tarball gen/third_party/dawn/dawn_version_gen.json_tarball --depfile gen/third_party/dawn/dawn_version_gen.json_tarball.d --expected-outputs-file gen/third_party/dawn/dawn_version_gen.expected_outputs --allowed-output-dirs-file gen/third_party/dawn/dawn_version_gen.allowed_output_dirs
Traceback (most recent call last):
[...]
FileNotFoundError: [Errno 2] No such file or directory: 'git'
[4761/49762] ACTION //third_party/blink/renderer/bindings:generate_bindings_all(//build/toolchain/linux/unbundle:default)fault)
ninja: build stopped: subcommand failed.

More details here: https://bugs.chromium.org/p/chromium/issues/detail?id=1321370

The patch doesn't apply to M102 so I had to cherry-pick it manually.
This commit is contained in:
Michael Weiss 2022-05-11 12:52:35 +02:00
parent 1bae25ac65
commit 37a13a3d4d
No known key found for this signature in database
GPG key ID: 5BE487C4D4771D83
2 changed files with 47 additions and 0 deletions

View file

@ -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") ''

View file

@ -0,0 +1,43 @@
From e9ffd084ec1ff9f7bfc86879732953dc58256958 Mon Sep 17 00:00:00 2001
From: Loko Kung <lokokung@google.com>
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 <lokokung@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
(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