Package: cdbs
Version: 0.4.13
Author: Guillem Jover <guillem@debian.org>
Status: applied
Description:
 Honour #DPATCHLEVEL and don't reverse not applied patches.

--- simple-patchsys.mk.in	2003-08-27 07:25:53.000000000 +0200
+++ simple-patchsys.mk.in.patched	2003-11-13 11:13:28.000000000 +0100
@@ -49,12 +49,16 @@
 	@echo "patches: $(DEB_PATCHES)"
 	@set -e ; reverse=""; patches="$(DEB_PATCHES)"; \
 	  if [ "$@" = "reverse-patches" ]; then \
+	    if [ ! -e debian/stamp-patched ]; then \
+	      echo "Not reversing not applied patches."; \
+	      exit 0; \
+	    fi; \
 	    reverse="-R"; \
 	    for patch in $$patches; do reversepatches="$$patch $$reversepatches"; done; \
 	    patches="$$reversepatches"; \
 	  fi; \
 	  for patch in $$patches; do \
-	  level=$(head $$patch | egrep '^#DPATCHLEVEL=' | cut -f 2 -d '='); \
+	  level=$$(head $$patch | egrep '^#DPATCHLEVEL=' | cut -f 2 -d '='); \
 	  reverse=""; \
 	  if [ "$@" = "reverse-patches" ]; then reverse="-R"; fi; \
 	  success=""; \
