章 15. debmake(1) 手冊頁

內容目錄

15.1. 名稱
15.2. 概述
15.3. 描述
15.3.1. 可選引數:
15.4. 範例
15.5. 幫助套件
15.6. 注意事項
15.7. 除錯
15.8. 作者
15.9. 許可證
15.10. 參見

debmake,用來製作 Debian 原始碼套件的程式

debmake [-h] [-c | -k] [-n | -a package-version.orig.tar.gz | -d | -t ] [-p package] [-u version] [-r revision] [-z extension] [-b "binarypackage[:type], …​]" [-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 協助從上游原始碼構建一個 Debian 套件,通常做法如下:

  • 下載上游原始碼壓縮包(tarball)並命名為 package-version.tar.gz 檔案。
  • 對其進行解壓縮並將所有檔案放置於 package-version/ 目錄之下。
  • package-version/ 目錄中呼叫 debmake,並按需帶上引數。
  • 手工調整 package-version/debian/ 目錄下的檔案。
  • dpkg-buildpackage (usually from its wrapper debuild or sbuild) is invoked in the package-version/ directory to make Debian packages.

請確保將 -b-f-l-w 選項的引數使用引號合適地保護起來,以避免 shell 環境的干擾。

-h, --help
顯示本幫助資訊並退出。
-c, --copyright

為授權+許可證文字而掃描原始碼,然後退出。

  • -c:簡單輸出風格
  • -cc:正常輸出風格(類似 debian/copyright 檔案)
  • -ccc:除錯輸出風格
-k, --kludge

debian/copyright 檔案和原始碼進行比較並退出。

debian/copyright 必須將通用的檔案匹配模式放在前部並將個別檔案的例外放在後部。

  • -k:基本輸出風格
  • -kk:冗長輸出風格
-n, --native

make a native Debian source package without .orig.tar.gz. This makes a Debian source format 3.0 (native) 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 Debian non-native package using the Debian source format 3.0 (quilt) 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

直接使用上游原始碼壓縮包。(-p, -u, -z:被覆蓋)

上游原始碼壓縮包可以命名為 package_version.orig.tar.gz 或者 tar.gz。在某些情況下,也可使用 tar.bz2tar.xz

如果所指定的原始碼壓縮包檔名中包含大寫字母,Debian 打包時生成的名稱會將其轉化為小寫字母。

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, …​)

-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 套件名
設定 Debian 套件名稱。
-u 上游版本號, --upstreamversion 版本號
設定上游套件版本。
-r 修訂號, --revision 修訂號
設定 Debian 套件修訂號。
-z 副檔名, --targz 副檔名
設定原始碼壓縮包型別,副檔名=(tar.gz|tar.bz2|tar.xz)。(別名:z, b, x
-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 based JavaScript package (all, foreign) (alias: 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 foo@example.org, --email foo@example.org

設定電子郵件地址。

預設值為環境變數 $DEBEMAIL 的值。

-f "名稱 姓氏", --fullname "名稱 姓氏"

設定全名。

預設值為環境變數 $DEBFULLNAME 的值。

-i "構建工具", --invoke "構建工具"

invoke "buildtool" at the end of execution. buildtool may be dpkg-buildpackage, debuild, sbuild, etc.

預設情況是不執行任何程式。

設定該選項也會自動設定 --local 選項。

-j, --judge

執行 dpkg-depcheck 以檢查構建依賴和檔案路徑。檢查日誌將儲存在父目錄下。

  • 套件名.build-dep.logdpkg-depcheck 的日誌檔案。
  • 套件名.install.log:記錄 debian/tmp 目錄下所安裝檔案的日誌。
-l "license_file,…​", --license "license_file,…​"

在存放許可證掃描結果的 debian/copyright 檔案末尾新增格式化後的許可證文字。

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

-m, --monoarch
強制套件不使用多架構特性。
-o 檔案, --option 檔案

從指定file讀取可選引數。(這個選項不適合日常使用。)

The content of file is sourced as the Python 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
在建立 debian/ 目錄下的檔案之前即提前退出程式。
-s, --spec
use upstream spec (pyproject.py for Python, etc.) for the package description.
-v, --version
顯示版本資訊。
-w "addon,…​", --with "addon,…​"

debian/rules 檔案中在 dh(1) 命令的引數中新增額外的 dh(1) 引數以指定所使用的附加元件(addon)。

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

For Autotools based packages, autoreconf as addon to run autoreconf -i -v -f for every package building is default behavior of the dh(1) command.

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 n, --extra n

以模板檔案的形式建立配置檔案(請注意 debian/changelogdebian/controldebian/copyrightdebian/rules 檔案是構建 Debian 二進位制套件所需的最小文件集合。)

n 的數字大小決定了生成哪些配置模板檔案。

  • -x0: all required configuration template files. (selected option if any of these 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.
  • -x3: all -x2 files + optional configuration template files. (default option)
  • -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
force yes for all prompts. (without option: ask [Y/n]; doubled option: force no)
-L, --local
為本地套件生成配置檔案以繞過 lintian(1) 的檢查。
-P, --pedantic
對自動生成的檔案進行嚴格(甚至古板到迂腐程度)的檢查。
-T, --tutorial
output tutorial comment lines in template files. default when -x3 or -x4 is set.

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 (version 3) module source tree:

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

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

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

對於典型的以 package-version.tar.gz 歸檔提供的 Perl 模組:

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

打包工作也許需要額外安裝一些專用的幫助套件。

  • 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 套件。
  • Node.js based JavaScript programs may require the pkg-js-tools package.
  • 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 2 positive 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.

Please double check copyright with the licensecheck(1) command.

組成 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 中設定的字元用來確定日誌輸出等級。

  • i: main.py logging
  • p: para.py logging
  • s: checkdep5.py check_format_style() logging
  • y: checkdep5.py split_years_name() logging
  • b: checkdep5.py parse_lines() 1 logging — content_state scan loop: begin-loop
  • m: checkdep5.py parse_lines() 2 logging — content_state scan loop: after regex match
  • e: checkdep5.py parse_lines() 3 logging — content_state scan loop: end-loop
  • a: checkdep5.py parse_lines() 4 logging — print author/translator section text
  • f: checkdep5.py check_all_license() 1 logging — input filename for the copyright scan
  • l: checkdep5.py check_all_license() 2 logging — print license section text
  • c: checkdep5.py check_all_license() 3 logging — print copyright section text
  • k: checkdep5.py check_all_license() 4 logging — sort key for debian/copyright stanza
  • r: sed.py logging
  • w: cat.py logging
  • n: kludge.py logging (debmake -k)

Use this feature as:

 $ DEBUG=ipsybmeaflckrwn debmake ...

See README.developer in the source for more.

Copyright © 2014-2024 Osamu Aoki <osamu@debian.org>

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 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.