File: dpatch2quilt.sh

package info (click to toggle)
quilt 0.60-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 1,856 kB
  • sloc: sh: 5,425; perl: 1,312; lisp: 430; makefile: 414
file content (63 lines) | stat: -rw-r--r-- 1,838 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/sh

# to be run from the package top level directory
# parts taken 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+
# svn-related lines commented out by Martin Quinson.

set -e

export QUILT_PATCHES=debian/patches

dh_testdir

[ -f debian/patches/00list ] || exit 1

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 --no-timestamps --no-index --strip-trailing-whitespace
        # svn add debian/patches/$p.patch
done
quilt pop -a

COUNT_D=$(ls -1 debian/patches/*.dpatch | wc -l)
COUNT_Q=$(ls -1 debian/patches/*.patch | wc -l)

# svn add debian/patches/series
# svn rm debian/patches/00list debian/patches/*.dpatch

sed -i -e 's;/usr/share/dpatch/dpatch\.make;/usr/share/quilt/quilt.make;' debian/rules
sed -i -e 's;DPATCH_STAMPFN;QUILT_STAMPFN;' debian/rules
sed -i -e 's;patch-stamp;$(QUILT_STAMPFN);' debian/rules

# same as "sed s/dpatch/quilt", but supports multi-line Build-Depends
perl -i -pe '
if( /^Build-Depends: / ) {
    $do_replace = 1;
    s/dpatch ?(?:\(.+\))?/quilt (>= 0.40)/;
    next;
}
if( /^ / ) {
    s/dpatch ?(?:\(.+\))?/quilt (>= 0.40)/ if $do_replace;
} else {
    $do_replace = 0;
}' debian/control

echo
echo "The next commit would remove $COUNT_D dpatch patches and add $COUNT_Q quilt patches."

if [ "$COUNT_D" != "$COUNT_Q" ] ; then
        echo "WARNING: The numbers of removed dpatch patches and added quilt patches differ!"
fi

exit 0