Reference
http://manpages.ubuntu.com/manpages/precise/man1/dpkg-buildpackage.1.htmlhttp://www.debian.org/doc/manuals/maint-guide/index.en.html
http://debian-handbook.info/browse/stable/debian-packaging.html
http://askubuntu.com/questions/28372/how-do-i-get-the-source-code-of-packages-installed-through-apt-get
http://www.debian.org/doc/debian-policy/
http://debian-handbook.info/browse/stable/sect.becoming-package-maintainer.html
Rebuild Flow Example
Download Source Code
最簡單的方式是利用 apt-get source
$ sudo apt-get source python-twill Reading package lists... Done Building dependency tree Reading state information... Done Picking 'twill' as source package instead of 'python-twill' NOTICE: 'twill' packaging is maintained in the 'Svn' version control system at: svn://svn.debian.org/python-modules/packages/twill/trunk/ Need to get 255 kB of source archives. Get:1 http://free.nchc.org.tw/ubuntu/ precise/universe twill 0.9-3 (dsc) [1,367 B] Get:2 http://free.nchc.org.tw/ubuntu/ precise/universe twill 0.9-3 (tar) [242 kB] Get:3 http://free.nchc.org.tw/ubuntu/ precise/universe twill 0.9-3 (diff) [11.5 kB] Fetched 255 kB in 3s (64.5 kB/s) gpgv: Signature made Sun 04 Dec 2011 11:29:49 PM CST using DSA key ID 5E3619D3 gpgv: Can't check signature: public key not found dpkg-source: warning: failed to verify signature on ./twill_0.9-3.dsc dpkg-source: info: extracting twill in twill-0.9 dpkg-source: info: unpacking twill_0.9.orig.tar.gz dpkg-source: info: unpacking twill_0.9-3.debian.tar.gz dpkg-source: info: applying 01_fix_history_path.patch dpkg-source: info: applying 02_remove_ext.patch dpkg-source: info: applying 03_no_setuptools.patch dpkg-source: info: applying 04_fix_deprecated_ClientForm.patch dpkg-source: info: applying 05_fix_missing_imports.patch $ ll total 268 drwxr-xr-x 3 eric_chen pjack 4096 Oct 9 15:39 ./ drwxr-xr-x 63 eric_chen pjack 4096 Oct 9 14:33 ../ drwxr-xr-x 9 root root 4096 Oct 9 15:39 twill-0.9/ -rw-r--r-- 1 root root 11494 Dec 17 2011 twill_0.9-3.debian.tar.gz -rw-r--r-- 1 root root 1367 Dec 17 2011 twill_0.9-3.dsc -rw-r--r-- 1 root root 242291 Feb 9 2009 twill_0.9.orig.tar.gz
如果有 dsc 檔, 裡面含有 Link 時, 也可以用 dpkg-source 指令下載
$ dpkg-source -x twill_0.9-3.dsc gpgv: Signature made Sun 04 Dec 2011 11:29:49 PM CST using DSA key ID 5E3619D3 gpgv: Can't check signature: public key not found dpkg-source: warning: failed to verify signature on ./twill_0.9-3.dsc dpkg-source: info: extracting twill in twill-0.9 dpkg-source: info: unpacking twill_0.9.orig.tar.gz dpkg-source: info: unpacking twill_0.9-3.debian.tar.gz dpkg-source: info: applying 01_fix_history_path.patch dpkg-source: info: applying 02_remove_ext.patch dpkg-source: info: applying 03_no_setuptools.patch dpkg-source: info: applying 04_fix_deprecated_ClientForm.patch dpkg-source: info: applying 05_fix_missing_imports.patch
Modify ChangeLog
$ sudo apt-get install devscripts $ cd twill-0.9 ~/twill-0.9/$ dch -v twill-0.9-3ubuntu1 # 或是用這個指令也可 ~/twill-0.9/$ dch -i # Increment the final component of the Debian release number
twill (0.9-3ubuntu1) precise; urgency=low * test rebuild -- eric_chenWed, 09 Oct 2013 15:40:31 +0800 twill (0.9-3) unstable; urgency=low * Add debian/patches/04_fix_deprecated_ClientForm.patch as ClientForm is now shipped with mechanize. + debian/rules: - Drop Depends on python-clientform. + debian/control: - Bump python-mechanize Depends to >= 0.2.0~. * debian/patches/02_remove_ext.patch: + Fix tests as well. * Add debian/patches/05_fix_missing_imports.patch. * debian/control: + Bump Standards-Version to 3.9.2. No changes needed. * Switch from now deprecated pysupport to dh_python2. + Drop debian/pyversions and debian/pycompat. + debian/rules: - Remove DEB_PYTHON_SYSTEM. + debian/control: - Add X-Python-Version field. - Bump python and cdbs versions.
Rebuild Package
先把需要的 package 裝一裝
$ sudo apt-get build-dep python-twill Reading package lists... Done Building dependency tree Reading state information... Done Picking 'twill' as source package instead of 'python-twill' The following NEW packages will be installed: cdbs debhelper dh-apparmor dh-translations docbook-xml docbook-xsl html2text intltool python-scour xsltproc 0 upgraded, 10 newly installed, 0 to remove and 2 not upgraded. Need to get 1,701 kB/2,781 kB of archives. After this operation, 16.5 MB of additional disk space will be used. Do you want to continue [Y/n]? y
開始 rebuild
~/twill-0.9$ debuild -us -uc dpkg-buildpackage -rfakeroot -D -us -uc dpkg-buildpackage: export CFLAGS from dpkg-buildflags (origin: vendor): -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security dpkg-buildpackage: export CPPFLAGS from dpkg-buildflags (origin: vendor): -D_FORTIFY_SOURCE=2 dpkg-buildpackage: export CXXFLAGS from dpkg-buildflags (origin: vendor): -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security dpkg-buildpackage: export FFLAGS from dpkg-buildflags (origin: vendor): -g -O2 dpkg-buildpackage: export LDFLAGS from dpkg-buildflags (origin: vendor): -Wl,-Bsymbolic-functions -Wl,-z,relro dpkg-buildpackage: source package twill dpkg-buildpackage: source version 0.9-3 dpkg-buildpackage: source changed by Arnaud Fontainedpkg-source --before-build twill-0.9 dpkg-buildpackage: host architecture amd64 fakeroot debian/rules clean ...
$ ll -rw-r--r-- 1 eric_chen pjack 68498 Oct 9 15:42 python-twill_0.9-3ubuntu1_all.deb drwxr-xr-x 10 eric_chen pjack 4096 Oct 9 15:42 twill-0.9/ -rw-r--r-- 1 eric_chen pjack 17480 Oct 9 15:43 twill_0.9-3ubuntu1_amd64.build -rw-r--r-- 1 eric_chen pjack 1252 Oct 9 15:42 twill_0.9-3ubuntu1_amd64.changes -rw-r--r-- 1 eric_chen pjack 11468 Oct 9 15:42 twill_0.9-3ubuntu1.debian.tar.gz -rw-r--r-- 1 eric_chen pjack 1149 Oct 9 15:42 twill_0.9-3ubuntu1.dsc
沒有留言:
張貼留言