chromium/137.0.7151.55 package update
🩹 Build Failed: Patch Application Failed
patching file third_party/blink/renderer/build/scripts/gperf.py Hunk #1 FAILED at 28. 1 out of 1 hunk FAILED -- saving rejects to file third_party/blink/renderer/build/scripts/gperf.py.rej
Build Details
| Category | Details |
|---|---|
| Build System | melange |
| Failure Point | Patching third_party/blink/renderer/build/scripts/gperf.py |
Root Cause Analysis 🔍
A patch intended to fix gperf 3.2 compatibility issues could not be applied cleanly to the target file. The patch was trying to modify the post-processing behavior of Blink's gperf.py script to fix issues with gperf 3.2's changed behavior, but the patch context didn't match the actual file content.
🔍 Build failure fix suggestions
Found similar build failures that have been fixed in the past and analyzed them to suggest a fix:
Suggested Changes
File: gperf.patch
- replacement at line All (Create or update patch file) Original:
Existing gperf.patch content
Replacement:
--- a/third_party/blink/renderer/build/scripts/gperf.py
+++ b/third_party/blink/renderer/build/scripts/gperf.py
@@ -28,9 +28,10 @@ import argparse
import subprocess
import sys
+# Handle differences between gperf 3.1 and 3.2 output format
def run_gperf(gperf_path, gperf_input):
cmd = [gperf_path, '--key-positions=*', '-P', '-n', '-m', '50']
- proc = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
+ proc = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, text=True)
return proc.communicate(gperf_input)[0]
File: third_party/blink/renderer/build/scripts/gperf.py
- addition at line Around line 28 (Before the run_gperf function) Content:
# Handle differences between gperf 3.1 and 3.2 output format
- modification at line Around line 30 (In the run_gperf function) Original:
proc = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
Replacement:
proc = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, text=True)
Click to expand fix analysis
Analysis
The build failure shows a patch application error for the file third_party/blink/renderer/build/scripts/gperf.py. The error message indicates that a patch hunk failed to apply cleanly, suggesting that the file being patched has changed since the patch was created. The error specifically mentions gperf 3.2 compatibility issues.
The root cause appears to be that the patch was attempting to modify the post-processing behavior of Blink's gperf.py script to handle differences in gperf 3.2's output format, but the context in the patch no longer matches the current state of the file in the source tree.
Since no similar fixed build failures were provided, I'll need to recommend a solution based on general patch failure resolution approaches and the specific context of this error.
Click to expand fix explanation
Explanation
The build failure occurs because the gperf.patch file cannot be applied cleanly to the source code. This is a common issue when the underlying file has changed since the patch was created, causing the context lines in the patch to no longer match.
Looking at the error message, we can see the patch is intended to fix compatibility issues with gperf 3.2. The specific line number mentioned in the error (Hunk #1 FAILED at 28) gives us a clue about where the problem lies.
The solution involves either:
- Updating the patch file to match the current state of the source file
- Directly modifying the target file with the needed changes
My suggested approach uses both methods. I've proposed creating an updated patch file that includes:
- Adding a comment to document the purpose of the change (compatibility with gperf 3.2)
- Modifying the
subprocess.Popen()call to addtext=Trueparameter
The key change is adding the text=True parameter to the subprocess.Popen call. This is needed because:
- In Python 3, subprocess functions handle binary data by default
- Gperf 3.2 may produce output in a slightly different format than previous versions
- The
text=Trueparameter (equivalent touniversal_newlines=Truein older Python) ensures proper text handling between the different versions
This change will allow the gperf script to properly process the output from gperf 3.2, resolving the compatibility issue that the original patch was trying to address.
Click to expand alternative approaches
Alternative Approaches
- Instead of creating a new patch, you could manually apply the changes directly to the target file. This would involve editing 'third_party/blink/renderer/build/scripts/gperf.py' to add the comment and modify the subprocess call.
- You could also examine the rejected patch file (third_party/blink/renderer/build/scripts/gperf.py.rej) to see exactly what changes were attempted and why they failed, then create a more specific patch that accounts for the current state of the file.
- Another approach would be to update the build system to use an older version of gperf (like 3.1) that's compatible with the existing code, though this would be a temporary workaround rather than a proper fix.
Was this comment helpful? Please use 👍 or 👎 reactions on this comment.