summaryrefslogtreecommitdiff
path: root/doc/tinderbox.txt
blob: bf1fa9e14dd7c72eff3073602b0679ea08eacef7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
* Use patched rebuildhistory.cgi, cf bottom.

	  still needs code to poke changed names at it.

* Bonsai sync replacement using cvsup

	+ dolog.pl
	    (process_cvs_info):
		groks:
			/ChangeLog/1.68/Thu Sep 26 12:25:08 2002//
		from CVS/Entries type thing.
		$username,$lines_added,$lines_removed from rlog -N -r foo
	     . Does it for all @changed_files, and @added_files in a directory.
	     . builds @outlist of [R]| | delimited, + LOGCOMMENT at end.

	+ Poser - how do we de-scatter this info from CVSup ?
	     . we have:
		  journal record
			  + parse journal
			  + rcs query between dates ?
		  timestamps
		  etc.

	+ At the other end we process it with:
		globals.pl: AddToDatabase - collates descr.
		How do we get 'Removes' ... ? what is a remove ? from what branch etc. ?

	+ We need a non-0 'selected revisions'; flatten the 'Attic' into the
	  repo - it's not interesting; but an anachronism
description:
----------------------------
revision 1.2
date: 2002/09/27 14:52:24;  author: michael;  state: dead;  lines: +0 -0
remove it from HEAD
----------------------------
revision 1.1
date: 2002/09/27 14:51:16;  author: michael;  state: Exp;
branches:  1.1.2;
A test on HEAD
----------------------------
revision 1.1.2.3
date: 2002/09/27 14:53:52;  author: michael;  state: dead;  lines: +0 -0
remove from Foo branch
----------------------------
revision 1.1.2.2
date: 2002/09/27 14:53:23;  author: michael;  state: Exp;  lines: +1 -1
updated after remove
----------------------------
revision 1.1.2.1
date: 2002/09/27 14:51:41;  author: michael;  state: Exp;  lines: +1 -1
upd.
=============================================================================


	


The plan:

	+ auto-pop and deliver that mail on a cron job here
	+ build the web pages from external tinderbox contributions.

	To use tinderbox etc. checkout the source:

* Ongoing
	+ (/etc/cvsup/cvsup-auto.sh &) - syncs with OO.o

* Setup log:

	cvs -z3 -d ':pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot' checkout mozilla/webtools/<foo>
	Where <foo> is 'lxr', 'tinderbox2', 'bonsai', 'registry'

	+ First time db setup:
		sudo mysqladmin create bonsai
		sudo mysql -u root mysql
		GRANT ALL PRIVILEGES ON *.* TO nobody@localhost\g
		quit\g
		sudo mysqladmin reload
	+ Install libnet, MailTools, TimeDate from CPAN
	+ bonsai/configure --prefix=/var/www
	+ cp -a registry /var/www
	+ Setup Apache to exec scripts in these dirs
	+ Hack all the scripts to get the perl path right [!]
	+ LXR's 'virtroot' has to have a '/lxr' in it NB '/'

	+ Had to hack adminfuncs.pl, cvsquery.pl to add #!/bin/perl
	  to each, and push (@INC, "/var/www/bonsai")

<darragh> My incprefix in lxr.conf is : 'incprefix' => ['/include', '/include/linux', '/inc', 'inc', '/*', '*', '/inc/*', '/inc/*/*', '/.*', '/.*/inc', '/.*/inc/', '/inc/*/*/*', '/inc/*/*/*/*', '/*/include', '/*/include/linux', '/*/inc', 'inc', '/.*/inc', '/.*/.*/inc', '/.*/.*/.*/inc', '/.*/.*/.*/.*/inc', '/*/inc/', '/*/*/inc', '/*/*/*/inc', '/*/*/*/*/inc', '/*/*', '*', '/*/inc/*', '/*/inc/*/*', '/*/inc/*/*/*', '/*/inc/*/*/*/*', '/.*/include', '/.
<darragh> */include/linux', '/inc', 'inc', '/.*', '.*', '/inc/.*', '/inc/.*/.*', '/.*', '/.*/inc', '/.*/inc/', '/.*/.*/inc/.*/.*/.*', '/inc/...*/.*/.*/.*', '/.*/include', '/.*/include/linux', '/.*/inc', 'inc', '/.*/.*', '.*', '/.*/inc/.*', '/.*/inc/.*/.*', '/.*/inc/.*/.*/.*', '/.*/inc/.*/.*/.*/.*'],


Index: rebuildcvshistory.cgi
===================================================================
RCS file: /cvsroot/mozilla/webtools/bonsai/rebuildcvshistory.cgi,v
retrieving revision 1.8
diff -u -p -u -r1.8 rebuildcvshistory.cgi
--- rebuildcvshistory.cgi	27 Jun 2002 04:31:28 -0000	1.8
+++ rebuildcvshistory.cgi	2 Oct 2002 09:35:46 -0000
@@ -1,4 +1,4 @@
-#!/usr/bonsaitools/bin/perl -w
+#!/usr/bin/perl -w
 #
 # The contents of this file are subject to the Netscape Public
 # License Version 1.1 (the "License"); you may not use this file
@@ -19,6 +19,8 @@
 #
 # Contributor(s): 
 
+push (@INC, "/var/www/bonsai");
+
 use diagnostics;
 use strict;
 
@@ -39,6 +41,7 @@ sub ProcessOneFile {
      my ($filename) = @_;
      my $rlog = Param('rlogcommand') . " $filename |";
      my $doingtags = 0;
+     my $stat = 'C';
      my $filehead = dirname($filename);
      my (%branchname, $filerealname, $filetail, $line, $trimmed);
      my ($tag, $version, $branchid, $dirid, $fileid, $indesc, $desc);
@@ -112,7 +115,7 @@ sub ProcessOneFile {
                                    $datestr =~ s!^(\d{4})/(\d+/\d+)!$2/$1!;
                                    $date = str2time($datestr, "GMT");
                                    if ($date >= $::StartFrom) {
-                                        AddToDatabase("C|$date|$author|$::Repository|$filehead|$filetail|$revision||$branch|+$pluscount|-$minuscount", $desc);
+                                        AddToDatabase("$stat|$date|$author|$::Repository|$filehead|$filetail|$revision||$branch|+$pluscount|-$minuscount", $desc);
                                    }
                               }
                               $indesc = 0;
@@ -127,6 +130,7 @@ sub ProcessOneFile {
                          if ($line =~ /^revision ([0-9.]*)$/) {
                               $pluscount = ($minuscount = 0);
                               $date = ($indesc = 0);
+			      $stat = 'C';
                               $datestr = ($desc = ($branch = ($author = "")));
                               $revision = $1;
 
@@ -142,10 +146,18 @@ sub ProcessOneFile {
                               $line =~ s!^author: ([^;]*);\s+!!;
                               $author = $1;
 
+			      if ($line =~ /state: dead;/) {
+				  $stat = 'R';
+			      } else {
+				  $stat = 'C';
+			      }
+
                               if ($line =~ /lines: \+(\d+) -(\d+)/) {
                                    $pluscount = $1;
                                    $minuscount = $2;
-                              }
+			      } else {
+				   $stat = 'A';
+			      }
                          }
 
                          elsif ($line =~ /^branches: [0-9 .;]*$/) {
@@ -204,6 +216,13 @@ sub ProcessDirectory {
 
 
 $| = 1;
+my $update = 0;
+my $TIMESTAMP_PATH = '/var/lxr/batch-timestamp';
+# max time from ooo cvs -> me refreshing [?]
+my $DODGY_SAFETY_FACTOR = 3600 * 4;
+my $a;
+my $mtime;
+my $cvsup_upd = 0;
 
 if ($#ARGV == 4) {
      $::TreeID                   = $ARGV[0];
@@ -211,6 +230,26 @@ if ($#ARGV == 4) {
      $::FORM{'firstfile'}        = $ARGV[2];
      $::FORM{'subdir'}           = $ARGV[3];
      $::FORM{'modules'}          = $ARGV[4];
+} elsif ($#ARGV == 0) {
+     $::TreeID                   = $ARGV[0];
+
+# Coupled to cvsup via this ...     
+     $mtime = 0;
+     ($a,$a,$a,$a,$a,$a,$a,$a,
+      $a,$mtime,$a,$a,$a)
+	 = stat($TIMESTAMP_PATH);
+     if ($mtime) {
+	 $::FORM{'startfrom'} = gmtime ($mtime - $DODGY_SAFETY_FACTOR);
+     } else {
+	 $::FORM{'startfrom'} = '';
+     }
+     print ("Updating from stamp ". gmtime ($mtime));
+     
+     $::FORM{'firstfile'}        = '';
+     $::FORM{'subdir'}           = '';
+     $::FORM{'modules'}          = '';
+
+     $cvsup_upd = 1;
 } else {
      print "Content-type: text/html
 
@@ -255,21 +294,51 @@ my $StartingDir;
 ($StartingDir = "$::Repository/$::SubDir") =~ s!/.?$!! if $::SubDir;
 
 
-print "Doing directories: @Dirs ...\n";
-foreach my $Dir (@Dirs) {
-     my $dir = "$::Repository/$Dir";
-
-     unless (grep $Dir, @::LegalDirs) {
-          print "$Dir: is invalid, skipping...\n";
-     }
-
-     if (-f $dir) {
-          ProcessOneFile($dir);
-     } elsif (-d $dir) {
-          ProcessDirectory($dir);
-     } else {
-          print "$Dir: not a file or directory, skipping...\n";
-     }
+if ($cvsup_upd) {
+    # CVSup prints before synching ...
+    my $delay_line='';
+    while (<STDIN>) {
+	my $line;
+	my $attic;
+	my $basename;
+	my $fname;
+	
+	$line = $_;
+
+	if ($delay_line) {
+		ProcessOneFile($delay_line);
+		$delay_line='';
+	}
+
+	if ($line =~ /\-\> Attic/) {
+	    $attic = "/Attic";
+	} else {
+	    $attic = '';
+	}
+	if ($line =~ /^ (Edit|Create) (.*\,v)/) {
+	    $basename = $fname = $2;
+	    $basename =~ s|/([^/]*)$||;
+	    $fname = $1;
+	    $delay_line = "$::Repository/$basename$attic/$fname";
+	}
+    }
+} else {
+    print "Doing directories: @Dirs ...\n";
+    foreach my $Dir (@Dirs) {
+	my $dir = "$::Repository/$Dir";
+	my $attic;
+	
+	unless (grep $Dir, @::LegalDirs) {
+	    print "$Dir: is invalid, skipping...\n";
+	
+        } elsif (-f $dir) {
+	    ProcessOneFile($dir);
+	} elsif (-d $dir) {
+	    ProcessDirectory($dir);
+	} else {
+	    print "$Dir: not a file or directory, skipping...\n";
+	}
+    }
 }
 
 exit 0;