pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/mk/wrapper Fixed the "inconsistent update" problem whe...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/4883644b82d8
branches:  trunk
changeset: 520426:4883644b82d8
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Sat Oct 21 11:42:25 2006 +0000

description:
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:

 mk/wrapper/bsd.wrapper.mk |   3 ++-
 mk/wrapper/logic          |   7 ++++---
 mk/wrapper/wrapper.sh     |  11 ++++++++---
 3 files changed, 14 insertions(+), 7 deletions(-)

diffs (93 lines):

diff -r 3bc54c847c31 -r 4883644b82d8 mk/wrapper/bsd.wrapper.mk
--- a/mk/wrapper/bsd.wrapper.mk Sat Oct 21 11:39:16 2006 +0000
+++ b/mk/wrapper/bsd.wrapper.mk Sat Oct 21 11:42:25 2006 +0000
@@ -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 @@
        -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 -r 3bc54c847c31 -r 4883644b82d8 mk/wrapper/logic
--- a/mk/wrapper/logic  Sat Oct 21 11:39:16 2006 +0000
+++ b/mk/wrapper/logic  Sat Oct 21 11:42:25 2006 +0000
@@ -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 @@
                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 @@
 EOF
                                $cat $cache_header \
                                     $cache_body \
-                                    $cache_footer > $cache
+                                    $cache_footer > $cache-$$.tmp
+                               $mv -f $cache-$$.tmp $cache
                                ;;
                        esac
                        ;;
diff -r 3bc54c847c31 -r 4883644b82d8 mk/wrapper/wrapper.sh
--- a/mk/wrapper/wrapper.sh     Sat Oct 21 11:39:16 2006 +0000
+++ b/mk/wrapper/wrapper.sh     Sat Oct 21 11:42:25 2006 +0000
@@ -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 @@
 cat="@CAT@"  
 echo="@ECHO@"
 expr="@EXPR@"
+mv="@MV@"
 sed="@SED@"
 test="@TEST@"
 Xsed="$sed -e 1s/^X//"
@@ -78,6 +81,8 @@
 msg_log $wrapperlog "[*]" $original_cmd
 
 cmd="@WRAPPEE@"
+libs=""
+rellpath=""
 do_transform=yes
 init_queue argbuf
 init_queue cmdbuf
@@ -111,8 +116,8 @@
 @_WRAP_ENV@
 
 msg_log $wrapperlog "<.>" $cmd
-eval $cmd
-wrapper_result=$?
+wrapper_result=0
+eval "$cmd" || wrapper_result="$?"
 
 . $cleanup
 



Home | Main Index | Thread Index | Old Index