From 17bbdef5cb8aaa9dd8b6231824412fbd3c3ee74e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Fri, 30 Aug 2019 13:22:54 +0100 Subject: [PATCH] build-aux: rewrite augeas test generator in Python MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As part of an goal to eliminate Perl from libvirt build tools, rewrite the augeas-gentest.pl tool in Python. This was a straight conversion, manually going line-by-line to change the syntax from Perl to Python. Thus the overall structure of the file and approach is the same. The use of $(AUG_GENTEST) as a dependancy in the makefiles needed to be fixed, because this was assumed to be the filename of the script, but is in fact a full shell command line. Reviewed-by: Ján Tomko Signed-off-by: Daniel P. Berrangé --- Makefile.am | 2 +- build-aux/augeas-gentest.pl | 60 --------------------------------- scripts/augeas-gentest.py | 67 +++++++++++++++++++++++++++++++++++++ src/Makefile.am | 4 +-- 4 files changed, 70 insertions(+), 63 deletions(-) delete mode 100755 build-aux/augeas-gentest.pl create mode 100755 scripts/augeas-gentest.py diff --git a/Makefile.am b/Makefile.am index 53f694840b..9ec010226c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -45,7 +45,7 @@ EXTRA_DIST = \ run.in \ README.md \ AUTHORS.in \ - build-aux/augeas-gentest.pl \ + scripts/augeas-gentest.py \ build-aux/check-spacing.pl \ build-aux/header-ifdef.pl \ build-aux/minimize-po.pl \ diff --git a/build-aux/augeas-gentest.pl b/build-aux/augeas-gentest.pl deleted file mode 100755 index 65834b533b..0000000000 --- a/build-aux/augeas-gentest.pl +++ /dev/null @@ -1,60 +0,0 @@ -#!/usr/bin/env perl -# -# augeas-gentest.pl: Generate an augeas test file, from an -# example config file + test file template -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library. If not, see -# . - -use strict; -use warnings; - -die "syntax: $0 CONFIG TEMPLATE\n" unless @ARGV == 2; - -my $config = shift @ARGV; -my $template = shift @ARGV; - -open CONFIG, "<", $config or die "cannot read $config: $!"; -open TEMPLATE, "<", $template or die "cannot read $template: $!"; - -my $group = 0; -while (