[Build-common-hackers] Integration of the quilt patch system into cdbs

Martin Quinson mquinson@ens-lyon.fr
Thu, 20 Nov 2003 19:02:33 +0100


--/jkxxxtAhYIHVDuh
Content-Type: multipart/mixed; boundary="SCOJXUq1iwCn05li"
Content-Disposition: inline


--SCOJXUq1iwCn05li
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Please CC me on answer, I'm not yet on this list.

Hello,

in attachement a patchsys-quilt.mk which performs the integration of quilt
into cdbs.

quilt is an advanced system to manage easily a serie of patch. It was
developed by and for kernel hackers and is very powerful. It is integrated
within debian since a few weeks, packaged by me.

As testcase, I took NWS, which is a completely unrelated package I package
for the work. It is not included in debian (yet), but the package are
visible from graal.ens-lyon.fr/~mquinson/deb.html for the very curious of you.

I maintain a rather large collection of patches against NWS with quilt, and
with the patchsys-quilt.mk, I managed to port my package to the cdbs like a
charm, prooving in my sense that this file is not too stupidely broken.

Ok, and now, here are my questions.

Could you please review this file to make sure that I did not make a stupid
error which was not detected by my tests, please?

Where should the quilt package install this file to? For now, it is in
/usr/share/cdbs/1/rules/ on my system (and the quilt package does not
install it at all for now), but I'm not sure you'll accept me to "polutate"
your directory that way. On the other hand, this is really a cdbs file, and
I think that putting it under /usr/share/quilt would be strange.

This file cannot be included into the cdbs directly, since the quilt package
(needed to use it) build-dep on cdbs, and this inclusion would then lead to
a chicken and egg problem for the bootstraping.


Thanks for your time, Mt.

Please CC me on answer, I'm not yet on this list.

--SCOJXUq1iwCn05li
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: attachment; filename="patchsys-quilt.mk"
Content-Transfer-Encoding: quoted-printable

# -*- mode: makefile; coding: utf-8 -*-
# Copyright =A9 2003 Martin Quinson <martin.quinson@tuxfamily.org>
# Description: An advanced patch system based on the quilt facilities.
#  please refere to the documentation of the quilt package for more informa=
tion.
#
# Used variables for configuration:
# =20

#
# 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.

ifndef _cdbs_bootstrap
_cdbs_scripts_path ?=3D /usr/lib/cdbs
_cdbs_rules_path ?=3D /usr/share/cdbs/1/rules
_cdbs_class_path ?=3D /usr/share/cdbs/1/class
endif

ifndef _cdbs_rules_patchsys_quilt
_cdbs_rules_patchsys_quilt :=3D 1

ifdef _cdbs_rules_patchsys
$(error cannot load two patch systems at the same time)
endif

include $(_cdbs_rules_path)/buildcore.mk$(_cdbs_makefile_suffix)

_cdbs_patch_system_apply_rule :=3D apply-patches
_cdbs_patch_system_unapply_rule :=3D reverse-patches

# DEB_PATCHDIRS: directory containing your source file for patches.
DEB_PATCHDIRS =3D debian/patches

# DEB_QUILT_PATCHDIR_LINK
# By default, quilt expects to find the patch files into the /patches direc=
tory.
#  Since it is often more pleasant to place them into /debian/patches, a li=
nk
#  is created by this makefile chunk to fix it.=20
# In the case where you already have a /patches directory in your package,=
=20
#  redefine this variable to somewhere else, and set QUILT_PATCHES in your
#   $HOME/.quiltrc (so that quilt knows where to search for this)
DEB_QUILT_PATCHDIR_LINK =3D patches

# DEB_QUILT_SERIES: series file to use
DEB_QUILT_SERIES =3D $(DEB_PATCHDIRS)/series

# Internal variables, do not change it unless you know what you're doing
DEB_QUILT_CMD =3D $(if $(DEB_QUILT_PATCHDIR_LINK),QUILT_PATCHES=3D$(DEB_QUI=
LT_PATCHDIR_LINK)) quilt

post-patches:: apply-patches

clean:: reverse-patches
	rm -f debian/stamp-patch*

# The patch subsystem
apply-patches: pre-build debian/stamp-patched
debian/stamp-patched:=20
debian/stamp-patched:
	if [ -n "$(DEB_QUILT_PATCHDIR_LINK)" ] ; then \
	  if [ -L $(DEB_QUILT_PATCHDIR_LINK) ] ; then : ; else \
	    echo "link $(DEB_QUILT_PATCHDIR_LINK) to make quilt happy";\
	    ln -s $(DEB_PATCHDIRS) $(DEB_QUILT_PATCHDIR_LINK) ; \
	  fi ; else echo "gloups"; \
	fi
	$(DEB_QUILT_CMD) push -a
	touch debian/stamp-patched

reverse-patches:
	$(DEB_QUILT_CMD) pop -a -R
	if [ -n "$(DEB_QUILT_PATCHDIR_LINK)" ] ; then \
	  if [ -L $(DEB_QUILT_PATCHDIR_LINK) ] ; then \
	    rm $(DEB_QUILT_PATCHDIR_LINK) ; \
	  fi ; \
	fi
	rm -rf .pc

endif
--SCOJXUq1iwCn05li--

--/jkxxxtAhYIHVDuh
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQE/vQG4IiC/MeFF8zQRAr37AKCuixEmv4EXC79PHClruTIZIoP9lQCdH8Jt
8o9ucesETADwD/HGOMFfmlI=
=iOZY
-----END PGP SIGNATURE-----

--/jkxxxtAhYIHVDuh--