[libvirt] [PATCH] maint: enforce private symbol section sorting
Daniel P. Berrange
berrange at redhat.com
Wed Feb 20 13:41:24 UTC 2013
On Wed, Feb 20, 2013 at 06:34:33AM -0700, Eric Blake wrote:
> Automating a sorting check is the only way to ensure we don't
> regress. Suggested by Dan Berrange.
>
> * src/check-symsorting.pl (check_sorting): Add a parameter,
> validate that groups are in order, and that files exist.
> * src/Makefile.am (check-symsorting): Adjust caller.
> * src/libvirt_private.syms: Fix typo.
> * src/libvirt_linux.syms: Fix file name.
> * src/libvirt_vmx.syms: Likewise.
> * src/libvirt_xenxs.syms: Likewise.
> * src/libvirt_sasl.syms: Likewise.
> * src/libvirt_libssh2.syms: Likewise.
> * src/libvirt_esx.syms: Mention file name.
> * src/libvirt_openvz.syms: Likewise.
> ---
>
> While I can manage in perl, I probably don't have the best usage
> patterns; suggestions for improving this patch are quite welcome.
> diff --git a/src/check-symsorting.pl b/src/check-symsorting.pl
> index 9c62246..cbcb737 100755
> --- a/src/check-symsorting.pl
> +++ b/src/check-symsorting.pl
> @@ -3,22 +3,27 @@
> use strict;
> use warnings;
>
> -die "syntax: $0 SYMFILE..." unless int(@ARGV) >= 1;
> +die "syntax: $0 SRCDIR SYMFILE..." unless int(@ARGV) >= 2;
>
> my $ret = 0;
> +my $srcdir = shift;
> +my $lastgroup = undef;
> foreach my $symfile (@ARGV) {
> open SYMFILE, $symfile or die "cannot read $symfile: $!";
>
> my $line;
> + my $groupfile;
> my @group;
>
> while (<SYMFILE>) {
> chomp;
> - next if /^#/;
>
> - if (/^\s*$/) {
> + if (/^#/) {
This can match plain comments, or comments with a filename
> + $_ =~ s/^# //;
> + $groupfile = $_;
So I'd split this into two:
if (/^#\s*((\w+\/)*(\w+\.h$))\s*$) {?
$groupfile = $1;
} elif (/^#\s*$/) {
# Ignore comments
...
> + } elsif (/^\s*$/) {
ACK either with or without the change
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 :|
More information about the libvir-list
mailing list