mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	scripts: merge_config: Add option to suppress warning on overrides
Currently merge_config.sh will unconditionally warn if a fragment overrides any already set symbol. This is generally desirable but is inconvenient in cases where we want to create a fragment which disables unwanted options in the base configuration, for example when attempting to produce a smaller version of another configuration. Add an option -Q which will suppress these warnings. Signed-off-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20230203-arm64-defconfigs-v1-1-cd0694a05f13@kernel.org Signed-off-by: Arnd Bergmann <arnd@arndb.de>
This commit is contained in:
		
							parent
							
								
									384fcb0bd1
								
							
						
					
					
						commit
						46dff8d7e3
					
				
					 1 changed files with 16 additions and 9 deletions
				
			
		| 
						 | 
				
			
			@ -29,6 +29,7 @@ usage() {
 | 
			
		|||
	echo "  -y    make builtin have precedence over modules"
 | 
			
		||||
	echo "  -O    dir to put generated output files.  Consider setting \$KCONFIG_CONFIG instead."
 | 
			
		||||
	echo "  -s    strict mode. Fail if the fragment redefines any value."
 | 
			
		||||
	echo "  -Q    disable warning messages for overridden options."
 | 
			
		||||
	echo
 | 
			
		||||
	echo "Used prefix: '$CONFIG_PREFIX'. You can redefine it with \$CONFIG_ environment variable."
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -40,6 +41,7 @@ BUILTIN=false
 | 
			
		|||
OUTPUT=.
 | 
			
		||||
STRICT=false
 | 
			
		||||
CONFIG_PREFIX=${CONFIG_-CONFIG_}
 | 
			
		||||
WARNOVERRIDE=echo
 | 
			
		||||
 | 
			
		||||
while true; do
 | 
			
		||||
	case $1 in
 | 
			
		||||
| 
						 | 
				
			
			@ -82,6 +84,11 @@ while true; do
 | 
			
		|||
		shift
 | 
			
		||||
		continue
 | 
			
		||||
		;;
 | 
			
		||||
	"-Q")
 | 
			
		||||
		WARNOVERRIDE=true
 | 
			
		||||
		shift
 | 
			
		||||
		continue
 | 
			
		||||
		;;
 | 
			
		||||
	*)
 | 
			
		||||
		break
 | 
			
		||||
		;;
 | 
			
		||||
| 
						 | 
				
			
			@ -138,21 +145,21 @@ for ORIG_MERGE_FILE in $MERGE_LIST ; do
 | 
			
		|||
		NEW_VAL=$(grep -w $CFG $MERGE_FILE)
 | 
			
		||||
		BUILTIN_FLAG=false
 | 
			
		||||
		if [ "$BUILTIN" = "true" ] && [ "${NEW_VAL#CONFIG_*=}" = "m" ] && [ "${PREV_VAL#CONFIG_*=}" = "y" ]; then
 | 
			
		||||
			echo Previous  value: $PREV_VAL
 | 
			
		||||
			echo New value:       $NEW_VAL
 | 
			
		||||
			echo -y passed, will not demote y to m
 | 
			
		||||
			echo
 | 
			
		||||
			${WARNOVVERIDE} Previous  value: $PREV_VAL
 | 
			
		||||
			${WARNOVERRIDE} New value:       $NEW_VAL
 | 
			
		||||
			${WARNOVERRIDE} -y passed, will not demote y to m
 | 
			
		||||
			${WARNOVERRIDE}
 | 
			
		||||
			BUILTIN_FLAG=true
 | 
			
		||||
		elif [ "x$PREV_VAL" != "x$NEW_VAL" ] ; then
 | 
			
		||||
			echo Value of $CFG is redefined by fragment $ORIG_MERGE_FILE:
 | 
			
		||||
			echo Previous  value: $PREV_VAL
 | 
			
		||||
			echo New value:       $NEW_VAL
 | 
			
		||||
			echo
 | 
			
		||||
			${WARNOVERRIDE} Value of $CFG is redefined by fragment $ORIG_MERGE_FILE:
 | 
			
		||||
			${WARNOVERRIDE} Previous  value: $PREV_VAL
 | 
			
		||||
			${WARNOVERRIDE} New value:       $NEW_VAL
 | 
			
		||||
			${WARNOVERRIDE}
 | 
			
		||||
			if [ "$STRICT" = "true" ]; then
 | 
			
		||||
				STRICT_MODE_VIOLATED=true
 | 
			
		||||
			fi
 | 
			
		||||
		elif [ "$WARNREDUN" = "true" ]; then
 | 
			
		||||
			echo Value of $CFG is redundant by fragment $ORIG_MERGE_FILE:
 | 
			
		||||
			${WARNOVERRIDE} Value of $CFG is redundant by fragment $ORIG_MERGE_FILE:
 | 
			
		||||
		fi
 | 
			
		||||
		if [ "$BUILTIN_FLAG" = "false" ]; then
 | 
			
		||||
			sed -i "/$CFG[ =]/d" $TMP_FILE
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue