qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] minikconf: do not include variables from MINIKCONF_ARGS in config-all-devices.mak
@ 2019-06-25  8:13 Paolo Bonzini
  2019-06-25  9:00 ` Christophe de Dinechin
  2019-06-25 10:52 ` Philippe Mathieu-Daudé
  0 siblings, 2 replies; 4+ messages in thread
From: Paolo Bonzini @ 2019-06-25  8:13 UTC (permalink / raw)
  To: qemu-devel; +Cc: Christophe de Dinechin

When minikconf writes config-devices.mak, it includes all variables including
those from MINIKCONF_ARGS.  This causes values from config-host.mak to "stick" to
the ones used in generating config-devices.mak, because config-devices.mak is
included after config-host.mak.  Avoid this by omitting assignments coming
from the command line in the output of minikconf.

Reported-by: Christophe de Dinechin <cdupontd@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 scripts/minikconf.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/scripts/minikconf.py b/scripts/minikconf.py
index 0ffc6c38da..3109a81db7 100644
--- a/scripts/minikconf.py
+++ b/scripts/minikconf.py
@@ -688,11 +688,13 @@ if __name__ == '__main__':
 
     data = KconfigData(mode)
     parser = KconfigParser(data)
+    external_vars = set()
     for arg in argv[3:]:
         m = re.match(r'^(CONFIG_[A-Z0-9_]+)=([yn]?)$', arg)
         if m is not None:
             name, value = m.groups()
             parser.do_assignment(name, value == 'y')
+            external_vars.add(name[7:])
         else:
             fp = open(arg, 'r')
             parser.parse_file(fp)
@@ -700,7 +702,8 @@ if __name__ == '__main__':
 
     config = data.compute_config()
     for key in sorted(config.keys()):
-        print ('CONFIG_%s=%s' % (key, ('y' if config[key] else 'n')))
+        if key not in external_vars:
+            print ('CONFIG_%s=%s' % (key, ('y' if config[key] else 'n')))
 
     deps = open(argv[2], 'w')
     for fname in data.previously_included:
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] minikconf: do not include variables from MINIKCONF_ARGS in config-all-devices.mak
  2019-06-25  8:13 [Qemu-devel] [PATCH] minikconf: do not include variables from MINIKCONF_ARGS in config-all-devices.mak Paolo Bonzini
@ 2019-06-25  9:00 ` Christophe de Dinechin
  2019-06-25 10:52 ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 4+ messages in thread
From: Christophe de Dinechin @ 2019-06-25  9:00 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: qemu-devel



> On 25 Jun 2019, at 10:13, Paolo Bonzini <pbonzini@redhat.com> wrote:
> 
> When minikconf writes config-devices.mak, it includes all variables including
> those from MINIKCONF_ARGS.  This causes values from config-host.mak to "stick" to
> the ones used in generating config-devices.mak, because config-devices.mak is
> included after config-host.mak.  Avoid this by omitting assignments coming
> from the command line in the output of minikconf.
> 
> Reported-by: Christophe de Dinechin <cdupontd@redhat.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> scripts/minikconf.py | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/scripts/minikconf.py b/scripts/minikconf.py
> index 0ffc6c38da..3109a81db7 100644
> --- a/scripts/minikconf.py
> +++ b/scripts/minikconf.py
> @@ -688,11 +688,13 @@ if __name__ == '__main__':
> 
>     data = KconfigData(mode)
>     parser = KconfigParser(data)
> +    external_vars = set()
>     for arg in argv[3:]:
>         m = re.match(r'^(CONFIG_[A-Z0-9_]+)=([yn]?)$', arg)
>         if m is not None:
>             name, value = m.groups()
>             parser.do_assignment(name, value == 'y')
> +            external_vars.add(name[7:])
>         else:
>             fp = open(arg, 'r')
>             parser.parse_file(fp)
> @@ -700,7 +702,8 @@ if __name__ == '__main__':
> 
>     config = data.compute_config()
>     for key in sorted(config.keys()):
> -        print ('CONFIG_%s=%s' % (key, ('y' if config[key] else 'n')))
> +        if key not in external_vars:
> +            print ('CONFIG_%s=%s' % (key, ('y' if config[key] else 'n')))

The approach is interesting, and shorter than the fix
I had in mind, which was to add a target to generate
all the config*.mak, then call that from the configure script,
forcing external variables on the command-line to
override config*.mak values

> 
>     deps = open(argv[2], 'w')
>     for fname in data.previously_included:
> -- 
> 2.21.0

This seems to address the leftover CONFIG_SPICE=y, but
I ran into what looks like new compilation errors with this.
For example, with a configure that strips quite a lot away:

monitor/hmp-cmds.c: In function ‘hmp_change’:
monitor/hmp-cmds.c:1946:17: error: unused variable ‘hmp_mon’ [-Werror=unused-variable]
 1946 |     MonitorHMP *hmp_mon = container_of(mon, MonitorHMP, common);
      |                 ^~~~~~~

This is apparently a side effect of that variable being used
only under CONFIG_VNC. Patch upcoming. There may be
other similar side effects.


Tested-by: Christophe de Dinechin <dinechin@redhat.com>
Reviewed-by: Christophe de DInechin <dinechin@redhat.com>



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] minikconf: do not include variables from MINIKCONF_ARGS in config-all-devices.mak
  2019-06-25  8:13 [Qemu-devel] [PATCH] minikconf: do not include variables from MINIKCONF_ARGS in config-all-devices.mak Paolo Bonzini
  2019-06-25  9:00 ` Christophe de Dinechin
@ 2019-06-25 10:52 ` Philippe Mathieu-Daudé
  2019-06-25 11:08   ` Philippe Mathieu-Daudé
  1 sibling, 1 reply; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-06-25 10:52 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel; +Cc: Christophe de Dinechin

On 6/25/19 10:13 AM, Paolo Bonzini wrote:
> When minikconf writes config-devices.mak, it includes all variables including
> those from MINIKCONF_ARGS.  This causes values from config-host.mak to "stick" to
> the ones used in generating config-devices.mak, because config-devices.mak is
> included after config-host.mak.  Avoid this by omitting assignments coming
> from the command line in the output of minikconf.
> 
> Reported-by: Christophe de Dinechin <cdupontd@redhat.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

> ---
>  scripts/minikconf.py | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/scripts/minikconf.py b/scripts/minikconf.py
> index 0ffc6c38da..3109a81db7 100644
> --- a/scripts/minikconf.py
> +++ b/scripts/minikconf.py
> @@ -688,11 +688,13 @@ if __name__ == '__main__':
>  
>      data = KconfigData(mode)
>      parser = KconfigParser(data)
> +    external_vars = set()
>      for arg in argv[3:]:
>          m = re.match(r'^(CONFIG_[A-Z0-9_]+)=([yn]?)$', arg)
>          if m is not None:
>              name, value = m.groups()
>              parser.do_assignment(name, value == 'y')
> +            external_vars.add(name[7:])
>          else:
>              fp = open(arg, 'r')
>              parser.parse_file(fp)
> @@ -700,7 +702,8 @@ if __name__ == '__main__':
>  
>      config = data.compute_config()
>      for key in sorted(config.keys()):
> -        print ('CONFIG_%s=%s' % (key, ('y' if config[key] else 'n')))
> +        if key not in external_vars:
> +            print ('CONFIG_%s=%s' % (key, ('y' if config[key] else 'n')))
>  
>      deps = open(argv[2], 'w')
>      for fname in data.previously_included:
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] minikconf: do not include variables from MINIKCONF_ARGS in config-all-devices.mak
  2019-06-25 10:52 ` Philippe Mathieu-Daudé
@ 2019-06-25 11:08   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-06-25 11:08 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel; +Cc: Christophe de Dinechin

On 6/25/19 12:52 PM, Philippe Mathieu-Daudé wrote:
> On 6/25/19 10:13 AM, Paolo Bonzini wrote:
>> When minikconf writes config-devices.mak, it includes all variables including
>> those from MINIKCONF_ARGS.  This causes values from config-host.mak to "stick" to
>> the ones used in generating config-devices.mak, because config-devices.mak is
>> included after config-host.mak.  Avoid this by omitting assignments coming
>> from the command line in the output of minikconf.
>>
>> Reported-by: Christophe de Dinechin <cdupontd@redhat.com>
>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> 
> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-06-25 11:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-25  8:13 [Qemu-devel] [PATCH] minikconf: do not include variables from MINIKCONF_ARGS in config-all-devices.mak Paolo Bonzini
2019-06-25  9:00 ` Christophe de Dinechin
2019-06-25 10:52 ` Philippe Mathieu-Daudé
2019-06-25 11:08   ` Philippe Mathieu-Daudé

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).