pkgsrc-Changes archive

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

CVS commit: pkgsrc/mk/misc



Module Name:    pkgsrc
Committed By:   jperkin
Date:           Wed Aug 19 09:22:27 UTC 2026

Modified Files:
        pkgsrc/mk/misc: common.mk

Log Message:
mk: Introduce support for ULIMIT_PRECMD.

While this has potential to run any pre-command, it is primarily useful as a
hook to insert ulimit(1) commands that will apply to shell commands, hence
the name.

In bulk builds there will occasionally be packages that end up spinning on
CPU and hanging the build until the user has a chance to kill the process.

For some builds this is desirable so that the issue can be debugged, but for
others the user may prefer to avoid having to interact with the build to get
it to complete, in which case they can set this to e.g. "ulimit -S -t 3600".


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 pkgsrc/mk/misc/common.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/mk/misc/common.mk
diff -u pkgsrc/mk/misc/common.mk:1.3 pkgsrc/mk/misc/common.mk:1.4
--- pkgsrc/mk/misc/common.mk:1.3        Sat Oct 13 11:04:19 2007
+++ pkgsrc/mk/misc/common.mk    Wed Aug 19 09:22:27 2026
@@ -1,4 +1,4 @@
-# $NetBSD: common.mk,v 1.3 2007/10/13 11:04:19 dsl Exp $
+# $NetBSD: common.mk,v 1.4 2026/08/19 09:22:27 jperkin Exp $
 #
 # This file contains the definitions that are used in all directories of
 # pkgsrc -- the top-level, the categories and the packages themselves.
@@ -8,6 +8,11 @@
 # PKG_DEBUG_LEVEL
 #      (See mk/help/debug.help)
 #
+# ULIMIT_PRECMD
+#      Command that is prepended to all RUN commands.  Primarily useful for
+#      setting to e.g. "ulimit -S -t 3600" to ensure no build process uses
+#      over an hour of CPU time, helping to avoid infinite loop hangs.
+#
 # System-provided variables:
 #
 # RUN
@@ -31,6 +36,7 @@ PKG_DEBUG_LEVEL?=     0
 _PKG_SILENT=           @
 _PKG_DEBUG=            # empty
 _PKG_DEBUG_SCRIPT=     ${SH}
+ULIMIT_PRECMD?=                :
 
 .if ${PKG_DEBUG_LEVEL} > 0
 _PKG_SILENT=           # empty
@@ -41,7 +47,7 @@ _PKG_DEBUG=           : commands for target ${.TA
 _PKG_DEBUG_SCRIPT=     ${SH} -x
 .endif
 
-RUN=                   ${_PKG_SILENT}${_PKG_DEBUG} set -e;
+RUN=                   ${_PKG_SILENT}${_PKG_DEBUG} set -e; ${ULIMIT_PRECMD};
 
 .if make(help)
 .include "../help/help.mk"



Home | Main Index | Thread Index | Old Index