pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/pkgtools/pkg_install/files Only copy new files into pl...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/00b6d44f0baf
branches:  trunk
changeset: 460641:00b6d44f0baf
user:      jlam <jlam%pkgsrc.org@localhost>
date:      Tue Sep 02 08:26:35 2003 +0000

description:
Only copy new files into place if they're different from the original file,
modulo $NetBSD$ tag differences.

diffstat:

 pkgtools/pkg_install/files/src2nbcompat |  31 +++++++++++++++++++++++++------
 1 files changed, 25 insertions(+), 6 deletions(-)

diffs (53 lines):

diff -r e0abd919c665 -r 00b6d44f0baf pkgtools/pkg_install/files/src2nbcompat
--- a/pkgtools/pkg_install/files/src2nbcompat   Tue Sep 02 08:07:16 2003 +0000
+++ b/pkgtools/pkg_install/files/src2nbcompat   Tue Sep 02 08:26:35 2003 +0000
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-#      $NetBSD: src2nbcompat,v 1.3 2003/09/02 08:07:16 jlam Exp $
+#      $NetBSD: src2nbcompat,v 1.4 2003/09/02 08:26:35 jlam Exp $
 #
 # Copyright (c) 2003 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -108,17 +108,36 @@
                                next;                                   \
                        }                                               \
                        { print }                                       \
-               ' $newf > $dest/$newf
+               ' $newf > $dest/$newf.tmp
+               if [ -f $dest/$newf ] &&                                \
+                  diff -q -I "\$NetBSD.*\$" $dest/$newf $dest/$newf.tmp >/dev/null; then
+                       rm -f $dest/$newf.tmp
+               else
+                       rm -f $dest/$newf
+                       mv $dest/$newf.tmp $dest/$newf
+               fi
                ;;
        *.[1-9])
                # Copy the manpage over, and generate the catpage.
-               cp $newf $dest/$newf
-               catf=`echo $newf | sed 's,\.\([1-9]\),.cat\1,'`
-               nroff -mandoc $newf > $dest/$catf
+               cp $newf $dest/$newf.tmp
+               if [ -f $dest/$newf ] &&                                \
+                  diff -q -I "\$NetBSD.*\$" $dest/$newf $dest/$newf.tmp >/dev/null; then
+                       rm -f $dest/$newf.tmp
+               else
+                       mv -f $dest/$newf.tmp $dest/$newf
+                       catf=`echo $newf | sed 's,\.\([1-9]\),.cat\1,'`
+                       nroff -mandoc $newf > $dest/$catf
+               fi
                ;;
        *)
                # Everything else just gets copied verbatim.
-               cp $newf $dest/$newf
+               cp $newf $dest/$newf.tmp
+               if [ -f $dest/$newf ] &&                                \
+                  diff -q -I "\$NetBSD.*\$" $dest/$newf $dest/$newf.tmp >/dev/null; then
+                       rm -f $dest/$newf.tmp
+               else
+                       mv -f $dest/$newf.tmp $dest/$newf
+               fi
                ;;
        esac
 done



Home | Main Index | Thread Index | Old Index