python包deb-pkg-tools是要构建和
检查Debian binary packages和二进制包的存储库。它的
主要用例是自动化构建。
一些功能在命令行界面中公开(如下所述)
因为在shell脚本中使用非常方便,而其他功能
将用作python api。包当前在cpython上测试
2.6、2.7、3.4、3.5、3.6、3.7和Pypy(2.7)。
请注意,deb-pkg-tools对于debian二进制文件的
应该构建包,并将其中的一些观点强加于用户。
使用可选的函数参数和/或环境可以避免大多数情况
变量。如果你发现了一些不符合你喜欢的东西而你不能
解决这个问题,可以随意要求额外的配置选项;我尝试
对我的项目的可能用例保持开放的心态。
一方面,deb-pkg-tools包是基于我在
Debian包和存储库在过去几年中
handdeb-pkg-tools本身还很年轻。同样,大多数功能是
由自动化测试覆盖;编写时覆盖率约为90%(有些
如果我们还想测试
非错误情况,这当然是主要焦点:—)
deb-pkg-tools包在PyPI上可用,这意味着安装
应该简单到:$ pip install deb-pkg-tools
实际上,安装python包的方法有很多(例如,per
user site-packages directory,virtual environments),或者只是安装
我不打算在这里讨论,所以
如果这让你感到害怕,那么在回到这些之前,先阅读一下你的选项
说明;-)。
在hood下deb-pkg-tools使用Debian提供的几个程序
有关详细信息,请参见dependencies部分。要安装这些程序:$ sudo apt-get install dpkg-dev fakeroot lintian
有两种方法可以使用deb-pkg-tools包:作为命令行
程序和作为python api。有关python api的详细信息,请参阅
在Read the Docs上提供的api文档。命令行界面
如下所述。
用法:deb-pkg-tools [OPTIONS] ...
deb pkg tools python项目的包装器,该项目实现了
检查、构建和操作Debian二进制包档案和相关的
像普通存储库这样的实体。
支持的选项:OptionDescription^{tt9}$, ^{tt10}$Inspect the metadata in the Debian binary package archive given by ^{tt11}$
(similar to “dpkg ^{tt12}$”).
^{tt13}$, ^{tt14}$Copy the package archive(s) given as positional arguments (and all package
archives required by the given package archives) into the directory given
by ^{tt15}$.
^{tt16}$, ^{tt17}$Perform static analysis on a package archive and its dependencies in order
to recognize common errors as soon as possible.
^{tt18}$, ^{tt19}$Patch fields into the existing control file given by ^{tt11}$. To be used
together with the ^{tt21}$, ^{tt22}$ option.
^{tt21}$, ^{tt24}$A line to patch into the control file (syntax: “Name: Value”). To be used
together with the ^{tt18}$, ^{tt26}$ option.
^{tt27}$, ^{tt28}$Build a Debian binary package with “dpkg-deb ^{tt29}$” (and lots of
intermediate Python magic, refer to the API documentation of the project
for full details) based on the binary package template in the directory
given by ^{tt15}$. The resulting archive is located in the system wide
temporary directory (usually /tmp).
^{tt31}$, ^{tt32}$Create or update the trivial Debian binary package repository in the
directory given by ^{tt15}$.
^{tt34}$, ^{tt35}$Enable “apt-get” to install packages from the trivial repository (requires
root/sudo privilege) in the directory given by ^{tt15}$. Alternatively you can
use the ^{tt37}$, ^{tt38}$ option.
^{tt39}$, ^{tt40}$Cleans up after ^{tt41}$ (requires root/sudo privilege).
Alternatively you can use the ^{tt37}$, ^{tt38}$ option.
^{tt37}$, ^{tt45}$Create or update a trivial package repository, activate the repository, run
the positional arguments as an external command (usually “apt-get install”)
and finally deactivate the repository.
^{tt46}$, ^{tt47}$Force removal of stale entries from the persistent (on disk) package
metadata cache. Garbage collection is performed automatically by the
deb-pkg-tools command line interface when the last garbage collection
cycle was more than 24 hours ago, so you only need to do it manually
when you want to control when it happens (for example by a daily
cron job scheduled during idle hours :-).
^{tt48}$, ^{tt49}$Assume the answer to interactive questions is yes.
^{tt50}$, ^{tt51}$Make more noise! (useful during debugging)
^{tt52}$, ^{tt53}$Show this message and exit.
需要注意的一点是deb-pkg-tools--update-repocan的操作
受配置文件的影响。有关详细信息,请参阅
关于deb_pkg_tools.repo.select_gpg_key()的文档。
deb-pkg-tools需要以下外部程序(取决于
您当然要使用哪些功能:ProgramPackage^{tt56}$^{tt57}$
^{tt58}$^{tt59}$
^{tt60}$^{tt61}$
^{tt62}$^{tt63}$
^{tt64}$^{tt65}$
^{tt66}$^{tt61}$
^{tt68}$^{tt68}$
^{tt70}$^{tt71}$
^{tt72}$^{tt72}$
^{tt74}$^{tt74}$
这些程序/包中的大多数已经安装在
基于Debian的系统,因此您只需要以下内容即可开始:$ sudo apt-get install dpkg-dev fakeroot lintian
如果环境变量不起作用,可以通过它们来调整一些东西
你的系统或平台。例如,在mac os x上,cp命令没有
有一个^ {tt77 } $参数,^ {tt78} $用户和组可能不存在,但
尽管如此,在mac os上测试包构建仍然是有用的。
x.以下环境变量可用于调整这些因素:VariableDefaultDescription^{tt79}$^{tt80}$Normalize ownership of files
during packaging.
^{tt81}$^{tt78}$During package builds the
ownership of all directories and
files is reset to this user.
^{tt83}$^{tt78}$During package builds the
ownership of all directories and
files is reset to this group.
^{tt85}$^{tt80}$Reset sticky bit on directories
inside package templates before
building.
^{tt87}$^{tt80}$Run commands using either
fakeroot or sudo (depending on
which is available).
^{tt89}$^{tt80}$Enable the usage of ^{tt91}$
during operations that normally
require elevated privileges.
^{tt92}$^{tt80}$Allow the usage of hard links to
speed up file copies between
directories on the same file
system.
^{tt94}$^{tt95}$Force the system to generate
entropy based on disk I/O.
^{tt96}$^{tt97}$Shell to use for the
^{tt98}$
command.
布尔选项的环境变量支持字符串yes,
true、1、no、false和0(忽略大小写)。
要禁用sudo的任何使用,可以使用以下命令:exportDPT_ALLOW_FAKEROOT_OR_SUDO=falseexportDPT_CHOWN_FILES=falseexportDPT_RESET_SETGID=falseexportDPT_SUDO=false
最新版本的deb-pkg-tools可在PyPI和GitHub上获得。这个
文档托管在Read the Docs。对于错误报告,请创建
关于GitHub的问题。如果你有问题、建议等,请随时寄给我
位于peter@peterodding.com的电子邮件。
版权所有©2018彼得·奥丁。
欢迎加入QQ群-->: 979659372
推荐PyPI第三方库