章 16. debmake options

內容目錄

16.1. Shortcut options (-a, -i)
16.2. debmake -b
16.3. debmake -cc
16.4. Snapshot upstream tarball (-d, -t)
16.5. debmake -j
16.6. debmake -k
16.7. debmake -P
16.8. debmake -T
16.9. debmake -x

Here are some additional explanations for debmake options.

debmake 命令提供了兩個快捷選項。

  • -a:開啟上游原始碼壓縮包
  • -i:執行構建二進位制包的指令碼

前文中章 5, Simple packaging”的例子可以使用下面的命令直接達到目的。

 $ debmake -a package-1.0.tar.gz -i debuild
[提示]提示

A URL such as https://www.example.org/DL/package-1.0.tar.gz may be used for the -a option.

[提示]提示

A URL such as https://arm.koji.fedoraproject.org/packages/ibus/1.5.7/3.fc21/src/ibus-1.5.7-3.fc21.src.rpm may be used for the -a option, too.

The debmake command with the -b option provides an intuitive and flexible method to create the initial template debian/control file. This file defines the split of the Debian binary packages with the following stanzas:

The debmake command also sets an appropriate set of substvars (substitution variables) used in each pertinent dependency stanza.

我們在這裡直接引用 debmake 手冊頁中的相關一部分內容。

-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 命令會發出警告。

debmake 命令在帶上 -cc 選項時可以對標準輸出列印整個原始碼樹的版權和許可證概要資訊。

 $ tar -xvzf package-1.0.tar.gz
 $ cd package-1.0
 $ debmake -cc | less

如果轉而使用 -c 選項,程式將提供較短的報告。

This test building scheme is suitable for git repositories organized as described in gbp-buildpackage(7), which uses the master, upstream, and pristine-tar branches.

The upstream snapshot from the upstream source tree in the upstream VCS can be made with the -d option if the upstream supports the make dist equivalence.

 $ cd /path/to/upstream-vcs
 $ debmake -d -i debuild

除此之外,也可使用 -t 選項以使用 tar 命令生成上游原始碼套件。

 $ cd /path/to/upstream-vcs
 $ debmake -p package -t -i debuild

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.

If the upstream VCS is hosted in the package/ directory instead of the upstream-vcs/ directory, the -p package can be skipped.

如果版本控制系統中的上游原始碼樹包含了 debian/* 檔案,debmake 命令在帶有 -d 選項或者 -t 選項並結合 -i 選項可以自動化進行使用這些 debian/* 檔案從版本控制系統快照中構建非原生套件的流程。

 $ cp -r /path/to/package-0~1403012359/debian/. /path/to/upstream-vcs/debian
 $ dch
   ... update debian/changelog
 $ git add -A .; git commit -m "vcs with debian/*"
 $ debmake -t -p package -i debuild

This non-native Debian binary package building scheme without the real upstream tarball is considered a quasi-native Debian package. See 節 11.13, “Quasi-native Debian packaging”” for more details.

This is an experimental feature.

生成多個二進位制套件通常比只生成一個二進位制套件需要投入更多的工作量。對原始碼包進行測試構建是其中的必要一環。

例如,我們考慮將相同的 package-1.0.tar.gz(參見 章 5, Simple packaging”)打包並生成多個二進位制套件。

  • 呼叫 debmake 命令並使用 -j 選項以測試構建並報告結果。

     $ debmake -j -a package-1.0.tar.gz
  • 請檢查 package.build-dep.log 檔案最後的幾行以確定 Build-Depends 所需填寫的構建依賴。(您不需要在 Build-Depends 中列出 debhelperperlfakeroot 所使用的套件。在只生成單個套件的情況下也是如此。)
  • 請檢查 package.install.log 的檔案內容以確定各個檔案的安裝路徑,從而決定如何將它們拆分成多個套件。
  • 呼叫 debmake 命令以開始準備打包資訊。

     $ rm -rf package-1.0
     $ tar -xvzf package-1.0.tar.gz
     $ cd package-1.0
     $ debmake -b"package1:type1, ..."
  • 請使用以上資訊更新 debian/controldebian/binarypackage.install 檔案。
  • 按需更新其它 debian/* 檔案。
  • 使用 debuild 或等效的其它工具構建 Debian 套件。

     $ debuild
  • 所有由 debian/binarypackage.install 檔案指定的二進位制套件條目均會生成 binarypackage_version-revision_arch.deb 的安裝檔。
[注意]注意

The -j option for the debmake command invokes dpkg-depcheck(1) to run debian/rules under strace(1) to obtain library dependencies. Unfortunately, this is very slow. If you know the library package dependencies from other sources such as the SPEC file in the source, you may just run the "debmake …​" command without the -j option and run the debian/rules install command to check the install paths of the generated files.

This is an experimental feature.

在使用上游新發行版本更新套件時,debmake 可以使用已有的 debian/copyright 檔案和整個更新的原始碼樹檔案進行對比驗證版權和許可證資訊。

 $ cd package-vcs
 $ gbp import-orig --uscan --pristine-tar
 ... update source with the new upstream release
 $ debmake -k | less

The debmake -k command parses the debian/copyright file from the top to the bottom and compares the license of all the non-binary files in the current package with the license described in the last matching file pattern entry of the debian/copyright file.

在您編輯自動生成的 debian/copyright 檔案時,請確保將最通用的檔案匹配模式放在檔案前部,最精確的匹配模式放在後部。

[提示]提示

For all new upstream releases, run the debmake -k command to ensure that the debian/copyright file is current.

呼叫 debmake 命令並帶上 -P 選項將會嚴厲地檢查所有自動生成檔案的版權和許可證文字資訊;即使它們都使用寬鬆的許可證也是如此。

此選項不止會影響正常執行過程中所生成的 debian/copyright 檔案的內容,也會影響帶引數 -k-c-cc-ccc 選項的輸出內容。

呼叫 debmake 命令並帶上 -T 選項會額外輸出詳細的教材註釋行。這些行在模板檔案中用 ### 進行標註。

debmake 生成的模板檔案數量由 -x[01234] 選項進行控制。

[注意]注意

debmake 命令不會修改任何已存在的配置文件。