1 | #!perl5 |
---|
2 | # |
---|
3 | # The contents of this file are subject to the Netscape Public |
---|
4 | # License Version 1.1 (the "License"); you may not use this file |
---|
5 | # except in compliance with the License. You may obtain a copy of |
---|
6 | # the License at http://www.mozilla.org/NPL/ |
---|
7 | # |
---|
8 | # Software distributed under the License is distributed on an "AS |
---|
9 | # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or |
---|
10 | # implied. See the License for the specific language governing |
---|
11 | # rights and limitations under the License. |
---|
12 | # |
---|
13 | # The Original Code is mozilla.org code. |
---|
14 | # |
---|
15 | # The Initial Developer of the Original Code is Netscape |
---|
16 | # Communications Corporation. Portions created by Netscape are |
---|
17 | # Copyright (C) 1998 Netscape Communications Corporation. All |
---|
18 | # Rights Reserved. |
---|
19 | # |
---|
20 | # Contributor(s): |
---|
21 | # |
---|
22 | |
---|
23 | # |
---|
24 | # Searches the tree for unclobbered files |
---|
25 | # should be relatively cross platform |
---|
26 | # |
---|
27 | |
---|
28 | $start_dir = $ENV{"MOZ_SRC"}; |
---|
29 | @ignore_list = ("make.dep","manifest.mnw"); |
---|
30 | |
---|
31 | $missed = 0; |
---|
32 | |
---|
33 | print "\n\nChecking for unclobbered files\n" . |
---|
34 | "------------------------------\n"; |
---|
35 | |
---|
36 | GoDir("ns"); |
---|
37 | GoDir("mozilla"); |
---|
38 | |
---|
39 | if( $missed ){ |
---|
40 | die "\nError: $missed files or directories unclobbered\n"; |
---|
41 | } |
---|
42 | else { |
---|
43 | print "No unclobbered files found\n"; |
---|
44 | } |
---|
45 | |
---|
46 | sub GoDir { |
---|
47 | local($dir) = @_; |
---|
48 | local(%filelist,$iscvsdir); |
---|
49 | local($k,$v,$d,$fn,$rev, $mod_time); |
---|
50 | local($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size, |
---|
51 | $atime,$mtime,$ctime,$blksize,$blocks); |
---|
52 | |
---|
53 | if(! chdir "$start_dir/$dir" ){ |
---|
54 | return; |
---|
55 | } |
---|
56 | |
---|
57 | while(<*.*> ){ |
---|
58 | if( $_ ne '.' && $_ ne '..' && $_ ne 'CVS' |
---|
59 | && $_ ne 'nuke' ){ |
---|
60 | $filelist{$_} = 1; |
---|
61 | } |
---|
62 | } |
---|
63 | |
---|
64 | if( -r "CVS/Entries" ){ |
---|
65 | $iscvsdir=1; |
---|
66 | open(ENT, "CVS/Entries" ) || |
---|
67 | die "Cannot open CVS/Entries for reading\n"; |
---|
68 | while(<ENT>){ |
---|
69 | chop; |
---|
70 | ($d,$fn,$rev,$mod_time) = split(/\//); |
---|
71 | |
---|
72 | if( $fn ne "" ){ |
---|
73 | if( $d eq "D" ){ |
---|
74 | $filelist{$fn} = 3; |
---|
75 | } |
---|
76 | else { |
---|
77 | $filelist{$fn} = 2; |
---|
78 | } |
---|
79 | } |
---|
80 | } |
---|
81 | close(ENT); |
---|
82 | } |
---|
83 | |
---|
84 | while( ($k,$v) = each %filelist ){ |
---|
85 | if( $v == 1 && $iscvsdir && !IgnoreFile( $k ) ){ |
---|
86 | if( ! -d $k ){ |
---|
87 | print " file: $dir/$k\n"; |
---|
88 | $missed++; |
---|
89 | } |
---|
90 | else { |
---|
91 | if( ! -r "$k/CVS/Entries" ){ |
---|
92 | print "directory: $dir/$k\n"; |
---|
93 | $missed++; |
---|
94 | } |
---|
95 | else { |
---|
96 | $filelist{$k} = 3; |
---|
97 | } |
---|
98 | |
---|
99 | } |
---|
100 | } |
---|
101 | } |
---|
102 | |
---|
103 | while( ($k,$v) = each %filelist ){ |
---|
104 | if( $v == 3 ){ |
---|
105 | GoDir("$dir/$k"); |
---|
106 | } |
---|
107 | } |
---|
108 | |
---|
109 | # while( ($k,$v) = each %filelist ){ |
---|
110 | # print "$k: $v\n"; |
---|
111 | # } |
---|
112 | |
---|
113 | } |
---|
114 | |
---|
115 | sub IgnoreFile { |
---|
116 | local($fn) = @_; |
---|
117 | local($i); |
---|
118 | |
---|
119 | for $i (@ignore_list){ |
---|
120 | if( $fn eq $i ){ |
---|
121 | return 1; |
---|
122 | } |
---|
123 | } |
---|
124 | return 0; |
---|
125 | } |
---|
126 | |
---|