build: make augeas-gentest.pl write to stdout

The augeas-gentest.pl program merges a config file into a augeas
file, saving the output to a new file. It is going to be useful
to further process the output file, and it would be easier if this can
be done with a pipeline, so change augeas-gentest.pl to write to stdout
instead of a file.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrangé 2019-07-17 11:39:32 +01:00
parent b67c1f3d02
commit 06334b97f1
8 changed files with 15 additions and 23 deletions

View File

@ -20,17 +20,10 @@
use strict;
use warnings;
die "syntax: $0 CONFIG TEMPLATE AUGTEST\n" unless @ARGV == 3;
die "syntax: $0 CONFIG TEMPLATE\n" unless @ARGV == 2;
my $config = shift @ARGV;
my $template = shift @ARGV;
my $augtest = shift @ARGV;
open AUGTEST, ">", $augtest or die "cannot create $augtest: $!";
$SIG{__DIE__} = sub {
unlink $augtest;
};
open CONFIG, "<", $config or die "cannot read $config: $!";
open TEMPLATE, "<", $template or die "cannot read $template: $!";
@ -39,12 +32,12 @@ my $group = 0;
while (<TEMPLATE>) {
if (/::CONFIG::/) {
my $group = 0;
print AUGTEST " let conf = \"";
print " let conf = \"";
while (<CONFIG>) {
if (/^#\w/) {
s/^#//;
s/\"/\\\"/g;
print AUGTEST $_;
print $_;
$group = /\[\s$/;
} elsif ($group) {
s/\"/\\\"/g;
@ -53,16 +46,15 @@ while (<TEMPLATE>) {
}
if (/^#/) {
s/^#//;
print AUGTEST $_;
print $_;
}
}
}
print AUGTEST "\"\n";
print "\"\n";
} else {
print AUGTEST $_;
print $_;
}
}
close TEMPLATE;
close CONFIG;
close AUGTEST or die "cannot save $augtest: $!";

View File

@ -55,7 +55,7 @@ AUGEAS_DIRS += bhyve
test_libvirtd_bhyve.aug: bhyve/test_libvirtd_bhyve.aug.in \
$(srcdir)/bhyve/bhyve.conf $(AUG_GENTEST)
$(AM_V_GEN)$(AUG_GENTEST) $(srcdir)/bhyve/bhyve.conf $< $@
$(AM_V_GEN)$(AUG_GENTEST) $(srcdir)/bhyve/bhyve.conf $< > $@
check-augeas-bhyve: test_libvirtd_bhyve.aug
$(AM_V_GEN)if test -x '$(AUGPARSE)'; then \

View File

@ -74,7 +74,7 @@ AUGEAS_DIRS += libxl
test_libvirtd_libxl.aug: libxl/test_libvirtd_libxl.aug.in \
$(srcdir)/libxl/libxl.conf $(AUG_GENTEST)
$(AM_V_GEN)$(AUG_GENTEST) $(srcdir)/libxl/libxl.conf $< $@
$(AM_V_GEN)$(AUG_GENTEST) $(srcdir)/libxl/libxl.conf $< > $@
check-augeas-libxl: test_libvirtd_libxl.aug
$(AM_V_GEN)if test -x '$(AUGPARSE)'; then \

View File

@ -228,7 +228,7 @@ if WITH_SANLOCK
if WITH_QEMU
test_libvirt_sanlock.aug: locking/test_libvirt_sanlock.aug.in \
locking/qemu-sanlock.conf $(AUG_GENTEST)
$(AM_V_GEN)$(AUG_GENTEST) locking/qemu-sanlock.conf $< $@
$(AM_V_GEN)$(AUG_GENTEST) locking/qemu-sanlock.conf $< > $@
check-augeas-sanlock: test_libvirt_sanlock.aug
$(AM_V_GEN)if test -x '$(AUGPARSE)'; then \
@ -244,14 +244,14 @@ endif ! WITH_SANLOCK
if WITH_QEMU
test_libvirt_lockd.aug: locking/test_libvirt_lockd.aug.in \
locking/qemu-lockd.conf $(AUG_GENTEST)
$(AM_V_GEN)$(AUG_GENTEST) locking/qemu-lockd.conf $< $@
$(AM_V_GEN)$(AUG_GENTEST) locking/qemu-lockd.conf $< > $@
else ! WITH_QEMU
test_libvirt_lockd.aug:
endif ! WITH_QEMU
test_virtlockd.aug: locking/test_virtlockd.aug.in \
locking/virtlockd.conf $(AUG_GENTEST)
$(AM_V_GEN)$(AUG_GENTEST) $(srcdir)/locking/virtlockd.conf $< $@
$(AM_V_GEN)$(AUG_GENTEST) $(srcdir)/locking/virtlockd.conf $< > $@
if WITH_QEMU
check-augeas-lockd: test_libvirt_lockd.aug

View File

@ -101,7 +101,7 @@ augeastest_DATA += test_virtlogd.aug
test_virtlogd.aug: logging/test_virtlogd.aug.in \
logging/virtlogd.conf $(AUG_GENTEST)
$(AM_V_GEN)$(AUG_GENTEST) $(srcdir)/logging/virtlogd.conf $< $@
$(AM_V_GEN)$(AUG_GENTEST) $(srcdir)/logging/virtlogd.conf $< > $@
AUGEAS_DIRS += logging

View File

@ -163,7 +163,7 @@ AUGEAS_DIRS += lxc
test_libvirtd_lxc.aug: lxc/test_libvirtd_lxc.aug.in \
$(srcdir)/lxc/lxc.conf $(AUG_GENTEST)
$(AM_V_GEN)$(AUG_GENTEST) $(srcdir)/lxc/lxc.conf $< $@
$(AM_V_GEN)$(AUG_GENTEST) $(srcdir)/lxc/lxc.conf $< > $@
check-augeas-lxc: test_libvirtd_lxc.aug
$(AM_V_GEN)if test -x '$(AUGPARSE)'; then \

View File

@ -122,7 +122,7 @@ AUGEAS_DIRS += qemu
test_libvirtd_qemu.aug: qemu/test_libvirtd_qemu.aug.in \
$(srcdir)/qemu/qemu.conf $(AUG_GENTEST)
$(AM_V_GEN)$(AUG_GENTEST) $(srcdir)/qemu/qemu.conf $< $@
$(AM_V_GEN)$(AUG_GENTEST) $(srcdir)/qemu/qemu.conf $< > $@
check-augeas-qemu: test_libvirtd_qemu.aug
$(AM_V_GEN)if test -x '$(AUGPARSE)'; then \

View File

@ -190,7 +190,7 @@ AUGEAS_DIRS += remote
test_libvirtd.aug: remote/test_libvirtd.aug.in \
remote/libvirtd.conf $(AUG_GENTEST)
$(AM_V_GEN)$(AUG_GENTEST) $(srcdir)/remote/libvirtd.conf $< $@
$(AM_V_GEN)$(AUG_GENTEST) $(srcdir)/remote/libvirtd.conf $< > $@
check-augeas-remote: test_libvirtd.aug
$(AM_V_GEN)if test -x '$(AUGPARSE)'; then \