Package: quilt
Version: 0.48-2a0.mrvn.1
Severity: important
Tags: patch

Hi,

by default quilt looks for patches and series in the current
directory. With the new 3.0 (quilt) format patches are in
debian/patches. In other projects patches can also be somewhere other
than the current directory. This means one has to set QUILT_PATCHES
and possibly QUILT_SERIES correctly before working on the source or
strange things happen when using quilt. To automate that one can put
some logic into .quiltrc that guesses the right
QUILT_PATCHES/QUILT_SERIES. But it remains to be a guess only and can
be wrong from time to time.

The attached patch makes quilt add .pc/quilt_patches and
..pc/quilt_series files when first creating the .pc directory and makes
it use those files to override any other setting if they exist. It
also make the two relative if they are inside the current directory
(dpkg-source sets them absolut) so renaming the source directory
doesn't invalidate them.

With the patch one can

dpkg-source -x *.dsc
cd */
quilt pop
quilt push
quilt refresh
....

without the need of a complicted .quiltrc to guess
QUILT_PATCHES/QUILT_SERIES.


Given the push to have 3.0 (quilt) as default format in Debian I think
this feature is verry important so first time users will not
experience strange quilt problems caused by an unset QUILT_PATCHES
while working with a debian source.

MfG
        Goswin

-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (499, 'unstable'), (2, 'experimental'), (1, 
'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.31.5 (SMP w/2 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/bash

Versions of packages quilt depends on:
ii  bzip2                         1.0.5-3    high-quality block-sorting file co
ii  diffstat                      1.47-1     produces graph of changes introduc
ii  gettext                       0.17-8     GNU Internationalization utilities
ii  patch                         2.5.9-5    Apply a diff file to an original

quilt recommends no packages.

Versions of packages quilt suggests:
ii  graphviz                      2.20.2-4   rich set of graph drawing tools
ii  procmail                      3.22-18    Versatile e-mail processor

-- no debconf information
Index: quilt-0.48/quilt/scripts/patchfns.in
===================================================================
--- quilt-0.48.orig/quilt/scripts/patchfns.in	2009-11-23 12:02:52.000000000 +0100
+++ quilt-0.48/quilt/scripts/patchfns.in	2009-11-23 12:04:35.000000000 +0100
@@ -20,9 +20,14 @@
 export QUILT_PATCHES QUILT_PC SUBDIR SERIES DB
 DB_VERSION=2
 
-: ${QUILT_PATCHES:=patches}
 : ${QUILT_PC:=.pc}
 
+if [ -r $QUILT_PC/quilt_patches ]; then
+	QUILT_PATCHES=$(cat $QUILT_PC/quilt_patches)
+else
+	: ${QUILT_PATCHES:=patches}
+fi
+
 # Support compatibility layer
 if [ -d $QUILT_DIR/compat ]
 then
@@ -924,11 +929,28 @@
         echo "${base%-$num}-$((num+1))${patch#$base}"
 }
 
+relativize_path() {
+	if ! [ "${1:0:1}" = "/" ]
+	then
+		echo "$1"
+		return
+	fi
+	LEN="$(echo "$2" | wc -c)"
+	if [ "${1:0:$(($LEN-1))}" = "$2" ]
+	then
+		echo "${1:$(($LEN-1))}"
+	else
+		echo "$1"
+	fi
+}
+
 create_db() {
 	if ! [ -e $QUILT_PC ]
 	then
 		mkdir -p $QUILT_PC
 		echo $DB_VERSION > $QUILT_PC/.version
+		relativize_path "$QUILT_PATCHES" "$(pwd)/" > "$QUILT_PC/quilt_patches"
+		relativize_path "$QUILT_SERIES" "$(pwd)/" > "$QUILT_PC/quilt_series"
 	fi
 }
 
@@ -1008,7 +1030,11 @@
     unset basedir down
 fi
 
-: ${QUILT_SERIES:=series}
+if [ -r $QUILT_PC/quilt_series ]; then
+	QUILT_SERIES=$(cat $QUILT_PC/quilt_series)
+else
+	: ${QUILT_SERIES:=series}
+fi
 
 if [ "${QUILT_SERIES:0:1}" = / ]
 then

Reply via email to