forked from pool/quilt
75 lines
2.3 KiB
Diff
75 lines
2.3 KiB
Diff
|
From: Jean Delvare <jdelvare@suse.de>
|
||
|
Subject: setup: Fix path to extra patches in series file
|
||
|
Upstream: Committed (1e5d95849e4a09427efefc7bd7e9f33bf911f526)
|
||
|
|
||
|
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
|