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:           Sun Nov 11 19:07:12 UTC 2018

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

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 pkgsrc/mk/misc/show.mk
cvs rdiff -u -r1.1 -r1.2 pkgsrc/regress/show-all/Makefile \
    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.15 pkgsrc/mk/misc/show.mk:1.16
--- pkgsrc/mk/misc/show.mk:1.15 Sat Nov 10 10:40:55 2018
+++ pkgsrc/mk/misc/show.mk      Sun Nov 11 19:07:12 2018
@@ -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 @@ show-all-${g}: .PHONY
 .  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 @@ show-all-${g}: .PHONY
        || ${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 @@ show-all-${g}: .PHONY
 # 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 @@ show-all-${g}: .PHONY
 # 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 @@ show-depends-options:
                cd ${.CURDIR}/../../$$dir &&                            \
                ${RECURSIVE_MAKE} ${MAKEFLAGS} show-options;            \
        done
-

Index: pkgsrc/regress/show-all/Makefile
diff -u pkgsrc/regress/show-all/Makefile:1.1 pkgsrc/regress/show-all/Makefile:1.2
--- pkgsrc/regress/show-all/Makefile:1.1        Sat Nov 10 10:40:56 2018
+++ pkgsrc/regress/show-all/Makefile    Sun Nov 11 19:07:12 2018
@@ -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 @@ COMMENT=    Demonstrates the show-all targe
 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 @@ REGRESS_ARGS.value=   VAR1=value1 VAR2=`co
 **=                    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"
Index: pkgsrc/regress/show-all/spec
diff -u pkgsrc/regress/show-all/spec:1.1 pkgsrc/regress/show-all/spec:1.2
--- pkgsrc/regress/show-all/spec:1.1    Sat Nov 10 10:40:56 2018
+++ pkgsrc/regress/show-all/spec        Sun Nov 11 19:07:12 2018
@@ -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 @@ check_result() {
 
        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