From 6503e6e08d68da490fe1c7c582c5f90656033c3f Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Fri, 5 Mar 2021 16:21:30 +0100 Subject: [PATCH] machine list: save as JSON Signed-off-by: Thomas Lamprecht --- debian/parse-machines.pl | 16 +++++++++++----- debian/rules | 2 +- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/debian/parse-machines.pl b/debian/parse-machines.pl index 8ad335d..e61b649 100755 --- a/debian/parse-machines.pl +++ b/debian/parse-machines.pl @@ -3,7 +3,9 @@ use warnings; use strict; -my @machines = (); +use JSON; + +my $machines = []; while () { if (/^\s*Supported machines are:/) { @@ -12,10 +14,14 @@ while () { s/^\s+//; my @machine = split(/\s+/); - next if $machine[0] !~ m/^pc-(i440fx|q35)/; - push @machines, $machine[0]; + next if $machine[0] !~ m/^pc-(i440fx|q35)-(.+)$/; + push @$machines, { + 'id' => $machine[0], + 'type' => $1, + 'version' => $2, + }; } -die "no QEMU machine types detected from STDIN input" if scalar (@machines) <= 0; +die "no QEMU machine types detected from STDIN input" if scalar (@$machines) <= 0; -print join("\n", @machines) or die "$!\n"; +print to_json($machines, { utf8 => 1 }) or die "$!\n"; diff --git a/debian/rules b/debian/rules index 386ac4b..349c610 100755 --- a/debian/rules +++ b/debian/rules @@ -22,7 +22,7 @@ PACKAGE=pve-qemu-kvm destdir := $(CURDIR)/debian/$(PACKAGE) flagfile := $(destdir)/usr/share/kvm/recognized-CPUID-flags-x86_64 -machinefile := $(destdir)/usr/share/kvm/machine-versions-x86_64 +machinefile := $(destdir)/usr/share/kvm/machine-versions-x86_64.json # default QEMU out-of-tree build directory is ./build BUILDDIR=build