I have been using this script to convert archive. Here is my updated one. Slightly touched up.
Osamu
#!/bin/sh set -e # COPYRIGHT # # (c) Osamu Aoki, 2010, GPL2+ # # dpatch2quilt.sh is used as the base of this program. # parts from http://blog.orebokech.com/2007/08/converting-debian-packages-from-dpatch.html # (c) gregor herrmann, 2007-2008, GPL2+ # (c) Damyan Ivanov, 2007-2008, GPL2+ # (c) Martin Quinson, 2008, GPL2+ # NAME # # deb3 - convert debian source package to new 3.0 (quilt) format # # SYNOPSIS # # deb3 [quilt|dpatch|0|1|2|] # # DESCRIPTION # # deb3 converts debian source packages which use series of patches from # 1.0 format to new 3.0 (quilt) format while adjusting contents in # debian/patches. This is run from the package top level directory. # If run without argument, deb3 guesses source structure. Following # formats are auto detected. # # * dh_quilt_patch/dh_quilt_unpatch # * dpatch # * cdbs (simple-patchsys.mk) # * dbs (dbs-build.mk) # # ARGUMENT # # You can force particular conversion using argument. # # quilt conversion for dh_quilt_patch/dh_quilt_unpatch # dpatch conversion for dpatch # 0 conversion for dbs and cdbs made with -p 0 patches (default) # 1 conversion for dbs and cdbs made with -p 1 patches # 2 conversion for dbs and cdbs made with -p 2 patches # Default patch level for cdbs and dbs # This may be overriden via environment variable or argument : ${PATCH_LEVEL=0} export QUILT_PATCHES=debian/patches export QUILT_PATCH_OPTS="--unified-reject-files" export QUILT_DIFF_ARGS="-p ab --no-timestamps --no-index --color=auto" export QUILT_REFRESH_ARGS="-p ab --no-timestamps --no-index" export QUILT_COLORS="diff_hdr=1;32:diff_add=1;34:diff_rem=1;31:diff_hunk=1;33:diff_ctx=35:diff_cctx=33" dummy_git() { # Do nothing if it is not under Git : } convert_quilt() { COUNT_OLD=$(ls -1 debian/patches/* | wc -l) COUNT_NEW=$(ls -1 debian/patches/* | wc -l) } convert_dpatch() { for p in $(dpatch list-all); do quilt import -P $p.patch debian/patches/$p.dpatch AUTHOR=$(dpatch cat --author-only $p.dpatch) DESC=$(dpatch cat --desc-only $p.dpatch) echo "Author: $AUTHOR" | quilt header -r $p.patch echo "Description: $DESC" | quilt header -a $p.patch quilt push quilt refresh $GITCOM add debian/patches/$p.patch done quilt pop -a COUNT_OLD=$(ls -1 debian/patches/*.dpatch | wc -l) COUNT_NEW=$(ls -1 debian/patches/*.patch | wc -l) $GITCOM add debian/patches/series $GITCOM rm debian/patches/00list debian/patches/*.dpatch rm -rf debian/patches/*.dpatch rm -rf debian/patches/00list } convert_simple() { mv debian/patches debian/patches-old for p in debian/patches-old/* ; do # normalize patch filename extension to *.patch q=${p##*/} q=${q%.*}.patch # normally $PATCH_LEVEL is 0 quilt import -p $PATCH_LEVEL -P $q $p # no good data to use. Just provide template entries. quilt push quilt refresh $GITCOM add $p done quilt pop -a COUNT_OLD=$(ls -1 debian/patches-old/* | wc -l) COUNT_NEW=$(ls -1 debian/patches/* | wc -l) rm -rf debian/patches-old $GITCOM add debian/patches/series } # # BEGIN # dh_testdir if [ -d ".git" ]; then GITCOM=git else GITCOM=dummy_git fi # set package source format mkdir -p debian/source $GITCOM add debian/source echo "3.0 (quilt)" >debian/source/format $GITCOM add debian/source/format # make debian/rules template mv debian/rules debian/rules-old cat >debian/rules <<EOF #!/usr/bin/make -f # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 #export DH_OPTIONS=-v %: dh \$@ # Use override_dh_* targets to customize this. # --------------------------------------------------- # Followings are the old debian/rules # EOF sed -e 's/^/# /' <debian/rules-old >>debian/rules rm debian/rules-old chmod 755 debian/rules $GITCOM add debian/rules # change patch queue format if [ "$1" = quilt ]; then convert_quilt elif [ "$1" = dpatch ]; then convert_dpatch elif [ "$1" = "0" ] || [ "$1" = "1" ] || [ "$1" = "2" ]; then PATCH_LEVEL=$1 convert_simple elif [ -f debian/patches/series ]; then convert_quilt elif [ -f debian/patches/00list ]; then convert_dpatch elif grep "include.*\/cdbs\/.*\/simple-patchsys\.mk" debian/rules ; then convert_simple elif grep "include.*\/dbs\/dbs-build\.mk" debian/rules ; then convert_simple else echo "deb3 [quilt|dpatch|0|1|2|]" >&2 exit 1 fi echo "INFO: The numbers of files in old debian/patches: $COUNT_OLD" >&2 echo "INFO: The numbers of files in new debian/patches: $COUNT_NEW" >&2 echo "... Auto conversion completed!" >&2 cat <<EOF ----------------------------------------------------------------------- You need to make further modification to your package following debhelper(7) manpage. This deb3 script only provides starting point to you. Typical modifications are: * "Build-Depends:" should remove "cdbs", "dpatch", and "quilt". * "Build-Depends:" should list "debhelper (>= 7.0.50~)" * Add "override_dh_*:" targets to debian/rules to address special cases. * Remove "--with quilt" in debian/rules, if it uses "dh \$@" syntax. You can find tutorial for packaging using this new "dh \$@" style and new 3.0 (quilt) source format in the maint-guide package. It is also availabe at: http://www.debian.org/doc/manuals/maint-guide/index.en.html ----------------------------------------------------------------------- EOF exit 0