第 15 章 debmake(1) 手册页

目录

15.1. 名称
15.2. 概述
15.3. 描述
15.4. Positional arguments
15.5. Options
15.6. 示例
15.7. 帮助软件包
15.8. 注意事项
15.9. 除错
15.10. 作者
15.11. 许可证
15.12. 参见

debmake,用来制作 Debian 源码包的程序

debmake [-h] [-n] [-p package] [-u version] [-r revision] [-z extension] [-b "binarypackage[:type], …​]" [-e [email protected]] [-f "firstname lastname"] [-i [debuild|sbuild|dgit sbuild|gbp buildpackage|dpkg-buildpackage| …​]] [-m] [-q] [-v] [-V] [-w "addon, …​"] [-x [01234]] [-y] [-B] [URL]

debmake helps to build the Debian package from the upstream source.

Normally, this is done as follows:

  • The upstream source is obtained as a tarball from a remote web site or a cloned work tree using git clone.

    • For a tarball, it is expanded to many files in the source directory.
    • For a cloned work tree, it is used as the source directory.
  • debmake is typically invoked in the source directory without any argument.

    • The source directory is copied to ../package-version/ directory.
    • If ../package_version.orig.tar.xz is missing, it is generated.
    • The current directory is moved to ../package-version/.
    • Template files are generated in the ../package-version/debian/ directory
  • Files in the ../package-version/debian/ directory should be manually adjusted.
  • dpkg-buildpackage (usually from its wrapper debuild, sbuild, …​) is invoked in the ../package-version/ directory to make Debian source and binary packages.

Also, debmake can be invoked with an argument. This argument can be URL for a tarball hosted on a remote web site or for a source code accessed by git clone; or local PATH to the tarball or the source code.

Arguments to -b, -f, and -w options need to be quoted to protect them from the shell.

Other tools also offer ways to obtain the upstream tarball and creating required symlink to build a Debian package depending on your workflow. For example, origtargz, mk-origtargz, git-deborig, and pristine-tar.

URL
aquire the source tree from the tarball, the git repository or the source tree at this URL (or PATH) (if missing, the source tree uses the current directory)
-h, --help
show this help message and exit

-n, --native make a native source package without .orig.tar.xz

-p, --package package
set the Debian package name
-u, --upstreamversion version
set the upstream package version
-r, --revision revision
set the Debian package revision
-z, --tarz extension
set the tarball compression type, extension=(tar.xz|tar.gz|tar.bz2) (alias: z, b, x)
-b, --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 命令会发出警告。

-e, --email [email protected]

set e-mail address

默认值为环境变量 $DEBEMAIL 的值。

-f, --fullname "firstname lastname"

set the fullname

默认值为环境变量 $DEBFULLNAME 的值。

-i, --invoke [debuild|sbuild|dgit sbuild|gbp buildpackage|dpkg-buildpackage| …​]
invoke package build tool
-m, --monoarch
force packages to be non-multiarch
-q, --quitearly
quit early before creating files in the debian directory
-v, --version
show version information
-V, --verbose
use --verbose for shell commands if available
-w, --with "addon …​"

set additional dh --with option arguments in debian/rules

For Autotools based packages, if they install Python (version 3) programs, setting python3 as addon to the debmake command argument is needed since this is non-obvious. But for pyproject.toml based Python packages, setting python3 as addon to the debmake command argument is not needed since this is obvious and the debmake command automatically set it to the dh(1) command.

-x, --extra [01234]

generate extra configuration files as templates (default: 2)

Please note debian/changelog, debian/control, debian/copyright, debian/rules, and debian/source/format are required configuration files to build a modern Debian binary package.

The number determines which configuration templates are generated.

  • -x0: all 5 required configuration template files. (selected option if any of these required files already exist)
  • -x1: all -x0 files + desirable configuration template files with binary package type supports.
  • -x2: all -x1 files + normal configuration template files with maintainer script supports. (default)
  • -x3: all -x2 files + optional configuration template files.
  • -x4: all -x3 files + deprecated configuration template files.

Some configuration template files are generated with the extra .ex suffix to ease their removal. To activate these, rename their file names to the ones without the .ex suffix and edit their contents. Existing configuration files are never overwritten. If you wish to update some of the existing configuration files, please rename them before running the debmake command and manually merge the generated configuration files with the old renamed ones.

-y, --yes
use once to force yes for all prompts, twice to force no
-B, --backup
keep the user editted ones without .ex suffix and create template files with .ex suffix

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.

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

  • debmake -i sbuild

对于典型的 Python(版本 3)模块源码树:

  • debmake -b":python3" -i sbuild

For a typical Python (version 3) module in the package-version.tar.xz archive:

  • debmake package-version.tar.xz -b":python3" -i sbuild

For a typical Perl module in the package-version.tar.xz archive:

  • debmake package-version.tar.xz -b":perl" -i sbuild

打包工作也许需要额外安装一些专用的帮助软件包。

  • Python (version 3) programs may require the pybuild-plugin-pyproject package.
  • The Autotools (autoconf + automake) build system may require autotools-dev or dh-autoreconf package.
  • Ruby 程序可能需要 gem2deb 软件包。
  • 基于JavaScript 的 Node.js 程序可能需要 pkg-js-tools 软件包。
  • Java 程序可能需要 javahelper 软件包。
  • Gnome 程序可能需要 gobject-introspection 软件包。
  • 等等。

Although debmake is meant to provide template files for the package maintainer to work on, actual packaging activities are often performed without using debmake while referencing only existing similar packages and Debian Policy Manual”. All template files generated by debmake are required to be modified manually.

There are some points for debmake:

  • debmake helps to write terse packaging tutorial Guide for Debian Maintainers (debmake-doc package).
  • debmake provides short extracted license texts as debian/copyright in decent accuracy to help license review.
  • Guide for Debian Maintainers also serves as a tutorial with examples for the usage of debmake.
  • debmake internally calls licensecheck from the licensecheck package to create debian/copyright if it doesn’t exist.
  • debmake internally calls lrc from the licenserecon package to verify debian/copyright if it already exists.

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

  • Upstream package name (-p): [-+.a-z0-9]{2,}
  • Binary package name (-b): [-+.a-z0-9]{2,}
  • Upstream version (-u): [0-9][-+.:~a-z0-9A-Z]*
  • Debian revision (-r): [0-9][+.~a-z0-9A-Z]*

See the exact definition in Chapter 5 - Control files and their fields in the Debian Policy Manual.

debmake assumes relatively simple packaging cases. So all programs related to the interpreter are assumed to be Architecture: all. This is not always true.

请使用 reportbug 命令报告 debmake 软件包的问题与错误。

环境变量 $DEBUG 中设置的字符用来确定日志输出等级。

  • s: program progress logging
  • p: key para[..] value logging
  • P: all para[..] value logging
  • d: para["debs"] value logging

Use this feature as:

[base_dir] $ export DEBUG=spd; debmake ...

See README.md in the source for more.

Copyright © 2014-2026 Osamu Aoki <[email protected]>

Expat 许可证

The debmake-doc package provides the Guide for Debian Maintainers” in plain text, HTML and PDF formats under the /usr/share/doc/debmake-doc/ directory.

See also licensecheck(1), lrc(1), dpkg-source(1), deb-control(5), debhelper(7), dh(1), dpkg-buildpackage(1), debuild(1), quilt(1), dpkg-depcheck(1), sbuild(1), gbp-buildpackage(1), and gbp-pq(1) manpages.