第 13 章 工具的使用

目录

13.1. debdiff
13.2. dget
13.3. mk-origtargz
13.4. origtargz
13.5. git deborig
13.6. dpkg-source -b
13.7. dpkg-source -x
13.8. debc
13.9. piuparts
13.10. bts

这里列出与 Debian 打包相关的值得注意的工具。

[注意]注意

The descriptions in this section are intentionally brief. Prospective maintainers are strongly encouraged to search for and read all relevant documentation associated with these commands.

[注意]注意

Examples here use the gz-compression. The xz-compression may be used instead.

您可以使用 debdiff 命令来对比两个 Debian 软件包内容的差别。

$ debdiff old-package.dsc new-package.dsc

您也可以使用 debdiff 命令来对比两组二进制 Debian 软件包中的文件列表。

$ debdiff old-package.changes new-package.changes

当检查源代码包中哪些文件被修改时,这个命令非常有用。它还可以用来检测二进制包中是否有文件在更新过程中发生变动,比如被意外替换或删除。

Debian now enforces the source-only upload when developing packages. So there may be 2 different *.changes files:

  • package_version-revision_source.changes for the normal source-only upload
  • package_version-revision_arch.changes for the binary upload

您可以使用 dget 命令来下载 Debian 源包的文件集。

$ dget https://www.example.org/path/to/package_version-rev.dsc

You can make the upstream tarball ../foo-newversion.tar.[xg]z accessible from the Debian source tree as ../foo_newversion.orig.tar.[xg]z. This command is useful for renaming and symlinking the upstream tarball to the expected Debian naming convention.

You can fetch the pre-existing orig tarball of a Debian package from various sources, and unpack it with origtargz command.

This is basically for -2, -3, …​ revisions.

If the upstream project is hosted in a Git repository without an official tarball release, you can generate its orig tarball from the git repository for use by the Debian source package. Execute git deborig from the root of the checked-out source tree.

This is basically for -1 revisions.

The dpkg-source -b command packs the upstream source tree into the Debian source package.

It expects a series of patches in the debian/patches/ directory and their application sequence in debian/patches/series.

It is compatible with dquilt (see 第 4.4 节 “quilt 设置””) operations and understands the patch application status from the existence of .pc/applied-patches.

The dpkg-buildpackage command invokes dpkg-source -b.

The dpkg-source -x command extracts the source tree and applies the patches in the debian/patches/ directory using the sequence specified in debian/patches/series to the upstream source tree. It also adds .pc/applied-patches. (See 第 11.6 节 “Patch applied Git repository””.)

The dpkg-source -x --skip-patches command extracts source tree only. It doesn’t add .pc/applied-patches. (See 第 11.5 节 “Patch unapplied Git repository”.)

Both extracted source trees are ready for building Debian binary packages with dpkg-buildpackage, dbuild, sbuild, etc..

您应该使用 debc 命令安装生成的软件包以在本地对齐进行测试。

$ debc package_version-rev_arch.changes

您应该使用 piuparts 命令安装生成的软件包以自动进行测试。

$ sudo piuparts package_version-rev_arch.changes
[注意]注意

这是一个非常慢的过程,因为它需要访问远程 APT 软件包仓库。

After uploading the package, you will receive bug reports. It is an important duty of a package maintainer to manage these bugs properly, as described in 5.8. Handling bugs” of the Debian Developer’s Reference.

bts 命令是一个用以处理 Debian 缺陷追踪系统 上的错误的便捷工具。

$ bts severity 123123 wishlist , tags -1 pending