內容目錄
Let’s describe more basics on Debian packaging.
All customization data for the Debian source package resides in the debian/ directory as presented in “節 5.7, “第三步:編輯模板檔案””:
When these are not sufficient to make a good Debian package, -p1 patches of 節 6.9, “debian/patches/* files” are deployed to modify the upstream source. These are applied in the sequence defined in the debian/patches/series file before building the package as presented in “節 5.9, “Step 3 (alternatives): Modification to the upstream source””.
您應當以引入最少修改的方式解決打包中出現的根本問題。所生成的套件應當考慮到未來的更新需求並有一定的健壯性。
![]() | 注意 |
---|---|
如果補丁對上游有所幫助的話,也請將解決根本問題的補丁反饋給上游作者和維護者。 |
Flexible customization of the 節 6.5, “debian/rules file” is realized by adding appropriate override_dh_* targets and their rules.
如果需要在 dh 命令呼叫某些特定的 dh_foo 命令時採取某些特別的操作,則任何自動執行的操作均可以被 debian/rules 中額外新增的 override_dh_foo 這樣的 Makefile 目標所覆寫。
構建的過程可以使用某些上游提供的介面進行定製化,如使用傳遞給標準的原始碼構建系統的引數。這些構建系統包括但不限於:
If this is the case, you should add the override_dh_auto_build target with “dh_auto_build -- arguments”. This ensures passing arguments to the build system after the default parameters that dh_auto_build usually passes.
![]() | 提示 |
---|---|
Please try not to execute the bare build system commands directly if they are supported by the dh_auto_build command. |
參見:
某些對設定 debian/rules 有用的變數定義可以在 /usr/share/dpkg/ 目錄下的檔案中找到。比較重要的包括:
例如,您按如下的方法在 debian/rules 檔案中新增內容,從而為 linux-any 目標架構添加額外的 CONFIGURE_FLAGS:
DEB_HOST_ARCH_OS ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS) ... ifeq ($(DEB_HOST_ARCH_OS),linux) CONFIGURE_FLAGS += --enable-wayland endif
See “節 9.10, “多體系架構””, dpkg-architecture(1) and dpkg-buildflags(1).
When a new upstream release tarball foo-newvwesion.tar.gz is released, the Debian source package can be updated by invoking commands in the old source tree as:
$ uscan ... foo-newversion.tar.gz downloaded $ uupdate -v newversion ../foo-newversion.tar.gz
After the above, you should refresh 節 6.9, “debian/patches/* files” (see “節 8.5, “Manage patch queue with dquilt””) and update debian/changelog with the dch(1) command.
When “debian uupdate” is specified at the end of line in the debian/watch file, uscan automatically executes uupdate(1) after downloading the tarball.
You can add, drop, and refresh 節 6.9, “debian/patches/* files” with dquilt to manage patch queue.
Add a new patch debian/patches/bugname.patch recording the upstream source modification on the file buggy_file as:
$ dquilt push -a $ dquilt new bugname.patch $ dquilt add buggy_file $ vim buggy_file ... $ dquilt refresh $ dquilt header -e $ dquilt pop -a
Drop (== disable) an existing patch
Refresh 節 6.9, “debian/patches/* files” to make “dpkg-source -b” work as expected after updating a Debian package to the new upstream release.
$ uscan; uupdate # updating to the new upstream release $ while dquilt push; do dquilt refresh ; done $ dquilt pop -a
Here is a recap of popular low level package build commands. There are many ways to do the same thing.
The sbuild(1) command is a wrapper script of dpkg-buildpackage which builds Debian binary packages in a chroot environment managed by the schroot(1) command. For example, building for Debian unstable suite can be done as:
$ sudo sbuild -d unstable
In schroot(1) terminology, this builds a Debian package in a clean ephemeral chroot “chroot:unstable-amd64-sbuild” started as a copy of the clean minimal persistent chroot “source:unstable-amd64-sbuild”.
This build environment was set up as described in “節 4.6, “sbuild setup”” with “sbuild-debian-developer-setup -s unstable” which essentially did the following:
$ sudo mkdir -p /srv/chroot/dist-amd64-sbuild $ sudo sbuild-createchroot unstable /srv/chroot/unstable-amd64-sbuild http://deb.debian.org/debian $ sudo usermod -a -G sbuild <your_user_name> $ sudo newgrp -
The schroot(1) configuration for unstable-amd64-sbuild was generated at /etc/schroot/chroot.d/unstable-amd64-sbuild.$suffix :
[unstable-amd64-sbuild] description=Debian sid/amd64 autobuilder groups=root,sbuild root-groups=root,sbuild profile=sbuild type=directory directory=/srv/chroot/unstable-amd64-sbuild union-type=overlay
其中:
You can update this source chroot “source:unstable-amd64-sbuild” by:
$ sudo sbuild-update -udcar unstable
You can log into this source chroot “source:unstable-amd64-sbuild” by:
$ sudo sbuild-shell unstable
![]() | 提示 |
---|---|
If your source chroot filesystem is missing packages such as libeatmydata1, ccache, and lintian for your needs, you may want to install these by logging into it. |
The orig.tar.gz file may need to be uploaded for a Debian revision other than 0 or 1 under some exceptional cases (e.g., for a security upload).
When an essential package becomes a non-essential one (e.g., adduser), you need to remove it manually from the existing chroot environment for its use by piuparts.
當您第一次對歸檔上傳套件時,您還需要包含原始的 orig.tar.gz 原始碼。
如果 Debian 修訂碼是 1 或者 0,這都是預設的。否則,您必須使用帶有 -sa 選項的 dpkg-buildpackage 命令。
![]() | 提示 |
---|---|
另一方面,-sd 選項將會強制排除原始的 orig.tar.gz 原始碼。 |
![]() | 提示 |
---|---|
新增至 ~/.bashrc 檔案。 |
如果當跳過上傳時,你在 debian/changelog 中建立了多個條目,你必須建立一個包含自上次上傳以來所有變更的 debian/changelog 檔案。這可以通過指定 dpkg-buildpackage 選項 -v 以及上次上傳的版本號,比如 1.2 來完成。
The reportbug(1) command used for the bug report of binarypackage can be customized by the files in usr/share/bug/binarypackage/.
dh_bugfiles 命令將安裝以下位於 debian/ 目錄中的的模板檔案。
debian/binarypackage.bug-control → usr/share/bug/binarypackage/control
debian/binarypackage.bug-presubj → usr/share/bug/binarypackage/presubj
debian/binarypackage.bug-script → usr/share/bug/binarypackage or usr/share/bug/binarypackage/script
See dh_bugfiles(1) and “reportbug’s Features for Developers (README.developers)”
![]() | 提示 |
---|---|
如果您總是需要提醒提交報告的使用者某些注意事項或詢問他們某些問題,使用這些檔案可以將這個過程自動化。 |