Skip to contentSkip to conversation

meson: Fix MESONINTROSPECT parsing

PATCH In review Akihiko Odaki 2 participants 4 messages Mar 27, 2024 – Oct 18, 2024 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

v3 cover meson: Fix MESONINTROSPECT parsing

The arguments in MESONINTROSPECT are quoted with shlex.quote() so it must be parsed with shlex.split().

To: Beraldo Leal <[email protected]>
To: Peter Maydell <[email protected]>
Cc: [email protected]
Cc: Philippe Mathieu-Daudé <[email protected]>
Cc: Thomas Huth <[email protected]>
Cc: Daniel P. Berrangé <[email protected]>
Cc: Marc-André Lureau <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: Cleber Rosa <[email protected]>
Cc: John Snow <[email protected]>
Cc: Michael Tokarev <[email protected]>

Changes in v3:
- Ensured meson>=1.4.0 on Windows.
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- Added patch "buildsys: Bump known good meson version to v1.4.0".
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Akihiko Odaki (2):
buildsys: Bump known good meson version to v1.4.0
meson: Fix MESONINTROSPECT parsing

 configure                                  |   5 +++++
 python/scripts/vendor.py                   |   4 ++--
 python/wheels/meson-1.2.3-py3-none-any.whl | Bin 964928 -> 0 bytes
 python/wheels/meson-1.4.0-py3-none-any.whl | Bin 0 -> 935471 bytes
 pythondeps.toml                            |   2 +-
 scripts/symlink-install-tree.py            |   3 ++-
 6 files changed, 10 insertions(+), 4 deletions(-)

---
base-commit: ba49d760eb04630e7b15f423ebecf6c871b8f77b
change-id: 20240326-meson-b5e2c7a2fb2f

Best regards,

Signature · 1 line
Akihiko Odaki <[email protected]>
#1 lore raw

PATCH v3 1/2 buildsys: Bump known good meson version to v1.4.0

We need meson v1.4.0 to fix MESONINTROSPECT quoting on Windows:
https://github.com/mesonbuild/meson/pull/12807

---
 python/scripts/vendor.py                   |   4 ++--
 python/wheels/meson-1.2.3-py3-none-any.whl | Bin 964928 -> 0 bytes
 python/wheels/meson-1.4.0-py3-none-any.whl | Bin 0 -> 935471 bytes
 pythondeps.toml                            |   2 +-
 4 files changed, 3 insertions(+), 3 deletions(-)
python/scripts/vendor.py +2 -2
index 1038b14ae0c8..da463fbde557 100755
@@ -41,8 +41,8 @@ def main() -> int:
     parser.parse_args()
 
     packages = {
-        "meson==1.2.3":
-        "4533a43c34548edd1f63a276a42690fce15bde9409bcf20c4b8fa3d7e4d7cac1",
+        "meson==1.4.0":
+        "476a458d51fcfa322a6bdc64da5138997c542d08e6b2e49b9fa68c46fd7c4475",
 
         "tomli==2.0.1":
         "939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc",
python/wheels/meson-1.2.3-py3-none-any.whl deleted binary +0 -0
deleted file mode 100644
index a8b84e5f114ad3fbec8ae56008426a90bccfc168..0000000000000000000000000000000000000000
GIT binary patch
python/wheels/meson-1.4.0-py3-none-any.whl new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..ca9adc3f024d75ae0c25d050070f1c42c5311156
GIT binary patch
pythondeps.toml +1 -1
index 0e8841599935..4269decf0e3e 100644
@@ -19,7 +19,7 @@
 
 [meson]
 # The install key should match the version in python/wheels/
-meson = { accepted = ">=0.63.0", installed = "1.2.3", canary = "meson" }
+meson = { accepted = ">=0.63.0", installed = "1.4.0", canary = "meson" }
 
 [docs]
 sphinx = { accepted = ">=1.6", installed = "5.3.0", canary = "sphinx-build" }
Signature · 1 line
2.44.0
#2 lore raw

PATCH v3 2/2 meson: Fix MESONINTROSPECT parsing

In reply to Akihiko Odaki

The arguments in MESONINTROSPECT are quoted with shlex.quote() so it must be parsed with shlex.split().

meson<1.4.0 quotes arguments in MESONINTROSPECT with the Windows-specific format on the platform, which is incompatible with shlex.split(). meson>=1.4.0 uses shlex.quote() also on the platform and fixes the incompatibility so make sure meson>=1.4.0 on Windows.

---
 configure                       | 5 +++++
 scripts/symlink-install-tree.py | 3 ++-
 2 files changed, 7 insertions(+), 1 deletion(-)
configure +5 -0
index 3cd736b139f3..57c2f1a2273d 100755
@@ -956,6 +956,11 @@ fi
 $mkvenv ensuregroup --dir "${source_path}/python/wheels" \
      ${source_path}/pythondeps.toml meson || exit 1
 
+# Windows needs: https://github.com/mesonbuild/meson/pull/12807
+if test "$host_os" = "windows"; then
+  $mkvenv ensure --dir "$source_path/python/wheels" 'meson>=1.4.0' || exit 1
+fi
+
 # At this point, we expect Meson to be installed and available.
 # We expect mkvenv or pip to have created pyvenv/bin/meson for us.
 # We ignore PATH completely here: we want to use the venv's Meson
scripts/symlink-install-tree.py +2 -1
index 8ed97e3c943d..b72563895c56 100644
@@ -4,6 +4,7 @@
 import errno
 import json
 import os
+import shlex
 import subprocess
 import sys
 
@@ -14,7 +15,7 @@ def destdir_join(d1: str, d2: str) -> str:
     return str(PurePath(d1, *PurePath(d2).parts[1:]))
 
 introspect = os.environ.get('MESONINTROSPECT')
-out = subprocess.run([*introspect.split(' '), '--installed'],
+out = subprocess.run([*shlex.split(introspect), '--installed'],
                      stdout=subprocess.PIPE, check=True).stdout
 for source, dest in json.loads(out).items():
     bundle_dest = destdir_join('qemu-bundle', dest)
Signature · 1 line
2.44.0
#3 lore raw
In reply to Akihiko Odaki
Quoted 31 lines · Akihiko Odaki

The arguments in MESONINTROSPECT are quoted with shlex.quote() so it must be parsed with shlex.split().

To: Beraldo Leal <[email protected]>
To: Peter Maydell <[email protected]>
Cc: [email protected]
Cc: Philippe Mathieu-Daudé <[email protected]>
Cc: Thomas Huth <[email protected]>
Cc: Daniel P. Berrangé <[email protected]>
Cc: Marc-André Lureau <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: Cleber Rosa <[email protected]>
Cc: John Snow <[email protected]>
Cc: Michael Tokarev <[email protected]>

Changes in v3:
- Ensured meson>=1.4.0 on Windows.
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- Added patch "buildsys: Bump known good meson version to v1.4.0".
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Akihiko Odaki (2):
buildsys: Bump known good meson version to v1.4.0
meson: Fix MESONINTROSPECT parsing

Quoted 7 lines
 configure                                  |   5 +++++
 python/scripts/vendor.py                   |   4 ++--
 python/wheels/meson-1.2.3-py3-none-any.whl | Bin 964928 -> 0 bytes
 python/wheels/meson-1.4.0-py3-none-any.whl | Bin 0 -> 935471 bytes
 pythondeps.toml                            |   2 +-
 scripts/symlink-install-tree.py            |   3 ++-
 6 files changed, 10 insertions(+), 4 deletions(-)

I've just had a report of somebody running into this "if you have a ~ in your build dir then symlink-install-tree breaks" bug, and realized we never applied this series.

We've just required rust 1.5.0 (commit 07f0d32641e0) because we need it for the Rust support, so we don't need patch 1 here any more or the windows-specific bits in patch 2. So I think we can just update the symlink-install-tree script now, which ironically is what v1 of this patchset did :-) (Though if we cared about fixing this in the stable branches that would be more awkward.)

-- PMM