summaryrefslogtreecommitdiff
path: root/mk/check
diff options
context:
space:
mode:
authorjperkin <jperkin@pkgsrc.org>2014-10-03 19:12:16 +0000
committerjperkin <jperkin@pkgsrc.org>2014-10-03 19:12:16 +0000
commit4d903fd319b52ea84c4560b0688e84785319b480 (patch)
treea99f6460f7f0065290ce5db74bfef4ae97a158a3 /mk/check
parent03416a4b31be6751bd7e420cfba065efcb112785 (diff)
downloadpkgsrc-4d903fd319b52ea84c4560b0688e84785319b480.tar.gz
Cache the results of getline and system() calls. Testing with
x11/kde-workspace4 shows a 25x performance improvement, reducing the runtime of _check-shlibs from 7m55s to just 18s.
Diffstat (limited to 'mk/check')
-rw-r--r--mk/check/check-shlibs-elf.awk27
1 files changed, 20 insertions, 7 deletions
diff --git a/mk/check/check-shlibs-elf.awk b/mk/check/check-shlibs-elf.awk
index 261d89ec54b..65c77543ec0 100644
--- a/mk/check/check-shlibs-elf.awk
+++ b/mk/check/check-shlibs-elf.awk
@@ -1,4 +1,4 @@
-# $NetBSD: check-shlibs-elf.awk,v 1.9 2014/10/01 08:59:33 jperkin Exp $
+# $NetBSD: check-shlibs-elf.awk,v 1.10 2014/10/03 19:12:16 jperkin Exp $
#
# Copyright (c) 2007 Joerg Sonnenberger <joerg@NetBSD.org>.
# All rights reserved.
@@ -71,12 +71,17 @@ function shquote(IN, out) {
function check_pkg(DSO, pkg, found) {
if (destdir == "")
return 0
- cmd = pkg_info_cmd " -Fe " shquote(DSO) " 2> /dev/null"
- if ((cmd | getline pkg) < 0) {
+ if (DSO in pkgcache) {
+ pkg = pkgcache[DSO]
+ } else {
+ cmd = pkg_info_cmd " -Fe " shquote(DSO) " 2> /dev/null"
+ if ((cmd | getline pkg) < 0) {
+ close(cmd)
+ return 0
+ }
close(cmd)
- return 0
+ pkgcache[DSO] = pkg
}
- close(cmd)
if (pkg == "")
return 0
found=0
@@ -124,12 +129,20 @@ function checkshlib(DSO, needed, rpath, found, dso_rath, got_rpath, nrpath) {
}
for (lib in needed) {
for (p = 1; p <= nrpath; p++) {
- if (!system("test -f " shquote(cross_destdir rpath[p] "/" lib))) {
+ libfile = cross_destdir rpath[p] "/" lib
+ if (!(libfile in libcache)) {
+ libcache[libfile] = system("test -f " shquote(libfile))
+ }
+ if (!libcache[libfile]) {
check_pkg(rpath[p] "/" lib)
found = 1
break
}
- if (!system("test -f " shquote(destdir rpath[p] "/" lib))) {
+ libfile = destdir rpath[p] "/" lib
+ if (!(libfile in libcache)) {
+ libcache[libfile] = system("test -f " shquote(libfile))
+ }
+ if (!libcache[libfile]) {
found = 1
break
}