Chapter 6. debmake 选项

Table of Contents

6.1. 快捷选项(-a,-i)
6.1.1. Python 模块
6.2. Snapshot upstream tarball (-d, -t)
6.3. debmake -cc
6.4. debmake -k
6.5. debmake -j
6.6. debmake -x
6.7. debmake -P
6.8. debmake -T

这里提供 debmake 命令的一些重要选项。

debmake 命令提供了两个快捷选项。

  • -a:打开上游源码压缩包
  • -i:执行构建二进制包的脚本

前文中Chapter 4, 简单例子的例子可以使用下面的命令直接达到目的。

 $ debmake -a package-1.0.tar.gz -i debuild
[Tip] Tip

-a 选项也可以使用“https://www.example.org/DL/package-1.0.tar.gz”这样的 URL。

[Tip] Tip

-a 选项也可以使用“https://arm.koji.fedoraproject.org/packages/ibus/1.5.7/3.fc21/src/ibus-1.5.7-3.fc21.src.rpm”这样的 URL。

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] Tip

对所有上游发布新版本的情况,运行“debmake -k”可以确保 debian/copyright 文件一直处于最新状态。

生成多个二进制软件包通常比只生成一个二进制软件包需要投入更多的工作量。对源码包进行测试构建是其中的必要一环。

例如,我们考虑将相同的 package-1.0.tar.gz(参见 Chapter 4, 简单例子)打包并生成多个二进制软件包。

  • 调用 debmake 命令并使用 -j 选项以测试构建并报告结果。

     $ debmake -j -a package-1.0.tar.gz
  • 请检查 package.build-dep.log 文件最后的几行以确定 Build-Depends 所需填写的构建依赖。(您不需要在 Build-Depends 中列出 debhelperperlfakeroot 所使用的软件包。在只生成单个软件包的情况下也是如此。)
  • 请检查 package.install.log 的文件内容以确定各个文件的安装路径,从而决定如何将它们拆分成多个软件包。
  • 调用 debmake 命令以开始准备打包信息。

     $ rm -rf package-1.0
     $ tar -xvzf package-1.0.tar.gz
     $ cd package-1.0
     $ debmake -b"package1:type1, ..."
  • 请使用以上信息更新 debian/controldebian/binarypackage.install 文件。
  • 按需更新其它 debian/* 文件。
  • 使用 debuild 或等效的其它工具构建 Debian 软件包。

     $ debuild
  • 所有由 debian/binarypackage.install 文件指定的二进制软件包条目均会生成 binarypackage_version-revision_arch.deb 的安装包。
[Note] Note

binarypackage_version-revision_arch.deb 命令的 -j 选项会调用 dpkg-depcheck(1) 以在 strace(1) 之下运行 debian/rules,从而获得库依赖信息。然而,这样操作的运行速度极慢。如果您由其他途径获知了软件包的库软件包依赖信息,例如外部的 SPEC 文件等等,您可以直接运行“debmake …”命令而不带 -j 选项并运行“debian/rules install”命令以检查所生成文件的安装路径。

debmake 生成的模板文件数量由 -x[01234] 选项进行控制。

[Note] Note

debmake 命令不会修改任何已存在的配置文件。

调用 debmake 命令并带上 -P 选项将会严厉地检查所有自动生成文件的版权和许可证文本信息;即使它们都使用宽松的许可证也是如此。

此选项不止会影响正常执行过程中所生成的 debian/copyright 文件的内容,也会影响带参数 -k-c-cc-ccc 选项的输出内容。

调用 debmake 命令并带上 -T 选项会额外输出详细的教程注释行。这些行在模板文件中用 ### 进行标注。