在多个构建中重复使用相同的部件
有没有办法在多个buldout之间重复使用零件?我有几个想要添加到构建中的工具,这些工具不会因构建而改变。下面是一个示例案例:
- 配置全局构建选项,使得 download-cache=~/.buildout/downloads
- Buildout A 需要 cmake 2.8.4
- Buildout B 需要 cmake 2.8.4
一种方法是将以下内容放入其每个配置
[cmake]
recipe = zc.recipe.cmmi
url = http://www.cmake.org/files/v2.8/cmake-2.8.4.tar.gz
由于这在两个构建中都不会改变,因此如果可以像鸡蛋的缓存方式一样进行设置,将会节省更多的磁盘空间。但是,我无法找到一个好的方法来做到这一点。我认为扩建的设计并没有考虑到这一点。
想法:
是否可以将 cmake tarball 作为 python Egg 重新分发?也许为不同的平台编译 tarball 并重新分发 Egg 内的二进制文件?
另一个想法是有一个可以处理这种行为的方法。也许是一个包含其他配方并检查该部件是否已全局安装的配方。也许它看起来像这样:
[cmake]
recipe = my.recipe.reusuableparts
real-recipe = zc.recipe.cmmi
url = http://www.cmake.org/files/v2.8/cmake-2.8.4.tar.gz
Is there a way to reuse parts across multiple buldouts? I've got several tools that I'd like to add to the buildout that don't change across buildouts. Here is an example case:
- Configured global buildout options such that download-cache=~/.buildout/downloads
- Buildout A needs cmake 2.8.4
- Buildout B needs cmake 2.8.4
One way to do this is to put the following in each of their configurations
[cmake]
recipe = zc.recipe.cmmi
url = http://www.cmake.org/files/v2.8/cmake-2.8.4.tar.gz
Since this doesn't change across the two buildouts, it would save more disc space if this could set up similarly to how eggs are cached. However, I cannot figure out a good way to do this. I don't think buildout was designed with this in mind.
Ideas:
Is it possible to redistribute the cmake tarball as a python egg? Perhaps compile the tarball for different platforms and redistribute the binaries inside eggs?
Another idea would to be have a recipe that can handle this kind of behavior. Maybe a recipe that wraps around other recipes and checks to see if the part is installed globally. Perhaps it would look like this:
[cmake]
recipe = my.recipe.reusuableparts
real-recipe = zc.recipe.cmmi
url = http://www.cmake.org/files/v2.8/cmake-2.8.4.tar.gz
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
zc.recipe.cmmi
配方直接支持该用例,但其记录不足(鸡蛋确实包含 完整文档)。只需将shared
选项设置为您选择的目录:或者只需将其设置为
True
即可将其放入构建下载缓存中:具体取决于各个配方是否支持此类共享行为。我认为包装食谱并不容易,因为构建食谱几乎可以做任何事情。
The
zc.recipe.cmmi
recipe supports the usecase directly, but it's under-documented (the egg does contain full documentation). Simply set theshared
option to the directory of your choice:or simply set it to
True
to put it in your buildout download cache:It's up to individual recipes to support such sharing behaviour. I don't think a wrapping recipe is going to be easy seeing as buildout recipes can pretty much do anything.