]> git.proxmox.com Git - pve-qemu.git/blame - debian/parse-machines.pl
fix #5054: backport fix for software reset with SATA
[pve-qemu.git] / debian / parse-machines.pl
CommitLineData
a6ede898
SR
1#!/usr/bin/perl
2
3use warnings;
4use strict;
5
6503e6e0
TL
6use JSON;
7
8my $machines = [];
a6ede898
SR
9
10while (<STDIN>) {
11 if (/^\s*Supported machines are:/) {
12 next;
13 }
14
15 s/^\s+//;
16 my @machine = split(/\s+/);
6503e6e0
TL
17 next if $machine[0] !~ m/^pc-(i440fx|q35)-(.+)$/;
18 push @$machines, {
19 'id' => $machine[0],
20 'type' => $1,
21 'version' => $2,
22 };
a6ede898
SR
23}
24
6503e6e0 25die "no QEMU machine types detected from STDIN input" if scalar (@$machines) <= 0;
a6ede898 26
590adba8
TL
27print to_json($machines, { utf8 => 1, canonical => 1 })
28 or die "failed to encode detected machines as JSON - $!\n";