forked from pool/quilt
91 lines
2.3 KiB
Diff
91 lines
2.3 KiB
Diff
Index: quilt-0.46/bin/patch-wrapper.in
|
|
===================================================================
|
|
--- quilt-0.46.orig/bin/patch-wrapper.in
|
|
+++ quilt-0.46/bin/patch-wrapper.in
|
|
@@ -27,7 +27,7 @@ then
|
|
fi
|
|
|
|
backup_files() {
|
|
- declare dir=${QUILT_PC:-.pc}/$patch
|
|
+ declare dir=${QUILT_PC:-.pc}/$name
|
|
|
|
if [ "$backup_mode" = --backup-if-mismatch ]
|
|
then
|
|
@@ -195,39 +195,56 @@ then
|
|
fi
|
|
|
|
quilt_patches=${QUILT_PATCHES:-patches}
|
|
-dir=$(dirname "$quilt_patches/$patch")
|
|
-mkdir -p "$dir"
|
|
-if [ -e "$patch" ]
|
|
+
|
|
+if [ "${patch#$RPM_SOURCE_DIR}" != "$patch" ]
|
|
+then
|
|
+ name=SOURCES/${patch#$RPM_SOURCE_DIR/}
|
|
+ if [ ! -e "$quilt_patches/SOURCES" ]
|
|
+ then
|
|
+ mkdir -p "$quilt_patches"
|
|
+ ln -s $RPM_SOURCE_DIR "$quilt_patches/SOURCES"
|
|
+ fi
|
|
+elif [ "${patch#$RPM_BUILD_DIR}" != "$patch" ]
|
|
then
|
|
+ name=BUILD/${patch#$RPM_BUILD_DIR/}
|
|
+ if [ ! -e "$quilt_patches/BUILD" ]
|
|
+ then
|
|
+ mkdir -p "$quilt_patches"
|
|
+ ln -s $RPM_BUILD_DIR "$quilt_patches/BUILD"
|
|
+ fi
|
|
+else
|
|
+ name=${patch#/}
|
|
+ dir=$(dirname "$quilt_patches/$name")
|
|
+ mkdir -p "$dir"
|
|
+
|
|
if [ "${patch:0:1}" = / ]
|
|
then
|
|
- ln -s "$patch" "$quilt_patches$patch"
|
|
- patch=${patch#/}
|
|
+ ln -s "$patch" "$quilt_patches/${name#/}"
|
|
else
|
|
- while ! [ "$dir/$updir$patch" -ef "$patch" ]
|
|
+ while ! [ "$dir/$updir$name" -ef "$patch" ]
|
|
do
|
|
updir=$updir../
|
|
[ ${#updir} -gt 96 ] && break
|
|
done
|
|
- if [ "$dir/$updir$patch" -ef "$patch" ]
|
|
+ if [ "$dir/$updir$name" -ef "$patch" ]
|
|
then
|
|
- ln -s "$updir$patch" "$quilt_patches/$patch"
|
|
+ ln -s "$updir$patch" "$quilt_patches/$name"
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
if [ "$opt_strip" = -p1 ]; then
|
|
- echo "$patch"
|
|
+ echo "$name"
|
|
else
|
|
- echo "$patch $opt_strip"
|
|
+ echo "$name $opt_strip"
|
|
fi >> $quilt_patches/series
|
|
|
|
-$PATCH "${new_options[@]}" --backup --prefix "${QUILT_PC:-.pc}/$patch/" \
|
|
+$PATCH "${new_options[@]}" --backup --prefix "${QUILT_PC:-.pc}/$name/" \
|
|
| backup_files
|
|
status=${PIPESTATUS[0]}
|
|
if [ $status -eq 0 ]
|
|
then
|
|
- dir=${QUILT_PC:-.pc}/$patch
|
|
+ dir=${QUILT_PC:-.pc}/$name
|
|
if [ ! -e "$dir" ]
|
|
then
|
|
mkdir -p "$dir"
|
|
@@ -237,6 +254,6 @@ then
|
|
then
|
|
echo 2 > ${QUILT_PC:-.pc}/.version
|
|
fi
|
|
- echo "$patch" >> "${QUILT_PC:-.pc}/applied-patches"
|
|
+ echo "$name" >> "${QUILT_PC:-.pc}/applied-patches"
|
|
fi
|
|
exit $status
|