qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org, Thomas Huth <thuth@redhat.com>
Cc: "Warner Losh" <imp@bsdimp.com>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Ed Maste" <emaste@freebsd.org>,
	"Daniel P . Berrangé" <berrange@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Erik Skultety" <eskultet@redhat.com>,
	"Wainer dos Santos Moschetta" <wainersm@redhat.com>,
	"Kyle Evans" <kevans@freebsd.org>,
	"Li-Wen Hsu" <lwhsu@freebsd.org>,
	"Beraldo Leal" <bleal@redhat.com>
Subject: [PATCH v3 3/4] tests/vm: Introduce get_qemu_packages_from_lcitool_json() helper
Date: Tue, 11 Jul 2023 16:49:21 +0200	[thread overview]
Message-ID: <20230711144922.67491-4-philmd@linaro.org> (raw)
In-Reply-To: <20230711144922.67491-1-philmd@linaro.org>

Add the get_qemu_packages_from_lcitool_json() helper which return
such package list from a lcitool env var file in JSON format.

Suggested-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 tests/vm/basevm.py | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py
index 23229e23d1..a97e23b0ce 100644
--- a/tests/vm/basevm.py
+++ b/tests/vm/basevm.py
@@ -27,6 +27,7 @@
 import multiprocessing
 import traceback
 import shlex
+import json
 
 from qemu.machine import QEMUMachine
 from qemu.utils import get_info_usernet_hostfwd_port, kvm_available
@@ -501,6 +502,16 @@ def gen_cloud_init_iso(self):
                               stderr=self._stdout)
         return os.path.join(cidir, "cloud-init.iso")
 
+    def get_qemu_packages_from_lcitool_json(self, json_path=None):
+        """Parse a lcitool variables json file and return the PKGS list."""
+        if json_path is None:
+            json_path = os.path.join(
+                os.path.dirname(__file__), "generated", self.name + ".json"
+            )
+        with open(json_path, "r") as fh:
+            return json.load(fh)["pkgs"]
+
+
 def get_qemu_path(arch, build_path=None):
     """Fetch the path to the qemu binary."""
     # If QEMU environment variable set, it takes precedence
-- 
2.38.1



  parent reply	other threads:[~2023-07-11 14:50 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-11 14:49 [PATCH v3 0/4] tests/vm/freebsd: Get up-to-date package list from lcitool Philippe Mathieu-Daudé
2023-07-11 14:49 ` [PATCH v3 1/4] tests/lcitool: Generate distribution packages list in JSON format Philippe Mathieu-Daudé
2023-07-11 15:31   ` Daniel P. Berrangé
2023-07-11 19:39   ` Warner Losh
2023-07-12 11:07     ` Philippe Mathieu-Daudé
2023-07-12 17:57       ` Warner Losh
2023-07-11 14:49 ` [PATCH v3 2/4] tests/lcitool: Refresh generated files Philippe Mathieu-Daudé
2023-07-11 17:58   ` Daniel P. Berrangé
2023-07-12 11:00     ` Philippe Mathieu-Daudé
2023-07-12 11:12       ` Daniel P. Berrangé
2023-07-12 12:55         ` Philippe Mathieu-Daudé
2023-07-12 13:07           ` Daniel P. Berrangé
2024-01-02 18:19             ` Philippe Mathieu-Daudé
2024-01-02 18:36               ` Ilya Maximets
2024-01-03  9:07                 ` Philippe Mathieu-Daudé
2023-07-11 14:49 ` Philippe Mathieu-Daudé [this message]
2023-07-11 17:59   ` [PATCH v3 3/4] tests/vm: Introduce get_qemu_packages_from_lcitool_json() helper Daniel P. Berrangé
2023-07-11 14:49 ` [PATCH v3 4/4] tests/vm/freebsd: Get up-to-date package list from lcitool vars file Philippe Mathieu-Daudé
2023-07-11 17:59   ` Daniel P. Berrangé
2023-07-17 12:18 ` [PATCH v3 0/4] tests/vm/freebsd: Get up-to-date package list from lcitool Thomas Huth
2023-07-17 12:30   ` Erik Skultety
2023-07-17 13:17     ` Daniel P. Berrangé

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=20230711144922.67491-4-philmd@linaro.org \
    --to=philmd@linaro.org \
    --cc=alex.bennee@linaro.org \
    --cc=berrange@redhat.com \
    --cc=bleal@redhat.com \
    --cc=emaste@freebsd.org \
    --cc=eskultet@redhat.com \
    --cc=imp@bsdimp.com \
    --cc=kevans@freebsd.org \
    --cc=lwhsu@freebsd.org \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.com \
    --cc=wainersm@redhat.com \
    /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).