Gah, never mind right now. I went overboard and broke it. This was my 
original, which works but not well:

patch -Np1 -b -z .orig -i "$@" | sed -e 's/patching file //' \
        -e 's/^.*$/&.orig &/' | xargs touch -r

robert

On July 13, 2006 12:27 am, Robert Connolly wrote:
> 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: pgpkP1LqqJdsS.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