--- hackpadID: FsvIrUHC7iR hackpadWorkspace: tossug tags: hackpad-import, tossug --- # Debian packaging workshop (5) ###### tags: `Debian packaging workshop` 上週筆記:[Debian packaging workshop 4](/37qXm4zDFbJ) 下週筆記:[Debian packaging workshop 6](/DWXo6WnLeOf) 日期:2015/05/05 網路聊天室:[](http://webchat.freenode.net/?channels=tossug)[http://webchat.freenode.net/?channels=tossug](http://webchat.freenode.net/?channels=tossug) YouTube直播錄影:[](http://youtu.be/iE92-bfAWEk)http://youtu.be/iE92-bfAWEk ## 主題:pbuilder 跟 sbuild 以及相關的工具 **pbuilder/cowbuilder** [](http://pbuilder.alioth.debian.org/)http://pbuilder.alioth.debian.org/ [](http://wen00072.github.io/blog/2014/11/20/package-debian-packages-using-local-debian-pbuilder-package/)http://wen00072.github.io/blog/2014/11/20/package-debian-packages-using-local-debian-pbuilder-package/ <undefined>* **安裝所需要的工具**</undefined> $ sudo apt-get install pbuilder cowbuilder ubuntu-dev-tools pbuilder - personal package builder for Debian packages cowbuilder - pbuilder running on cowdancer cowdancer - Copy-on-write directory tree utility. ubuntu-dev-tools: /usr/bin/pbuilder-dist ubuntu-dev-tools: /usr/bin/cowbuilder-dist <undefined>* **以 Debian unstable 為例**</undefined> 在 ~/bin/ 底下建立 Soft link pbuilder-unstable-amd64 -> /usr/bin/pbuilder-dist $ pbuilder-unstable-amd64 create # 建立基本環境 $ pbuilder-unstable-amd64 update # 更新環境 $ pbuilder-unstable-amd64 build hello_2.10-0.1.dsc # 編譯該套件 pbuilder 1st: 1m38.364s, 2nd: 1m50.065s, 3rd: 1m24.354s cowbuilder 1st: 1m32.800s, 2nd: 1m42.222s, 3rd: 1m7.449s **sbuild** [](https://wiki.debian.org/sbuild)https://wiki.debian.org/sbuild <undefined>* **安裝所需要的工具**</undefined> $ sudo apt-get install sbuild ubuntu-dev-tools <undefined>* **以 Debian unstable 為例**</undefined> $ mk-sbuild --arch amd64 --distro debian unstable # 第一次執行時會把你加入 sbuild 群組 $ newgrp sbuild # 馬上得到 sbuild $ mk-sbuild --arch amd64 --distro debian unstable To CHANGE the golden image: sudo schroot -c source:sid-amd64 -u root To ENTER an image snapshot: schroot -c sid-amd64 To BUILD within a snapshot: sbuild -A -d sid-amd64 PACKAGE*.dsc $ sbuild -A -d sid-amd64 hello_2.10-0.1.dsc E: Local archive GPG signing key not found I: Please generate a key with ’sbuild-update --keygen’ $ sbuild-update --keygen # 第一次需要產生一組公私鑰給它用 $ sbuild -A -d sid-amd64 hello_2.10-0.1.dsc sbuild, 1st: 0m59.525s, 2nd: 0m59.437s **pdebuild** pdebuild - pbuilder way of doing debuild 這個就比較沒有那麼彈性,只能依照 ~/.pbuilderrc 裡面設定或是指令所下的參數來建立環境 <undefined>* **Host 為 Ubuntu 14.04**</undefined> [](http://askubuntu.com/questions/435450/how-to-get-a-sid-pbuilder-in-ubuntu)http://askubuntu.com/questions/435450/how-to-get-a-sid-pbuilder-in-ubuntu $ sudo apt-get install debian-archive-keyring $ sudo pbuilder --create --mirror [](http://free.nchc.org.tw/debian)http://free.nchc.org.tw/debian --distribution unstable --architecture amd64 --debootstrapopts --keyring=/usr/share/keyrings/debian-archive-keyring.gpg # 產生 Debian unstable amd64 的環境 $ cd ~/workshop/hello-2.10 # 直接進到 Debian source package 解開後的目錄底下 $ pdebuild <undefined>* **Host 為 Debian **</undefined> $ sudo pbuilder --create --mirror [](http://free.nchc.org.tw/debian)http://[free.nchc.org.tw](http://free.nchc.org.tw/debian)/debian --distribution unstable --architecture amd64 如果沒有特別設定的話,Debian binary package 會產生在 /var/cache/pbuilder/result 底下 * "Only the [root user](http://en.wikipedia.org/wiki/Superuser) can perform a chroot. This is intended to prevent users from putting a [setuid](http://en.wikipedia.org/wiki/Setuid) program inside a specially crafted chroot jail (for example, with a fake [/etc/passwd](http://en.wikipedia.org/wiki//etc/passwd) and [/etc/shadow](http://en.wikipedia.org/wiki//etc/shadow) file) that would fool it into a [privilege escalation](http://en.wikipedia.org/wiki/Privilege_escalation)." -- [Wikipedia](http://en.wikipedia.org/wiki/Chroot) * "Schroot allows users to execute commands or interactive shells in different <u>[chroots](https://wiki.debian.org/chroot)</u> (see <u>[schroot](https://packages.debian.org/schroot)</u>)." -- [Debian wiki](https://wiki.debian.org/Schroot) 下週主題:git-buildpackage [](https://enc.com.au/2015/04/28/backporting-and-git-buildpackage/)https://enc.com.au/2015/04/28/backporting-and-git-buildpackage/ $ git clone [](git://anonscm.debian.org/pkg-ime/libchewing.git)git://anonscm.debian.org/pkg-ime/libchewing.git $ DIST=sid git-pbuilder create [](https://help.launchpad.net/Code/Git)https://help.launchpad.net/Code/Git 下週主題二:metapackage/transitional/dummy package, [](https://wiki.debian.org/DebianPureBlends)https://wiki.debian.org/DebianPureBlends
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up