Debian

使用 git-dpm 來管理 Debian package中的 patch – 新增 Debian 套件

之前管理/ 使用 Debian package 中的 patches 都是直接操作 quilt 為主, 但經由 ChangZhuo 告知, 可使用 git-dpm 來作管理會更方便.

1: 安裝必要套件

 apt-get install -y git git-dpm pristine-tar devscripts  

 

2: 準備好 upstream 的 tarball檔案

並命名為 <PACKAGENAME>_<UPSTREAM VERSION>.orig.tar.gz

  • PACKAGENAME: 為你要打包的套件名
  • UPSTREAM VERSION: 為上游版本號
3: 解開上一步的壓縮檔並進入資料夾
4: 將目前檔案加到 git 中, 送出 commit 並切換 branch 到 “upstream"
git add .
git commit -m "Import <PACKAGENAME>_<UPSTREAM VERSION>.orig.tar.gz"
git checkout -b upstream
5: 使用 pristine tar 來儲存 tar 相關資料
pristine-tar commit ../<PACKAGENAME>_<UPSTREAM VERSION>.orig.tar.gz upstream
6: 告訴 git-dpm 有關 upstream tarball 的位置
git-dpm init ../<PACKAGENAME>_<UPSTREAM VERSION>.orig.tar.gz

 

7: 設定 git-dpm tag 格式, 以 / 來做分隔符號

編輯 debian/.git-dpm, 在後面加入.

debianTag="debian/%e%v"
patchedTag="patched/%e%v"
upstreamTag="upstream/%e%u"

 

8: 開始設定並編輯 debian/ 目錄相關資料

ex: debian/control, debian/changelog 等等

 

9: 將 debian/ 加入 git 中並送出 commit

git add debian
git commit -m "Initial packaging"

 

10: 使用 checkout-patched 指令切換 branch 並開始修改 upstream 的檔案, 最後送出 commit 並 update patch. 此時 git-dpm 會自動將 git commit 轉成 patch 並存放在 debian/patches 中

git-dpm checkout-patched
vi ...
git commit
git-dpm update-patches

 

11: 更新 debian/changelog

dch "fix ... (Closes: num)"
git commit --amend -a

 

12: 確認 git-dpm status

git-dpm status

 

13: 確認套件可正常構建

debuild

 

14: 幫 git-dpm 打 tag

git-dpm tag

 

15: 將修改結果 push 回去

git push --tags origin upstream:upstream pristine-tar:pristine-tar master

 

ref

[1]: http://git-dpm.alioth.debian.org/examples.html#newupstream

[2]: https://anonscm.debian.org/git/collab-maint/cppman.git/

[3]: http://git-dpm.alioth.debian.org/git-dpm-debconf13.pdf

 

使用 git-dpm 來管理 Debian package中的 patch – 新增 Debian 套件 有 “ 1 則迴響 ”

發表迴響