pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/regress/make-quoting/files Added an example workaround...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/1ef4c39e37bb
branches:  trunk
changeset: 493865:1ef4c39e37bb
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Sun May 15 23:37:13 2005 +0000

description:
Added an example workaround to bug1.mk.

diffstat:

 regress/make-quoting/files/bug1.mk  |  37 ++++++++++++++++++++++++++++---------
 regress/make-quoting/files/bug1.out |   3 ++-
 2 files changed, 30 insertions(+), 10 deletions(-)

diffs (74 lines):

diff -r 449dd035d048 -r 1ef4c39e37bb regress/make-quoting/files/bug1.mk
--- a/regress/make-quoting/files/bug1.mk        Sun May 15 23:27:44 2005 +0000
+++ b/regress/make-quoting/files/bug1.mk        Sun May 15 23:37:13 2005 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: bug1.mk,v 1.1 2005/05/15 22:50:13 rillig Exp $
+# $NetBSD: bug1.mk,v 1.2 2005/05/15 23:37:13 rillig Exp $
 #
 # This file demonstrates a parsing bug in make(1) from NetBSD-1.6.2 and
 # the current pkgsrc bmake. The make from NetBSD-2.99.15 has been fixed.
@@ -7,30 +7,49 @@
 # terminator for a variable and once as literal character, which is
 # appended to PKG_OPTIONS.
 
-PKG_OPTIONS=   a b c
-.for _o_ in -b -c
-_opt_:=                ${_o_}          # .for variables cannot be used in modifiers
+OPTIONS=       a b c d
+MYOPTIONS=     -b -c
+
+OPTIONS_1:=    ${OPTIONS}
+.for _o_ in ${MYOPTIONS}
+_opt_:=                ${_o_}
 .  if !empty(_opt_:M-*)
-PKG_OPTIONS:=  ${PKG_OPTIONS:N${_opt_:C/-//}} # <-- the bug
+OPTIONS_1:=    ${OPTIONS_1:N${_opt_:C/-//}}    # <-- the bug
+.  endif
+.endfor
+
+# This is a possible workaround for this bug. It defines an intermediate
+# variable that reduces the complexity of the modifier expression.
+
+OPTIONS_2:=    ${OPTIONS}
+.for _o_ in ${MYOPTIONS}
+_opt_:=                ${_o_}
+_popt_:=       ${_o_:C/-//}                    # <-- workaround, part 1
+.  if !empty(_opt_:M-*)
+OPTIONS_2:=    ${OPTIONS_2:N${_popt_}}         # <-- workaround, part 2
 .  endif
 .endfor
 
 PASSED?=       no
 
 # /usr/bin/make from NetBSD 2.99.15 or similar
-.if !empty(MAKE_VERSION:Mnetbsd-2005*) && ${PKG_OPTIONS} == "a"
+.if !empty(MAKE_VERSION:Mnetbsd-2005*) && ${OPTIONS_1} == "a"
 PASSED=                yes
 
 # /usr/bin/make from NetBSD 1.6.2
-.elif !empty(MAKE_VERSION:Mnetbsd-20040210) && ${PKG_OPTIONS} == "a b c}}"
+.elif !empty(MAKE_VERSION:Mnetbsd-20040210) && ${OPTIONS_1} == "a b c d}}"
 PASSED=                yes
 
 # bmake from pkgsrc
-.elif !empty(MAKE_VERSION:Mbmake-3.1.12*) && ${PKG_OPTIONS} == "a b c}}"
+.elif !empty(MAKE_VERSION:Mbmake-3.1.12*) && ${OPTIONS_1} == "a b c d}}"
 PASSED=                yes
 
 .endif
 
 .PHONY: all
 all:
-       @echo ${PASSED}
+       @echo "PASSED="${PASSED:Q}""
+.if ${PASSED} != "yes"
+       @echo "OPTIONS_1="${OPTIONS_1:Q}""
+.endif
+       @echo "OPTIONS_2="${OPTIONS_2:Q}""
diff -r 449dd035d048 -r 1ef4c39e37bb regress/make-quoting/files/bug1.out
--- a/regress/make-quoting/files/bug1.out       Sun May 15 23:27:44 2005 +0000
+++ b/regress/make-quoting/files/bug1.out       Sun May 15 23:37:13 2005 +0000
@@ -1,1 +1,2 @@
-yes
+PASSED=yes
+OPTIONS_2=a d



Home | Main Index | Thread Index | Old Index