I've made a little script to get patch(1) to preserve timestamps, so that 
autoconf/automake files don't get rebuilt:

# First make sure all the files in the patch exist, otherwise we are probably
# using --help or the wrong patch.
patch --dry-run "$@" | sed -e 's/patching file //' \
        -e '/Hunk/d' -e '/Skipping patch/d' \
        -e '/saving rejects/d' \
        | xargs ls > /dev/null 2>&1 &&
patch --dry-run "$@" | sed -e 's/patching file //' \
        -e '/Hunk/d' -e '/Skipping patch/d' \
        -e '/saving rejects/d' -e 's/^.*$/& &.timestamp/' \
        | xargs touch -r ;
find . -type f -name "*.timestamp" -exec rm -f {} \; &&
patch "$@"

Run this script in place of the patch command and it will patch files and 
restore their timestamps to what they were originally. This script returns 0 
on success, 1 with an error, 2 with major error (like how patch normally 
does). --help still works, and -v. As far as I know its a transparent 
replacement for the patch command. This script will be slower than using 
patch directly, but its not bad.

robert

Attachment: pgpBiVZaacHNV.pgp
Description: PGP signature

-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-chat
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to