On Sun, 29 Nov 2009, Bert Wesarg wrote:
> There is a missing '.' in the last 'if [ -r $QUILT_PC/quilt_series ];
> then'. I could point you directly to the position, but the patch is
> only attached, not inlined.

Indeed, updated patch attached.

> Also, can't these be symlinks to the actual patches and series targets?

They could but I don't see a strong reason why it would be better. They
would point to a non-existing dir or file until the first patch is added
to the series file (or after the last one has been removed).

Cheers,
-- 
Raphaƫl Hertzog
Description: remember locations for patches and series file
 Create .pc/.quilt_patches and .pc/.quilt_series files when creating
 the .pc directory containing the path to the patches directory and
 series file used that first time. The paths are made relative when
 they point inside the directory .pc resides in, to allow renaming
 of the top directory, and are left absolute otherwise. This allows to
 be set QUILT_PATCHES only on the first invocation and have it correct
 automatically on subsequent calls.
Bug-Debian: http://bugs.debian.org/557623
Author: Goswin von Brederlow <[email protected]>
Last-Update: 2009-11-28

diff --git a/quilt/scripts/patchfns.in b/quilt/scripts/patchfns.in
index 9ed4fd1..7468349 100644
--- a/quilt/scripts/patchfns.in
+++ b/quilt/scripts/patchfns.in
@@ -20,9 +20,14 @@ export LANG=POSIX
 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:="$(< $QUILT_PC/.quilt_patches)"}
+else
+	: ${QUILT_PATCHES:=patches}
+fi
+
 # Support compatibility layer
 if [ -d $QUILT_DIR/compat ]
 then
@@ -943,11 +948,29 @@ next_filename()
         echo "${base%-$num}-$((num+1))${patch#$base}"
 }
 
+relativize_path() {
+	local dir=$1 base=$2
+	if ! [ "${dir:0:1}" = "/" ]
+	then
+		echo "$dir"
+		return
+	fi
+	LEN="${#base}"
+	if [ "${dir:0:$LEN}" = "$base" ]
+	then
+		echo "${dir:$LEN}"
+	else
+		echo "$dir"
+	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
 }
 
@@ -1073,7 +1096,11 @@ then
     unset basedir down
 fi
 
-: ${QUILT_SERIES:=series}
+if [ -r $QUILT_PC/.quilt_series ]; then
+	: ${QUILT_SERIES:="$(< $QUILT_PC/.quilt_series)"}
+else
+	: ${QUILT_SERIES:=series}
+fi
 
 if [ "${QUILT_SERIES:0:1}" = / ]
 then
_______________________________________________
Quilt-dev mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/quilt-dev

Reply via email to