lzdeb-以惰性方式构建debian包
lzdeb的Python项目详细描述
lzdeb-以惰性方式构建debian包
<>想从Debian/APT包中安装一些东西,但是预构建的包不存在吗?建立自己的,简单(和懒惰)的方式!
使用量
运行(/d是一个目录):
$ lzdeb build /d
在工作目录中收集生成的debian包文件。
$ lzdeb build /d ... $ ls *.deb
目录/d
应包含以下文件:
/d/config.yml
- (可选)
/d/build
/d/install
- (可选)
/d/validate
示例:examples/silversearcher-ag
为the silver searcher创建Debian包。
lzdeb.yml
builder:image:ubuntu:16.04bootstrap_cmds:-apt update-apt install -y gitvalidator:image:ubuntu:18.04bootstrap_cmds:-apt updatesource:type:giturl:https://github.com/ggreer/the_silver_searcher.gitref:2.2.0pull_submodules:yesdeb_info:pkgname:silversearcher-agpkgversion:2.2.0pkgrelease:1pkglicense:Apache 2.0pkggroup:mainmaintainer:example@lzdeb.invaliddescription:"Acode-searchingtoolsimilartoack,butfaster.http://geoff.greer.fm/ag/"requires:-liblzma-dev>=5.1.1-libpcre3-dev>=2:8.38-zlib1g-dev>=1:1.2.8
builder
定义在其中生成deb包的docker容器。
validator
定义用于验证生成的deb的docker容器(安装包,可能是一些测试命令)
source
定义从何处获取要生成的源代码。
deb_info
定义创建debian包时要使用的debian包元数据。
1.build
安装生成工具和所需的库。编译代码。
#!/usr/bin/env bashset -e apt-get update apt-get install -y \ automake \ pkg-config \ libpcre3-dev \ zlib1g-dev \ liblzma-dev cd the_silver_searcher*/ ./build.sh
2。install
执行“make install”。debian包是根据文件系统的更改自动构建的。
#!/usr/bin/env bashset -e cd the_silver_searcher*/ make install
3。validate
尝试安装构建的debian包。验证程序是否运行。
#!/usr/bin/env bashset -e apt install -y ./*.deb ag -h
将它们结合在一起
$ lzdeb build example/silversearcher-ag
... spin up build container
...
... build script gets run
...
... install script gets run (deb package file created)
...
... validate script gets run (deb package file gets installed in fresh container)
...
$ ls *.deb
silversearcher-ag_2.2.0-1_amd64.deb
安装
$ pip3 install lzdeb
在MacOS上测试。可能也适用于Linux。
注意事项
有很多!
我们将在本节中填充用户报告的最重要的内容。
如何贡献
- 放弃回购。
- 在virtualenv中:
pip3 install -r requirements.txt
pip3 install -r .circleci/test_requirements
- 滚开!
- 测试:
- 要进入的新单元测试
test/
- 如果您有CircleCI访问权限,请确保
test_all
工作流通过。 - 否则,可以在本地运行测试(请参见
.circleci/config.yml
):- 单元测试:
py.test --cov=lzdeb test/
- 绒布:
pylint -E lzdeb test
- PEP8:
pycodestyle lzdeb test
- 类型提示检查:
mypy lzdeb test
- 单元测试:
- 要进入的新单元测试