diff mbox

[1/2] kconfig/merge_config.sh: Support KCONFIG_CONFIG

Message ID 55F06D73.70303@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Gabriel de Perthuis Sept. 9, 2015, 5:33 p.m. UTC
All make targets support $KCONFIG_CONFIG because they
run scripts/kconf.  Make sure merge_config.sh accesses the
correct file in all cases.

Previously this script broke in two different code paths,
one for targets like kvmconfig (which use merge_config.sh -m
then call a target that respects KCONFIG_CONFIG) and one for
direct use of the script without -m, which called make rules
that edit KCONFIG_CONFIG but verified a different file.

Signed-off-by: Gabriel de Perthuis <g2p.code@gmail.com>
Cc: Michal Marek <mmarek@suse.cz>
---
  scripts/kconfig/merge_config.sh | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

   # Check all specified config values took (might have 
missed-dependency issues)
  for CFG in $(sed -n "$SED_CONFIG_EXP" $TMP_FILE); do
   	REQUESTED_VAL=$(grep -w -e "$CFG" $TMP_FILE)
-	ACTUAL_VAL=$(grep -w -e "$CFG" $OUTPUT/.config)
+	ACTUAL_VAL=$(grep -w -e "$CFG" ${KCONFIG_CONFIG:=$OUTPUT/.config})
  	if [ "x$REQUESTED_VAL" != "x$ACTUAL_VAL" ] ; then
  		echo "Value requested for $CFG not in final .config"
  		echo "Requested value:  $REQUESTED_VAL"
  		echo "Actual value:     $ACTUAL_VAL"
  		echo ""

Comments

Michal Marek Oct. 14, 2015, 10:56 a.m. UTC | #1
On 2015-09-09 19:33, Gabriel de Perthuis wrote:
> All make targets support $KCONFIG_CONFIG because they
> run scripts/kconf.  Make sure merge_config.sh accesses the
> correct file in all cases.
> 
> Previously this script broke in two different code paths,
> one for targets like kvmconfig (which use merge_config.sh -m
> then call a target that respects KCONFIG_CONFIG) and one for
> direct use of the script without -m, which called make rules
> that edit KCONFIG_CONFIG but verified a different file.
> 
> Signed-off-by: Gabriel de Perthuis <g2p.code@gmail.com>
> Cc: Michal Marek <mmarek@suse.cz>
> ---
>   scripts/kconfig/merge_config.sh | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/scripts/kconfig/merge_config.sh 
> b/scripts/kconfig/merge_config.sh
> index 0d883b3..5f1e110 100755
> --- a/scripts/kconfig/merge_config.sh
> +++ b/scripts/kconfig/merge_config.sh
> @@ -122,13 +122,13 @@ for MERGE_FILE in $MERGE_LIST ; do
>   	done
>   	cat $MERGE_FILE >> $TMP_FILE
>   done
>    if [ "$RUNMAKE" = "false" ]; then
> -	cp $TMP_FILE $OUTPUT/.config
> +	cp $TMP_FILE ${KCONFIG_CONFIG:=$OUTPUT/.config}
>   	echo "#"
> -	echo "# merged configuration written to $OUTPUT/.config (needs make)"
> +	echo "# merged configuration written to $KCONFIG_CONFIG (needs make)"

The message will not contain the name of the output file when invoked
directly and without the variable set. Also, it will be more readable if
you set the default value once and then use simply $KCONFIG_CONFIG.

Michal
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Gabriel de Perthuis Oct. 14, 2015, 1:50 p.m. UTC | #2
Le 14/10/2015 à 12:56, Michal Marek a écrit :
> On 2015-09-09 19:33, Gabriel de Perthuis wrote:
>> All make targets support $KCONFIG_CONFIG because they
>> run scripts/kconf.  Make sure merge_config.sh accesses the
>> correct file in all cases.
>>
>> Previously this script broke in two different code paths,
>> one for targets like kvmconfig (which use merge_config.sh -m
>> then call a target that respects KCONFIG_CONFIG) and one for
>> direct use of the script without -m, which called make rules
>> that edit KCONFIG_CONFIG but verified a different file.
>>
>> Signed-off-by: Gabriel de Perthuis <g2p.code@gmail.com>
>> Cc: Michal Marek <mmarek@suse.cz>
>> ---
>>    scripts/kconfig/merge_config.sh | 6 +++---
>>    1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/scripts/kconfig/merge_config.sh
>> b/scripts/kconfig/merge_config.sh
>> index 0d883b3..5f1e110 100755
>> --- a/scripts/kconfig/merge_config.sh
>> +++ b/scripts/kconfig/merge_config.sh
>> @@ -122,13 +122,13 @@ for MERGE_FILE in $MERGE_LIST ; do
>>    	done
>>    	cat $MERGE_FILE >> $TMP_FILE
>>    done
>>     if [ "$RUNMAKE" = "false" ]; then
>> -	cp $TMP_FILE $OUTPUT/.config
>> +	cp $TMP_FILE ${KCONFIG_CONFIG:=$OUTPUT/.config}
>>    	echo "#"
>> -	echo "# merged configuration written to $OUTPUT/.config (needs make)"
>> +	echo "# merged configuration written to $KCONFIG_CONFIG (needs make)"
>
> The message will not contain the name of the output file when invoked
> directly and without the variable set.

Don't miss the ${:=} assignments.

 > Also, it will be more readable if you set the default value once and 
then use simply $KCONFIG_CONFIG.

I'll resubmit something more explicit, pick whichever you prefer.


--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Michal Marek Oct. 14, 2015, 2:11 p.m. UTC | #3
On 2015-10-14 15:50, Gabriel de Perthuis wrote:
> Le 14/10/2015 à 12:56, Michal Marek a écrit :
>> On 2015-09-09 19:33, Gabriel de Perthuis wrote:
>>> All make targets support $KCONFIG_CONFIG because they
>>> run scripts/kconf.  Make sure merge_config.sh accesses the
>>> correct file in all cases.
>>>
>>> Previously this script broke in two different code paths,
>>> one for targets like kvmconfig (which use merge_config.sh -m
>>> then call a target that respects KCONFIG_CONFIG) and one for
>>> direct use of the script without -m, which called make rules
>>> that edit KCONFIG_CONFIG but verified a different file.
>>>
>>> Signed-off-by: Gabriel de Perthuis <g2p.code@gmail.com>
>>> Cc: Michal Marek <mmarek@suse.cz>
>>> ---
>>>    scripts/kconfig/merge_config.sh | 6 +++---
>>>    1 file changed, 3 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/scripts/kconfig/merge_config.sh
>>> b/scripts/kconfig/merge_config.sh
>>> index 0d883b3..5f1e110 100755
>>> --- a/scripts/kconfig/merge_config.sh
>>> +++ b/scripts/kconfig/merge_config.sh
>>> @@ -122,13 +122,13 @@ for MERGE_FILE in $MERGE_LIST ; do
>>>    	done
>>>    	cat $MERGE_FILE >> $TMP_FILE
>>>    done
>>>     if [ "$RUNMAKE" = "false" ]; then
>>> -	cp $TMP_FILE $OUTPUT/.config
>>> +	cp $TMP_FILE ${KCONFIG_CONFIG:=$OUTPUT/.config}
>>>    	echo "#"
>>> -	echo "# merged configuration written to $OUTPUT/.config (needs make)"
>>> +	echo "# merged configuration written to $KCONFIG_CONFIG (needs make)"
>>
>> The message will not contain the name of the output file when invoked
>> directly and without the variable set.
> 
> Don't miss the ${:=} assignments.

Ah, you are right. I confused them with ":-".


>  > Also, it will be more readable if you set the default value once and 
> then use simply $KCONFIG_CONFIG.
> 
> I'll resubmit something more explicit, pick whichever you prefer.

Please do so. While the patch is correct, patching the first usage of
the variable in various code flows is not easy to follow.

Michal
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/scripts/kconfig/merge_config.sh 
b/scripts/kconfig/merge_config.sh
index 0d883b3..5f1e110 100755
--- a/scripts/kconfig/merge_config.sh
+++ b/scripts/kconfig/merge_config.sh
@@ -122,13 +122,13 @@  for MERGE_FILE in $MERGE_LIST ; do
  	done
  	cat $MERGE_FILE >> $TMP_FILE
  done
   if [ "$RUNMAKE" = "false" ]; then
-	cp $TMP_FILE $OUTPUT/.config
+	cp $TMP_FILE ${KCONFIG_CONFIG:=$OUTPUT/.config}
  	echo "#"
-	echo "# merged configuration written to $OUTPUT/.config (needs make)"
+	echo "# merged configuration written to $KCONFIG_CONFIG (needs make)"
  	echo "#"
  	clean_up
  	exit
  fi
  @@ -148,11 +148,11 @@ make KCONFIG_ALLCONFIG=$TMP_FILE $OUTPUT_ARG 
$ALLTARGET