File: check-glade-parsing

package info (click to toggle)
gnumeric 1.10.8-1squeeze5
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 90,968 kB
  • ctags: 23,303
  • sloc: ansic: 248,235; xml: 51,894; sh: 10,491; makefile: 2,822; perl: 2,466; yacc: 1,272; python: 205
file content (62 lines) | stat: -rwxr-xr-x 1,644 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/perl -w
#
#  Gnumeric
#
#  Copyright (C) 2009 Morten Welinder.
#
#  This program is free software; you can redistribute it and/or
#  modify it under the terms of the GNU General Public License as
#  published by the Free Software Foundation; either version 2 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
#  General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this library; if not, write to the Free Software
#  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
#  Author: Morten Welinder <terra@gnome.org>

use strict;
use XML::Parser;

my $exitcode = 0;

die "$0: must be run from top-level directory.\n"
    unless -r "configure.in" && -r 'ChangeLog';

my %exceptions = ();

my @files;
{
    local (*FIND);
    open (*FIND, "find . '(' -name \*.glade -type f -print ')' -o '(' -type d '(' -name .git -o -name intl -o -name macros ')' -prune ')' |")
	or die "$0: cannot execute find: $!\n";
    foreach my $filename (<FIND>) {
	chomp $filename;
	$filename =~ s|^\./||;
	next if $exceptions{$filename};
	push @files, $filename;
    }
    close (*FIND);
}


{
    my $parser = new XML::Parser ('Style' => 'Tree');
  FILE:
    foreach my $filename (@files) {
	eval {
	    my $tree = $parser->parsefile ($filename);
	};
	if ($@) {
	    print STDERR "File $filename doesn't parse: $@\n";
	    $exitcode = 1;
	}
    }
}

exit $exitcode;