Package: quilt
Severity: normal

Hi,

I updated the patch as per the feedback. The reason why
relativize_path is needed is that dpkg-source uses absolute paths when
unpacking a 3.0 (quilt) package and tools like dch rename the top
directory when changing the (upstream) version. Without relative paths
quilt would then not find the patches dir and series file or, when
the directory is copied, even use the original ones. I think that would
be highly confusing to the user.

If you fix dpkg-source to use relative paths then I don't really care
if relativize_path is removed. But there might be other tools out
there that use abolute paths where a relative one is called for and
what harm does it do? I think if the path is not specifically outside
the top directory then a relative path is always preferable.

MfG
        Goswin

-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable-i386
  APT policy: (1001, 'unstable-i386'), (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.29.4-frosties-2 (SMP w/4 CPU cores)
Locale: LANG=C, LC_CTYPE=de_DE (charmap=ISO-8859-1)
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  gawk                      1:3.1.6.dfsg-3 GNU awk, a pattern scanning and pr
ii  gettext                   0.17-6         GNU Internationalization utilities
ii  libc6                     2.10.1-2       GNU C Library: Shared libraries
ii  patch                     2.5.9-5        Apply a diff file to an original

quilt recommends no packages.

Versions of packages quilt suggests:
ii  ccache                        2.4-17     Compiler results cacher, for fast 

-- no debconf information
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 <goswin-...@web.de>
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

Reply via email to