pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/mk/install mk: install performance improvements.



details:   https://anonhg.NetBSD.org/pkgsrc/rev/bb134d1052fb
branches:  trunk
changeset: 388594:bb134d1052fb
user:      jperkin <jperkin%pkgsrc.org@localhost>
date:      Wed Nov 23 11:26:51 2022 +0000

description:
mk: install performance improvements.

Inline ${RUN} calls where appropriate.  Only call mkdir and rm when
necessary.  Remove useless use of cat(1).

Saves at least 12 execs per build, but often a lot more depending on the
number of files that were not stripped or had CTF conversion applied.

diffstat:

 mk/install/bsd.install.mk |   9 ++++---
 mk/install/install.mk     |  50 ++++++++++++++++++++++++++--------------------
 2 files changed, 33 insertions(+), 26 deletions(-)

diffs (134 lines):

diff -r f4ec3dca7569 -r bb134d1052fb mk/install/bsd.install.mk
--- a/mk/install/bsd.install.mk Wed Nov 23 11:17:51 2022 +0000
+++ b/mk/install/bsd.install.mk Wed Nov 23 11:26:51 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.install.mk,v 1.17 2019/05/07 19:36:44 rillig Exp $
+# $NetBSD: bsd.install.mk,v 1.18 2022/11/23 11:26:51 jperkin Exp $
 #
 # This Makefile fragment is included by bsd.pkg.mk and provides all
 # variables and targets related to installing packages.
@@ -58,6 +58,7 @@
 ###
 .PHONY: install-cookie
 install-cookie:
-       ${RUN} [ ! -f ${_COOKIE.install} ]
-       ${RUN} ${MKDIR} ${_COOKIE.install:H}
-       ${RUN} ${ECHO} ${PKGNAME} > ${_COOKIE.install}
+       ${RUN}                                                          \
+       [ ! -f ${_COOKIE.install} ];                                    \
+       ${TEST} -d ${_COOKIE.install:H} || ${MKDIR} ${_COOKIE.install:H}; \
+       ${ECHO} ${PKGNAME} > ${_COOKIE.install}
diff -r f4ec3dca7569 -r bb134d1052fb mk/install/install.mk
--- a/mk/install/install.mk     Wed Nov 23 11:17:51 2022 +0000
+++ b/mk/install/install.mk     Wed Nov 23 11:26:51 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: install.mk,v 1.82 2022/11/03 08:29:32 jperkin Exp $
+# $NetBSD: install.mk,v 1.83 2022/11/23 11:26:51 jperkin Exp $
 #
 # This file provides the code for the "install" phase.
 #
@@ -127,10 +127,11 @@
 ###
 install-check-interactive: .PHONY
 .if !empty(INTERACTIVE_STAGE:Minstall) && defined(BATCH)
-       @${ERROR_MSG} "The installation stage of this package requires user interaction"
-       @${ERROR_MSG} "Please install manually with:"
-       @${ERROR_MSG} " \"cd ${.CURDIR} && ${MAKE} install\""
-       ${RUN} ${FALSE}
+       ${RUN}                                                          \
+       ${ERROR_MSG} "The installation stage of this package requires user interaction"; \
+       ${ERROR_MSG} "Please install manually with:";                   \
+       ${ERROR_MSG} "  \"cd ${.CURDIR} && ${MAKE} install\"";          \
+       ${FALSE}
 .else
        @${DO_NADA}
 .endif
@@ -287,10 +288,9 @@
 #
 .PHONY: install-dirs-from-PLIST
 install-dirs-from-PLIST:
-       @${STEP_MSG} "Creating installation directories from PLIST files"
        ${RUN}                                                          \
-       ${CAT} ${PLIST_SRC}                                             \
-       | sed -n                                                        \
+       ${STEP_MSG} "Creating installation directories from PLIST files"; \
+       ${SED} -n                                                       \
                -e 's,\\,\\\\,'                                         \
                -e 's,^gnu/man/,${PKGGNUDIR}${PKGMANDIR}/,'             \
                -e 's,^gnu/,${PKGGNUDIR},'                              \
@@ -298,6 +298,7 @@
                -e 's,^info/,${PKGINFODIR}/,'                           \
                -e 's,^share/locale/,${PKGLOCALEDIR}/locale/,'          \
                -e 's,^\([^$$@]*\)/[^/]*$$,\1,p'                        \
+               < ${PLIST_SRC}                                          \
        | ${TOOLS_PLATFORM.uniq:Uuniq}                                  \
        | while read dir; do                                            \
                ${_INSTALL_ONE_DIR_CMD};                                \
@@ -359,9 +360,10 @@
 ###
 .PHONY: install-ctf
 install-ctf: plist
-       @${STEP_MSG} "Generating CTF data"
-       ${RUN}cd ${DESTDIR:Q}${PREFIX:Q};                               \
-       ${CAT} ${_PLIST_NOKEYWORDS} | while read f; do                  \
+       ${RUN}                                                          \
+       ${STEP_MSG} "Generating CTF data";                              \
+       cd ${DESTDIR:Q}${PREFIX:Q};                                     \
+       while read f; do                                                \
                case "$${f}" in                                         \
                ${_DEBUG_SKIP_PATTERNS:@p@${p}) continue ;;@}           \
                ${CTF_FILES_SKIP:@p@${p}) continue ;;@}                 \
@@ -374,8 +376,10 @@
                                ${MV} "$${tmp_f}" "$${f}";              \
                        fi;                                             \
                fi;                                                     \
-               ${RM} -f "$${tmp_f}";                                   \
-       done
+               if [ -f "$${tmp_f}" ]; then                             \
+                       ${RM} -f "$${tmp_f}";                           \
+               fi;                                                     \
+       done < ${_PLIST_NOKEYWORDS}
 
 ######################################################################
 ### install-strip-debug (PRIVATE)
@@ -385,9 +389,10 @@
 ###
 .PHONY: install-strip-debug
 install-strip-debug: plist
-       @${STEP_MSG} "Automatic stripping of debug information"
-       ${RUN}cd ${DESTDIR:Q}${PREFIX:Q};                               \
-       ${CAT} ${_PLIST_NOKEYWORDS} | while read f; do                  \
+       ${RUN}                                                          \
+       ${STEP_MSG} "Automatic stripping of debug information";         \
+       cd ${DESTDIR:Q}${PREFIX:Q};                                     \
+       while read f; do                                                \
                case "$${f}" in                                         \
                ${_DEBUG_SKIP_PATTERNS:@p@${p}) continue ;;@}           \
                ${STRIP_FILES_SKIP:@p@${p}) continue;;@}                \
@@ -400,8 +405,10 @@
                                ${MV} "$${tmp_f}" "$${f}";              \
                        fi;                                             \
                fi;                                                     \
-               ${RM} -f "$${tmp_f}";                                   \
-       done
+               if [ -f "$${tmp_f}" ]; then                             \
+                       ${RM} -f "$${tmp_f}";                           \
+               fi;                                                     \
+       done < ${_PLIST_NOKEYWORDS}
 
 ######################################################################
 ### install-doc-handling (PRIVATE)
@@ -423,10 +430,9 @@
 
 .PHONY: install-doc-handling
 install-doc-handling: plist
-       @${STEP_MSG} "Automatic manual page handling"
-       ${RUN} \
-       ${CAT} ${_PLIST_NOKEYWORDS} \
-       | ${EGREP} ${_PLIST_REGEXP.man:Q} \
+       ${RUN}                                                          \
+       ${STEP_MSG} "Automatic manual page handling";                   \
+       ${EGREP} ${_PLIST_REGEXP.man:Q} ${_PLIST_NOKEYWORDS}            \
        | ${_DOC_COMPRESS}
 
 privileged-install-hook: .PHONY



Home | Main Index | Thread Index | Old Index