Re: [OS-BUILD PATCHv2 1/3] redhat/configs: Update & generalize evaluate_configs

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

 



On 7/17/20 1:12 PM, Herton R. Krzesinski wrote:
On Fri, Jul 17, 2020 at 12:07:53PM -0000, GitLab Bridge on behalf of prarit wrote:
> From: Prarit Bhargava <prarit@xxxxxxxxxx>
>
> evaluate_configs is a tool that verifies the CONFIG setting hierarchy for
> the kernel.  It can display settings for a specific CONFIG, find and
> remove extra CONFIG files and synchronize the CONFIG settings between
> the common, ark, and fedora directories.
>
> For example, to view a config,
>
> [prarit@prarit configs]$ ./evaluate_configs -p priority.rhel -c CONFIG_HEADER_TEST
> CONFIG_HEADER_TEST
> legend                         g  ga1  ga2  d  da1  da2
> common-x86_64                  y  -    -    -  X    -
> common-ppc64le                 y  -    X    -  -    X
> common-s390x                   y  -    X    -  -    X
> common-s390x-zfcpdump          y  -    -    X  X    X
> common-aarch64                 y  -    -    -  X    -
> ark-x86_64                     y  -    -    -  X    -
> ark-ppc64le                    y  -    X    -  -    X
> ark-s390x                      y  -    X    -  -    X
> ark-s390x-zfcpdump             y  -    -    X  X    X
> ark-aarch64                    y  -    -    -  X    -
> pending-common-x86_64          -  -    -    -  X    -
> pending-common-ppc64le         -  -    X    -  -    X
> pending-common-s390x           -  -    X    -  -    X
> pending-common-s390x-zfcpdump  -  -    -    X  X    X
> pending-common-aarch64         -  -    -    -  X    -
>
> The legend row, shows the subdirectory entries.  These can be mapped
> back to the priority.rhel entries, for example, for x86_64
>
> x86_64=generic:generic-x86:generic-x86-x86_64
> x86_64-debug=generic:generic-x86:generic-x86-x86_64:debug:debug-x86-x86_64
>
> are combined into one entry for x86_64 where
>
> g maps to "generic"
> ga1 maps to "generic-x86"
> ga2 maps to "generic-x86-x86-64"
> d maps to "debug"
> da1 maps to nothing (more on this below)
> da2 maps to debug-x86-x86_64
>
> The left hand column indicates the directory and config-variant.  For
> example, ark-s390x-zfcpdump is the s390x-zfcpdump variant and the
> row beside it shows the config settings in the ark directory.
>
> The data contained in the output can have 5 values:
>
>         y = CONFIG is set to 'y'
>         m = CONFIG is set to 'm'
>         n = CONFIG is set to 'is not set'
>         - = CONFIG file does not exist
>         X = CONFIG file entry is not in priority file
>
> As can be seen above in the CONFIG_HEADER_TEST output, da1 is not present
> in the priority.rhel file and is marked with an 'X'.
>
> The -f option can be used to evaluate all the CONFIGs by executing, for
> example
>
> |# evaluate_configs -p priority.rhel -f
>
> or a single CONFIG
>
> |# evaluate_configs -p priority.rhel -f -c CONFIG_HEADER_TEST
>
> and similarily the common, ark and fedora CONFIGs can be verified by
> executing
>
> evaluate_configs -j
>
> or
>
> evaluate_configs -j -c CONFIG_HEADER_TEST
>
> The two CONFIG patches in this patchset are runs of
>
> evaluate_configs -p priority.rhel -f
> evaluate_configs -p priority.fedora -f
>
> and
>
> evaluate_configs -j
>
> v2: Documentation cleanup (herton)
>
> Signed-off-by: Prarit Bhargava <prarit@xxxxxxxxxx>
> ---
>  redhat/configs/README.evaluate_configs |  134 +++
>  redhat/configs/evaluate_configs        | 1278 +++++++++++++++---------
>  redhat/configs/priority.common         |   28 +
>  redhat/configs/priority.fedora         |   16 +-
>  redhat/configs/priority.rhel           |   16 +-
>  5 files changed, 1015 insertions(+), 457 deletions(-)
>  create mode 100644 redhat/configs/README.evaluate_configs
>  create mode 100644 redhat/configs/priority.common
>
> diff --git a/redhat/configs/README.evaluate_configs
b/redhat/configs/README.evaluate_configs
> new file mode 100644
> index 000000000000..6d53e5d993e1
> --- /dev/null
> +++ b/redhat/configs/README.evaluate_configs
> @@ -0,0 +1,134 @@
> +evaluate_configs is a tool that can verify the settings of kernel
> +CONFIGs in the redhat/configs directory.  The data for evaluate_configs
> +is a combination of the redhat/configs files and the priority files.
> +
> +Introduction to Basic Output
> +============================
> +
> +This command demonstrates how to display information about the
> +CONFIG_HEADER_TEST option for RHEL.
> +
> +[prarit@prarit configs]$ ./evaluate_configs -p priority.rhel -c
CONFIG_HEADER_TEST
> +CONFIG_HEADER_TEST
> +legend                         g  ga1  ga2  d  da1  da2
> +common-x86_64                  y  -    -    -  X    -
> +common-ppc64le                 y  -    X    -  -    X
> +common-s390x                   y  -    X    -  -    X
> +common-s390x-zfcpdump          y  -    -    X  X    X
> +common-aarch64                 y  -    -    -  X    -
> +ark-x86_64                     y  -    -    -  X    -
> +ark-ppc64le                    y  -    X    -  -    X
> +ark-s390x                      y  -    X    -  -    X
> +ark-s390x-zfcpdump             y  -    -    X  X    X
> +ark-aarch64                    y  -    -    -  X    -
> +pending-common-x86_64          -  -    -    -  X    -
> +pending-common-ppc64le         -  -    X    -  -    X
> +pending-common-s390x           -  -    X    -  -    X
> +pending-common-s390x-zfcpdump  -  -    -    X  X    X
> +pending-common-aarch64         -  -    -    -  X    -
> +
> +The legend row, shows the subdirectory entries.  These can be mapped
> +back to the priority.rhel entries, for example, for x86_64
> +
> +# x86_64
> +x86_64=generic:generic-x86:generic-x86-x86_64
> +x86_64-debug=generic:generic-x86:generic-x86-x86_64:debug:debug-x86-x86_64
> +
> +are combined into one entry for x86_64 where
> +
> +g maps to "generic"
> +ga1 maps to "generic-x86"
> +ga2 maps to "generic-x86-x86-64"
> +d maps to "debug"
> +da1 maps to nothing (more on this below)
> +da2 maps to debug-x86-x86_64
> +
> +The left hand column indicates the directory and config-variant.  For
> +example, ark-s390x-zfcpdump is the s390x-zfcpdump variant and the
> +row beside it shows the config settings in the ark directory.
> +
> +The data contained in the output can have 5 values:
> +
> +	y = CONFIG is set to 'y'
> +	m = CONFIG is set to 'm'
> +	n = CONFIG is set to 'is not set'
> +	- = CONFIG file does not exist
> +	X = CONFIG file entry is not in priority file
> +
> +As can be seen above in the CONFIG_HEADER_TEST output, da1 is not present
> +in the priority.rhel file and is marked with an 'X'.
> +
> +Options
> +=======
> +
> +	-c CONFIG
> +		Evalulate these specific CONFIGs. This can be a file,
> +		or a comma-separated list.  If nothing is specified then
> +		all CONFIGs are examined by default.)
> +	-d
> +		Enable debug
> +	-p priority.file
> +		Specify a priority.file (no default)
> +	-j
> +		Evaluate common directory
> +	-f
> +		Evaluate and fix a priority's CONFIGs
> +
> +All commands except -j require a -p argument.
> +
> +Evaluate CONFIGs
> +================
> +
> +The -f option can be used to evaluate all the CONFIGs by executing, for
> +example
> +
> +# evaluate_configs -p priority.rhel -f
> +
> +or a single CONFIG
> +
> +# evaluate_configs -p priority.rhel -f -c CONFIG_HEADER_TEST
> +
> +The Evaluate Output will show a different view than the Basic Output above:
> +
> +ERROR: (hierarchy) ark/generic/CONFIG_HEADER_TEST : superseding value has y.
> +|CONFIG_HEADER_TEST (ark-aarch64)
> +|g  ga1  ga2  d  da1  da2  g  ga1  ga2  d  da1  da2  g  ga1  ga2  d  da1  da2
> +|y  -    -    -  X    -    y  -    -    -  X    -    -  -    -    -  X    -
> +| Deleting ark/generic/CONFIG_HEADER_TEST
> +
> +This view is the Basic Output's aarch64 data in a single line,  From the
> +above output,
> +
> +common-aarch64                 y  -    -    -  X    -
> +ark-aarch64                    y  -    -    -  X    -
> +pending-common-aarch64         -  -    -    -  X    -
> +
> +The Evaluate output makes it easier to visually see a conflict.   One
> +can read the line and if there are two y|m|n separated by one or more - or
> +X's in a line, then there is the possibility of a conflict.
> +
> +If the CONFIG setting is found to be incorrect it it automatically removed
> +and a message
> +
> +| Deleting ark/generic/CONFIG_HEADER_TEST
> +
> +will be output.
> +
> +Evaluate common Directory
> +=========================
> +
> +This function does a 1-to-1 comparison of CONFIG settings in the
> +ark and fedora directories, and checks to see if the CONFIG should be set
> +in the common directory.
> +
> +The output is the same as the Evaluate output.
> +
> +This functionality uses the priority.common file and can be executed via
> +
> +evaluate_configs -j
> +
> +for all CONFIGs, or
> +
> +evaluate_configs -j -c CONFIG_HEADER_TEST
> +
> +for a single CONFIG.
> diff --git a/redhat/configs/evaluate_configs b/redhat/configs/evaluate_configs
> index 5ed3e0407bca..613a9dbf8537 100755
> --- a/redhat/configs/evaluate_configs
> +++ b/redhat/configs/evaluate_configs
> @@ -1,528 +1,896 @@
> -#!/bin/bash
> -#
> -# The order of priority is
> -#
> -#	debug/arch highest (ie, this can override the remaining levels)
> -#	debug/
> -#	generic/arch
> -#	generic/   lowest (ie, this value can be overridden by anything above)
> -#
> -# however, inheritance is the opposite.  That is if a CONFIG is undefined
> -# the lower level's config is inherited at the higher level.
> -#
> -# ex) Consider CONFIG_MLX4_EN
> -# which is set as
> -#					     s390x
> -#	arch	aarch64	ppc64le	s390x x86_64 zfcpd
> -#
> -#	d_a	  x	  x	  x      x     x   <<< generic/s390x/zfcpdump
> -#	debug     x       x       x      x     |   <<< noop for s390/zfcpdump
> -#	gen_a     m       m       m      m     m   <<< same as s390x
> -#	gen       n       n       n      n     n
> -#
> -# where
> -#	x = no file/undefined
> -#	n = not set
> -#	m = module
> -#	y = built in
> -#	c = character/string setting
> -#
> -# The arch-debug configs would have m, as it is inherited from gen_a.
> -# All the arch configs would have m, because gen_a overrode gen.
> -#
> -# Obviously, the debug and gen rows will have the same setting as there
> -# is one setting for all arches.
> -#
> -# Rules:
> -# 1) If an entire arch row is majority m/y/n, then the generic/debug row should
> -# be m/y/n.
> -# 2) A column should not have back-to-back identical settings, ex) m followed
> -# by an m.
> -# 3) debug can have the same setting as gen.  The config set is described
> -# in the priority file.
> -# 4) make as few as files as possible.  That might sound crazy but consider the
> -# example above.  gen_a has separate files which are all =m.  It is more
> -# correct to have a single gen file =m.
> -#
> -# TODO: Inherit priority map from priority file?
> -# TODO: What to do with character & string configs?
> -# TODO: Can some of the syntax errors be cleaned up?  For example blank lines,
> -# or comment on the same line as a config?
> -#
> -
> -DIR=./
> -
> -usage()
> -{
> -	echo "evaluate_configs [ -b | -c | -d | -s | -f ]"
> -	echo "	-b : balance level (generic, generic/arch, debug, debug/arch) CONFIGs"
> -	echo "	-c : check arch CONFIGs"
> -	echo "	-d : enable debug"
> -	echo "	-s : check CONFIGs syntax"
> -	echo "	-f : find dead CONFIGs"
> +#!/usr/bin/bash
> +trap '[ -d "$tempdir" ] && rm -rf "$tempdir"' EXIT INT
> +
> +# TODO: -c takes a comma separated list or file?
> +# TODO: allow for user to specify CONFIGS ^^^ ?
> +# TODO: move the undo the p setting to map_configs_to_array
> +# TODO: Fix ERROR: message so it only shows when the file is being deleted
> +
> +DEBUG=false
> +
> +# global definitions
> +CONFIG=
> +priority_file=
> +ORDER=
> +cfgvariants=
> +toplevels=
> +subdirs=
> +rows=
> +columns=
> +configmap=
> +cfgs=
> +cfgs_base=
> +weightorig=
> +numorder=
> +longheader=
> +weightorig=
> +weight=
> +
> +tempdir=$(mktemp -d)
> +
> +whatcouldgowrong() {
> +	echo ""
> +	echo "usage: evaluate_configs [-c CONFIG] [-d] [-j] [ -p priority_file]"
                                                  ^--- add [-f] above

And sorry Prarit, still some -x references remains, like in help output below:

> +	echo ""
> +	echo "      -c CONFIG          Evalulate specific CONFIGs (file or csl)"
> +	echo "      -d	               Enable debug"
> +	echo "      -p priority.file   Specify a priority.file (no default)"
> +	echo "      -j                 Evaluate common directory"
> +	echo "      -f                 Evaluate CONFIGs"
> +	echo ""
> +	echo "examples)"
> +	echo ""
> +	echo "To show the status of CONFIG_HEADER_TEST in ARK,"
> +	echo "	./evaluate_configs -p priority.rhel -c CONFIG_HEADER_TEST"
> +	echo ""
> +	echo "To fix all the CONFIGS in Fedora,"
> +	echo "  ./evaluate_configs -p priority.fedora -x"
> +	echo ""
> +	echo "To fix only CONFIG_HEADER_TEST in RHEL,"
> +	echo "  ./evaluate_configs -p priority.fedora -c CONFIG_HEADER_TEST -x"
> +	echo ""
> +	echo "To fix the common directory entries,"
> +	echo " ./evaluate_configs -j"
>  	echo ""
> -	echo "See redhat/docs/editing_CONFIGS.txt for more information"
>  	exit 1
>  }

#oops.  I'll fix these.

P.
_______________________________________________
kernel mailing list -- kernel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to kernel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/kernel@xxxxxxxxxxxxxxxxxxxxxxx




[Index of Archives]     [Fedora General Discussion]     [Older Fedora Users Archive]     [Fedora Advisory Board]     [Fedora Security]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Mentors]     [Fedora Package Announce]     [Fedora Package Review]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Coolkey]     [Yum Users]     [Tux]     [Yosemite News]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [USB]     [Asterisk PBX]

  Powered by Linux