]> git.proxmox.com Git - pve-qemu.git/commitdiff
machine list: save as JSON
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 5 Mar 2021 15:21:30 +0000 (16:21 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 5 Mar 2021 15:21:30 +0000 (16:21 +0100)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
debian/parse-machines.pl
debian/rules

index 8ad335dee6d7cce0529011b8c987727767816108..e61b649efe4feffde0cfdd940721e97fd9b1d352 100755 (executable)
@@ -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";
index 386ac4b9ec4edbd5572d0bfceef25aa600dd351e..349c610c0ba97db2437ae4f10f62ba7e17a1c5f6 100755 (executable)
@@ -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