章 12. Tool usages

內容目錄

12.1. debdiff
12.2. dget
12.3. mk-origtargz
12.4. origtargz
12.5. git deborig
12.6. dpkg-source -b
12.7. dpkg-source -x
12.8. debc
12.9. piuparts
12.10. bts

Here are some notable tools around Debian packaging.

[注意]注意

本節中的描述過於簡潔,對大多數潛在的維護者都沒用。 這是作者的有意為之。 我們強烈建議您搜尋並閱讀與所用命令相關的所有文件。

[注意]注意

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.

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 on a Git repository without the official release of tarball, you can generate its orig tarball from the git repository for use by the Debain source package. Please, 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 setup””) operations and understands the the patch application status from the existance of .pc/applied-patches.

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

The dpkg-source -x command extracts 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 節 10.6, “Patch applied Git repository””.)

The dpkg-source -x --skip-patches command extracts source tree only. It doesn’t add .pc/applied-patches. (See 節 10.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.

The bts command is a handy tool to manage bugs on the Debian Bug Tracking System.

$ bts severity 123123 wishlist , tags -1 pending