diff options
author | Guillem Jover <guillem@debian.org> | 2004-09-13 17:22:54 +0000 |
---|---|---|
committer | Guillem Jover <guillem@debian.org> | 2004-09-13 17:22:54 +0000 |
commit | 13b3370e051e99e11000edae51bc6efa2681c905 (patch) | |
tree | abbfcf205c08a351a46757dbf886467bb60ddca0 /debian | |
parent | 767b81e5b26d8f2167c333684ca9834a9d81e383 (diff) |
Split patches into debian/patches/. Use a modified cdbs simple-patchsys.
Diffstat (limited to 'debian')
-rw-r--r-- | debian/changelog | 6 | ||||
-rw-r--r-- | debian/patch.mk | 95 | ||||
-rwxr-xr-x | debian/rules | 8 |
3 files changed, 106 insertions, 3 deletions
diff --git a/debian/changelog b/debian/changelog index 4c37447..6f8cc8d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +gnumach (1:20040229-2) unstable; urgency=low + + * Split patches into debian/patches/. + + -- Guillem Jover <guillem@debian.org> Mon, 13 Sep 2004 19:19:30 +0200 + gnumach (1:20040229-1) unstable; urgency=low * Update to CVS 20040229. diff --git a/debian/patch.mk b/debian/patch.mk new file mode 100644 index 0000000..b83ad49 --- /dev/null +++ b/debian/patch.mk @@ -0,0 +1,95 @@ +# -*- mode: makefile; coding: utf-8 -*- +# Copyright © 2002,2003 Colin Walters <walters@debian.org> +# +# Modified by Guillem Jover <guillem@debian.org>: +# Standalone system +# Honour DPATCHLEVEL +# Exit when trying to revert patches but no stamp-patch exists +# Provide a patch target +# +# Description: A sample patch system which uses separate files in debian/patches +# Patch names must end in .patch, currently. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2, or (at +# your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +# 02111-1307 USA. + +DEB_SRCDIR ?= . +DEB_PATCHDIRS = debian/patches +DEB_PATCHES = $(foreach dir,$(DEB_PATCHDIRS),$(shell LC_COLLATE=C echo $(wildcard $(dir)/*.patch) $(wildcard $(dir)/*.diff))) + +patch:: apply-patches + +clean:: reverse-patches + rm -f debian/stamp-patch* + rm -f debian/patches/*.log + +# The patch subsystem +apply-patches: debian/stamp-patched +debian/stamp-patched: $(DEB_PATCHES) +debian/stamp-patched reverse-patches: + @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 '='); \ + reverse=""; \ + if [ "$@" = "reverse-patches" ]; then reverse="-R"; fi; \ + success=""; \ + if [ -z "$$level" ]; then \ + echo -n "Trying "; if test -n "$$reverse"; then echo -n "reversed "; fi; echo -n "patch $$patch at level "; \ + for level in 0 1 2; do \ + if test -z "$$success"; then \ + echo -n "$$level..."; \ + if cat $$patch | patch -d $(DEB_SRCDIR) $$reverse -E --dry-run -p$$level 1>$$patch.level-$$level.log 2>&1; then \ + if cat $$patch | patch -d $(DEB_SRCDIR) $$reverse -E --no-backup-if-mismatch -V never -p$$level 1>$$patch.level-$$level.log 2>&1; then \ + success=yes; \ + touch debian/stamp-patch-$$(basename $$patch); \ + echo "success."; \ + fi; \ + fi; \ + fi; \ + done; \ + if test -z "$$success"; then \ + if test -z "$$reverse"; then \ + echo "failure."; \ + exit 1; \ + else \ + echo "failure (ignored)."; \ + fi \ + fi; \ + else \ + echo -n "Trying patch $$patch at level $$level..."; \ + if cat $$patch | patch -d $(DEB_SRCDIR) $$reverse -E --no-backup-if-mismatch -V never -p$$level 1>$$patch.log 2>&1; then \ + touch debian/stamp-patch-$$(basename $$patch); \ + echo "success."; \ + else \ + echo "failure:"; \ + cat $$patch.log; \ + if test -z "$$reverse"; then exit 1; fi; \ + fi; \ + fi; \ + done + if [ "$@" = "debian/stamp-patched" ]; then touch debian/stamp-patched; fi + +.PHONY: patch clean apply-patches reverse-patches + diff --git a/debian/rules b/debian/rules index 0e442af..c1dc650 100755 --- a/debian/rules +++ b/debian/rules @@ -128,14 +128,16 @@ drivers := --enable-floppy \ --enable-lance \ --enable-tlan -stamp-configure: +include debian/patch.mk + +stamp-configure: patch $(checkdir) -mkdir build cd build && ../configure $(drivers) \ --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE) touch stamp-configure -stamp-configure-dbg: +stamp-configure-dbg: patch $(checkdir) -mkdir build-dbg cd build-dbg && ../configure --enable-kdb $(drivers) \ @@ -154,7 +156,7 @@ stamp-build-dbg: stamp-configure-dbg cd build-dbg && $(MAKE) touch stamp-build-dbg -clean: +clean:: $(checkdir) -rm -f $(FILES_TO_CLEAN) $(STAMPS_TO_CLEAN) -rm -rf $(DIRS_TO_CLEAN) |