Am Sa., 7. Juni 2025 um 21:12 Uhr schrieb Stefan Hajnoczi <stefa...@redhat.com>:
>
> On Sat, Jun 07, 2025 at 11:45:04AM +0200, oltolm wrote:
> > Sorry, I forgot to cc the maintainers.
> >
> > The build failed when run on Windows. I replaced calls to Unix programs
> > like ´cat´, ´sed´ and ´true´ with calls to ´python´. I wrapped calls to
> > ´os.path.relpath´ in try-except because it can fail when the two paths
> > are on different drives. I made sure to convert the Windows paths to
> > Unix paths to prevent warnings in generated files.
> >
> > Signed-off-by: oltolm <oleg.tolmat...@gmail.com>
> > ---
> >  contrib/plugins/meson.build         |  2 +-
> >  plugins/meson.build                 |  2 +-
> >  scripts/tracetool/__init__.py       | 15 ++++++++++++---
> >  scripts/tracetool/backend/ftrace.py |  4 +---
> >  scripts/tracetool/backend/log.py    |  4 +---
> >  scripts/tracetool/backend/syslog.py |  4 +---
> >  tests/functional/meson.build        |  4 +---
> >  tests/include/meson.build           |  2 +-
> >  tests/tcg/plugins/meson.build       |  2 +-
> >  trace/meson.build                   |  5 +++--
> >  10 files changed, 23 insertions(+), 21 deletions(-)
> >
> > diff --git a/contrib/plugins/meson.build b/contrib/plugins/meson.build
> > index fa8a426c8..1876bc784 100644
> > --- a/contrib/plugins/meson.build
> > +++ b/contrib/plugins/meson.build
> > @@ -24,7 +24,7 @@ endif
> >  if t.length() > 0
> >    alias_target('contrib-plugins', t)
> >  else
> > -  run_target('contrib-plugins', command: find_program('true'))
> > +  run_target('contrib-plugins', command: [python, '-c', ''])
> >  endif
> >
> >  plugin_modules += t
> > diff --git a/plugins/meson.build b/plugins/meson.build
> > index 5383c7b88..cb7472df8 100644
> > --- a/plugins/meson.build
> > +++ b/plugins/meson.build
> > @@ -33,7 +33,7 @@ if host_os == 'windows'
> >      input: qemu_plugin_symbols,
> >      output: 'qemu_plugin_api.def',
> >      capture: true,
> > -    command: ['sed', '-e', '0,/^/s//EXPORTS/; s/[{};]//g', '@INPUT@'])
> > +    command: [python, '-c', 'import fileinput, re; print("EXPORTS", 
> > end=""); [print(re.sub(r"[{};]", "", line), end="") for line in 
> > fileinput.input()]', '@INPUT@'])
>
> On second thought, is print("EXPORTS", end="") correct? Unlike the lines
> coming from fileinput, there is no line ending. I though that .def files
> look like this:
>
> EXPORTS
>   ...
>   ...
>
> So maybe end="" should be dropped for EXPORTS to correctly format the
> .def file?
>
> (I didn't have a Windows build environment to check myself, but it
> should be easy to diff the before/after files to verify whether there
> are any changes.)

I already did that. It produces the same output.
Oleg

Reply via email to