Add git format-patch stuff
authorGregory Colpart <reg@debian.org>
Sun, 15 Mar 2009 11:15:40 +0000 (12:15 +0100)
committerGregory Colpart <reg@debian.org>
Sun, 15 Mar 2009 15:35:28 +0000 (16:35 +0100)
debian/changelog
debian/rules

index 7a6852f..ace63b1 100644 (file)
@@ -1,8 +1,9 @@
 horde3 (3.3.3+debian0-1) unstable; urgency=low
 
   * New upstream release. 
+  * Add "Git patches" stuff in debian/rules.
 
- -- Gregory Colpart <reg@debian.org>  Sun, 15 Mar 2009 06:24:14 +0100
+ -- Gregory Colpart <reg@debian.org>  Sun, 15 Mar 2009 16:33:02 +0100
 
 horde3 (3.2.2+debian0-2) unstable; urgency=high
 
index 347c30f..a003e3a 100755 (executable)
@@ -7,7 +7,47 @@
 # /usr/share/horde3
 COPY_EXCLUDE=^(\{arch\}|COPYING|README|po|scripts|config|debian|docs|build-stamp|configure-stamp)$
 
-configure: configure-stamp
+srcpkg = $(shell dpkg-parsechangelog | sed -ne 's/Source: *//p')
+srcver = $(shell dpkg-parsechangelog | sed -ne 's/Version: *\(.*:\)\?\(.*\)-.*$$/\2/p')
+
+#{{{ generic rules
+
+../$(srcpkg)_$(srcver).orig.tar.gz:
+       @if git rev-parse --git-dir >/dev/null 2>&1; then                 \
+            pristine-tar checkout $@;                                     \
+        fi
+
+check-tarball: ../$(srcpkg)_$(srcver).orig.tar.gz
+
+.PHONY: check-tarball
+
+#}}}
+#{{{ maintainer stuff
+
+refresh-patches: check-tarball
+       @dh_testdir
+       @echo 'refreshing debian/patches:'
+       @rm -rf '$(CURDIR)'/debian/patches
+       @mkdir -p '$(CURDIR)'/debian/patches
+       @cd '$(CURDIR)'/debian/patches && git format-patch horde-upstream..horde-upstream+patches
+       @echo .
+
+#}}}
+
+patch: patch-stamp check-tarball
+patch-stamp:
+       dh_testdir
+       set -e; test -e patch-stamp || \
+           for i in `ls -1 debian/patches/*.patch || :`; do patch -p1 <$$i > /dev/null; done
+       touch $@
+
+unpatch:
+       dh_testdir
+       set -e; ! test -e patch-stamp || \
+           for i in `ls -1r debian/patches/*.patch || :`; do patch -p1 -R <$$i > /dev/null; done
+       rm -f patch-stamp
+
+configure: configure-stamp patch
 configure-stamp:
        dh_testdir
        # Add here commands to configure the package.
@@ -20,7 +60,7 @@ build-stamp: configure-stamp
        dh_testdir
        touch build-stamp
 
-clean:
+clean:  unpatch
        dh_testdir
        dh_testroot
        dh_clean build-stamp configure-stamp
@@ -202,4 +242,4 @@ check-external-libs:
         fi
 
 binary: binary-indep binary-arch
-.PHONY: build clean binary-indep binary-arch binary install configure
+.PHONY: patch unpatch build clean binary-indep binary-arch binary install configure