[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

X Strike Force X.Org X11 SVN commit: r30 - trunk/debian



Author: branden
Date: 2005-03-10 02:25:37 -0500 (Thu, 10 Mar 2005)
New Revision: 30

Modified:
   trunk/debian/rules
Log:
Add apply-patches and revert-patches targets.


Modified: trunk/debian/rules
===================================================================
--- trunk/debian/rules	2005-03-10 06:31:15 UTC (rev 29)
+++ trunk/debian/rules	2005-03-10 07:25:37 UTC (rev 30)
@@ -144,6 +144,51 @@
 	  && test -d $(SOURCE_NAME)-$(UPSTREAM_VERSION) \
 	  && tar --exclude=debian --exclude=debian/* -cf - $(SOURCE_NAME)-$(UPSTREAM_VERSION) | gzip -9 >$(SOURCE_NAME)_$(UPSTREAM_VERSION).orig.tar.gz )
 
-.PHONY: build clean make-orig-tar-gz prune-upstream-tree
+# Apply all patches in debian/patches to the source tree.  This must be done
+# *BEFORE* creating the Debian source package, so that all patches are reflected
+# in the upstream part of the source tree when the .diff.gz file is generated.
+# This is in contrast to prior xfree86 packaging, in which patches were applied
+# at package build time.
+apply-patches:
+	@if [ "$$(echo debian/patches/*.diff)" != "debian/patches/*.diff" ]; then \
+	    env LC_COLLATE=C ls -1 debian/patches/*.diff | while IFS="" read PATCH; do \
+	        echo "Applying patch $$PATCH." >&2; \
+	        if ! PATCH_OUTPUT=$$(patch --dry-run --fuzz=0 --strip=0 <"$$PATCH"); then \
+	            echo "Patch $$PATCH will fail to apply." >&2; \
+	            exit 1; \
+	        fi; \
+	        if echo "$$PATCH_OUTPUT" | grep -Ei 'Hunk.*succeeded at.*(fuzz|offset)'; then \
+	            echo "Patch $$PATCH will fail to apply cleanly." >&2; \
+	            exit 1; \
+	        fi; \
+	        patch --fuzz=0 --strip=0 <"$$PATCH"; \
+	    done; \
+	    echo "Done applying patches." >&2; \
+	else \
+	    echo "No patches to apply; debian/patches empty." >&2; \
+	fi
 
+# Revert all patches in debian/patches from the source tree.
+revert-patches:
+	@if [ "$$(echo debian/patches/*.diff)" != "debian/patches/*.diff" ]; then \
+	    env LC_COLLATE=C ls -1r debian/patches/*.diff | while IFS="" read PATCH; do \
+	        echo "Reverting patch $$PATCH." >&2; \
+	        if ! PATCH_OUTPUT=$$(patch --dry-run --reverse --fuzz=0 --strip=0 <"$$PATCH"); then \
+	            echo "Patch $$PATCH will fail to revert." >&2; \
+	            exit 1; \
+	        fi; \
+	        if echo "$$PATCH_OUTPUT" | grep -Ei 'Hunk.*succeeded at.*(fuzz|offset)'; then \
+	            echo "Patch $$PATCH will fail to revert cleanly." >&2; \
+	            exit 1; \
+	        fi; \
+	        patch --reverse --fuzz=0 --strip=0 <"$$PATCH"; \
+	    done; \
+	    echo "Done reverting patches." >&2; \
+	else \
+	    echo "No patches to revert; debian/patches empty." >&2; \
+	fi
+
+.PHONY: apply-patches build clean make-orig-tar-gz prune-upstream-tree \
+        revert-patches
+
 # vim:set ai noet sts=8 sw=8 tw=0:



Reply to: