Debian-maint-guide/A
来自Ubuntu中文
Debian新维护人员手册
附录 A - 例子
现在我们来给上游软件gentoo-1.0.2.tar.gz打包,并且上传所有的软件包到nm_target.
A.1 简单打包例子
$ mkdir -p /path/to # new empty directory $ cd /path/to $ tar -xvzf /path/from/gentoo-1.0.2.tar.gz # get source $ cd gentoo-1.0.2 $ dh_make -e [email protected] -f /path/from/gentoo-1.0.2.tar.gz ... Answer prompts. ... Fix source tree ... If it is a script package, set debian/control to "Architecture: all" ... Do not erase ../gentoo_1.0.2.orig.tar.gz $ debuild ... Make sure no warning happens. $ cd .. $ dupload -t nm_target gentoo_1.0.2-1_i386.changes
A.2 用dpatch和pbuilder打包
$ mkdir -p /path/to # new empty directory $ cd /path/to $ tar -xvzf /path/from/gentoo-1.0.2.tar.gz $ cp -a gentoo-1.0.2 gentoo-1.0.2-orig $ cd gentoo-1.0.2 $ dh_make -e [email protected] -f /path/from/gentoo-1.0.2.tar.gz ... Answer prompts. ... Fix source tree by editor ... Try building packages with "dpkg-buildpackage -rfakeroot -us -uc" ... Edit source to make source buildable. ... Do not erase ../gentoo_1.0.2.orig.tar.gz $ cd .. $ cp -a gentoo-1.0.2 gentoo-1.0.2-keep # safety backup $ mv gentoo-1.0.2/debian debian $ diff -Nru gentoo-1.0.2-orig gentoo-1.0.2 > patch-file ... You may overwrite gentoo-1.0.2 directory while doing this. ... Make sure to keep gentoo-1.0.2-keep for your safety $ mkdir -p debian/patches $ dpatch patch-template -p "01_patchname" "patch-file description" \ < patch-file > debian/patches/01_patchname.dpatch $ cd debian/patches $ echo 01_patchname.dpatch >00list $ cd ../.. # back to /path/to $ rm -rf gentoo-1.0.2 $ editor debian/rules
现在文件debian/rules的内容是:
config.status: configure ./configure --prefix=/usr --mandir=/usr/share build: config.status ${MAKE} clean: $(testdir) $(testroot) ${MAKE} distclean rm -rf debian/imaginary-package debian/files debian/substvars
你可以用编辑器修改debian/rules文件为以下内容使其使用dpatch:
config.status: patch configure ./configure --prefix=/usr --mandir=/usr/share build: config.status ${MAKE} clean: clean-patched unpatch clean-patched: $(testdir) $(testroot) ${MAKE} distclean rm -rf debian/imaginary-package debian/files debian/substvars patch: patch-stamp patch-stamp: dpatch apply-all dpatch call-all -a=pkg-info >patch-stamp unpatch: dpatch deapply-all rm -rf patch-stamp debian/patched
现在你可以用dpatch系统重新打包了。
$ tar -xvzf gentoo_1.0.2.orig.tar.gz $ cp -a debian/ gentoo-1.0.2/debian $ cd gentoo-1.0.2 $ sudo pbuilder update $ pdebuild $ cd /var/cache/pbuilder/result/ $ dupload -t nm_target gentoo_1.0.2-1_i386.changes