I encountered a problem yesterday that the moe lilac sent me a e-mail to remind me the that vim-youcompleteme-git was failed to build AGAIN! The error occured while runing makepkg -od.
I did a research and found it was mainly due to the existing of the old $srcdir generated by last runing of makepkg -od, and a patch was applied twice:
==> 正在开始 prepare()...
-> Setting up Git submodules...
patching file YouCompleteMe/autoload/youcompleteme.vim
patching file ycmd/default_settings.json
Reversed (or previously applied) patch detected! Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file ycmd/default_settings.json.rej
==> 错误: 在 prepare() 中发生一个错误。
正在放弃...
Since the file to be patched is actually in a git submodule, It keeps patched (but not reset to the origin one at the process of extracting sources) at the second time makepkg -od running. The submodule in PKGBUILD is initialized as the wiki says.
I think about some solutions, but don't know which is best:
Force clean up the submodule dircetories before git submodule init in PKGBUILD. However, this is unnacessary in most cases and may make PKGBUILD a little bit confusing.
Clean up the $srcdir (or more specifically, remove it) in lilac.py. However, due to the different setting of BUILDDIR in ~/.makepkg.conf or /etc/makepkg.conf, it is not easy to obtain the location where the $srcdir is.
Use makepkg -od --nopreparehere. This is a bit tricky and since pkgver() is executed after prepare(), pkgver may be wrongly acquired by lilac due to the skip of prepare().
Use makepkg -odc at the line mentioned above. This force makepkg remove the $srcdir after obtaining the sources and running pkgver() to update PKGBUILD. (I prefer this)
I encountered a problem yesterday that the moe lilac sent me a e-mail to remind me the that vim-youcompleteme-git was failed to build AGAIN! The error occured while runing
makepkg -od
.I did a research and found it was mainly due to the existing of the old
$srcdir
generated by last runing ofmakepkg -od
, and a patch was applied twice:Since the file to be patched is actually in a git submodule, It keeps patched (but not reset to the origin one at the process of extracting sources) at the second time
makepkg -od
running. The submodule in PKGBUILD is initialized as the wiki says.I think about some solutions, but don't know which is best:
git submodule init
in PKGBUILD. However, this is unnacessary in most cases and may make PKGBUILD a little bit confusing.$srcdir
(or more specifically, remove it) inlilac.py
. However, due to the different setting ofBUILDDIR
in~/.makepkg.conf
or/etc/makepkg.conf
, it is not easy to obtain the location where the$srcdir
is.makepkg -od --noprepare
here. This is a bit tricky and sincepkgver()
is executed afterprepare()
,pkgver
may be wrongly acquired by lilac due to the skip ofprepare()
.makepkg -odc
at the line mentioned above. This forcemakepkg
remove the$srcdir
after obtaining the sources and runningpkgver()
to update PKGBUILD. (I prefer this)So, which one is preferable?