chroumium electron apply_all_patches.py patch git error WindowsError: [Error 2] The system cannot find the file specified

patch failure during build of electron on head commit:9554d06 #24046

 Closed
bigben0123 opened this issue 2 days ago · 4 comments 
 
 Closed

patch failure during build of electron on head commit:9554d06#24046

bigben0123 opened this issue 2 days ago · 4 comments 
 

Comments

@bigben0123
 
 

bigben0123 commented 2 days ago • 

edited 

I have just installed a windows server 2019 vm on AWS.
1, I unzip the deposit_tools and executed gclient. It get tools of git and python 2 and 3 for me.

2, execute env.bat :
set path=C:zhibindepot_tools;%PATH%
set DEPOT_TOOLS_WIN_TOOLCHAIN=0
set GIT_CACHE_PATH=C:.git_cache

3, `gclient sync --with_branch_heads --with_tags
Warning: Running gclient on Python 3.
If you encounter any issues, please file a bug on crbug.com under the Infra>SDK component.
Syncing projects: 11% (11/92) src/third_party/blink/web_tests/wpt_internal/webgpu/third_party/glslang_js:chromium/third
Syncing projects: 13% (12/92) src/chrome/test/data/perf/frame_rate/content
Syncing projects: 100% (100/100), done.

running 'vpython.bat src/electron/script/apply_all_patches.py src/electron/patches/config.json' in 'C:zhibin'
src/electron/patches/chromium
['git', '-C', u'src', 'update-ref', 'refs/patches/upstream-head', 'HEAD']
(['git', '-C', u'src', 'update-ref', 'refs/patches/upstream-head', 'HEAD'],)
{}
None
git -C src update-ref refs/patches/upstream-head HEAD
None
None
<subprocess.STARTUPINFO instance at 0x0000000002DDCE88>
git -C src update-ref refs/patches/upstream-head HEAD
Traceback (most recent call last):
File "src/electron/script/apply_all_patches.py", line 36, in 
main()
File "src/electron/script/apply_all_patches.py", line 32, in main
apply_patches(json.load(config_json))
File "src/electron/script/apply_all_patches.py", line 18, in apply_patches
committer_name="Electron Scripts", committer_email="scripts@electron")
File "C:zhibinsrcelectronscriptlibgit.py", line 97, in import_patches
newvalue='HEAD'
File "C:zhibinsrcelectronscriptlibgit.py", line 121, in update_ref
return subprocess.check_call(args)
File "C:zhibindepot_toolsootstrap-3_8_0_chromium_8_binpythoninLibsubprocess.py", line 187, in check_call
retcode = call(*popenargs, **kwargs)
File "C:zhibindepot_toolsootstrap-3_8_0_chromium_8_binpythoninLibsubprocess.py", line 172, in call
return Popen(*popenargs, **kwargs).wait()
File "C:zhibindepot_toolsootstrap-3_8_0_chromium_8_binpythoninLibsubprocess.py", line 396, in init
errread, errwrite)
File "C:zhibindepot_toolsootstrap-3_8_0_chromium_8_binpythoninLibsubprocess.py", line 654, in _execute_child
startupinfo)
WindowsError: [Error 2] The system cannot find the file specified
Error: Command 'vpython.bat src/electron/script/apply_all_patches.py src/electron/patches/config.json' returned non-zero exit status 1 in C:zhibin`

I add some debug in git.py. I find out that if command with "C:Windowssystem32cmd.exe /c "xxxxx" ", it's ok. However, this not start with "cmd.exe" : git -C src update-ref refs/patches/upstream-head HEAD.
I'am not familiar with python. It's not helpful from previous same issue solve.
By default, gclient use pthon3. I tried python2 and it doesn't work either.

where git
C:zhibindepot_toolsgit.bat

where git.exe
C:zhibindepot_toolsootstrap-3_8_0_chromium_8_bingitingit.exe

 
@bigben0123
 
Author

bigben0123 commented 2 days ago • 

edited 

When I add "shell=True" at Popen, it doesn't show that error. But other issur occured:

running 'vpython.bat src/electron/script/apply_all_patches.py src/electron/patches/config.json' in 'C:zhibin'
error: patch failed: gin/array_buffer.cc:43
error: gin/array_buffer.cc: patch does not apply
error: patch failed: gin/array_buffer.h:21
error: gin/array_buffer.h: patch does not apply
error: patch failed: third_party/blink/renderer/bindings/core/v8/v8_initializer.cc:672
error: third_party/blink/renderer/bindings/core/v8/v8_initializer.cc: patch does not apply
error: patch failed: third_party/blink/renderer/core/typed_arrays/array_buffer/array_buffer_contents.cc:129
error: third_party/blink/renderer/core/typed_arrays/array_buffer/array_buffer_contents.cc: patch does not apply
error: patch failed: third_party/blink/renderer/core/typed_arrays/array_buffer/array_buffer_contents.h:108
error: third_party/blink/renderer/core/typed_arrays/array_buffer/array_buffer_contents.h: patch does not apply
Applying: add_realloc.patch
Patch failed at 0001 add_realloc.patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
hint: Use 'git am --show-current-patch' to see the failed patch
src/electron/patches/chromium
['git', '-C', u'src', 'update-ref', 'refs/patches/upstream-head', 'HEAD']
(['git', '-C', u'src', 'update-ref', 'refs/patches/upstream-head', 'HEAD'],)
{'shell': True}

None
C:Windowssystem32cmd.exe /c "git -C src update-ref refs/patches/upstream-head HEAD"
None
None
<subprocess.STARTUPINFO instance at 0x00000000034ECE48>
C:Windowssystem32cmd.exe /c "git -C src update-ref refs/patches/upstream-head HEAD"

None
C:Windowssystem32cmd.exe /c "git -C src -c "user.name=Electron Scripts" -c user.email=scripts@electron -c commit.gpgsign=false am"
None
None
<subprocess.STARTUPINFO instance at 0x00000000034ECF08>
C:Windowssystem32cmd.exe /c "git -C src -c "user.name=Electron Scripts" -c user.email=scripts@electron -c commit.gpgsign=false am"
Traceback (most recent call last):
File "src/electron/script/apply_all_patches.py", line 36, in 
main()
File "src/electron/script/apply_all_patches.py", line 32, in main
apply_patches(json.load(config_json))
File "src/electron/script/apply_all_patches.py", line 18, in apply_patches
committer_name="Electron Scripts", committer_email="scripts@electron")
File "C:zhibinsrcelectronscriptlibgit.py", line 99, in import_patches
am(repo=repo, **kwargs)
File "C:zhibinsrcelectronscriptlibgit.py", line 69, in am
proc.returncode))
RuntimeError: Command ['git', '-C', u'src', '-c', 'user.name=Electron Scripts', '-c', 'user.email=scripts@electron', '-c', 'commit.gpgsign=false', 'am'] returned 128
Error: Command 'vpython.bat src/electron/script/apply_all_patches.py src/electron/patches/config.json' returned non-zero exit status 1 in C:zhibin
Hook 'vpython.bat src/electron/script/apply_all_patches.py src/electron/patches/config.json' took 20.13 secs

@bigben0123
 
Author

bigben0123 commented 15 hours ago

srcelectronscriptlibgit.py

When first error occured, git run without "cmd -c". This can be fixed by modifying srcelectronscriptlibgit.py
1, Search "check_all" and add " , shell=True" at the end of check_all's parameters, such as check_all(args,shell=True);
2, Search "pOpen", change into pOpen(...., shell=True);

then do gclient sync a again.
When do patch apply all, it must success once. otherwise, after failed, patch should be abort. and patch again. But the success patch should not run again, otherwise, conflict. Remove the success patch item. such as srcelectronpatchesxxxx.patch list items.

@codebytere
 
Member

codebytere commented 7 hours ago • 

edited 

Please use build-tools - it should handle this for you. Future issues can/should also be opened there

 
@codebytere codebytere closed this 7 hours ago
 
@bigben0123
 
Author

bigben0123 commented 20 seconds ago

I figure out why git cannot be found by check_all or pOPen in file of git.py, must fix by adding shell=true.
On my windows, execute:
where git
it returns: /../../depot/git.bat
It is not the real git.exe, but python's script git.bat.
Adding the git.exe to path will fix it.

原文地址:https://www.cnblogs.com/bigben0123/p/13097867.html