[libvirt] [PATCH] Replace @SYSCONFDIR@ with ::SYSCONFDIR:: to avoid syntax-check warning

make syntax-check complains if any Makefile.am uses the old style @FOO@ for replacement, rather than $(FOO). Unfortunately the tools/Makefile.am intentionally uses the @FOO@ syntax for generating some scripts. Currently these are whitelisted in cfg.mk, but adding more to this whitelist makes the entire check rather worthless. This changes the tools/ directory to use ::FOO:: as the replacement syntax for virt-pki-validate.in and virt-xml-validate.in * tools/Makefile.am, tools/virt-pki-validate.in tools/virt-xml-validate.in: Change @FOO@ to ::FOO:: * cfg.mk: Remove _makefile_at_at_check_exceptions --- cfg.mk | 3 --- tools/Makefile.am | 4 ++-- tools/virt-pki-validate.in | 2 +- tools/virt-xml-validate.in | 2 +- 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/cfg.mk b/cfg.mk index 5d3ef26..c2230b8 100644 --- a/cfg.mk +++ b/cfg.mk @@ -581,9 +581,6 @@ _autogen: $(srcdir)/autogen.sh ./config.status -# Exempt @...@ uses of these symbols. -_makefile_at_at_check_exceptions = ' && !/(SCHEMA|SYSCONF)DIR/' - # regenerate HACKING as part of the syntax-check syntax-check: $(top_srcdir)/HACKING diff --git a/tools/Makefile.am b/tools/Makefile.am index 826674a..7a1a5c6 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -23,14 +23,14 @@ dist_man1_MANS = virt-xml-validate.1 virt-pki-validate.1 virsh.1 virt-xml-validate: virt-xml-validate.in Makefile - $(AM_V_GEN)sed -e 's,@SCHEMADIR@,$(pkgdatadir)/schemas,' < $< > $@ \ + $(AM_V_GEN)sed -e 's,::SCHEMADIR::,$(pkgdatadir)/schemas,' < $< > $@ \ || (rm $@ && exit 1) && chmod +x $@ virt-xml-validate.1: virt-xml-validate.in $(AM_V_GEN)$(POD2MAN) $< $(srcdir)/$@ virt-pki-validate: virt-pki-validate.in Makefile - $(AM_V_GEN)sed -e 's,@SYSCONFDIR@,$(sysconfdir),' < $< > $@ \ + $(AM_V_GEN)sed -e 's,::SYSCONFDIR::,$(sysconfdir),' < $< > $@ \ || (rm $@ && exit 1) && chmod +x $@ virt-pki-validate.1: virt-pki-validate.in diff --git a/tools/virt-pki-validate.in b/tools/virt-pki-validate.in index 01825d1..f429d77 100755 --- a/tools/virt-pki-validate.in +++ b/tools/virt-pki-validate.in @@ -25,7 +25,7 @@ echo Found "$CERTOOL" # # Check the directory structure # -SYSCONFDIR="@SYSCONFDIR@" +SYSCONFDIR="::SYSCONFDIR::" PKI="$SYSCONFDIR/pki" if [ ! -d "$PKI" ] then diff --git a/tools/virt-xml-validate.in b/tools/virt-xml-validate.in index 1959261..33f6c0f 100644 --- a/tools/virt-xml-validate.in +++ b/tools/virt-xml-validate.in @@ -57,7 +57,7 @@ if [ -z "$TYPE" ]; then esac fi -SCHEMA="@SCHEMADIR@/${TYPE}.rng" +SCHEMA="::SCHEMADIR::/${TYPE}.rng" if [ ! -f "$SCHEMA" ]; then echo "$0: schema $SCHEMA does not exist" -- 1.7.4.4

On 06/22/2011 10:29 AM, Daniel P. Berrange wrote:
make syntax-check complains if any Makefile.am uses the old style @FOO@ for replacement, rather than $(FOO).
Unfortunately the tools/Makefile.am intentionally uses the @FOO@ syntax for generating some scripts. Currently these are whitelisted in cfg.mk, but adding more to this whitelist makes the entire check rather worthless.
This changes the tools/ directory to use ::FOO:: as the replacement syntax for virt-pki-validate.in and virt-xml-validate.in
* tools/Makefile.am, tools/virt-pki-validate.in tools/virt-xml-validate.in: Change @FOO@ to ::FOO:: * cfg.mk: Remove _makefile_at_at_check_exceptions
Hmm, I'm thinking we should go for a v2. The @FOO@ notation in virt-xml-validate.in is pretty idiomatic, so instead of changing to ::FOO::, why don't we instead change tools/Makefile.am to not fall foul of the syntax check rule in the first place, with a well-placed regex bracket sequence? Smaller patches are always nicer :) diff --git i/cfg.mk w/cfg.mk index 5d3ef26..c2230b8 100644 --- i/cfg.mk +++ w/cfg.mk @@ -581,9 +581,6 @@ _autogen: $(srcdir)/autogen.sh ./config.status -# Exempt @...@ uses of these symbols. -_makefile_at_at_check_exceptions = ' && !/(SCHEMA|SYSCONF)DIR/' - # regenerate HACKING as part of the syntax-check syntax-check: $(top_srcdir)/HACKING diff --git i/tools/Makefile.am w/tools/Makefile.am index 826674a..909c4b2 100644 --- i/tools/Makefile.am +++ w/tools/Makefile.am @@ -23,14 +23,14 @@ dist_man1_MANS = virt-xml-validate.1 virt-pki-validate.1 virsh.1 virt-xml-validate: virt-xml-validate.in Makefile - $(AM_V_GEN)sed -e 's,@SCHEMADIR@,$(pkgdatadir)/schemas,' < $< > $@ \ + $(AM_V_GEN)sed -e 's,[@]SCHEMADIR@,$(pkgdatadir)/schemas,' < $< > $@ \ || (rm $@ && exit 1) && chmod +x $@ virt-xml-validate.1: virt-xml-validate.in $(AM_V_GEN)$(POD2MAN) $< $(srcdir)/$@ virt-pki-validate: virt-pki-validate.in Makefile - $(AM_V_GEN)sed -e 's,@SYSCONFDIR@,$(sysconfdir),' < $< > $@ \ + $(AM_V_GEN)sed -e 's,[@]SYSCONFDIR@,$(sysconfdir),' < $< > $@ \ || (rm $@ && exit 1) && chmod +x $@ virt-pki-validate.1: virt-pki-validate.in -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

On Wed, Jun 22, 2011 at 10:36:19AM -0600, Eric Blake wrote:
On 06/22/2011 10:29 AM, Daniel P. Berrange wrote:
make syntax-check complains if any Makefile.am uses the old style @FOO@ for replacement, rather than $(FOO).
Unfortunately the tools/Makefile.am intentionally uses the @FOO@ syntax for generating some scripts. Currently these are whitelisted in cfg.mk, but adding more to this whitelist makes the entire check rather worthless.
This changes the tools/ directory to use ::FOO:: as the replacement syntax for virt-pki-validate.in and virt-xml-validate.in
* tools/Makefile.am, tools/virt-pki-validate.in tools/virt-xml-validate.in: Change @FOO@ to ::FOO:: * cfg.mk: Remove _makefile_at_at_check_exceptions
Hmm, I'm thinking we should go for a v2.
The @FOO@ notation in virt-xml-validate.in is pretty idiomatic, so instead of changing to ::FOO::, why don't we instead change tools/Makefile.am to not fall foul of the syntax check rule in the first place, with a well-placed regex bracket sequence?
Yep, that works for me
Smaller patches are always nicer :)
diff --git i/cfg.mk w/cfg.mk index 5d3ef26..c2230b8 100644 --- i/cfg.mk +++ w/cfg.mk @@ -581,9 +581,6 @@ _autogen: $(srcdir)/autogen.sh ./config.status
-# Exempt @...@ uses of these symbols. -_makefile_at_at_check_exceptions = ' && !/(SCHEMA|SYSCONF)DIR/' - # regenerate HACKING as part of the syntax-check syntax-check: $(top_srcdir)/HACKING
diff --git i/tools/Makefile.am w/tools/Makefile.am index 826674a..909c4b2 100644 --- i/tools/Makefile.am +++ w/tools/Makefile.am @@ -23,14 +23,14 @@ dist_man1_MANS = virt-xml-validate.1 virt-pki-validate.1 virsh.1
virt-xml-validate: virt-xml-validate.in Makefile - $(AM_V_GEN)sed -e 's,@SCHEMADIR@,$(pkgdatadir)/schemas,' < $< > $@ \ + $(AM_V_GEN)sed -e 's,[@]SCHEMADIR@,$(pkgdatadir)/schemas,' < $< > $@ \ || (rm $@ && exit 1) && chmod +x $@
virt-xml-validate.1: virt-xml-validate.in $(AM_V_GEN)$(POD2MAN) $< $(srcdir)/$@
virt-pki-validate: virt-pki-validate.in Makefile - $(AM_V_GEN)sed -e 's,@SYSCONFDIR@,$(sysconfdir),' < $< > $@ \ + $(AM_V_GEN)sed -e 's,[@]SYSCONFDIR@,$(sysconfdir),' < $< > $@ \ || (rm $@ && exit 1) && chmod +x $@
virt-pki-validate.1: virt-pki-validate.in
ACK Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

On 06/22/2011 10:38 AM, Daniel P. Berrange wrote:
The @FOO@ notation in virt-xml-validate.in is pretty idiomatic, so instead of changing to ::FOO::, why don't we instead change tools/Makefile.am to not fall foul of the syntax check rule in the first place, with a well-placed regex bracket sequence?
Yep, that works for me
Smaller patches are always nicer :)
virt-xml-validate: virt-xml-validate.in Makefile - $(AM_V_GEN)sed -e 's,@SCHEMADIR@,$(pkgdatadir)/schemas,' < $< > $@ \ + $(AM_V_GEN)sed -e 's,[@]SCHEMADIR@,$(pkgdatadir)/schemas,' < $< > $@ \ || (rm $@ && exit 1) && chmod +x $@
ACK
Pushed with this commit message: commit 50a6a1267ad45f4af1c872744777ba5a4b03d29e Author: Eric Blake <eblake@redhat.com> Date: Wed Jun 22 10:40:24 2011 -0600 maint: remove syntax-check exception We weren't using the @FOO@ notation for a Makefile substitution, but instead for a sed rule, so using [@]FOO@ instead avoids the need to exempt this syntax check. * cfg.mk (_makefile_at_at_check_exceptions): Delete. * tools/Makefile.am (virt-xml-validate, virt-pki-validate): Avoid tripping syntax-check. Reported by Daniel P. Berrange. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org
participants (2)
-
Daniel P. Berrange
-
Eric Blake