]>
Commit | Line | Data |
---|---|---|
0d34a427 LO |
1 | #!/usr/bin/perl -w |
2 | ||
3 | $flavour = shift; | |
4 | $prev_abidir = shift; | |
5 | $abidir = shift; | |
6 | $skipmodule = shift; | |
7 | ||
8 | print "II: Checking modules for $flavour..."; | |
9 | ||
10 | if (-f "$prev_abidir/ignore.modules" | |
11 | or -f "$prev_abidir/$flavour.ignore.modules") { | |
12 | print "explicitly ignoring modules\n"; | |
13 | exit(0); | |
14 | } | |
15 | ||
16 | if (not -f "$abidir/$flavour.modules" or not -f | |
17 | "$prev_abidir/$flavour.modules") { | |
18 | print "previous or current modules file missing!\n"; | |
19 | print " $abidir/$flavour.modules\n"; | |
20 | print " $prev_abidir/$flavour.modules\n"; | |
21 | if (defined($skipmodule)) { | |
22 | exit(0); | |
23 | } else { | |
24 | exit(1); | |
25 | } | |
26 | } | |
27 | ||
28 | print "\n"; | |
29 | ||
30 | my %modules; | |
31 | my %modules_ignore; | |
32 | my $missing = 0; | |
33 | my $new = 0; | |
34 | my $errors = 0; | |
35 | ||
36 | # See if we have any ignores | |
37 | if (-f "$prev_abidir/../modules.ignore") { | |
38 | my $ignore = 0; | |
39 | open(IGNORE, "< $prev_abidir/../modules.ignore") or | |
40 | die "Could not open $prev_abidir/../modules.ignore"; | |
41 | print " reading modules to ignore..."; | |
42 | while (<IGNORE>) { | |
43 | chomp; | |
44 | next if /\s*#/; | |
45 | $modules_ignore{$_} = 1; | |
46 | $ignore++; | |
47 | } | |
48 | close(IGNORE); | |
49 | print "read $ignore modules.\n"; | |
50 | } | |
51 | ||
52 | # Read new modules first | |
53 | print " reading new modules..."; | |
54 | $new_count = 0; | |
55 | open(NEW, "< $abidir/$flavour.modules") or | |
56 | die "Could not open $abidir/$flavour.modules"; | |
57 | while (<NEW>) { | |
58 | chomp; | |
59 | $modules{$_} = 1; | |
60 | $new_count++; | |
61 | } | |
62 | close(NEW); | |
63 | print "read $new_count modules.\n"; | |
64 | ||
65 | # Now the old modules, checking for missing ones | |
66 | print " reading old modules..."; | |
67 | $old_count = 0; | |
68 | open(OLD, "< $prev_abidir/$flavour.modules") or | |
69 | die "Could not open $prev_abidir/$flavour.modules"; | |
70 | while (<OLD>) { | |
71 | chomp; | |
72 | if (not defined($modules{$_})) { | |
73 | print "\n" if not $missing; | |
74 | $missing++; | |
75 | if (not defined($modules_ignore{$_})) { | |
76 | print " MISS: $_\n"; | |
77 | $errors++; | |
78 | } else { | |
79 | print " MISS: $_ (ignored)\n"; | |
80 | } | |
81 | } else { | |
82 | $modules{$_}++; | |
83 | } | |
84 | $old_count++; | |
85 | } | |
86 | close(OLD); | |
87 | # Check for new modules | |
88 | foreach $mod (keys(%modules)) { | |
89 | if ($modules{$mod} < 2) { | |
90 | print "\n" if not $missing and not $new; | |
91 | print " NEW : $mod\n"; | |
92 | $new++; | |
93 | } | |
94 | } | |
95 | if ($new or $missing) { | |
96 | print " read $old_count modules : new($new) missing($missing)\n"; | |
97 | } else { | |
98 | print "read $old_count modules.\n"; | |
99 | } | |
100 | ||
101 | ||
102 | # Let's see where we stand... | |
103 | if ($errors) { | |
104 | if (defined($skipmodule)) { | |
105 | print "WW: Explicitly asked to ignore failures (probably not good)\n"; | |
106 | } else { | |
107 | print "EE: Missing modules (start begging for mercy)\n"; | |
108 | exit 1 | |
109 | } | |
110 | } | |
111 | ||
112 | if ($new) { | |
113 | print "II: New modules (you've been busy, wipe the poop off your nose)\n"; | |
114 | } else { | |
115 | print "II: No new modules (hope you're happy, slacker)\n"; | |
116 | } | |
117 | ||
118 | print "II: Done\n"; | |
119 | ||
120 | exit(0); |