machine list: save as JSON

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2021-03-05 16:21:30 +01:00
parent 40e6b6e5a5
commit 6503e6e08d
2 changed files with 12 additions and 6 deletions

View File

@ -3,7 +3,9 @@
use warnings;
use strict;
my @machines = ();
use JSON;
my $machines = [];
while (<STDIN>) {
if (/^\s*Supported machines are:/) {
@ -12,10 +14,14 @@ while (<STDIN>) {
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";

2
debian/rules vendored
View File

@ -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