Table of Contents
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 [email protected]] [-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 软件包,通常做法如下:
请确保将 -b、-f、-l 和 -w 选项的参数使用引号合适地保护起来,以避免 shell 环境的干扰。
为授权+许可证文本而扫描源码,然后退出。
对 debian/copyright 文件和源代码进行比较并退出。
debian/copyright 必须将通用的文件匹配模式放在前部并将个别文件的例外放在后部。
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.
直接使用上游源码压缩包。(-p, -u, -z:被覆盖)
上游源码压缩包可以命名为 package_version.orig.tar.gz 或者 tar.gz。在某些情况下,也可使用 tar.bz2 或 tar.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.
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
, …)
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/.)
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:
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:
Generating an executable (python3) binary package python3-foo:
Generating a data package foo:
Generating a executable binary package foo and a documentation one foo-doc:
Generating a executable binary package foo, a library package libfoo1, and a library development package libfoo-dev:
如果源码树的内容和类型的设置不一致,debmake 命令会发出警告。
设置电子邮件地址。
默认值为环境变量 $DEBEMAIL 的值。
设置全名。
默认值为环境变量 $DEBFULLNAME 的值。
invoke "buildtool" at the end of execution. buildtool may be “dpkg-buildpackage”, “debuild”, “sbuild”, etc.
默认情况是不执行任何程序。
设置该选项也会自动设置 --local 选项。
运行 dpkg-depcheck 以检查构建依赖和文件路径。检查日志将存储在父目录下。
在存放许可证扫描结果的 debian/copyright 文件末尾添加格式化后的许可证文本。
The default is to add COPYING and LICENSE, and license_file needs to list only the additional file names all separated by “,”.
从指定file读取可选参数。(这个选项不适合日常使用。)
文件 file 的内容,将在 para.py 的末尾作为 Python 代码的源代码。例如,软件包描述信息可以使用下述文件来定义。
para['desc'] = 'program short description' para['desc_long'] = '''\ program long description which you wish to include. . Empty line is space + . You keep going on ... '''
在 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.
以模板文件的形式创建配置文件(请注意 debian/changelog、debian/control、debian/copyright 和 debian/rules 文件是构建 Debian 二进制软件包所需的最小文件集合。)
n 的数字大小决定了生成哪些配置模板文件。
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.
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:
对于典型的 Python(版本 3)模块源码树:
对于 package-version.tar.gz 存档里的一个典型 Python*(版本 3) 模块:
对于典型的以 package-version.tar.gz 归档提供的 Perl 模块:
打包工作也许需要额外安装一些专用的帮助软件包。
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:
Please double check copyright with the licensecheck(1) command.
组成 Debian 软件包名称的字符选取存在一定的限制。最明显的限制应当是软件包名称中禁止出现大写字母。这里给出正则表达式形式的规则总结:
[-+.a-z0-9]{2,}
[-+.a-z0-9]{2,}
[0-9][-+.:~a-z0-9A-Z]*
[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 中设置的字符用来确定日志输出等级。
main.py
logging
para.py
logging
checkdep5.py
check_format_style()
logging
checkdep5.py
split_years_name()
logging
checkdep5.py
parse_lines()
1 logging — content_state scan loop:
begin-loop
checkdep5.py
parse_lines()
2 logging — content_state scan loop: after
regex match
checkdep5.py
parse_lines()
3 logging — content_state scan loop:
end-loop
checkdep5.py
parse_lines()
4 logging — print author/translator section
text
checkdep5.py
check_all_license()
1 logging — input filename for the
copyright scan
checkdep5.py
check_all_license()
2 logging — print license section
text
checkdep5.py
check_all_license()
3 logging — print copyright section
text
checkdep5.py
check_all_license()
4 logging — sort key for
debian/copyright stanza
sed.py
logging
cat.py
logging
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 <[email protected]>
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.