backup: Wire up qemu full pull backup commands over QMP
[libvirt/ericb.git] / build-aux / augeas-gentest.pl
blob65834b533b2ed9d03a2103c315718c254681a47a
1 #!/usr/bin/env perl
3 # augeas-gentest.pl: Generate an augeas test file, from an
4 # example config file + test file template
6 # This library is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU Lesser General Public
8 # License as published by the Free Software Foundation; either
9 # version 2.1 of the License, or (at your option) any later version.
11 # This library is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # Lesser General Public License for more details.
16 # You should have received a copy of the GNU Lesser General Public
17 # License along with this library. If not, see
18 # <http://www.gnu.org/licenses/>.
20 use strict;
21 use warnings;
23 die "syntax: $0 CONFIG TEMPLATE\n" unless @ARGV == 2;
25 my $config = shift @ARGV;
26 my $template = shift @ARGV;
28 open CONFIG, "<", $config or die "cannot read $config: $!";
29 open TEMPLATE, "<", $template or die "cannot read $template: $!";
31 my $group = 0;
32 while (<TEMPLATE>) {
33 if (/\@CONFIG\@/) {
34 my $group = 0;
35 print " let conf = \"";
36 while (<CONFIG>) {
37 if (/^#\w/) {
38 s/^#//;
39 s/\"/\\\"/g;
40 print $_;
41 $group = /\[\s$/;
42 } elsif ($group) {
43 s/\"/\\\"/g;
44 if (/#\s*\]/) {
45 $group = 0;
47 if (/^#/) {
48 s/^#//;
49 print $_;
53 print "\"\n";
54 } else {
55 print $_;
59 close TEMPLATE;
60 close CONFIG;