Here we package the upstream tarball gentoo-1.0.2.tar.gz and uploading all the packages to the nm_target.
$ 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 name@domain.dom -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
dpatch and the 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 name@domain.dom -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 patch-file \
-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
Here debian/rules originally looks like:
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
You change debian/rules to the following by the editor to use
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
Now you are ready to repackage the source tree with dpatch system.
$ 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
Debian New Maintainers' Guide
version 1.2.3, 18 January 2005.joy-mg@debian.org