summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Gruenbacher <agruen@suse.de>2006-02-06 05:31:10 +0000
committerAndreas Gruenbacher <agruen@suse.de>2006-02-06 05:31:10 +0000
commit2a02ce16ee3f20d46dc500bf08b47e10187a28f9 (patch)
tree61ae675308fa015dfd47c474581b2d6f6a80d6c8
parent1c56918eee78602861b04188394895dfd9a1876b (diff)
downloadquilt-2a02ce16ee3f20d46dc500bf08b47e10187a28f9.tar.gz
- bin/patch-wrapper.in: Add hack to follow pipes via /proc on
Linux (zcat patch.diff.gz | patch -p0, etc.).
-rwxr-xr-xbin/patch-wrapper.in21
-rw-r--r--quilt.changes6
2 files changed, 23 insertions, 4 deletions
diff --git a/bin/patch-wrapper.in b/bin/patch-wrapper.in
index 46ef8ae..5f2f107 100755
--- a/bin/patch-wrapper.in
+++ b/bin/patch-wrapper.in
@@ -149,6 +149,18 @@ else
fi
fi
+find_pipe_patch() {
+ declare patch=$1
+ patch=${patch//\[/\\[}
+ patch=${patch//\]/\\]}
+ set -- $(stat -c $'%a %N\n' /proc/*/fd/* 2>/dev/null \
+ | sed -nre "s,^300 \`(/proc/.*/fd)/.*' -> \`$patch'$,\\1,p")
+ set -- $(stat -c $'%a %N\n' $1/* 2>/dev/null \
+ | sed -nre "s,^500 \`.*' -> \`(.*)',\\1,p")
+ [ $# -eq 1 ] || set -- "$patch"
+ echo "$1"
+}
+
if [ -n "$cannot_handle" ]
then
$PATCH "${original_options[@]}"
@@ -160,9 +172,10 @@ then
patch=$opt_input
else
patch=$(readlink /proc/self/fd/0)
- # FIXME: try to recognize pipes, find the other end of a pipe
- # in /proc, and for gzip and bzip2 processes, use the file
- # that the process is reading from.
+ if [[ "$patch" =~ "^pipe:" ]]
+ then
+ patch=$(find_pipe_patch "$patch")
+ fi
fi
patch=${patch#$PWD/}
@@ -173,8 +186,8 @@ if [ -e "$patch" ]
then
if [ "${patch:0:1}" = / ]
then
+ ln -s "$patch" "$quilt_patches$patch"
patch=${patch#/}
- ln -s "$patch" "$quilt_patches/$patch"
else
while ! [ "$dir/$updir$patch" -ef "$patch" ]
do
diff --git a/quilt.changes b/quilt.changes
index e470a87..f2746bc 100644
--- a/quilt.changes
+++ b/quilt.changes
@@ -1,4 +1,10 @@
-------------------------------------------------------------------
+Mon Feb 6 06:26:59 CET 2006 - agruen@suse.de
+
+- bin/patch-wrapper.in: Add hack to follow pipes via /proc on
+ Linux (zcat patch.diff.gz | patch -p0, etc.).
+
+-------------------------------------------------------------------
Mon Feb 6 02:41:10 CET 2006 - agruen@suse.de
- bin/patch-wrapper.in: A wrapper to GNU patch that recognizes the