quilt-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Quilt-dev] [PATCH 2/2] setup: Fix path to extra patches in series file


From: Jean Delvare
Subject: [Quilt-dev] [PATCH 2/2] setup: Fix path to extra patches in series file
Date: Wed, 29 Oct 2014 15:39:02 +0100

Extra patches (typically contained in archives) end up in the working
directory, not the source directory where regular patches live. In
the most common case, it makes no difference because both directories
are the same. However, as soon as options -d or --sourcedir are used
in conjunction with extra patches, the working directory and the
source directory are different, and the paths to the extra patches in
the series file get wrong.

While we can't possible handle the case where the source and working
directories are completely different, we can easily handle the most
typical case where the working directory is a subdirectory of the
source directory.
---
 quilt/scripts/inspect-wrapper.in |    2 +-
 quilt/setup.in                   |   26 ++++++++++++++++++++++++++
 2 files changed, 27 insertions(+), 1 deletion(-)

--- a/quilt/scripts/inspect-wrapper.in
+++ b/quilt/scripts/inspect-wrapper.in
@@ -30,7 +30,7 @@ original_file()
        do
                if [ "$md5sum" = "$md5sum_" ]
                then
-                       echo ${file_#\*}
+                       echo $QUILT_SETUP_PREFIX${file_#\*}
                        return 0
                fi
        done < $tmpdir/more-md5sums
--- a/quilt/setup.in
+++ b/quilt/setup.in
@@ -101,6 +101,27 @@ create_symlink()
        ln -s "${1:-.}" "$link"
 }
 
+dir_to_dir()
+{
+       local from=$1 to=$2
+
+       [ "${from:0:1}" = / ] || from=$PWD/$from
+       from=$(normalize_path "$from")
+
+       [ "${to:0:1}" = / ] || to=$PWD/$to
+       to=$(normalize_path "$to")
+
+       # If the target is a subdirectory of the origin, we can express the path
+       # in a relative way. Otherwise, return the absolute path.
+       if [ "${to:0:${#from}}" = "$from" ]
+       then
+               to=${to:${#from}}
+               to=${to#/}
+       fi
+
+       echo "$to"
+}
+
 usage()
 {
        printf $"Usage: quilt setup [-d path-prefix] [-v] [--sourcedir dir] 
[--fuzz=N] {specfile|seriesfile}\n"
@@ -170,6 +191,11 @@ fi
 tmpfile=$(gen_tempfile)
 add_exit_handler "rm -f $tmpfile"
 
+# The patches link will point to the source directory, while extra patches
+# may be available under $prefix. If the latter is a subdirectory of the 
former,
+# a prefix can be added to fix up the path to the extra patches.
+export QUILT_SETUP_PREFIX=$(dir_to_dir "$sourcedir" "$prefix")
+
 case "$1" in
 *.spec)
        spec_file=$1

-- 
Jean Delvare
SUSE L3 Support



reply via email to

[Prev in Thread] Current Thread [Next in Thread]