pkgsrc-Changes archive

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

CVS commit: pkgsrc



Module Name:    pkgsrc
Committed By:   rillig
Date:           Fri Mar 20 16:39:03 UTC 2020

Modified Files:
        pkgsrc/mk/misc: show.mk
        pkgsrc/regress/show-all: Makefile spec

Log Message:
show-all: fix output for list variables containing dollar characters

Before, variables containing dollar characters displayed so wrong that it
was hard to explain.

To fix the problem, I typed almost random characters into the code until
the output was exactly as expected. I still do not understand:

* why the list variables need 8 dollars to survive the @x@ loop,
* why the code only works if the dollars come from an external variable
  instead of being written inline,
* why the backslash in the :C modifier needs to be doubled.

Anyway, the output of "bmake show-all-extract" now contains the shell
variable $${extract_file}, just as it should. The dollars are now doubled
in the output and thereby match the source code from the Makefile
exactly.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 pkgsrc/mk/misc/show.mk
cvs rdiff -u -r1.4 -r1.5 pkgsrc/regress/show-all/Makefile
cvs rdiff -u -r1.3 -r1.4 pkgsrc/regress/show-all/spec

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/show.mk
diff -u pkgsrc/mk/misc/show.mk:1.18 pkgsrc/mk/misc/show.mk:1.19
--- pkgsrc/mk/misc/show.mk:1.18 Sun Sep  8 09:01:04 2019
+++ pkgsrc/mk/misc/show.mk      Fri Mar 20 16:39:03 2020
@@ -1,4 +1,4 @@
-# $NetBSD: show.mk,v 1.18 2019/09/08 09:01:04 rillig Exp $
+# $NetBSD: show.mk,v 1.19 2020/03/20 16:39:03 rillig Exp $
 #
 # This file contains some targets that print information gathered from
 # variables. They do not modify any variables.
@@ -165,6 +165,9 @@ show-all: show-all-${g}
 # using the :sh modifier may show warnings, for example because ${WRKDIR}
 # doesn't exist.
 
+_SHOW_ALL.d4=  $$$$            # see regress/show-all
+_SHOW_ALL.d8=  $$$$$$$$        # see regress/show-all
+
 show-all-${g}: .PHONY
        @${RUN} printf '%s:\n' ${g:Q}
 
@@ -181,7 +184,7 @@ show-all-${g}: .PHONY
          printf '  %s\t%-23s # empty\n' ${_LABEL.${c}} ${v:Q}=;        \
        else                                                            \
          printf '  %s\t%-23s \\\n' ${_LABEL.${c}} ${v:Q}=;             \
-         printf '\t\t\t\t%s \\\n' ${${v}:O:@x@${x:Q}@};                \
+         printf '\t\t\t\t%s \\\n' ${${v}:O:C,\\$$,${_SHOW_ALL.d8},g:@x@${x:Q}@}; \
          printf '\t\t\t\t# end of %s (sorted)\n' ${v:Q};               \
        fi
 
@@ -195,7 +198,7 @@ show-all-${g}: .PHONY
          printf '  %s\t%-23s # empty\n' ${_LABEL.${c}} ${v:Q}=;        \
        else                                                            \
          printf '  %s\t%-23s \\\n' ${_LABEL.${c}} ${v:Q}=;             \
-         printf '\t\t\t\t%s \\\n' ${${v}:@x@${x:Q}@};                  \
+         printf '\t\t\t\t%s \\\n' ${${v}:C,\\$$,${_SHOW_ALL.d8},g:@x@${x:Q}@}; \
          printf '\t\t\t\t# end of %s\n' ${v:Q};                        \
        fi
 
@@ -205,7 +208,7 @@ show-all-${g}: .PHONY
        ${RUN}                                                          \
        if ${!defined(${v}) :? true : false}; then                      \
          printf '  %s\t%-23s # undefined\n' ${_LABEL.${c}} ${v:Q};     \
-       elif value=${${v}:U:Q} && test "x$$value" = "x"; then           \
+       elif value=${${v}:U:C,\\$$,${_SHOW_ALL.d4},gW:Q} && test "x$$value" = "x"; then \
          printf '  %s\t%-23s # empty\n' ${_LABEL.${c}} ${v:Q}=;        \
        else                                                            \
          case "$$value" in (*[\        \ ]) eol="# ends with space";; (*) eol=""; esac; \

Index: pkgsrc/regress/show-all/Makefile
diff -u pkgsrc/regress/show-all/Makefile:1.4 pkgsrc/regress/show-all/Makefile:1.5
--- pkgsrc/regress/show-all/Makefile:1.4        Fri Mar 20 15:45:12 2020
+++ pkgsrc/regress/show-all/Makefile    Fri Mar 20 16:39:03 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.4 2020/03/20 15:45:12 rillig Exp $
+# $NetBSD: Makefile,v 1.5 2020/03/20 16:39:03 rillig Exp $
 
 DISTNAME=      show-all-1.0
 CATEGORIES=    regress
@@ -33,9 +33,9 @@ _PKG_VARS.regress+=   * **
 _SORTED_VARS.regress=  *_ENV.*
 _LISTED_VARS.regress=  *_ARGS.*
 
-SHELLVAR_PLAIN=                "$$var $${var} $$other"
-SHELLVAR_ENV=          "$$var $${var} $$other"
-SHELLVAR_ARGS=         "$$var $${var} $$other"
+SHELLVAR_PLAIN=                "$$var $${var} $$other $$$$"
+SHELLVAR_ENV=          "$$var $${var} $$other $$$$"
+SHELLVAR_ARGS=         "$$var $${var} $$other $$$$"
 
 _VARGROUPS+=           shellvar
 _PKG_VARS.shellvar=    SHELLVAR_PLAIN SHELLVAR_ENV SHELLVAR_ARGS

Index: pkgsrc/regress/show-all/spec
diff -u pkgsrc/regress/show-all/spec:1.3 pkgsrc/regress/show-all/spec:1.4
--- pkgsrc/regress/show-all/spec:1.3    Fri Mar 20 15:45:12 2020
+++ pkgsrc/regress/show-all/spec        Fri Mar 20 16:39:03 2020
@@ -1,4 +1,4 @@
-# $NetBSD: spec,v 1.3 2020/03/20 15:45:12 rillig Exp $
+# $NetBSD: spec,v 1.4 2020/03/20 16:39:03 rillig Exp $
 
 tmpdir=${TMPDIR:-/tmp}/pkgsrc-show-all
 rm -rf "$tmpdir"
@@ -49,7 +49,7 @@ regress:
   pkg  REGRESS.undefined       # undefined
   pkg  REGRESS.empty=          # empty
   pkg  REGRESS.space=           # ends with space
-  pkg  REGRESS.value=          All * kinds of `strange' \escape $characters
+  pkg  REGRESS.value=          All * kinds of `strange' \escape $$characters
   pkg  *=                      show-all-regress
   pkg  **=                     asterisk
 
@@ -71,17 +71,17 @@ EOF
        require_file "$tmpdir/show-all-regress.out" --equals "$tmpdir/expected"
 
 
-       # TODO: What the heck is going on here?
-       # The output of the ENV and ARGS cases should be the same as in PLAIN.
+       # Up to 2020-03-20, the output of the ENV and ARGS variables differed
+       # a lot from the PLAIN variable.
        #
        cat <<'EOF' > "$tmpdir/expected"
 shellvar:
-  pkg  SHELLVAR_PLAIN=         "$var ${var} $other"
+  pkg  SHELLVAR_PLAIN=         "$$var $${var} $$other $$$$"
   pkg  SHELLVAR_ENV=           \
-                               ".MAKE.LEVEL.ENVar  ther" \
+                               "$$var $${var} $$other $$$$" \
                                # end of SHELLVAR_ENV (sorted)
   pkg  SHELLVAR_ARGS=          \
-                               ".MAKE.LEVEL.ENVar  ther" \
+                               "$$var $${var} $$other $$$$" \
                                # end of SHELLVAR_ARGS
 
 EOF



Home | Main Index | Thread Index | Old Index