pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc mk/misc: adjust layout of the show-all output to pkgsr...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/53394a32305d
branches:  trunk
changeset: 325195:53394a32305d
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Sun Nov 11 19:07:12 2018 +0000

description:
mk/misc: adjust layout of the show-all output to pkgsrc format

In Makefiles, the variable values are aligned vertically. This format is
now also used in the show-all target, which makes it easier readable.

Some more variables have been marked as multi-value, and single-valued
variables ending in space are clearly marked. Without the latter, the
regression test would have a line with significant trailing whitespace.

diffstat:

 mk/misc/show.mk           |  35 +++++++++++++++-------------
 regress/show-all/Makefile |  11 ++++----
 regress/show-all/spec     |  57 +++++++++++++++++++++++-----------------------
 3 files changed, 53 insertions(+), 50 deletions(-)

diffs (195 lines):

diff -r 27e23b78f8a3 -r 53394a32305d mk/misc/show.mk
--- a/mk/misc/show.mk   Sun Nov 11 18:03:17 2018 +0000
+++ b/mk/misc/show.mk   Sun Nov 11 19:07:12 2018 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: show.mk,v 1.15 2018/11/10 10:40:55 rillig Exp $
+# $NetBSD: show.mk,v 1.16 2018/11/11 19:07:12 rillig Exp $
 #
 # This file contains some targets that print information gathered from
 # variables. They do not modify any variables.
@@ -149,18 +149,20 @@
 .  for c in ${_SHOW_ALL_CATEGORIES}
 .    for v in ${${c}.${g}}
 .      if (${v:M*_ENV}                 \
-       || ${v:M*_ENV.*})
+       || ${v:M*_ENV.*}                \
+       || ${v} == PLIST_SUBST          \
+       || ${v:MSUBST_VARS.*})
 
 # multi-valued variables, values are sorted
        ${RUN}                                                          \
        if ${!defined(${v}) :? true : false}; then                      \
-         printf '  %s\t%s (undefined)\n' ${_LABEL.${c}} ${v:Q};        \
+         printf '  %s\t%-23s # undefined\n' ${_LABEL.${c}} ${v:Q};     \
        elif value=${${v}:U:M*:Q} && test "x$$value" = "x"; then        \
-         printf '  %s\t%s = # empty\n' ${_LABEL.${c}} ${v:Q};          \
+         printf '  %s\t%-23s # empty\n' ${_LABEL.${c}} ${v:Q}=;        \
        else                                                            \
-         printf '  %s\t%s (sorted) = \\\n' ${_LABEL.${c}} ${v:Q};      \
-         printf '  \t\t%s \\\n' ${${v}:O:@x@${x:Q}@};                  \
-         printf '  \t\t# end of %s\n' ${v:Q};                          \
+         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# end of %s (sorted)\n' ${v:Q};               \
        fi
 
 .      elif (${v:M*_ARGS}              \
@@ -168,6 +170,7 @@
        || ${v:M*_CMD}                  \
        || ${v:M*_CMD_DEFAULT}          \
        || ${v:M*_SKIP}                 \
+       || ${v:M*INSTALL_SRC}           \
        || ${v:MMASTER_SITE*}           \
        || ${v:MSUBST_FILES.*}          \
        || ${v:MSUBST_SED.*}            \
@@ -177,13 +180,13 @@
 # multi-valued variables, preserving original order
        ${RUN}                                                          \
        if ${!defined(${v}) :? true : false}; then                      \
-         printf '  %s\t%s (undefined)\n' ${_LABEL.${c}} ${v:Q};        \
+         printf '  %s\t%-23s # undefined\n' ${_LABEL.${c}} ${v:Q};     \
        elif value=${${v}:U:M*:Q} && test "x$$value" = "x"; then        \
-         printf '  %s\t%s = # empty\n' ${_LABEL.${c}} ${v:Q};          \
+         printf '  %s\t%-23s # empty\n' ${_LABEL.${c}} ${v:Q}=;        \
        else                                                            \
-         printf '  %s\t%s = \\\n' ${_LABEL.${c}} ${v:Q};               \
-         printf '  \t\t%s \\\n' ${${v}:@x@${x:Q}@};                    \
-         printf '  \t\t# end of %s\n' ${v:Q};                          \
+         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# end of %s\n' ${v:Q};                        \
        fi
 
 .      else
@@ -191,11 +194,12 @@
 # single-valued variables
        ${RUN}                                                          \
        if ${!defined(${v}) :? true : false}; then                      \
-         printf '  %s\t%s (undefined)\n' ${_LABEL.${c}} ${v:Q};        \
+         printf '  %s\t%-23s # undefined\n' ${_LABEL.${c}} ${v:Q};     \
        elif value=${${v}:U:Q} && test "x$$value" = "x"; then           \
-         printf '  %s\t%s = # empty\n' ${_LABEL.${c}} ${v:Q};          \
+         printf '  %s\t%-23s # empty\n' ${_LABEL.${c}} ${v:Q}=;        \
        else                                                            \
-         printf '  %s\t%s = %s\n' ${_LABEL.${c}} ${v:Q} "$$value";     \
+         case "$$value" in (*[\        \ ]) eol="# ends with space";; (*) eol=""; esac; \
+         printf '  %s\t%-23s %s\n' ${_LABEL.${c}} ${v:Q}= "$$value$$eol"; \
        fi
 
 .      endif
@@ -213,4 +217,3 @@
                cd ${.CURDIR}/../../$$dir &&                            \
                ${RECURSIVE_MAKE} ${MAKEFLAGS} show-options;            \
        done
-
diff -r 27e23b78f8a3 -r 53394a32305d regress/show-all/Makefile
--- a/regress/show-all/Makefile Sun Nov 11 18:03:17 2018 +0000
+++ b/regress/show-all/Makefile Sun Nov 11 19:07:12 2018 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.1 2018/11/10 10:40:56 rillig Exp $
+# $NetBSD: Makefile,v 1.2 2018/11/11 19:07:12 rillig Exp $
 
 DISTNAME=      show-all-1.0
 CATEGORIES=    regress
@@ -10,16 +10,15 @@
 LICENSE=       2-clause-bsd
 
 REGRESS.empty=         # empty
+REGRESS.space=         ${:U } # a single space
 REGRESS.value=         All * kinds of `strange' \escape $$characters
 
 REGRESS_ENV.empty=     # empty
-REGRESS_ENV.space=     # initially empty
-REGRESS_ENV.space+=    # now it contains a single space
+REGRESS_ENV.space=     ${:U } # a single space
 REGRESS_ENV.value=     VAR1=value1 VAR2=`command execution via backticks` *=all
 
 REGRESS_ARGS.empty=    # empty
-REGRESS_ARGS.space=    # initially empty
-REGRESS_ARGS.space+=   # now it contains a single space
+REGRESS_ARGS.space=    ${:U } # a single space
 REGRESS_ARGS.value=    VAR1=value1 VAR2=`command execution via backticks` *=all
 
 # Variable names may also contain special characters that must be escaped.
@@ -27,9 +26,9 @@
 **=                    asterisk
 
 _VARGROUPS+=           regress
-_PKG_VARS.regress+=    REGRESS.undefined REGRESS.empty REGRESS.value
 _PKG_VARS.regress+=    REGRESS_ENV.undefined REGRESS_ENV.empty REGRESS_ENV.space REGRESS_ENV.value
 _PKG_VARS.regress+=    REGRESS_ARGS.undefined REGRESS_ARGS.empty REGRESS_ARGS.space REGRESS_ARGS.value
+_PKG_VARS.regress+=    REGRESS.undefined REGRESS.empty REGRESS.space REGRESS.value
 _PKG_VARS.regress+=    * **
 
 .include "../../mk/bsd.pkg.mk"
diff -r 27e23b78f8a3 -r 53394a32305d regress/show-all/spec
--- a/regress/show-all/spec     Sun Nov 11 18:03:17 2018 +0000
+++ b/regress/show-all/spec     Sun Nov 11 19:07:12 2018 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: spec,v 1.1 2018/11/10 10:40:56 rillig Exp $
+# $NetBSD: spec,v 1.2 2018/11/11 19:07:12 rillig Exp $
 
 tmpdir=${TMPDIR:-/tmp}/pkgsrc-show-all
 rm -rf "$tmpdir"
@@ -23,33 +23,34 @@
 
        cat <<'EOF' > "$tmpdir/expected"
 regress:
-  pkg  REGRESS.undefined (undefined)
-  pkg  REGRESS.empty = # empty
-  pkg  REGRESS.value = All * kinds of `strange' \escape $characters
-  pkg  REGRESS_ENV.undefined (undefined)
-  pkg  REGRESS_ENV.empty = # empty
-  pkg  REGRESS_ENV.space = # empty
-  pkg  REGRESS_ENV.value (sorted) = \
-               *=all \
-               VAR1=value1 \
-               VAR2=`command \
-               backticks` \
-               execution \
-               via \
-               # end of REGRESS_ENV.value
-  pkg  REGRESS_ARGS.undefined (undefined)
-  pkg  REGRESS_ARGS.empty = # empty
-  pkg  REGRESS_ARGS.space = # empty
-  pkg  REGRESS_ARGS.value = \
-               VAR1=value1 \
-               VAR2=`command \
-               execution \
-               via \
-               backticks` \
-               *=all \
-               # end of REGRESS_ARGS.value
-  pkg  * = show-all-regress
-  pkg  ** = asterisk
+  pkg  REGRESS_ENV.undefined   # undefined
+  pkg  REGRESS_ENV.empty=      # empty
+  pkg  REGRESS_ENV.space=      # empty
+  pkg  REGRESS_ENV.value=      \
+                               *=all \
+                               VAR1=value1 \
+                               VAR2=`command \
+                               backticks` \
+                               execution \
+                               via \
+                               # end of REGRESS_ENV.value (sorted)
+  pkg  REGRESS_ARGS.undefined  # undefined
+  pkg  REGRESS_ARGS.empty=     # empty
+  pkg  REGRESS_ARGS.space=     # empty
+  pkg  REGRESS_ARGS.value=     \
+                               VAR1=value1 \
+                               VAR2=`command \
+                               execution \
+                               via \
+                               backticks` \
+                               *=all \
+                               # end of REGRESS_ARGS.value
+  pkg  REGRESS.undefined       # undefined
+  pkg  REGRESS.empty=          # empty
+  pkg  REGRESS.space=           # ends with space
+  pkg  REGRESS.value=          All * kinds of `strange' \escape $characters
+  pkg  *=                      show-all-regress
+  pkg  **=                     asterisk
 
 EOF
 



Home | Main Index | Thread Index | Old Index