pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/mk/wrapper Avoid one fork per wrapper call if no clean...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/965493615a90
branches:  trunk
changeset: 393951:965493615a90
user:      joerg <joerg%pkgsrc.org@localhost>
date:      Sat May 30 19:18:01 2009 +0000

description:
Avoid one fork per wrapper call if no cleanup is necessary and debugging
is disabled.  In that case, the post processing is doing nothing anyway.

diffstat:

 mk/wrapper/bsd.wrapper.mk |   3 ++-
 mk/wrapper/wrapper.sh     |  13 ++++++++++---
 2 files changed, 12 insertions(+), 4 deletions(-)

diffs (53 lines):

diff -r d5ef457bf6df -r 965493615a90 mk/wrapper/bsd.wrapper.mk
--- a/mk/wrapper/bsd.wrapper.mk Sat May 30 18:16:26 2009 +0000
+++ b/mk/wrapper/bsd.wrapper.mk Sat May 30 19:18:01 2009 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.wrapper.mk,v 1.82 2008/12/29 20:47:17 joerg Exp $
+# $NetBSD: bsd.wrapper.mk,v 1.83 2009/05/30 19:18:01 joerg Exp $
 #
 # Copyright (c) 2005 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -400,6 +400,7 @@
 
 .for _wrappee_ in ${_WRAPPEES}
 _WRAP_SUBST_SED.${_wrappee_}=                                          \
+       -e "s|@_WRAP_EMPTY_FILE@|${_WRAP_EMPTY_FILEQ}|g"                \
        -e "s|@_WRAP_ENV@|${_WRAP_ENV.${_wrappee_}:Q}|g"                \
        -e "s|@_WRAP_EXTRA_ARGS@|${_WRAP_EXTRA_ARGS.${_wrappee_}:Q}|g"  \
        -e "s|@_WRAP_ARG_PP@|${_WRAP_ARG_PP.${_wrappee_}:Q}|g"          \
diff -r d5ef457bf6df -r 965493615a90 mk/wrapper/wrapper.sh
--- a/mk/wrapper/wrapper.sh     Sat May 30 18:16:26 2009 +0000
+++ b/mk/wrapper/wrapper.sh     Sat May 30 19:18:01 2009 +0000
@@ -1,6 +1,6 @@
 #! @WRAPPER_SHELL@
 #
-# $NetBSD: wrapper.sh,v 1.20 2009/05/30 17:48:20 joerg Exp $
+# $NetBSD: wrapper.sh,v 1.21 2009/05/30 19:18:01 joerg Exp $
 #
 # Copyright (c) 2004 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -39,6 +39,7 @@
 #set -eu
 
 # The list of include files for the wrapper.
+empty_file="@_WRAP_EMPTY_FILE@"
 arg_pp="@_WRAP_ARG_PP@"
 arg_pp_main="@_WRAP_ARG_PP_MAIN@"
 arg_source="@_WRAP_ARG_SOURCE@"
@@ -129,8 +130,14 @@
 @_WRAP_ENV@
 
 msg_log $wrapperlog "<.>" "$cmd"
-wrapper_result=0
-eval "$cmd" || wrapper_result="$?"
+
+if [ "${empty_file}" = "${cleanup}" ] && [ "$debug" != "yes" ]; then
+       eval "exec $cmd"
+       wrapper_results=$?
+else
+       wrapper_result=0
+       eval "$cmd" || wrapper_result="$?"
+fi
 
 . $cleanup
 



Home | Main Index | Thread Index | Old Index