Chapter 6. debmake 選項

Table of Contents

6.1. 快捷選項(-a,-i)
6.1.1. Python 模組
6.2. Snapshot upstream tarball (-d, -t)
6.3. debmake -cc
6.4. debmake -k
6.5. debmake -j
6.6. debmake -x
6.7. debmake -P
6.8. debmake -T

這裡提供 debmake 命令的一些重要選項。

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

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

前文中Chapter 4, 簡單例子的例子可以使用下面的命令直接達到目的。

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

-a 選項也可以使用“https://www.example.org/DL/package-1.0.tar.gz”這樣的 URL。

[Tip] Tip

-a 選項也可以使用“https://arm.koji.fedoraproject.org/packages/ibus/1.5.7/3.fc21/src/ibus-1.5.7-3.fc21.src.rpm”這樣的 URL。

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

如果上游套件支援“make dist”或者等效的目標,您可以使用 -d 選項從上游原始碼樹版本控制系統中得到上游程式碼的快照。

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

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

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

除非您明確使用 -u 選項或者在 debian/changelog 檔案中提前指定好版本號,預設情況下快照生成的上游版本號將應用協調世界時的日期和時間使用 0~%y%m%d%H%M 格式生成,例如 0~1403012359

如果上游版本控制系統位於 套件名/ 目錄而非任意的 上游版本控制系統/ 目錄,引數中的“-p 套件名”這部分可以跳過。

如果版本控制系統中的上游原始碼樹包含了 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 using the “debmake -t -i debuild” command may be considered as the quasi-native Debian package scheme since the packaging situation resembles the native Debian binary package building case using the debuild command without the upstream tarball.

Use of a non-native Debian package building scheme helps to ease communication with the downstream distros such as Ubuntu for bug fixes etc.

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

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

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

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

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

debmake -k”命令可以完整解析 debian/copyright 並將當前套件中的所有非二進位制文件內含的許可證資訊按照最後一項匹配的方式與 debian/copyright 檔案中的資訊進行對比。

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

[Tip] Tip

對所有上游釋出新版本的情況,執行“debmake -k”可以確保 debian/copyright 檔案一直處於最新狀態。

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

例如,我們考慮將相同的 package-1.0.tar.gz(參見 Chapter 4, 簡單例子)打包並生成多個二進位制套件。

  • 呼叫 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 的安裝檔。
[Note] Note

binarypackage_version-revision_arch.deb 命令的 -j 選項會呼叫 dpkg-depcheck(1) 以在 strace(1) 之下執行 debian/rules,從而獲得程式庫依賴資訊。然而,這樣操作的執行速度極慢。如果您由其他途徑獲知了套件的程式庫套件依賴資訊,例如外部的 SPEC 文件等等,您可以直接執行“debmake …”命令而不帶 -j 選項並執行“debian/rules install”命令以檢查所生成檔案的安裝路徑。

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

[Note] Note

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

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

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

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