~ubuntu-branches/ubuntu/karmic/quilt/karmic

« back to all changes in this revision

Viewing changes to debian/patchsys-quilt.mk

  • Committer: Bazaar Package Importer
  • Author(s): Martin Quinson
  • Date: 2004-12-23 14:48:35 UTC
  • Revision ID: james.westby@ubuntu.com-20041223144835-r5tgpp5vjrxr803s
Tags: 0.37-4
Fix the 'patches' command (print the patch names again).
(Closes: #286293).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- mode: makefile; coding: utf-8 -*-
 
2
# Copyright � 2003 Martin Quinson <martin.quinson@tuxfamily.org>
 
3
# Description: An advanced patch system based on the quilt facilities.
 
4
#  please refere to the documentation of the quilt package for more information.
 
5
#
 
6
# Used variables for configuration:
 
7
#  
 
8
 
 
9
#
 
10
# This program is free software; you can redistribute it and/or
 
11
# modify it under the terms of the GNU General Public License as
 
12
# published by the Free Software Foundation; either version 2, or (at
 
13
# your option) any later version.
 
14
#
 
15
# This program is distributed in the hope that it will be useful, but
 
16
# WITHOUT ANY WARRANTY; without even the implied warranty of
 
17
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
18
# General Public License for more details.
 
19
#
 
20
# You should have received a copy of the GNU General Public License
 
21
# along with this program; if not, write to the Free Software
 
22
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
 
23
# 02111-1307 USA.
 
24
 
 
25
ifndef _cdbs_bootstrap
 
26
_cdbs_scripts_path ?= /usr/lib/cdbs
 
27
_cdbs_rules_path ?= /usr/share/cdbs/1/rules
 
28
_cdbs_class_path ?= /usr/share/cdbs/1/class
 
29
endif
 
30
 
 
31
ifndef _cdbs_rules_patchsys_quilt
 
32
_cdbs_rules_patchsys_quilt := 1
 
33
 
 
34
ifdef _cdbs_rules_patchsys
 
35
$(error cannot load two patch systems at the same time)
 
36
endif
 
37
 
 
38
include $(_cdbs_rules_path)/buildcore.mk$(_cdbs_makefile_suffix)
 
39
 
 
40
DEB_SRCDIR ?= .
 
41
 
 
42
_cdbs_patch_system_apply_rule := apply-patches
 
43
_cdbs_patch_system_unapply_rule := reverse-patches
 
44
 
 
45
# DEB_PATCHDIRS: directory containing your source file for patches.
 
46
DEB_PATCHDIRS = $(shell pwd)/debian/patches
 
47
 
 
48
# DEB_QUILT_PATCHDIR_LINK
 
49
# By default, quilt expects to find the patch files into the /patches directory.
 
50
#  Since it is often more pleasant to place them into /debian/patches, a link
 
51
#  is created by this makefile chunk to fix it. 
 
52
# In the case where you already have a /patches directory in your package, 
 
53
#  redefine this variable to somewhere else, and set QUILT_PATCHES in your
 
54
#   $HOME/.quiltrc (so that quilt knows where to search for this)
 
55
DEB_QUILT_PATCHDIR_LINK = patches
 
56
 
 
57
# DEB_QUILT_SERIES: series file to use
 
58
DEB_QUILT_SERIES = $(DEB_PATCHDIRS)/series
 
59
 
 
60
# Internal variables, do not change it unless you know what you're doing
 
61
DEB_QUILT_CMD = cd $(DEB_SRCDIR) && $(if $(DEB_QUILT_PATCHDIR_LINK),QUILT_PATCHES=$(DEB_QUILT_PATCHDIR_LINK)) quilt
 
62
 
 
63
post-patches:: apply-patches
 
64
 
 
65
clean:: reverse-patches
 
66
 
 
67
# The patch subsystem
 
68
apply-patches: pre-build debian/stamp-patched
 
69
debian/stamp-patched: 
 
70
        if [ -n "$(DEB_QUILT_PATCHDIR_LINK)" ] ; then \
 
71
          if [ -L $(DEB_SRCDIR)/$(DEB_QUILT_PATCHDIR_LINK) ] ; then : ; else \
 
72
            (cd $(DEB_SRCDIR); ln -s $(DEB_PATCHDIRS) $(DEB_QUILT_PATCHDIR_LINK)) ; \
 
73
          fi ; \
 
74
        fi
 
75
        # quilt exits with 2 as return when there was nothing to do. 
 
76
        # That's not an error here (but it's usefull to break loops in crude scripts)
 
77
        $(DEB_QUILT_CMD) push -a || test $$? = 2
 
78
        touch debian/stamp-patched
 
79
 
 
80
reverse-patches:
 
81
        if [ -d "$(DEB_SRCDIR)" ] ; then \
 
82
          $(DEB_QUILT_CMD) pop -a -R || test $$? = 2 ; \
 
83
        fi 
 
84
        if [ -n "$(DEB_QUILT_PATCHDIR_LINK)" ] ; then \
 
85
          if [ -L $(DEB_SRCDIR)/$(DEB_QUILT_PATCHDIR_LINK) ] ; then \
 
86
            rm $(DEB_SRCDIR)/$(DEB_QUILT_PATCHDIR_LINK) ; \
 
87
          fi ; \
 
88
        fi
 
89
        rm -rf $(DEB_SRCDIR)/.pc
 
90
        rm -f debian/stamp-patch*
 
91
 
 
92
endif