Table of Contents
这里提供 debmake 命令的一些重要选项。
debmake 命令提供了两个快捷选项。
前文中Chapter 4, 简单例子的例子可以使用下面的命令直接达到目的。
$ debmake -a package-1.0.tar.gz -i debuild
Tip | |
---|---|
-a 选项也可以使用“https://www.example.org/DL/package-1.0.tar.gz”这样的 URL。 |
Tip | |
---|---|
-a 选项也可以使用“https://arm.koji.fedoraproject.org/packages/ibus/1.5.7/3.fc21/src/ibus-1.5.7-3.fc21.src.rpm”这样的 URL。 |
您可以使用以源码压缩包(tarball)形式提供的 pythonmodule-1.0.tar.gz Python 模块包直接生成一个独立二进制 Debian 软件包。这里的 -b 选项可以指定软件包类型为 python,-s 选项可以从上游压缩包中提取并复制软件包描述内容至指定位置。
$ debmake -s -b':python' -a pythonmodule-1.0.tar.gz -i debuild
对其他支持 -b 选项的解释式编程语言,请给 -b 选项指定恰当的 type 。
对没有 -b 选线支持的其它解释性语言,您可以指定其为脚本类型(script 类型)并调整 debian/control 文件而将解释器对应的软件包添加为软件包依赖。
This test building scheme is good for the git repository organized as described in gbp-buildpackage(7) which uses the master, upstream, and pristine-tar branches.
如果上游软件包支持“make dist”或者等效的目标,您可以使用 -d 选项从上游源码树版本控制系统中得到上游代码的快照。
$ cd /path/to/upstream-vcs $ debmake -d -i debuild
除此之外,也可使用 -t 选项以使用 tar 命令生成上游源码包。
$ cd /path/to/upstream-vcs $ debmake -p package -t -i debuild
除非您明确使用 -u 选项或者在 debian/changelog 文件中提前指定好版本号,默认情况下快照生成的上游版本号将应用协调世界时的日期和时间使用 0~%y%m%d%H%M 格式生成,例如 0~1403012359。
如果上游版本控制系统位于 软件包名/ 目录而非任意的 上游版本控制系统/ 目录,参数中的“-p 软件包名”这部分可以跳过。
如果版本控制系统中的上游源码树包含了 debian/* 文件,debmake 命令在带有 -d 选项或者 -t 选项并结合 -i 选项可以自动化进行使用这些 debian/* 文件从版本控制系统快照中构建非原生软件包的流程。
$ cp -r /path/to/package-0~1403012359/debian/. /path/to/upstream-vcs/debian $ dch ... update debian/changelog $ git add -A .; git commit -m "vcs with debian/*" $ debmake -t -p package -i debuild
This non-native Debian binary package building scheme without the real upstream tarball using the “debmake -t -i debuild” command may be considered as the quasi-native Debian package scheme since the packaging situation resembles the native Debian binary package building case using the debuild command without the upstream tarball.
Use of a non-native Debian package building scheme helps to ease communication with the downstream distros such as Ubuntu for bug fixes etc.
debmake 命令在带上 -cc 选项时可以向标准输出打印整个源码树的版权和许可证概要信息。
$ tar -xvzf package-1.0.tar.gz $ cd package-1.0 $ debmake -cc | less
如果转而使用 -c 选项,程序将提供较短的报告。
在使用上游新发行版本更新软件包时,debmake 可以使用已有的 debian/copyright 文件和整个更新的源码树文件进行对比验证版权和许可证信息。
$ cd package-vcs $ gbp import-orig --uscan --pristine-tar ... update source with the new upstream release $ debmake -k | less
“debmake -k”命令可以完整解析 debian/copyright 并将当前软件包中的所有非二进制文件内含的许可证信息按照最后一项匹配的方式与 debian/copyright 文件中的信息进行对比。
在您编辑自动生成的 debian/copyright 文件时,请确保将最通用的文件匹配模式放在文件前部,最精确的匹配模式放在后部。
Tip | |
---|---|
对所有上游发布新版本的情况,运行“debmake -k”可以确保 debian/copyright 文件一直处于最新状态。 |
生成多个二进制软件包通常比只生成一个二进制软件包需要投入更多的工作量。对源码包进行测试构建是其中的必要一环。
例如,我们考虑将相同的 package-1.0.tar.gz(参见 Chapter 4, 简单例子)打包并生成多个二进制软件包。
调用 debmake 命令并使用 -j 选项以测试构建并报告结果。
$ debmake -j -a package-1.0.tar.gz
调用 debmake 命令以开始准备打包信息。
$ rm -rf package-1.0 $ tar -xvzf package-1.0.tar.gz $ cd package-1.0 $ debmake -b"package1:type1, ..."
使用 debuild 或等效的其它工具构建 Debian 软件包。
$ debuild
Note | |
---|---|
binarypackage_version-revision_arch.deb 命令的 -j 选项会调用 dpkg-depcheck(1) 以在 strace(1) 之下运行 debian/rules,从而获得库依赖信息。然而,这样操作的运行速度极慢。如果您由其他途径获知了软件包的库软件包依赖信息,例如外部的 SPEC 文件等等,您可以直接运行“debmake …”命令而不带 -j 选项并运行“debian/rules install”命令以检查所生成文件的安装路径。 |
debmake 生成的模板文件数量由 -x[01234] 选项进行控制。
Note | |
---|---|
debmake 命令不会修改任何已存在的配置文件。 |
调用 debmake 命令并带上 -P 选项将会严厉地检查所有自动生成文件的版权和许可证文本信息;即使它们都使用宽松的许可证也是如此。
此选项不止会影响正常执行过程中所生成的 debian/copyright 文件的内容,也会影响带参数 -k、-c、-cc 和 -ccc 选项的输出内容。