mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
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:
parent
b67c1f3d02
commit
06334b97f1
@ -20,17 +20,10 @@
|
|||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
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 $config = shift @ARGV;
|
||||||
my $template = 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 CONFIG, "<", $config or die "cannot read $config: $!";
|
||||||
open TEMPLATE, "<", $template or die "cannot read $template: $!";
|
open TEMPLATE, "<", $template or die "cannot read $template: $!";
|
||||||
@ -39,12 +32,12 @@ my $group = 0;
|
|||||||
while (<TEMPLATE>) {
|
while (<TEMPLATE>) {
|
||||||
if (/::CONFIG::/) {
|
if (/::CONFIG::/) {
|
||||||
my $group = 0;
|
my $group = 0;
|
||||||
print AUGTEST " let conf = \"";
|
print " let conf = \"";
|
||||||
while (<CONFIG>) {
|
while (<CONFIG>) {
|
||||||
if (/^#\w/) {
|
if (/^#\w/) {
|
||||||
s/^#//;
|
s/^#//;
|
||||||
s/\"/\\\"/g;
|
s/\"/\\\"/g;
|
||||||
print AUGTEST $_;
|
print $_;
|
||||||
$group = /\[\s$/;
|
$group = /\[\s$/;
|
||||||
} elsif ($group) {
|
} elsif ($group) {
|
||||||
s/\"/\\\"/g;
|
s/\"/\\\"/g;
|
||||||
@ -53,16 +46,15 @@ while (<TEMPLATE>) {
|
|||||||
}
|
}
|
||||||
if (/^#/) {
|
if (/^#/) {
|
||||||
s/^#//;
|
s/^#//;
|
||||||
print AUGTEST $_;
|
print $_;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
print AUGTEST "\"\n";
|
print "\"\n";
|
||||||
} else {
|
} else {
|
||||||
print AUGTEST $_;
|
print $_;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
close TEMPLATE;
|
close TEMPLATE;
|
||||||
close CONFIG;
|
close CONFIG;
|
||||||
close AUGTEST or die "cannot save $augtest: $!";
|
|
||||||
|
@ -55,7 +55,7 @@ AUGEAS_DIRS += bhyve
|
|||||||
|
|
||||||
test_libvirtd_bhyve.aug: bhyve/test_libvirtd_bhyve.aug.in \
|
test_libvirtd_bhyve.aug: bhyve/test_libvirtd_bhyve.aug.in \
|
||||||
$(srcdir)/bhyve/bhyve.conf $(AUG_GENTEST)
|
$(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
|
check-augeas-bhyve: test_libvirtd_bhyve.aug
|
||||||
$(AM_V_GEN)if test -x '$(AUGPARSE)'; then \
|
$(AM_V_GEN)if test -x '$(AUGPARSE)'; then \
|
||||||
|
@ -74,7 +74,7 @@ AUGEAS_DIRS += libxl
|
|||||||
|
|
||||||
test_libvirtd_libxl.aug: libxl/test_libvirtd_libxl.aug.in \
|
test_libvirtd_libxl.aug: libxl/test_libvirtd_libxl.aug.in \
|
||||||
$(srcdir)/libxl/libxl.conf $(AUG_GENTEST)
|
$(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
|
check-augeas-libxl: test_libvirtd_libxl.aug
|
||||||
$(AM_V_GEN)if test -x '$(AUGPARSE)'; then \
|
$(AM_V_GEN)if test -x '$(AUGPARSE)'; then \
|
||||||
|
@ -228,7 +228,7 @@ if WITH_SANLOCK
|
|||||||
if WITH_QEMU
|
if WITH_QEMU
|
||||||
test_libvirt_sanlock.aug: locking/test_libvirt_sanlock.aug.in \
|
test_libvirt_sanlock.aug: locking/test_libvirt_sanlock.aug.in \
|
||||||
locking/qemu-sanlock.conf $(AUG_GENTEST)
|
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
|
check-augeas-sanlock: test_libvirt_sanlock.aug
|
||||||
$(AM_V_GEN)if test -x '$(AUGPARSE)'; then \
|
$(AM_V_GEN)if test -x '$(AUGPARSE)'; then \
|
||||||
@ -244,14 +244,14 @@ endif ! WITH_SANLOCK
|
|||||||
if WITH_QEMU
|
if WITH_QEMU
|
||||||
test_libvirt_lockd.aug: locking/test_libvirt_lockd.aug.in \
|
test_libvirt_lockd.aug: locking/test_libvirt_lockd.aug.in \
|
||||||
locking/qemu-lockd.conf $(AUG_GENTEST)
|
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
|
else ! WITH_QEMU
|
||||||
test_libvirt_lockd.aug:
|
test_libvirt_lockd.aug:
|
||||||
endif ! WITH_QEMU
|
endif ! WITH_QEMU
|
||||||
|
|
||||||
test_virtlockd.aug: locking/test_virtlockd.aug.in \
|
test_virtlockd.aug: locking/test_virtlockd.aug.in \
|
||||||
locking/virtlockd.conf $(AUG_GENTEST)
|
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
|
if WITH_QEMU
|
||||||
check-augeas-lockd: test_libvirt_lockd.aug
|
check-augeas-lockd: test_libvirt_lockd.aug
|
||||||
|
@ -101,7 +101,7 @@ augeastest_DATA += test_virtlogd.aug
|
|||||||
|
|
||||||
test_virtlogd.aug: logging/test_virtlogd.aug.in \
|
test_virtlogd.aug: logging/test_virtlogd.aug.in \
|
||||||
logging/virtlogd.conf $(AUG_GENTEST)
|
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
|
AUGEAS_DIRS += logging
|
||||||
|
|
||||||
|
@ -163,7 +163,7 @@ AUGEAS_DIRS += lxc
|
|||||||
|
|
||||||
test_libvirtd_lxc.aug: lxc/test_libvirtd_lxc.aug.in \
|
test_libvirtd_lxc.aug: lxc/test_libvirtd_lxc.aug.in \
|
||||||
$(srcdir)/lxc/lxc.conf $(AUG_GENTEST)
|
$(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
|
check-augeas-lxc: test_libvirtd_lxc.aug
|
||||||
$(AM_V_GEN)if test -x '$(AUGPARSE)'; then \
|
$(AM_V_GEN)if test -x '$(AUGPARSE)'; then \
|
||||||
|
@ -122,7 +122,7 @@ AUGEAS_DIRS += qemu
|
|||||||
|
|
||||||
test_libvirtd_qemu.aug: qemu/test_libvirtd_qemu.aug.in \
|
test_libvirtd_qemu.aug: qemu/test_libvirtd_qemu.aug.in \
|
||||||
$(srcdir)/qemu/qemu.conf $(AUG_GENTEST)
|
$(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
|
check-augeas-qemu: test_libvirtd_qemu.aug
|
||||||
$(AM_V_GEN)if test -x '$(AUGPARSE)'; then \
|
$(AM_V_GEN)if test -x '$(AUGPARSE)'; then \
|
||||||
|
@ -190,7 +190,7 @@ AUGEAS_DIRS += remote
|
|||||||
|
|
||||||
test_libvirtd.aug: remote/test_libvirtd.aug.in \
|
test_libvirtd.aug: remote/test_libvirtd.aug.in \
|
||||||
remote/libvirtd.conf $(AUG_GENTEST)
|
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
|
check-augeas-remote: test_libvirtd.aug
|
||||||
$(AM_V_GEN)if test -x '$(AUGPARSE)'; then \
|
$(AM_V_GEN)if test -x '$(AUGPARSE)'; then \
|
||||||
|
Loading…
Reference in New Issue
Block a user