Table of Contents
這裡提供 debmake 命令的一些重要選項。
debmake 命令提供了兩個快捷選項。
前文中Chapter 4, 簡單例子的例子可以使用下面的命令直接達到目的。
$ debmake -a package-1.0.tar.gz -i debuild
![]() |
Tip |
---|---|
-a 選項也可以使用“https://www.example.org/DL/package-1.0.tar.gz”這樣的 URL。 |
![]() |
Tip |
---|---|
-a 選項也可以使用“https://arm.koji.fedoraproject.org/packages/ibus/1.5.7/3.fc21/src/ibus-1.5.7-3.fc21.src.rpm”這樣的 URL。 |
您可以使用以原始碼壓縮包(tarball)形式提供的 pythonmodule-1.0.tar.gz Python 模組包直接生成一個獨立二進位制 Debian 套件。這裡的 -b 選項可以指定套件型別為 python,-s 選項可以從上游壓縮包中提取並複製軟體包描述內容至指定位置。
$ debmake -s -b':python' -a pythonmodule-1.0.tar.gz -i debuild
對其他支援 -b 選項的解釋式程式語言,請給 -b 選項指定恰當的 type 。
對沒有 -b 選線支援的其它解釋性語言,您可以指定其為指令碼型別(script 型別)並調整 debian/control 檔案而將直譯器對應的軟體包新增為套件依賴。
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 |
---|---|
對所有上游釋出新版本的情況,執行“debmake -k”可以確保 debian/copyright 檔案一直處於最新狀態。 |
生成多個二進位制套件通常比只生成一個二進位制套件需要投入更多的工作量。對原始碼包進行測試構建是其中的必要一環。
例如,我們考慮將相同的 package-1.0.tar.gz(參見 Chapter 4, 簡單例子)打包並生成多個二進位制套件。
呼叫 debmake 命令並使用 -j 選項以測試構建並報告結果。
$ debmake -j -a package-1.0.tar.gz
呼叫 debmake 命令以開始準備打包資訊。
$ rm -rf package-1.0 $ tar -xvzf package-1.0.tar.gz $ cd package-1.0 $ debmake -b"package1:type1, ..."
使用 debuild 或等效的其它工具構建 Debian 套件。
$ debuild
![]() |
Note |
---|---|
binarypackage_version-revision_arch.deb 命令的 -j 選項會呼叫 dpkg-depcheck(1) 以在 strace(1) 之下執行 debian/rules,從而獲得程式庫依賴資訊。然而,這樣操作的執行速度極慢。如果您由其他途徑獲知了套件的程式庫套件依賴資訊,例如外部的 SPEC 文件等等,您可以直接執行“debmake …”命令而不帶 -j 選項並執行“debian/rules install”命令以檢查所生成檔案的安裝路徑。 |
debmake 生成的模板檔案數量由 -x[01234] 選項進行控制。
![]() |
Note |
---|---|
debmake 命令不會修改任何已存在的配置文件。 |
呼叫 debmake 命令並帶上 -P 選項將會嚴厲地檢查所有自動生成檔案的版權和許可證文字資訊;即使它們都使用寬鬆的許可證也是如此。
此選項不止會影響正常執行過程中所生成的 debian/copyright 檔案的內容,也會影響帶引數 -k、-c、-cc 和 -ccc 選項的輸出內容。