Closed lilydjwg closed 6 years ago
直接在 /var/cache
里建立 cargo 和 sccache 目录,然后每次 build 的时候传 -d
参数给 makechrootpkg
,把 cache 目录 bind 进去,再对 makepkg
设置环境变量, 就像这样:
*-x86_64-build ... -- -d /var/cache/sccache -d /var/cache/cargo -- SCCACHE_DIR=/var/cache/sccache CARGO_HOME=/var/cache/cargo
是否可行?
但是怎样传正确的 PATH 给 makepkg 让它使用 sccache 呢?
权限呢?你试试看行不行?
PS: cargo 的 registry 也要共享,不然好像得每次打包都 clone 一份……还有包文件的缓存(就整个 ~/.cargo 共享好了)
权限除了 777 还没有想到更好的方法…毕竟 build 的时候是用 builduser。
共享了 CARGO_HOME 的下就包括了 registry 了吧(实际测试时 build 了两次 ydcv-rs,也只有一次更新过 index 和下载过 crates)?CARGO_HOME 的 registry/ 下包括了 index、src 和 cache 三个目录。我对 cargo 不太了解,本来是想解决 ccache 问题才看到这个 issue 😂
builduser 好像就是当前用户耶。这样的话只要放我家里就可以了。我先拿 ~/.cargo 试试看,可以的话我继续加 ccache 什么的。
好像对 exa-git 有效,对 servo-git 无效呢。
servo-git 要 archlinuxcn-x86_64-build -- -d /home/zsrkmyn/.cargo:/build/.cargo -- CARGO_HOME=/build/.cargo
。
可以看 python/servo/command_base.py
里第 250 行。
或者是 python/servo/bootstrap_commands.py
的 372 行,我也不确定是哪里起的作用 😂
你能弄明白它默认把 CARGO_HOME 设到哪里了么?
应该是 /build/servo-git/src/servo/.cargo
,就是 mach 文件所在目录。从 mach 的 mian()
里传进去的。
以下是废话……
在 python/mach_bootstrap.py
257 行定义了 populate_context
处理 'topdir'
,271 行作为 handler 传给 mach
对象,在 python/_virtualenv/lib/python2.7/site-packages/mach/main.py
380 行把该 handler 传给 context
实例的构造函数,142 行 ContextWrapper
中把这个 handler 设成了 context
对象的 _handler
属性,然后获取 context.topdir
的利用这个 handler 获取 topdir
。真麻烦 (
哦。也就是在 chroot 里边,打包好就被干掉了……这样的话,在打包脚本里设置环境变量更合理 @farseerfc
所以应该在 PKGBUILD 里设置 PATH 和 CARGO_HOME 变量吗?这样会不会很麻烦?直接通过 *-*-build 传进去呢?
就 servo 特殊啊。
但是 CARGO_HOME 本身对 cargo 也有效,man cargo
里有写。(虽然感觉除了 servo 一般不会去动这个环境变量
sscache 没实现,registry 和下载的包都应该共享好了。
第三方 repo呢?。。。 主要是有些git包的submodule每次都得下载一遍。。。
submodule 都是在 PKGBUILD 里处理的呀。
submodule 可以在 PKGBUILD 里全部写在 source 里,然后 clone 完主 repo 之后手动设置 submoudule 的 URL 为本地,再对 submoudule 进行 init,这样可以避免重复 clone。具体可以参考 vim-youcompleteme-git。
2018年1月17日 11:02,"依云" notifications@github.com写道:
submodule 都是在 PKGBUILD 里处理的呀。
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/archlinuxcn/lilac/issues/44#issuecomment-358180498, or mute the thread https://github.com/notifications/unsubscribe-auth/ADmPC-d20VEhlvURY6qg3BspWoOEkJhWks5tLWK6gaJpZM4O1mKR .
包括 register、第三方 repo、已下载的文件。如果能共享编译结果就更好的(sccache)。