summaryrefslogtreecommitdiff
path: root/mk
diff options
context:
space:
mode:
authorjmmv <jmmv>2012-10-13 15:31:23 +0000
committerjmmv <jmmv>2012-10-13 15:31:23 +0000
commita70b145d5c19dbf343d42a8017acbaae81c86157 (patch)
treea2f49df80baad85e6e5890ae951bc309e65a339d /mk
parentbec7f725f7bc8ba3e89f5ee39c64d792b2a94832 (diff)
downloadpkgsrc-a70b145d5c19dbf343d42a8017acbaae81c86157.tar.gz
Speed up the algorithm to determine the files left to check.
This change modifies the algorithm used to keep track of the files that have not yet been checksummed to use a simple loop instead of shell pattern matching. For packages with few distinfo entries, either way yields the same result as the list of files to check is very short. But for those packages with hundreds of distinfo entries (vim, I'm looking at you), the difference is huge. In my old macppc machine, the checksum of vim used to take around 40 minutes and now it takes ~35 seconds. The difference is also clearly visible in my faster amd64 machine (although I haven't bothered to time it).
Diffstat (limited to 'mk')
-rwxr-xr-xmk/checksum/checksum19
1 files changed, 7 insertions, 12 deletions
diff --git a/mk/checksum/checksum b/mk/checksum/checksum
index ba0ad67faf2..6bba786bd60 100755
--- a/mk/checksum/checksum
+++ b/mk/checksum/checksum
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# $NetBSD: checksum,v 1.12 2007/08/15 13:56:24 jlam Exp $
+# $NetBSD: checksum,v 1.13 2012/10/13 15:31:23 jmmv Exp $
#
# Copyright (c) 2006, 2007 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -156,17 +156,12 @@ fi
${TEST} -z "$patch" || sfile="${sfile##*/}"
${TEST} "$d_file" = "($sfile)" || continue
- case "$files_left" in
- "$file"|"$file "*) pre= ;;
- *" $file") pre="${files_left%% $file}" ;;
- *) pre="${files_left%% $file *} " ;;
- esac
- case "$files_left" in
- "$file"|*" $file") post= ;;
- "$file "*) post="${files_left##$file }" ;;
- *) post="${files_left##* $file }" ;;
- esac
- files_left="${pre}${post}"
+ new_files_left=
+ for file_left in $files_left; do
+ ${TEST} "${file_left}" = "${file}" || \
+ new_files_left="${new_files_left} ${file_left}"
+ done
+ files_left="${new_files_left}"
if ${TEST} "$d_checksum" = "IGNORE"; then
${ECHO} 1>&2 "$self: Ignoring checksum for $sfile"