qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Akihiko Odaki <akihiko.odaki@gmail.com>
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
	"Jason Wang" <jasowang@redhat.com>,
	qemu-devel@nongnu.org, Programmingkid <programmingkidx@gmail.com>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	"Gerd Hoffmann" <kraxel@redhat.com>,
	"Daniel P . Berrangé" <berrange@redhat.com>
Subject: Re: [PATCH v6 0/7] cutils: Introduce bundle mechanism
Date: Thu, 16 Jun 2022 11:18:57 +0200	[thread overview]
Message-ID: <00e86718-b1b9-1622-79aa-a6f44623df09@redhat.com> (raw)
In-Reply-To: <6edab96b-9585-5a37-d992-68d717be2c63@redhat.com>

On 6/15/22 21:27, Paolo Bonzini wrote:
> 
> Thanks for prototyping this, I think this is appealing.  I'll take a 
> look later at using meson introspection info to build the preinstall 
> layout.

Something like this:

diff --git a/meson.build b/meson.build
index 0458b69cdf..17023d511a 100644
--- a/meson.build
+++ b/meson.build
@@ -3612,6 +3612,21 @@ if host_machine.system() == 'windows'
    alias_target('installer', nsis)
  endif

+#####################
+# Preinstalled data #
+#####################
+
+qemu_bundle_sources_stamp = configure_file(
+  output: 'qemu-bundle-sources.stamp',
+  command: ['touch', '@OUTPUT'])
+custom_target('tree with preinstalled data files',
+              build_by_default: true,
+              output: 'qemu-bundle.stamp',
+              input: qemu_bundle_sources_stamp,
+              env: {'MESON': config_host['MESON']},
+              command: files('symlink-install-tree.py'),
+              capture: true)
+
  #########################
  # Configuration summary #
  #########################
diff --git a/scripts/symlink-install-tree.py 
b/scripts/symlink-install-tree.py
new file mode 100644
index 0000000000..cd66dc06cd
--- /dev/null
+++ b/scripts/symlink-install-tree.py
@@ -0,0 +1,34 @@
+#! /usr/bin/env python3
+
+import json
+import os
+import subprocess
+
+def destdir_join(d1: str, d2: str) -> str:
+    if not d1:
+        return d2
+    if not os.path.isabs(d2):
+        return os.path.join(d1, d2)
+
+    # c:\destdir + c:\prefix must produce c:\destdir\prefix
+    if len(d2) > 1 and d2[1] == ':':
+        return d1 + d2[2:]
+    return d1 + d2
+
+meson = os.environ.get("MESON")
+out = subprocess.run([meson, 'introspect', '--installed'],
+                     stdout=subprocess.PIPE, check=True).stdout
+for source, dest in json.loads(out).items():
+    assert os.path.isabs(source)
+    bundle_dest = destdir_join('qemu-bundle', dest)
+    path = os.path.dirname(bundle_dest)
+    try:
+        os.makedirs(path, exist_ok=True)
+    except e:
+        print('error making directory {path}', file=sys.stderr)
+        raise e
+    try:
+        os.symlink(source, bundle_dest)
+    except e:
+        print('error making symbolic link {dest}', file=sys.stderr)
+        raise e



  reply	other threads:[~2022-06-16  9:23 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-15 15:56 [PATCH v6 0/7] cutils: Introduce bundle mechanism Akihiko Odaki
2022-06-15 15:56 ` [PATCH v6 1/7] datadir: Simplify firmware directory search Akihiko Odaki
2022-06-15 16:52   ` Daniel P. Berrangé
2022-06-15 15:56 ` [PATCH v6 2/7] qga: Relocate a path emitted in the help text Akihiko Odaki
2022-06-15 15:56 ` [PATCH v6 3/7] Remove prefixes from path configuration macros Akihiko Odaki
2022-06-15 19:25   ` Paolo Bonzini
2022-06-15 15:56 ` [PATCH v6 4/7] cutils: Introduce bundle mechanism Akihiko Odaki
2022-06-15 19:26   ` Paolo Bonzini
2022-06-15 15:56 ` [PATCH v6 5/7] datadir: Use " Akihiko Odaki
2022-06-15 19:23   ` Paolo Bonzini
2022-06-15 15:56 ` [PATCH v6 6/7] ui/icons: " Akihiko Odaki
2022-06-15 15:56 ` [PATCH v6 7/7] net: " Akihiko Odaki
2022-06-15 19:27 ` [PATCH v6 0/7] cutils: Introduce " Paolo Bonzini
2022-06-16  9:18   ` Paolo Bonzini [this message]
2022-06-24 16:33     ` Akihiko Odaki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=00e86718-b1b9-1622-79aa-a6f44623df09@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=akihiko.odaki@gmail.com \
    --cc=berrange@redhat.com \
    --cc=f4bug@amsat.org \
    --cc=jasowang@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=programmingkidx@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).