vern@2007-08-10:/var% ls tags

dpatch使用

dpatch的介绍 dpatch是一个易于使用的Debian包补丁管理系统,和dbs包有些类似,但是比它更简单。 dpatch让你把补丁文件或者其它自定义的文件存放到debian/patches目录,而不需要对你的源码树作过多的修改。要在编译期间使补丁生效,你只需简单的在debian/rules文件的build和clean节中添加对patch/unpatch的依赖。你还可以直接调用/usr/bin/dpatch带来更多的弹性。

使用dpatch的动机 * 你希望自己维护的代码以独立的形式出现,而不是直接融入到软件作者的原始代码中。

使用dpatch打包

FROM: http://www.debian.org/doc/manuals/maint-guide/ap-pkg-eg.zh-cn.html

$ 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 <a href="mailto:name@domain.dom"> name@domain.dom</a> -f /path/from/gentoo-1.0.2.tar.gz
... Answer prompts.
... Fix source tree by editor
... Try building packages message "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 -ENBaurw 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
    touch 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
$ debuild