附录 A. debmake(1) manpage

debmake - program to make a Debian source package

debmake [-h] [-c | -k] [-n | -a package-version.orig.tar.gz | -d | -t ] [-p package] [-u version] [-r revision] [-z extension] [-b "binarypackage, …]" [-e foo@example.org] [-f "firstname lastname"] [-i "buildtool" | -j] [-l license_file] [-m] [-o file] [-q] [-s] [-v] [-w "addon, …"] [-x [01234]] [-y] [-L] [-P] [-T]

debmake helps to build a Debian package from the upstream source. Normally, this is done as follows:

  • 下载上游源码压缩包(tarball)并命名为 package-version.tar.gz 文件。
  • It is untarred to create many files under the package-version/ directory.
  • debmake is invoked in the package-version/ directory, possibly without any arguments.
  • Files in the package-version/debian/ directory are manually adjusted.
  • dpkg-buildpackage (usually from its wrapper debuild or pdebuild) is invoked in the package-version/ directory to make Debian packages.

请确保将 -b-f-l-w 选项的参数使用引号合适地保护起来,以避免 shell 环境的干扰。

-h, --help
显示本帮助信息并退出。
-c, --copyright

scan source for copyright+license text and exit.

  • -c: simple output style
  • -cc: normal output style (similar to the debian/copyright file)
  • -ccc: debug output style
-k, --kludge

compare the debian/copyright file with the source and exit.

The debian/copyright file must be organized to list the generic file patterns before the specific exceptions.

  • -k: basic output style
  • -kk: verbose output style
-n, --native

make a native Debian source package without .orig.tar.gz. This makes a “3.0 (native)” format package.

If you are thinking of packaging a Debian-specific source tree with debian/* in it into a native Debian package, please think otherwise. You can use the “debmake -d -i debuild” or “debmake -t -i debuild” commands to make a “3.0 (quilt)” format non-native Debian package. The only difference is that the debian/changelog file must use the non-native version scheme: version-revision. The non-native package is more friendly to downstream distributions.

-a package-version.tar.gz, --archive package-version.tar.gz

use the upstream source tarball directly. (-p, -u, -z: overridden)

The upstream tarball may be specified as package_version.orig.tar.gz and tar.gz. For other cases, it may be tar.bz2, or tar.xz.

If the specified upstream tarball name contains uppercase letters, the Debian package name is generated by converting them to lowercase letters.

If the specified argument is the URL (http://, https://, or ftp://) to the upstream tarball, the upstream tarball is downloaded from the URL using wget or curl.

-d, --dist

run the “make dist” command equivalents first to generate the upstream tarball and use it.

The “debmake -d” command is designed to run in the package/ directory hosting the upstream VCS with the build system supporting the “make dist” command equivalents. (automake/autoconf, Python distutils, …)

-t, --tar

run the “tar” command to generate the upstream tarball and use it.

The “debmake -t” command is designed to run in the package/ directory hosting the upstream VCS. 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. The generated tarball excludes the debian/ directory found in the upstream VCS. (It also excludes typical VCS directories: .git/ .hg/ .svn/ .CVS/.)

-p package, --package package
设置 Debian 软件包名称。
-u version, --upstreamversion version
设置上游软件包版本。
-r revision, --revision revision
设置 Debian 软件包修订号。
-z extension, --targz extension
set the tarball type, extension=(tar.gz|tar.bz2|tar.xz). (alias: z, b, x)
-b "二进制软件包名[:type],…", --binaryspec "二进制软件包名[:type],…"

set the binary package specs by a comma separated list of binarypackage:type pairs, e.g., in the full form “foo:bin,foo-doc:doc,libfoo1:lib,libfoo-dev:dev” or in the short form, “-doc,libfoo1,libfoo-dev”.

这里,二进制软件包是二进制软件包名称,可选的类型应当从下面的类型值中进行选取:

  • bin:C/C++ 预编译 ELF 二进制代码软件包(any,foreign)(默认,别名:"",即,空字符串
  • data:数据(字体、图像、……)软件包(all,foreign)(别名:da
  • dev:库开发软件包(any,same)(别名:de
  • doc:文档软件包(all,foreign)(别名:do
  • lib:库软件包(any,same)(别名:l
  • perl:Perl 脚本软件包(all,foreign)(别名:pl
  • python:Python 脚本软件包(all,foreign)(别名:py
  • python3:Python3 脚本软件包(all,foreign)(别名:py3
  • ruby:Ruby 脚本软件包(all,foreign)(别名:rb
  • script:Shell 脚本软件包(all,foreign)(别名:sh

括号内成对的值,例如(any,foreign),是软件包的架构多架构(Multi-Arch)特性的值,它们将设置在 debian/control 文件中。

大多数情况下,debmake 命令可以有效地从二进制软件包的名称猜测出正确的类型。如果类型的值并不明显,程序将回退到将类型设置为bin。例如,libfoo 设置类型lib,而 font-bar 会令程序设置类型data,……

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

-e foo@example.org, --email foo@example.org

设置电子邮件地址。

The default is taken from the value of the environment variable $DEBEMAIL.

-f "firstname lastname", --fullname "firstname lastname"

set the fullname.

The default is taken from the value of the environment variable $DEBFULLNAME.

-i "buildtool", --invoke "buildtool"

invoke "buildtool" at the end of execution. buildtool may be “dpkg-buildpackage”, “debuild”, “pdebuild”, “pdebuild --pbuilder cowbuilder”, etc.

The default is not to execute any program.

Setting this option automatically sets the --local option.

-j, --judge

run dpkg-depcheck to judge build dependencies and identify file paths. Log files are in the parent directory.

  • package.build-dep.log: Log file for dpkg-depcheck.
  • package.install.log: Log file recording files in the debian/tmp directory.
-l "license_file,…", --license "license_file,…"

add formatted license text to the end of the debian/copyright file holding license scan results.

The default is to add COPYING and LICENSE, and license_file needs to list only the additional file names all separated by “,”.

-m, --monoarch
force packages to be non-multiarch.
-o file, --option file

read optional parameters from file. (This is not for everyday use.)

The content of file is sourced as the Python3 code at the end of para.py. For example, the package description can be specified by the following file.

para['desc'] = 'program short description'
para['desc_long'] = '''\
 program long description which you wish to include.
 .
 Empty line is space + .
 You keep going on ...
'''
-q, --quitearly
quit early before creating files in the debian/ directory.
-s, --spec
use upstream spec (setup.py for Python, etc.) for the package description.
-v, --version
show version information.
-w "addon,…", --with "addon,…"

add extra arguments to the --with option of the dh(1) command as addon in debian/rules.

The addon values are listed all separated by “,”, e.g., “-w "python2,autoreconf"”.

For Autotools based packages, setting autoreconf as addon forces running “autoreconf -i -v -f” for every package building. Otherwise, autotools-dev as addon is used as the default.

For Autotools based packages, if they install Python programs, python2 as addon is needed for packages with “compat < 9” since this is non-obvious. But for setup.py based packages, python2 as addon is not needed since this is obvious and it is automatically set for the dh(1) command by the debmake command when it is required.

-x n, --extra n

generate configuration files as templates. (Please note debian/changelog, debian/control, debian/copyright, and debian/rules are bare minimum configuration files to build a Debian binary package.)

The number n determines which configuration templates are generated.

  • -x0: bare minimum configuration files. (default option if any of bare minimum configuration files already exist)
  • -x1: all -x0 files + desirable configuration files for the single binary package. (default option for the single binary package if none of bare minimum configuration files exist)
  • -x2: all -x1 files + desirable configuration files for the multi binary package. (default option for the multi binary package if none of bare minimum configuration files exist)
  • -x3: all -x2 files + unusual configuration template files. Unsual configuration template files are generated with the extra .ex suffix to ease their removal. To use these as configuration files, rename their file names to ones without the .ex suffix.
  • -x4: all -x3 files + copyright file examples.
-y, --yes
“force yes” for all prompts. (without option: “ask [Y/n]”; doubled option: “force no”)
-L, --local
generate configuration files for the local package to fool lintian(1) checks.
-P, --pedantic
pedantically check auto-generated files.
-T, --tutorial
output tutorial comment lines in template files.

For a well behaving source, you can build a good-for-local-use installable single Debian binary package easily with one command. Test install of such a package generated in this way offers a good alternative to the traditional “make install” command installing into the /usr/local directory since the Debian package can be removed cleanly by the “dpkg -P …” command. Here are some examples of how to build such test packages. (These should work in most cases. If the -d option does not work, try the -t option instead.)

For a typical C program source tree packaged with autoconf/automake:

  • debmake -d -i debuild

For a typical Python module source tree:

  • debmake -s -d -b":python" -i debuild

For a typical Python module in the package-version.tar.gz archive:

  • debmake -s -a package-version.tar.gz -b":python" -i debuild

For a typical Perl module in the Package-version.tar.gz archive:

  • debmake -a Package-version.tar.gz -b":perl" -i debuild

Packaging may require installation of some additional specialty helper packages.

  • Python3 程序可能需要 dh-python 软件包。
  • Autotools (Autoconf + Automake) 建构系统可能需要 autotools-devdh-autoreconf 软件包。
  • Ruby 程序可能需要 gem2deb 软件包。
  • Java 程序可能需要 javahelper 软件包。
  • Gnome programs may require the gobject-introspection package.
  • etc.

debmake 的目的是为软件包维护者提供开始工作的模板文件。注释行以 # 开始,其中包含一些教程性文字。您在将软件包上传至 Debian 仓库之前必须删除或者修改这样的注释行。

许可证信息的提取和赋值过程应用了大量启发式操作,因此在某些情况下可能不会正常工作。强烈建议您搭配使用其它工具,例如来自 devscripts 软件包的 licensecheck 工具,以配合 debmake 的使用。

组成 Debian 软件包名称的字符选取存在一定的限制。最明显的限制应当是软件包名称中禁止出现大写字母。这里给出正则表达式形式的规则总结:

  • 上游软件包名称(-p):[-+.a-z0-9]{2,}
  • 二进制软件包名称(-b):[-+.a-z0-9]{2,}
  • 上游版本号(-u):[0-9][-+.:~a-z0-9A-Z]*
  • Debian 修订版本(-r): [0-9][+.~a-z0-9A-Z]*

请在“Debian 政策手册”的 第 5 章 - Control 文件及其字段 一节中查看其精确定义。

debmake 所假设的打包情景是相对简单的。因此,所有与解释器相关的程序都会默认为“Architecture: all”的情况。当然,这个假设并非总是成立。

Please report bugs to the debmake package using the reportbug command.

The character set in the environment variable $DEBUG determines the logging output level.

  • i: print information
  • p: list all global parameters
  • d: list parsed parameters for all binary packages
  • f: input filename for the copyright scan
  • y: year/name split of copyright line
  • s: line scanner for format_state
  • b: content_state scan loop: begin-loop
  • m: content_state scan loop: after regex match
  • e: content_state scan loop: end-loop
  • c: print copyright section text
  • l: print license section text
  • a: print author/translator section text
  • k: sort key for debian/copyright stanza
  • n: scan result of debian/copyright (“debmake -k”)

Use this as:

 $ DEBUG=pdfbmeclak debmake ...

查看源码中的 README.developer 文件以了解更多信息。

版权 © 2014-2017 Osamu Aoki <osamu@debian.org>

Expat 许可证

debmake-doc 软件包提供了“Debian 维护者指南”手册,以纯文本、HTML 和 PDF 三种格式存放在 /usr/share/doc/debmake-doc/ 目录下。

另见 dpkg-source(1), deb-control(5), debhelper(7), dh(1), dpkg-buildpackage(1), debuild(1), quilt(1), dpkg-depcheck(1), pdebuild(1), pbuilder(8), cowbuilder(8), gbp-buildpackage(1), gbp-pq(1) 和 git-pbuilder(1) 的手册页。