+RHCE
[www.jankratochvil.net.git] / project / checkListItem.pl
1 #! /usr/bin/perl
2
3 # $Id$
4 # Check for unhandled 'ListItem' fields.
5 # Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
6
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; exactly version 2 of June 1991 is required
10
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 # GNU General Public License for more details.
15
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
20
21 package project::checkListItem;
22 require 5.6.0;  # at least 'use warnings;' but we need some 5.6.0+ modules anyway
23 our $VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
24 our $CVS_ID=q$Id$;
25 use strict;
26 use warnings;
27
28 use lib qw(/home/short/lib/perl5/site_perl/5.6.0/i386-linux /home/short/lib/perl5/site_perl/5.6.0 /home/short/lib/perl5/site_perl/i386-linux /home/short/lib/perl5/site_perl /home/short/lib/perl5/5.6.0/i386-linux /home/short/lib/perl5/5.6.0 /home/short/lib/perl5/i386-linux /home/short/lib/perl5);
29
30 use lib "../";
31 use My::Web;
32
33 use constant ENTRIES=>"CVS/Entries";
34 use constant ENTRIES_LOG=>"CVS/Entries.Log";
35
36
37 my %dirs;
38 for my $ENTRIES (ENTRIES,ENTRIES_LOG) {
39         local *E;
40         next if !open E,$ENTRIES;
41         while (<E>) {
42                 chomp;
43                 do { $dirs{$1}=1; next; } if m#^(?:A )?D/([^/]*)/#;
44                 next if m#^/([^/]*)/# ;
45                 next if /^D$/;
46                 warn "File $ENTRIES contains invalid line \"$_\": $!";
47                 }
48         close E;
49         }
50
51 my %item;
52 for my $dir (keys(%dirs)) {
53         Wrequire "$dir/ListItem.pm";
54         my $item=eval('\%My::Project::'.$dir.'::ListItem');
55         do { warn "Broken $dir/List.pm"; next; } if !defined %$item;
56         $item{$dir}=$item;
57         }
58
59 open(STDOUT,">/dev/null");
60 while (my($key,$ListItem)=each(%item)) {
61         chdir $key;
62         My::Web->print_project($ListItem);
63         for my $attr (qw(priority name description)) {
64                 delete $ListItem->{$attr};
65                 }
66         require Data::Dumper;
67         print STDERR Data::Dumper->Dump([$ListItem],[$key]) if %$ListItem;
68         chdir "..";
69         }