diff options
author | Jean Delvare <jdelvare@suse.de> | 2015-07-02 11:51:23 +0200 |
---|---|---|
committer | Jean Delvare <jdelvare@suse.de> | 2015-07-02 11:51:23 +0200 |
commit | ecfe1b53be0b06eec4e76bab3ce850dcbb3ca7e5 (patch) | |
tree | 69b8cb321ec39b94faf221c9098f0e5256442280 | |
parent | 0ab5e01c9c472f9138bd994659fc4ed36b656e4e (diff) | |
download | quilt-ecfe1b53be0b06eec4e76bab3ce850dcbb3ca7e5.tar.gz |
inspect-wrapper: Identify files passed as stdin
When the input file is passed through stdin, we can usually get its
name from procfs. This avoids having to look up the file by md5sum.
Not only this makes things faster, but this also helps if the patch
file was modified by additional commands in the spec file before
being applied (yes, I've seen this happen.)
Speed gain from this change can reach 20 %.
-rw-r--r-- | quilt/scripts/inspect-wrapper.in | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/quilt/scripts/inspect-wrapper.in b/quilt/scripts/inspect-wrapper.in index 2cccde3..9636a62 100644 --- a/quilt/scripts/inspect-wrapper.in +++ b/quilt/scripts/inspect-wrapper.in @@ -235,6 +235,13 @@ unzip) ;; esac +# If the file was not passed as a parameter, try to identify stdin +if [ -n "$QUILT_SETUP_FAST" -a -z "$inputfile" ] +then + inputfile=$(readlink /proc/self/fd/0) + [ "${inputfile:0:1}" = / -a -f "$inputfile" ] || inputfile= +fi + if [ -n "$inputfile" ] then if [ "${inputfile:0:1}" = / ] |