1 |
|
#!/usr/bin/perl -w |
2 |
|
|
3 |
< |
use CGI; |
3 |
> |
use CGI qw/:standard/; |
4 |
|
$query=new CGI; |
5 |
|
my($period)=$query->param('period'); |
6 |
|
$period = "today" unless defined $period; |
44 |
|
$modulelist =~ s/[\r\n]/ /gm; |
45 |
|
|
46 |
|
my($cvs2clpath) = "/usr/local/bin/cvs2cl"; |
47 |
< |
my($cvs2clargs) = "--stdout --no-wrap -r -t -w -S -U $cvsroot/CVSROOT/users -l \"-d'$firstdate'\" -g \"-d$cvsroot\" -g \"-Q\""; |
47 |
> |
my($cvs2clargs) = "--stdout --no-wrap --no-common-dir -r -t -w -S -U $cvsroot/CVSROOT/users -l \"-d'$firstdate'\" -g \"-d$cvsroot\" -g \"-Q\""; |
48 |
|
my($updatecmd) = "/home/iscream/bin/fullcvsupdate.sh $modulelist"; |
49 |
|
my($logcmd) = "cd /tmp/i-scream/cvstmp && $cvs2clpath $cvs2clargs"; |
50 |
|
|
51 |
< |
my ($left) = "../htdocs/left.inc" ; |
52 |
< |
my ($title) = "../htdocs/title.inc"; |
53 |
< |
my ($bottom) = "../htdocs/bottom.inc"; |
51 |
> |
my ($incdir) = "../nwww"; |
52 |
|
|
53 |
< |
print "Content-type: text/html\n\n"; |
53 |
> |
# Include files |
54 |
> |
my ($doctype) = "$incdir/doctype.inc"; |
55 |
> |
my ($style) = "$incdir/style.inc"; |
56 |
> |
my ($header) = "$incdir/header.inc"; |
57 |
> |
my ($footer) = "$incdir/footer.inc"; |
58 |
> |
my ($menu) = "$incdir/menu.inc" ; |
59 |
|
|
60 |
< |
print <<"END"; |
61 |
< |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
60 |
> |
# Section markers |
61 |
> |
my ($sec) = 0; |
62 |
> |
my ($secwho) = 1; |
63 |
> |
my ($secfiles) = 2; |
64 |
> |
my ($seclog) = 3; |
65 |
|
|
66 |
< |
<html> |
66 |
> |
# This should be application/xhtml+xml |
67 |
> |
print "Content-type: text/html\n\n"; |
68 |
|
|
69 |
< |
<head> |
63 |
< |
<title>The i-scream Project Commit Log</title> |
64 |
< |
</head> |
69 |
> |
&print_html($doctype); |
70 |
|
|
71 |
< |
<body bgcolor="#ffffff" link="#0000ff" alink="#3333cc" vlink="#3333cc" text="#000066"> |
71 |
> |
print <<"END"; |
72 |
|
|
73 |
< |
<table border="0" cellpadding="2" cellspacing="2"> |
74 |
< |
<tr> |
75 |
< |
<td valign="top"> |
73 |
> |
<head> |
74 |
> |
<title> |
75 |
> |
i-scream CVS Commit Logs |
76 |
> |
</title> |
77 |
|
END |
78 |
|
|
79 |
< |
&print_html($left); |
79 |
> |
&print_html($style); |
80 |
|
|
81 |
|
print <<"END"; |
82 |
< |
</td> |
83 |
< |
<td valign="top"> |
82 |
> |
|
83 |
> |
</head> |
84 |
> |
<body> |
85 |
> |
<div id="container"> |
86 |
> |
<div id="main"> |
87 |
|
END |
88 |
|
|
89 |
< |
&print_html($title); |
89 |
> |
&print_html($header); |
90 |
|
|
91 |
|
print <<"END"; |
92 |
< |
<h2>$heading</h2> |
92 |
> |
|
93 |
> |
<div id="contents"> |
94 |
> |
<h1 class="top"> |
95 |
> |
i-scream CVS Commit Logs |
96 |
> |
</h1> |
97 |
> |
<h2> |
98 |
> |
$heading |
99 |
> |
</h2> |
100 |
> |
<div id="cvslog"> |
101 |
|
END |
102 |
|
|
103 |
|
print `$updatecmd >/dev/null 2>&1`; |
105 |
|
my(@modules) = split (/\s+/, $modulelist); |
106 |
|
|
107 |
|
foreach my $module (@modules) { |
108 |
+ |
my($firstentry) = 1; |
109 |
+ |
print <<"END"; |
110 |
+ |
<div> |
111 |
+ |
<h3> |
112 |
+ |
<a href="http://cvs.i-scream.org/$module/" class="cvsloghead">$module module</a> |
113 |
+ |
</h3> |
114 |
+ |
END |
115 |
|
|
92 |
– |
print "<table border=\"0\" bgcolor=\"#000066\" cellpadding=\"5\" width=\"100%\">\n\n"; |
93 |
– |
print "<tr><td>\n<font size=\"4\"><b><a href=\"http://cvs.i-scream.org/$module\" style=\"color: white\">$module module</a></b></font>\n</td></tr>\n\n"; |
94 |
– |
print "<tr><td bgcolor=\"white\">\n"; |
95 |
– |
|
116 |
|
my(@lines) = `$logcmd $module 2>&1`; |
117 |
|
if(@lines == 0) { |
118 |
< |
print "There have been no commits in this module during this period.\n"; |
118 |
> |
print <<"END"; |
119 |
> |
<p> |
120 |
> |
There have been no commits in this module during this period. |
121 |
> |
</p> |
122 |
> |
END |
123 |
|
} |
124 |
|
else { |
125 |
+ |
my(@log) = (); |
126 |
|
foreach my $line (@lines) { |
127 |
|
|
128 |
< |
if ($line =~ /^([0-9]{4}-[0-9]{2}-[0-9]{2}.*?)\s+([^\s]+)\s+<([^\s]+)>$/) { |
129 |
< |
print "\n<font color=\"blue\">\n<b>"; |
130 |
< |
print HTML_encode($1); |
131 |
< |
print "</b>\n<i>"; |
132 |
< |
print " committed by <a href=\"mailto:$3\" style=\"text-decoration: none;\">"; |
133 |
< |
print HTML_encode("$2"); |
134 |
< |
print "</a></i>\n</font>\n" |
128 |
> |
if ($line =~ /^([0-9]{4}-[0-9]{2}-[0-9]{2}.*?)\s+([^\s]+)(\s+<([^\s]+)>)?$/) { |
129 |
> |
my($datetime) = escapeHTML($1); |
130 |
> |
my($committer) = escapeHTML($2); |
131 |
> |
my($email) = $4; |
132 |
> |
|
133 |
> |
if($sec != $secwho) { |
134 |
> |
if($sec == $seclog) { |
135 |
> |
@log = &trim_array(@log); |
136 |
> |
foreach my $logline (@log) { |
137 |
> |
$logline =~ s/^\t//; |
138 |
> |
print "$logline\n"; |
139 |
> |
} |
140 |
> |
@log = (); |
141 |
> |
print <<"END"; |
142 |
> |
</pre> |
143 |
> |
</div> |
144 |
> |
END |
145 |
> |
} |
146 |
> |
if($firstentry) { |
147 |
> |
$firstentry = 0; |
148 |
> |
print <<"END"; |
149 |
> |
<div class="logitemfirst"> |
150 |
> |
END |
151 |
> |
} |
152 |
> |
else { |
153 |
> |
print <<"END"; |
154 |
> |
<div class="logitem"> |
155 |
> |
END |
156 |
> |
} |
157 |
> |
$sec = $secwho; |
158 |
> |
} |
159 |
> |
|
160 |
> |
print <<"END"; |
161 |
> |
<p> |
162 |
> |
<b> |
163 |
> |
$datetime |
164 |
> |
</b> |
165 |
> |
committed by |
166 |
> |
END |
167 |
> |
if(defined $email) { |
168 |
> |
print <<"END"; |
169 |
> |
<a href="mailto:$email">$committer</a> |
170 |
> |
END |
171 |
> |
} |
172 |
> |
else { |
173 |
> |
print <<"END"; |
174 |
> |
$committer |
175 |
> |
END |
176 |
> |
} |
177 |
> |
print <<"END"; |
178 |
> |
</p> |
179 |
> |
END |
180 |
|
} |
181 |
< |
elsif ($line =~ /^([0-9]{4}-[0-9]{2}-[0-9]{2}.*?)\s+([^\s]+)$/) { |
182 |
< |
print "\n<font color=\"blue\">\n<b>"; |
183 |
< |
print HTML_encode($1); |
184 |
< |
print "</b>\n<i>"; |
185 |
< |
print " committed by "; |
186 |
< |
print HTML_encode("$2"); |
187 |
< |
print "</i>\n</font>\n" |
188 |
< |
} |
189 |
< |
elsif($line =~ /(\S+) (\(\S+\))([,:])/ || $line =~ /(\S+) (\(\S+,\s+\S+\))([,:])/) { |
190 |
< |
my ($file, $rest, $ext) = ($1, $2, $3); |
191 |
< |
print "<code>"; |
192 |
< |
print "<a href=\"http://cvs.i-scream.org/$file\" style=\"text-decoration: none;\">"; |
193 |
< |
print HTML_encode($file); |
194 |
< |
print "</a> "; |
125 |
< |
if($rest =~ /\((\S+)\.(\d+)(.*)\)/) { |
181 |
> |
elsif($line =~ /([^\s]+) (\([^,^\)]+(,[^\)]+)?\))([,:])/) { |
182 |
> |
my ($file, $rev, $tags, $ext) = ($1, $2, $3, $4); |
183 |
> |
$ext = escapeHTML($ext); |
184 |
> |
if($sec != $secfiles) { |
185 |
> |
$sec = $secfiles; |
186 |
> |
print <<"END"; |
187 |
> |
<p> |
188 |
> |
END |
189 |
> |
} |
190 |
> |
$file = escapeHTML($file); |
191 |
> |
print <<"END"; |
192 |
> |
<a href="http://cvs.i-scream.org/$file">$file</a> |
193 |
> |
END |
194 |
> |
if($rev =~ /\(([^\s]+)\.(\d+)(.*)\)/) { |
195 |
|
my $start = $1; |
196 |
|
my $end = $2; |
197 |
|
my $other = $3; |
207 |
|
chop $oldrev; |
208 |
|
} |
209 |
|
if(defined $oldrev) { |
210 |
< |
my $diff = ".diff?r1=$oldrev&r2=$newrev"; |
211 |
< |
print "(<a href=\"http://cvs.i-scream.org/$file$diff\" style=\"text-decoration: none;\">"; |
212 |
< |
print HTML_encode("$start.$end"); |
213 |
< |
print "</a>"; |
214 |
< |
print HTML_encode("$other)"); |
210 |
> |
my $diff = ".diff?r1=$oldrev&r2=$newrev"; |
211 |
> |
my $startend = escapeHTML("$start.$end"); |
212 |
> |
$other = escapeHTML($other); |
213 |
> |
chomp $other; |
214 |
> |
print <<"END"; |
215 |
> |
(<a href="http://cvs.i-scream.org/$file$diff">$startend</a>$other)$ext |
216 |
> |
END |
217 |
|
} |
218 |
|
else { |
219 |
< |
print HTML_encode($rest); |
219 |
> |
$rev = escapeHTML($rev); |
220 |
> |
print <<"END"; |
221 |
> |
$rev$ext |
222 |
> |
END |
223 |
|
} |
224 |
|
} |
225 |
|
else { |
226 |
< |
print HTML_encode($rest); |
226 |
> |
$rev = escapeHTML($rev); |
227 |
> |
print <<"END"; |
228 |
> |
$rev$ext |
229 |
> |
END |
230 |
|
} |
231 |
< |
print HTML_encode($ext); |
232 |
< |
print "</code><br>\n" |
231 |
> |
if($ext !~ /:$/) { |
232 |
> |
print <<"END"; |
233 |
> |
<br /> |
234 |
> |
END |
235 |
> |
} |
236 |
|
} |
237 |
|
else { |
238 |
< |
chop $line; |
239 |
< |
print "<code>"; |
240 |
< |
print HTML_encode($line); |
241 |
< |
print "</code><br>\n" |
238 |
> |
next if $sec == $secwho; # not done secfiles yet |
239 |
> |
if($sec != $seclog) { |
240 |
> |
$sec = $seclog; |
241 |
> |
print <<"END"; |
242 |
> |
</p> |
243 |
> |
<pre> |
244 |
> |
END |
245 |
> |
} |
246 |
> |
chomp $line; |
247 |
> |
push(@log, $line); |
248 |
|
} |
249 |
|
} |
250 |
+ |
if($sec == $seclog) { |
251 |
+ |
@log = &trim_array(@log); |
252 |
+ |
foreach my $logline (@log) { |
253 |
+ |
$logline =~ s/^\t//; |
254 |
+ |
print "$logline\n"; |
255 |
+ |
} |
256 |
+ |
@log = (); |
257 |
+ |
print <<"END"; |
258 |
+ |
</pre> |
259 |
+ |
</div> |
260 |
+ |
END |
261 |
+ |
} |
262 |
|
} |
263 |
< |
print "</td></tr>\n"; |
264 |
< |
|
265 |
< |
print "</table><p>\n\n"; |
263 |
> |
print <<"END"; |
264 |
> |
</div> |
265 |
> |
END |
266 |
|
} |
267 |
|
|
268 |
< |
&print_html($bottom); |
268 |
> |
print <<"END"; |
269 |
> |
</div> |
270 |
> |
</div> |
271 |
> |
END |
272 |
|
|
273 |
+ |
&print_html($footer); |
274 |
+ |
|
275 |
|
print <<"END"; |
276 |
|
|
277 |
< |
</td> |
278 |
< |
</tr> |
176 |
< |
</table> |
277 |
> |
</div> |
278 |
> |
END |
279 |
|
|
280 |
< |
</body> |
280 |
> |
&print_html($menu); |
281 |
|
|
282 |
+ |
print <<"END"; |
283 |
+ |
|
284 |
+ |
</div> |
285 |
+ |
</body> |
286 |
|
</html> |
287 |
|
END |
288 |
|
|
289 |
|
exit 0; |
290 |
|
|
291 |
< |
#------------------------------------------------------ |
292 |
< |
# sub HTML_encode |
293 |
< |
# |
294 |
< |
# escape HTML characters that may cause problems when |
295 |
< |
# shown either in the <body> or within text fields. |
296 |
< |
#------------------------------------------------------ |
297 |
< |
sub HTML_encode ($){ |
298 |
< |
my ($encoded) = @_; |
193 |
< |
$encoded =~ s/&/&/g; |
194 |
< |
$encoded =~ s/"/"/g; |
195 |
< |
$encoded =~ s/</</g; |
196 |
< |
$encoded =~ s/>/>/g; |
197 |
< |
return $encoded; |
291 |
> |
# Print the contents of a file containing html |
292 |
> |
sub print_html { |
293 |
> |
my ($filename) = @_; |
294 |
> |
open(FILE, $filename); |
295 |
> |
while(<FILE>) { |
296 |
> |
print; |
297 |
> |
} |
298 |
> |
close FILE; |
299 |
|
} |
300 |
|
|
301 |
< |
# Print a file without escaping HTML: - |
302 |
< |
sub print_html ($) { |
303 |
< |
my ($filename) = @_; |
304 |
< |
print `cat $filename 2>&1`; |
301 |
> |
# Trim an array (remove beginning and end emptry entries) |
302 |
> |
sub trim_array { |
303 |
> |
my (@array) = @_; |
304 |
> |
for(my $i = 0; $i < scalar @array; $i++) { |
305 |
> |
if($array[$i] ne "") { |
306 |
> |
splice @array, 0, $i; |
307 |
> |
last; |
308 |
> |
} |
309 |
> |
} |
310 |
> |
for(my $i = scalar @array - 1; $i >= 0; $i--) { |
311 |
> |
if($array[$i] ne "") { |
312 |
> |
splice @array, $i+1; |
313 |
> |
last; |
314 |
> |
} |
315 |
> |
} |
316 |
> |
return @array; |
317 |
|
} |