aboutsummaryrefslogtreecommitdiffstats
path: root/ports-mgmt
diff options
context:
space:
mode:
authorsimon <simon@FreeBSD.org>2006-04-16 21:32:28 +0800
committersimon <simon@FreeBSD.org>2006-04-16 21:32:28 +0800
commit95e94156428fb9db22cee6360ce1e85b6baa0a25 (patch)
treed5f1c00bc6dd12ee853a1156897896954f9fe133 /ports-mgmt
parent45267d52fcdbd95c87afda00eb77dc66c93a4df9 (diff)
downloadfreebsd-ports-gnome-95e94156428fb9db22cee6360ce1e85b6baa0a25.tar.gz
freebsd-ports-gnome-95e94156428fb9db22cee6360ce1e85b6baa0a25.tar.zst
freebsd-ports-gnome-95e94156428fb9db22cee6360ce1e85b6baa0a25.zip
Avoid unnecessary invocations of pkg_info by checking whether the
package is installed or not using a precalculated regex. This speeds up "portaudit -a" with around a factor of 10. The change is slightly modified from the one from the PR by using pkg_info -aE instead of ls /var/db/pkg for determining installed packages. Submitted by: Kuang-che Wu <kcwu@csie.org> PR: ports/92942
Diffstat (limited to 'ports-mgmt')
-rw-r--r--ports-mgmt/portaudit/Makefile2
-rw-r--r--ports-mgmt/portaudit/files/portaudit-cmd.sh4
2 files changed, 5 insertions, 1 deletions
diff --git a/ports-mgmt/portaudit/Makefile b/ports-mgmt/portaudit/Makefile
index 914dd0c95f35..8d585f433cba 100644
--- a/ports-mgmt/portaudit/Makefile
+++ b/ports-mgmt/portaudit/Makefile
@@ -6,7 +6,7 @@
#
PORTNAME= portaudit
-PORTVERSION= 0.5.10
+PORTVERSION= 0.5.11
CATEGORIES= security
DISTFILES=
diff --git a/ports-mgmt/portaudit/files/portaudit-cmd.sh b/ports-mgmt/portaudit/files/portaudit-cmd.sh
index b16c7e368dab..4a303698ce4c 100644
--- a/ports-mgmt/portaudit/files/portaudit-cmd.sh
+++ b/ports-mgmt/portaudit/files/portaudit-cmd.sh
@@ -131,6 +131,7 @@ audit_installed()
local osversion=`sysctl -n kern.osreldate`
fixedre=`echo -n $portaudit_fixed | tr -c '[:alnum:]- \t\n' 'x' | tr -s ' \t\n' '|'`
+ installedre=`$pkg_info -aE | sed -e 's/-[^-]*$//g' | paste -s -d '|' -`
extract_auditfile | awk -F\| "$PRINTAFFECTED_AWK"'
BEGIN { vul=0; fixedre="'"$fixedre"'" }
@@ -144,6 +145,9 @@ audit_installed()
}
next
}
+ $1 ~ /^[^{}*?]*[<=>!]/ {
+ if ($1 !~ "^('"$installedre"')[<=>!]") next;
+ }
{
cmd="'"$pkg_info"' -E \"" $1 "\""
while((cmd | getline pkg) > 0) {