I decided I wanted to investigate an old Chromium performance regression. Building old versions of Chrome turned out to be trickier than expected and I wanted to share my steps in case they are useful, and in case anybody wants to tell me how I could have done it more easily. And I wanted to point out that we currently
build old versions of Chrome, and if we care about this (I'm not saying we should) then we need to test for it.
The hash I was trying to sync to is af4e289461794790203de6d050198b7e8e7ad5d1 (July 2016) so first I checked out that hash. I then tried "gclient sync -D" but hit an error. Over time depot_tools has gotten better at finding errors in DEPS files (which is good) and those errors have been fixed, but that causes failures when running gclient sync on an old repo:
File "c:\src\depot_tools\gclient_eval.py", line 319, in _validate_statement
target.id, filename, getattr(node, 'lineno', '<unknown>')))
ValueError: invalid assignment: overrides var 'recursedeps' (file 'c:\\src\\chromium4\\src\\DEPS', line 963)
So I checked out an old version of depot_tools (sync to old version, set DEPOT_TOOLS_UPDATE=0) but that hit more intractable problems so I went back to the latest version of depot_tools and patched recursedeps in the DEPS file to use the current value.
That eventually caused other problems when the "gclient runhooks" phase tried to run the file build\gyp_angle:
c:\src\depot_tools\.cipd_bin\vpython.exe: could not resolve options: failed to resolve Python script: CreateFile c:\src\chromium4\build\gyp_angle: The system cannot find the path specified.
Error: Command 'vpython.bat build/gyp_angle' returned non-zero exit status 1 in c:\src\chromium4
Apparently the recursedeps paths went from being DEPS-file-relative to src-directory-relative. I commented out the problematic line and that seemed to be sufficient.
I then hit this error in build/gyp_chromium.py:
x64_runtime, x86_runtime = vs2013_runtime_dll_dirs
ValueError: too many values to unpack
I recognized that issue as being caused by the addition of a third-runtime on Windows - we now support x64, x86, and arm64. A dictionary for the return value would have been more stable but it's a bit late for that. I patched this by adding an extra variable to grab the third return value.
I then hit problems with gen_file_type_proto.py not being able to find optparse:
File "browser/resources/safe_browsing/gen_file_type_proto.py", line 21, in <module>
import optparse
ImportError: No module named optparse
I assume that this is something to do with vpython and wheels but I resolved this by hacking the script to add depot_tools\bootstrap-3_8_0_chromium_8_bin\python\bin\lib to sys.path.
With that I was able to build chrome in out\release and it ran!
I then wanted to share my must-never-be-submitted modifications to ancient Chrome by uploading a CL. ExecPresubmitScript failed with this error:
File "c:\src\depot_tools\presubmit_support.py", line 1335, in ExecPresubmitScript
return post_upload_hook(cl, change, OutputApi(False))
File "PRESUBMIT.py", line 103, in PostUploadHook
AttributeError: 'Changelist' object has no attribute 'RpcServer'
P.S.
I have heard complaints that "git cl upload" runs slowly if you are too far behind head. I think that 3.5 years counts as a torture-test of this theory and I found the "git cl upload" performance quite reasonable - has that issue been fixed?