pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/mk Add optional caching of extracted build options. As...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/13a0a354d37a
branches:  trunk
changeset: 356044:13a0a354d37a
user:      joerg <joerg%pkgsrc.org@localhost>
date:      Sat Dec 17 23:41:51 2016 +0000

description:
Add optional caching of extracted build options. As the number of users
of this feature has exploded over recent years, this avoids quadratic
complexity for many packages during scan and build phase of a bulk
build. Pbulk logic for exploiting this feature will be committed
separately. Over all, this saves ~66% for wm/xfce4-wm
with initially empty cache and ~90% when the cache is populated. Total
scan time can be cut in half.

diffstat:

 mk/pbulk/pbulk-index.mk |  10 ++++++++--
 mk/pkg-build-options.mk |  11 +++++++++--
 2 files changed, 17 insertions(+), 4 deletions(-)

diffs (62 lines):

diff -r 2069536e7992 -r 13a0a354d37a mk/pbulk/pbulk-index.mk
--- a/mk/pbulk/pbulk-index.mk   Sat Dec 17 23:31:35 2016 +0000
+++ b/mk/pbulk/pbulk-index.mk   Sat Dec 17 23:41:51 2016 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: pbulk-index.mk,v 1.22 2016/09/08 15:19:18 joerg Exp $
+#      $NetBSD: pbulk-index.mk,v 1.23 2016/12/17 23:41:52 joerg Exp $
 
 # This Makefile fragment is included by bsd.pkg.mk and provides all
 # variables and targets related to the parallel bulk build
@@ -104,6 +104,12 @@
                ${_PBULK_MULTI_NEEDED:@._t.@;done@}
 .endif
 
+.if defined(PBULK_CACHE_DIRECTORY)
+_PBULK_SCAN_DEPENDS=   ${.MAKE.MAKEFILES:N${PBULK_CACHE_DIRECTORY}/*}
+.else
+_PBULK_SCAN_DEPENDS=   ${.MAKE.MAKEFILES}
+.endif
+
 pbulk-index-item:
        @echo "PKGNAME="${PKGNAME:Q}
        @echo "ALL_DEPENDS="${_ALL_DEPENDS:Q}
@@ -116,7 +122,7 @@
        @echo "USE_DESTDIR="${_USE_DESTDIR:Q}
        @echo "BOOTSTRAP_PKG="${BOOTSTRAP_PKG}
        @echo "USERGROUP_PHASE="${USERGROUP_PHASE:Q}
-       @echo "SCAN_DEPENDS="${.MAKE.MAKEFILES:Q}
+       @echo "SCAN_DEPENDS="${_PBULK_SCAN_DEPENDS:Q}
 .if defined(_PBULK_MULTI_NEEDED)
        @printf "MULTI_VERSION="
 .for _t in ${_PBULK_MULTI_NEEDED}
diff -r 2069536e7992 -r 13a0a354d37a mk/pkg-build-options.mk
--- a/mk/pkg-build-options.mk   Sat Dec 17 23:31:35 2016 +0000
+++ b/mk/pkg-build-options.mk   Sat Dec 17 23:41:51 2016 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: pkg-build-options.mk,v 1.10 2016/07/09 09:54:27 rillig Exp $
+# $NetBSD: pkg-build-options.mk,v 1.11 2016/12/17 23:41:51 joerg Exp $
 #
 # This procedure determines the PKG_OPTIONS that have been in effect
 # when the package ${pkgbase} has been built. When the package is not
@@ -40,13 +40,20 @@
 .  endfor
 .else
 .  for b in ${pkgbase}
+.    if !defined(PKG_BUILD_OPTIONS.${b}) && defined(PBULK_CACHE_DIRECTORY)
+.sinclude "${PBULK_CACHE_DIRECTORY}/build-options.${b}"
+.    endif
 .    if !defined(PKG_BUILD_OPTIONS.${b})
 PKG_BUILD_OPTIONS.${b}!= \
        echo ""; \
        ${PKG_INFO} -Q PKG_OPTIONS ${b} 2>/dev/null \
        || { cd ${BUILDLINK_PKGSRCDIR.${b}} \
             && ${MAKE} ${MAKEFLAGS} show-var VARNAME=PKG_OPTIONS; }
-
+.        if defined(PBULK_CACHE_DIRECTORY)
+_PKG_BUILD_OPTIONS.${b}!= \
+       echo PKG_BUILD_OPTIONS.${b:Q}=${PKG_BUILD_OPTIONS.${b:Q}} > ${PBULK_CACHE_DIRECTORY:Q}/build-options.${pkgbase}.$$$$; \
+       mv ${PBULK_CACHE_DIRECTORY:Q}/build-options.${pkgbase}.$$$$ ${PBULK_CACHE_DIRECTORY:Q}/build-options.${pkgbase}
+.        endif
 MAKEFLAGS+=    PKG_BUILD_OPTIONS.${b}=${PKG_BUILD_OPTIONS.${b}:Q}
 .    endif
 



Home | Main Index | Thread Index | Old Index