Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/postinstall Don't use slow file_exists_exact if we ...



details:   https://anonhg.NetBSD.org/src/rev/d33932f559ae
branches:  trunk
changeset: 821647:d33932f559ae
user:      uwe <uwe%NetBSD.org@localhost>
date:      Sat Feb 11 19:35:45 2017 +0000

description:
Don't use slow file_exists_exact if we don't have to.

file_exists_exact function was introduced in 1.26 for the benefit of
cross-building on OS X case-insensitive file system.  It is extremely
slow on diskless machines.  That becomes especially noticeable when
you upgrade a system that has a lot of obsolete files, it can take
literally hours.

diffstat:

 usr.sbin/postinstall/postinstall |  16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diffs (46 lines):

diff -r 8701a88e5ce2 -r d33932f559ae usr.sbin/postinstall/postinstall
--- a/usr.sbin/postinstall/postinstall  Sat Feb 11 19:34:23 2017 +0000
+++ b/usr.sbin/postinstall/postinstall  Sat Feb 11 19:35:45 2017 +0000
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall,v 1.209 2017/01/09 19:51:31 christos Exp $
+# $NetBSD: postinstall,v 1.210 2017/02/11 19:35:45 uwe Exp $
 #
 # Copyright (c) 2002-2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -523,7 +523,7 @@
 
        failed=0
        while read ofile; do
-               if ! file_exists_exact "${ofile}"; then
+               if ! ${file_exists_exact} "${ofile}"; then
                        continue
                fi
                ofile="${DEST_DIR}${ofile#.}"
@@ -534,6 +534,8 @@
                elif [ -d "${ofile}" ]; then
                        ftype="directory"
                        cmd="rmdir"
+               elif [ ! -e "${ofile}" ]; then
+                       continue
                fi
                if [ "${op}" = "check" ]; then
                        msg "Remove obsolete ${ftype} ${ofile}"
@@ -2328,6 +2330,16 @@
        DIRMODE=false           # true if "-s" specified a directory
        SOURCEMODE=false        # true if "-s" specified a source directory
 
+       case "$(uname -s)" in
+       Darwin)
+               # case sensitive match for case insensitive fs
+               file_exists_exact=file_exists_exact
+               ;;
+       *)
+               file_exists_exact=:
+               ;;
+       esac
+
        while getopts s:x:d:m:a: ch; do
                case "${ch}" in
                s)



Home | Main Index | Thread Index | Old Index