mbox series

[v10,0/4] cutils: Introduce bundle mechanism

Message ID 20220627035744.23218-1-akihiko.odaki@gmail.com (mailing list archive)
Headers show
Series cutils: Introduce bundle mechanism | expand

Message

Akihiko Odaki June 27, 2022, 3:57 a.m. UTC
Developers often run QEMU without installing. The bundle mechanism
allows to look up files which should be present in installation even in
such a situation.

It is a general mechanism and can find any files located relative
to the installation tree. The build tree must have a new directory,
qemu-bundle, to represent what files the installation tree would
have for reference by the executables.

Note that this abandons compatibility with Windows older than 8 to use
PathCchSkipRoot(). The extended support for the prior version, 7 ended
more than 2 years ago, and it is unlikely that anyone would like to run
the latest QEMU on such an old system.

v10:
* Update destdir_join() in scripts/symlink-install-tree.py with the
  latest implementation from Meson:
  https://github.com/mesonbuild/meson/pull/10531

v9:
* Update _WIN32_WINNT in include/qemu/osdep.h (Thomas Huth)

v8:
* Pass absolute paths to get_relocated_path() (Paolo Bonzini)
* Use meson introspection (Paolo Bonzini)
* Drop "qga: Relocate a path emitted in the help text" as it is no longer
  relevant for the bundle mechanism.

v7: Properly fix --firmwarepath (Daniel P. Berrangé)

v6: Reuse get_relocated_path() in find_bundle() (Paolo Bonzini)

v5:
* Prefer qemu-bundle if it exists. (Daniel P. Berrangé)
* Check install_blobs option before installing BIOSes (Paolo Bonzini)
* Add common code to set up qemu-bundle to the top level meson.build
  (Paolo Bonzini)

v4:
* Add Daniel P. Berrangé to CC. Hopefully this helps merging his patch:
  https://mail.gnu.org/archive/html/qemu-devel/2022-06/msg02276.html
* Rebased to the latest QEMU.

v3:
* Note that the bundle mechanism is for any files located relative to the
  installation tree including but not limited to datadir. (Peter Maydell)
* Fix "bridge" typo (Philippe Mathieu-Daudé)

v2: Rebased to the latest QEMU.

Akihiko Odaki (3):
  cutils: Introduce bundle mechanism
  datadir: Use bundle mechanism
  module: Use bundle mechanism

Paolo Bonzini (1):
  tests/vm: do not specify -bios option

 .travis.yml                     |  2 +-
 docs/about/build-platforms.rst  |  2 +-
 include/qemu/cutils.h           | 18 +++++++--
 include/qemu/osdep.h            |  2 +-
 meson.build                     |  4 ++
 pc-bios/keymaps/meson.build     | 21 +++-------
 pc-bios/meson.build             | 13 ++-----
 scripts/oss-fuzz/build.sh       |  2 +-
 scripts/symlink-install-tree.py | 34 +++++++++++++++++
 softmmu/datadir.c               | 22 +----------
 tests/qtest/fuzz/fuzz.c         | 15 --------
 tests/vm/fedora                 |  1 -
 tests/vm/freebsd                |  1 -
 tests/vm/netbsd                 |  1 -
 tests/vm/openbsd                |  1 -
 util/cutils.c                   | 68 +++++++++++++++++++++++----------
 util/meson.build                |  1 +
 util/module.c                   |  1 -
 18 files changed, 115 insertions(+), 94 deletions(-)
 create mode 100755 scripts/symlink-install-tree.py

Comments

Paolo Bonzini July 11, 2022, 3:42 p.m. UTC | #1
On 6/27/22 05:57, Akihiko Odaki wrote:
> Developers often run QEMU without installing. The bundle mechanism
> allows to look up files which should be present in installation even in
> such a situation.
> 
> It is a general mechanism and can find any files located relative
> to the installation tree. The build tree must have a new directory,
> qemu-bundle, to represent what files the installation tree would
> have for reference by the executables.
> 
> Note that this abandons compatibility with Windows older than 8 to use
> PathCchSkipRoot(). The extended support for the prior version, 7 ended
> more than 2 years ago, and it is unlikely that anyone would like to run
> the latest QEMU on such an old system.

Thanks, merged.

However there were a couple issues:

- the bashism in patch 4, replaced by

+meson_option_build_array() {
+  printf '['
+  (if test "$targetos" == windows; then
+    IFS=\;
+  else
+    IFS=:
+  fi
+  for e in $1; do
+    e=${e/'\'/'\\'}
+    e=${e/\"/'\"'}
+    printf '"""%s""",' "$e"
+  done)
+  printf ']\n'
+}
+

- oss-fuzz didn't work, it has a syntax error and also can be simplified 
to use qemu-bundle as well, like

-# Copy over the datadir
-cp  -r ../pc-bios/ "$DEST_DIR/pc-bios"
+# Prepare a preinstalled tree
+make install DESTDIR=$DEST_DIR/qemu-bundle


Paolo
> v10:
> * Update destdir_join() in scripts/symlink-install-tree.py with the
>    latest implementation from Meson:
>    https://github.com/mesonbuild/meson/pull/10531
> 
> v9:
> * Update _WIN32_WINNT in include/qemu/osdep.h (Thomas Huth)
> 
> v8:
> * Pass absolute paths to get_relocated_path() (Paolo Bonzini)
> * Use meson introspection (Paolo Bonzini)
> * Drop "qga: Relocate a path emitted in the help text" as it is no longer
>    relevant for the bundle mechanism.
> 
> v7: Properly fix --firmwarepath (Daniel P. Berrangé)
> 
> v6: Reuse get_relocated_path() in find_bundle() (Paolo Bonzini)
> 
> v5:
> * Prefer qemu-bundle if it exists. (Daniel P. Berrangé)
> * Check install_blobs option before installing BIOSes (Paolo Bonzini)
> * Add common code to set up qemu-bundle to the top level meson.build
>    (Paolo Bonzini)
> 
> v4:
> * Add Daniel P. Berrangé to CC. Hopefully this helps merging his patch:
>    https://mail.gnu.org/archive/html/qemu-devel/2022-06/msg02276.html
> * Rebased to the latest QEMU.
> 
> v3:
> * Note that the bundle mechanism is for any files located relative to the
>    installation tree including but not limited to datadir. (Peter Maydell)
> * Fix "bridge" typo (Philippe Mathieu-Daudé)
> 
> v2: Rebased to the latest QEMU.
> 
> Akihiko Odaki (3):
>    cutils: Introduce bundle mechanism
>    datadir: Use bundle mechanism
>    module: Use bundle mechanism
> 
> Paolo Bonzini (1):
>    tests/vm: do not specify -bios option
> 
>   .travis.yml                     |  2 +-
>   docs/about/build-platforms.rst  |  2 +-
>   include/qemu/cutils.h           | 18 +++++++--
>   include/qemu/osdep.h            |  2 +-
>   meson.build                     |  4 ++
>   pc-bios/keymaps/meson.build     | 21 +++-------
>   pc-bios/meson.build             | 13 ++-----
>   scripts/oss-fuzz/build.sh       |  2 +-
>   scripts/symlink-install-tree.py | 34 +++++++++++++++++
>   softmmu/datadir.c               | 22 +----------
>   tests/qtest/fuzz/fuzz.c         | 15 --------
>   tests/vm/fedora                 |  1 -
>   tests/vm/freebsd                |  1 -
>   tests/vm/netbsd                 |  1 -
>   tests/vm/openbsd                |  1 -
>   util/cutils.c                   | 68 +++++++++++++++++++++++----------
>   util/meson.build                |  1 +
>   util/module.c                   |  1 -
>   18 files changed, 115 insertions(+), 94 deletions(-)
>   create mode 100755 scripts/symlink-install-tree.py
>
Stefan Weil Oct. 29, 2022, 8:51 a.m. UTC | #2
Am 27.06.22 um 05:57 schrieb Akihiko Odaki:

> Developers often run QEMU without installing. The bundle mechanism
> allows to look up files which should be present in installation even in
> such a situation.
>
> It is a general mechanism and can find any files located relative
> to the installation tree. The build tree must have a new directory,
> qemu-bundle, to represent what files the installation tree would
> have for reference by the executables.
>
> Note that this abandons compatibility with Windows older than 8 to use
> PathCchSkipRoot(). The extended support for the prior version, 7 ended
> more than 2 years ago, and it is unlikely that anyone would like to run
> the latest QEMU on such an old system.
>
> v10:
> * Update destdir_join() in scripts/symlink-install-tree.py with the
>    latest implementation from Meson:
>    https://github.com/mesonbuild/meson/pull/10531
>
> v9:
> * Update _WIN32_WINNT in include/qemu/osdep.h (Thomas Huth)
>
> v8:
> * Pass absolute paths to get_relocated_path() (Paolo Bonzini)
> * Use meson introspection (Paolo Bonzini)
> * Drop "qga: Relocate a path emitted in the help text" as it is no longer
>    relevant for the bundle mechanism.
>
> v7: Properly fix --firmwarepath (Daniel P. Berrangé)
>
> v6: Reuse get_relocated_path() in find_bundle() (Paolo Bonzini)
>
> v5:
> * Prefer qemu-bundle if it exists. (Daniel P. Berrangé)
> * Check install_blobs option before installing BIOSes (Paolo Bonzini)
> * Add common code to set up qemu-bundle to the top level meson.build
>    (Paolo Bonzini)
>
> v4:
> * Add Daniel P. Berrangé to CC. Hopefully this helps merging his patch:
>    https://mail.gnu.org/archive/html/qemu-devel/2022-06/msg02276.html
> * Rebased to the latest QEMU.
>
> v3:
> * Note that the bundle mechanism is for any files located relative to the
>    installation tree including but not limited to datadir. (Peter Maydell)
> * Fix "bridge" typo (Philippe Mathieu-Daudé)
>
> v2: Rebased to the latest QEMU.
>
> Akihiko Odaki (3):
>    cutils: Introduce bundle mechanism
>    datadir: Use bundle mechanism
>    module: Use bundle mechanism
>
> Paolo Bonzini (1):
>    tests/vm: do not specify -bios option
>
>   .travis.yml                     |  2 +-
>   docs/about/build-platforms.rst  |  2 +-
>   include/qemu/cutils.h           | 18 +++++++--
>   include/qemu/osdep.h            |  2 +-
>   meson.build                     |  4 ++
>   pc-bios/keymaps/meson.build     | 21 +++-------
>   pc-bios/meson.build             | 13 ++-----
>   scripts/oss-fuzz/build.sh       |  2 +-
>   scripts/symlink-install-tree.py | 34 +++++++++++++++++
>   softmmu/datadir.c               | 22 +----------
>   tests/qtest/fuzz/fuzz.c         | 15 --------
>   tests/vm/fedora                 |  1 -
>   tests/vm/freebsd                |  1 -
>   tests/vm/netbsd                 |  1 -
>   tests/vm/openbsd                |  1 -
>   util/cutils.c                   | 68 +++++++++++++++++++++++----------
>   util/meson.build                |  1 +
>   util/module.c                   |  1 -
>   18 files changed, 115 insertions(+), 94 deletions(-)
>   create mode 100755 scripts/symlink-install-tree.py


Hi,

when I run `wine qemu-system-i386 --version` on Debian GNU Linux stable 
in the build directory of a cross build which targets Windows, I now get 
an error:

Z:\home\stefan\qemu\bin\ndebug\x86_64-w64-mingw32\qemu-system-i386.exe: 
--version: Could not open 
'Z:\home\stefan\qemu\bin\ndebug\x86_64-w64-mingw32/qemu-bundle': 
Permission denied

Regards

Stefan Weil
Paolo Bonzini Oct. 29, 2022, 7:45 p.m. UTC | #3
Il sab 29 ott 2022, 10:52 Stefan Weil <sw@weilnetz.de> ha scritto:

when I run `wine qemu-system-i386 --version` on Debian GNU Linux stable
in the build directory of a cross build which targets Windows, I now get
an error:

Z:\home\stefan\qemu\bin\ndebug\x86_64-w64-mingw32\qemu-system-i386.exe:
--version: Could not open
'Z:\home\stefan\qemu\bin\ndebug\x86_64-w64-mingw32/qemu-bundle':
Permission denied



Where in the code does it triggers the error?

You could perhaps also try WINEDEBUG=+relay to see what Windows API calls
fail.

Paolo