this time for real, sorry for the noise
[nautilus.git] / check-POTFILES.pl
blob247cfa0b75db47ae753bc40713ad8bdd06215a6c
1 #!/usr/bin/perl -w
2 # -*- Mode: perl; indent-tabs-mode: nil -*-
5 # Nautilus
7 # Copyright (C) 2000 Eazel, Inc.
9 # This library is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU General Public License as
11 # published by the Free Software Foundation; either version 2 of the
12 # License, or (at your option) any later version.
14 # This library is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 # General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with this library; if not, write to the Free Software
21 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 # Author: Darin Adler <darin@bentspoon.com>,
26 # check-POTFILES.pl: Checks for files mentioned in POTFILES.in that
27 # are not present in the Makefile.am files for those directories.
29 use diagnostics;
30 use strict;
32 my @directories = (".");
34 my %exceptions =
36 '$(APPLETS_SUBDIRS)' => 'applets',
37 '$(AUTHENTICATE_HELPER_SUBDIRS)' => 'authenticate',
38 '$(INSTALL_SERVICE)' => 'install',
39 '$(MOZILLA_COMPONENT_SUBDIRS)' => 'mozilla',
40 '$(NULL)' => '',
41 '$(RPMVIEW_COMPONENT_SUBDIRS)' => 'rpmview',
42 '$(SERVICE_SUBDIRS)' => 'services',
43 'intl' => '',
44 'po' => '',
47 my %files;
49 # collect all files mentioned in Makefile.am files
50 while (@directories)
52 my $directory = pop @directories;
53 my $prefix = "";
54 $prefix = "$directory/" if $directory ne ".";
56 my $in_subdirs = 0;
58 my $file = $prefix . "Makefile.am";
59 open FILE, $file or die "can't open $file\n";
60 while (<FILE>)
62 if (s/^SUBDIRS\s*=//)
64 $in_subdirs = 1;
66 if ($in_subdirs)
68 while (s/^\s*([^\s\\]+)//)
70 if (defined $exceptions{$1})
72 if ($exceptions{$1})
74 push @directories, $prefix . $exceptions{$1};
77 else
79 push @directories, $prefix . $1;
82 if (/^\s*$/)
84 $in_subdirs = 0;
86 elsif (!/^\s*\\$/)
88 die "can't parse SUBDIRS in $directory\n";
91 while (s/([-_a-zA-Z0-9]+\.(c|h|xml|cpp|oaf\.in|desktop\.in))\W//)
93 $files{$prefix . $1} = $1;
96 close FILE;
99 open POTFILES, "po/POTFILES.in" or die "can't open POTFILES.in\n";
100 while (<POTFILES>)
102 chomp;
103 if (! defined $files{$_})
105 print "$_ is in POTFILES.in but not Makefile.am\n";
108 close POTFILES;