Only invoke audit-packages if we do find the package-name prefix in

the vulnerabilities file.  This cuts down significantly on the time
spent running sort-packages:
On 3228 packages before:
20259.43s real  9888.82s user 13138.60s system

With this change:
 6595.97s real  3215.58s user  4265.13s system
This commit is contained in:
jschauma 2007-02-20 06:46:20 +00:00
parent 161bfb99b6
commit 853b673667

View file

@ -1,5 +1,5 @@
#! /bin/sh
# $NetBSD: sort-packages,v 1.4 2006/10/01 14:54:16 rillig Exp $
# $NetBSD: sort-packages,v 1.5 2007/02/20 06:46:20 jschauma Exp $
# This program scans all binary packages in the current directory and
# creates three lists of files in OUTDIR:
@ -65,11 +65,13 @@ for pkg in *${PKG_SUFX}; do
if [ "${restricted}" = "no" ] && [ "${no_bin_on_ftp}" = "no" ]; then
# Check whether the package is vulnerable or not.
vuln=`${AUDIT_PACKAGES} -p "${pkg}"`
if [ "${vuln}" = "" ]; then
category="regular"
else
category="vulnerable"
pkg_prefix="${pkg%%-*}"
category="regular"
if grep "^${pkg_prefix}" /usr/pkgsrc/distfiles/pkg-vulnerabilities >/dev/null 2>&1; then
vuln=`${AUDIT_PACKAGES} -p "${pkg}"`
if [ -n "${vuln}" ]; then
category="vulnerable"
fi
fi
elif [ "${restricted}" != "unknown" ] && [ "${no_bin_on_ftp}" != "unknown" ]; then
category="restricted"