第 16 章 debmake options

目录

16.1. Shortcut options (-a, -i)
16.2. debmake -b
16.3. debmake -cc
16.4. Snapshot upstream tarball (-d, -t)
16.5. debmake -j
16.6. debmake -k
16.7. debmake -P
16.8. debmake -T
16.9. debmake -x

Here are some additional explanations for debmake options.

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

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

前文中第 5 章 简单打包”的例子可以使用下面的命令直接达到目的。

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

A URL such as https://www.example.org/DL/package-1.0.tar.gz may be used for the -a option.

[提示]提示

A URL such as https://arm.koji.fedoraproject.org/packages/ibus/1.5.7/3.fc21/src/ibus-1.5.7-3.fc21.src.rpm may be used for the -a option, too.

The debmake command with the -b option provides an intuitive and flexible method to create the initial template debian/control file. This file defines the split of the Debian binary packages with the following stanzas:

The debmake command also sets an appropriate set of substvars (substitution variables) used in each pertinent dependency stanza.

我们在这里直接引用 debmake 手册页中的相关一部分内容。

-b "binarypackage[:type],…​", --binaryspec "binarypackage[:type],…​"

set the binary package specs by a comma separated list of binarypackage:type pairs. Here, binarypackage is the binary package name, and the optional type is chosen from the following type values:

  • bin: C/C++ compiled ELF binary code package (any, foreign) (default, alias: "", i.e., null-string)
  • data: Data (fonts, graphics, …​) package (all, foreign) (alias: da)
  • dev:库开发软件包(any,same)(别名:de
  • doc:文档软件包(all,foreign)(别名:do
  • lib:库软件包(any,same)(别名:l
  • perl:Perl 脚本软件包(all,foreign)(别名:pl
  • python3: Python (version 3) script package (all, foreign) (alias: py3, python, py)
  • ruby:Ruby 脚本软件包(all,foreign)(别名:rb
  • nodejs:基于 Node.js 的 JavaScript 软件包(all,foreign)(别名:js
  • script: Shell and other interpreted language script package (all, foreign) (alias: sh)

The pair values in the parentheses, such as (any, foreign), are the Architecture and Multi-Arch stanza values set in the debian/control file. In many cases, the debmake command makes good guesses for type from binarypackage. If type is not obvious, type is set to bin.

Here are examples for typical binary package split scenarios where the upstream Debian source package name is foo:

  • Generating an executable binary package foo:

    • -b’foo:bin', or its short form `-b'-'`", or no -b option
  • Generating an executable (python3) binary package python3-foo:

    • -b’python3-foo:py', or its short form -b’python3-foo'
  • Generating a data package foo:

    • -b’foo:data', or its short form -b'-:data'
  • Generating a executable binary package foo and a documentation one foo-doc:

    • -b’foo:bin,foo-doc:doc', or its short form -b'-:-doc'
  • Generating a executable binary package foo, a library package libfoo1, and a library development package libfoo-dev:

    • -b’foo:bin,libfoo1:lib,libfoo-dev:dev' or its short form -b'-,libfoo1,libfoo-dev'

如果源码树的内容和类型的设置不一致,debmake 命令会发出警告。

debmake 命令在带上 -cc 选项时可以向标准输出打印整个源码树的版权和许可证概要信息。

 $ tar -xvzf package-1.0.tar.gz
 $ cd package-1.0
 $ debmake -cc | less

如果转而使用 -c 选项,程序将提供较短的报告。

This test building scheme is suitable for git repositories organized as described in gbp-buildpackage(7), which uses the master, upstream, and pristine-tar branches.

The upstream snapshot from the upstream source tree in the upstream VCS can be made with the -d option if the upstream supports the make dist equivalence.

 $ cd /path/to/upstream-vcs
 $ debmake -d -i debuild

除此之外,也可使用 -t 选项以使用 tar 命令生成上游源码包。

 $ cd /path/to/upstream-vcs
 $ debmake -p package -t -i debuild

Unless you provide the upstream version with the -u option or with the debian/changelog file, a snapshot upstream version is generated in the 0~%y%m%d%H%M format, e.g., 0~1403012359, from the UTC date and time.

If the upstream VCS is hosted in the package/ directory instead of the upstream-vcs/ directory, the -p package can be skipped.

如果版本控制系统中的上游源码树包含了 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 is considered a quasi-native Debian package. See 第 11.13 节 “Quasi-native Debian packaging”” for more details.

这是测试性功能。

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

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

  • 调用 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 的安装包。
[注意]注意

The -j option for the debmake command invokes dpkg-depcheck(1) to run debian/rules under strace(1) to obtain library dependencies. Unfortunately, this is very slow. If you know the library package dependencies from other sources such as the SPEC file in the source, you may just run the "debmake …​" command without the -j option and run the debian/rules install command to check the install paths of the generated files.

这是测试性功能。

在使用上游新发行版本更新软件包时,debmake 可以使用已有的 debian/copyright 文件和整个更新的源码树文件进行对比验证版权和许可证信息。

 $ cd package-vcs
 $ gbp import-orig --uscan --pristine-tar
 ... update source with the new upstream release
 $ debmake -k | less

The debmake -k command parses the debian/copyright file from the top to the bottom and compares the license of all the non-binary files in the current package with the license described in the last matching file pattern entry of the debian/copyright file.

在您编辑自动生成的 debian/copyright 文件时,请确保将最通用的文件匹配模式放在文件前部,最精确的匹配模式放在后部。

[提示]提示

For all new upstream releases, run the debmake -k command to ensure that the debian/copyright file is current.

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

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

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

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

[注意]注意

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