summaryrefslogtreecommitdiff
path: root/mk/wrapper
diff options
context:
space:
mode:
authorrillig <rillig@pkgsrc.org>2006-10-21 11:42:25 +0000
committerrillig <rillig@pkgsrc.org>2006-10-21 11:42:25 +0000
commit69155cdc3e7cd4516da0e1fc05e755e7ee8aad8e (patch)
tree183e33b5d1ed0cf0f5da1d12ccb5299bc9043bd4 /mk/wrapper
parentb8c6a5e566c78b927e64b868bfcbcdd85cce0585 (diff)
downloadpkgsrc-69155cdc3e7cd4516da0e1fc05e755e7ee8aad8e.tar.gz
Fixed the "inconsistent update" problem when using the pkgsrc wrapper
cache together with MAKE_FLAGS=-j. The cache file is now regenerated into a temporary file and then renamed (atomically) to the "real" cache file. Fixed some code that would fail when run in "set -e" mode. If you want to test the "set -e" mode, just uncomment the line in wrapper.sh.
Diffstat (limited to 'mk/wrapper')
-rw-r--r--mk/wrapper/bsd.wrapper.mk3
-rw-r--r--mk/wrapper/logic7
-rw-r--r--mk/wrapper/wrapper.sh11
3 files changed, 14 insertions, 7 deletions
diff --git a/mk/wrapper/bsd.wrapper.mk b/mk/wrapper/bsd.wrapper.mk
index f423cee8aec..24e8df1dd8f 100644
--- a/mk/wrapper/bsd.wrapper.mk
+++ b/mk/wrapper/bsd.wrapper.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.wrapper.mk,v 1.54 2006/10/21 10:01:23 rillig Exp $
+# $NetBSD: bsd.wrapper.mk,v 1.55 2006/10/21 11:42:25 rillig Exp $
#
# Copyright (c) 2005 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -343,6 +343,7 @@ _WRAP_SUBST_SED= \
-e "s|@CAT@|${CAT:Q}|g" \
-e "s|@ECHO@|${ECHO:Q}|g" \
-e "s|@EXPR@|${EXPR:Q}|g" \
+ -e "s|@MV@|${MV}|g" \
-e "s|@SED@|${SED:Q}|g" \
-e "s|@TEST@|${TEST:Q}|g" \
-e "s|@WRAPPER_SHELL@|${WRAPPER_SHELL:Q}|g" \
diff --git a/mk/wrapper/logic b/mk/wrapper/logic
index 679684d6978..c70f5f4c5c0 100644
--- a/mk/wrapper/logic
+++ b/mk/wrapper/logic
@@ -1,4 +1,4 @@
-# $NetBSD: logic,v 1.11 2005/02/14 21:43:11 jlam Exp $
+# $NetBSD: logic,v 1.12 2006/10/21 11:42:25 rillig Exp $
#
# Copyright (c) 2004 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -56,7 +56,7 @@ while ! queue_is_empty argbuf; do
if $test $skipargs -eq 0; then
do_transform=yes
else
- skipargs=`$expr $skipargs - 1`
+ skipargs=`$expr $skipargs - 1 || true`
do_transform=no
argok=yes
continue
@@ -137,7 +137,8 @@ $cachearg) arg=$cachedarg; split_arg=$split_arg; cachehit=yes ;;
EOF
$cat $cache_header \
$cache_body \
- $cache_footer > $cache
+ $cache_footer > $cache-$$.tmp
+ $mv -f $cache-$$.tmp $cache
;;
esac
;;
diff --git a/mk/wrapper/wrapper.sh b/mk/wrapper/wrapper.sh
index e1e37042496..588a2524089 100644
--- a/mk/wrapper/wrapper.sh
+++ b/mk/wrapper/wrapper.sh
@@ -1,6 +1,6 @@
#! @WRAPPER_SHELL@
#
-# $NetBSD: wrapper.sh,v 1.5 2005/01/18 17:25:13 jlam Exp $
+# $NetBSD: wrapper.sh,v 1.6 2006/10/21 11:42:25 rillig Exp $
#
# Copyright (c) 2004 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -36,6 +36,8 @@
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
+#set -eu
+
arg_pp="@_WRAP_ARG_PP@"
arg_pp_main="@_WRAP_ARG_PP_MAIN@"
arg_source="@_WRAP_ARG_SOURCE@"
@@ -60,6 +62,7 @@ append_extra_args=yes
cat="@CAT@"
echo="@ECHO@"
expr="@EXPR@"
+mv="@MV@"
sed="@SED@"
test="@TEST@"
Xsed="$sed -e 1s/^X//"
@@ -78,6 +81,8 @@ original_cmd="$0 $@"
msg_log $wrapperlog "[*]" $original_cmd
cmd="@WRAPPEE@"
+libs=""
+rellpath=""
do_transform=yes
init_queue argbuf
init_queue cmdbuf
@@ -111,8 +116,8 @@ cmd="$cmd $libs"
@_WRAP_ENV@
msg_log $wrapperlog "<.>" $cmd
-eval $cmd
-wrapper_result=$?
+wrapper_result=0
+eval "$cmd" || wrapper_result="$?"
. $cleanup