2 # Usage: service <code>.nn
3 # Temps: incoming/P<code>.nn
14 #############################################################################
15 # Gloabal Variable Declaration
16 #############################################################################
17 my $VERSION = '3.01'; #External Version number
18 my $BANNER = "DebBugs v$VERSION"; #Version Banner - text form
19 my $FILE = 'debbugs-service'; #File name
23 my $inputfilename; #file specified on commandline
26 my $control; #call to control or request
28 my @body; #list of commands
29 my $replyto; #address of to send reply to
30 my $transcript = ''; #building of return message
31 my %LTags; #Tags Local to this email
32 my @message; #holds copy of msg to apply tags
34 #############################################################################
36 #############################################################################
37 # Hash used to process commandline options
41 my %opthash = (# ------------------ actions
42 "config|c=s" => \$config,
44 "version|V" => \&banner,
45 "verbose|v!" => \$verbose,
46 "quiet|q!" => \$quiet,
47 "debug|d+" => \$debug, # Count the -d flags
49 Getopt::Long::config('bundling', 'no_getopt_compat', 'no_auto_abbrev');
50 GetOptions(%opthash) or &syntax( 1 );
52 { print "D2: Commandline:\n";
53 print "\tconfig = $config\n" unless $config eq '';
54 print "\tverbos\n" if $verbose;
55 print "\tquiet\n" if $quiet;
56 print "\tdebug = $debug\n";
58 $Globals{ 'debug' } = $debug;
59 $Globals{ 'quiet' } = $quiet;
60 $Globals{ 'verbose' } = $verbose;
62 #############################################################################
63 # Read Config File and parse
64 #############################################################################
65 $config = "./debbugs.cfg" if( $config eq '' );
66 print "D1: config file=$config\n" if $Globals{ 'debug' };
67 @config = Debbugs::Config::ParseConfigFile( $config );
69 #############################################################################
70 # Load in template emails
71 #############################################################################
72 @notify_done_email = Debbugs::Email::LoadEmail( $Globals{ 'template-dir' }.'/'.$Globals{ 'not-don-con' } );
74 #############################################################################
75 # Find file name and load input file
76 #############################################################################
78 m/^[RC]\.\d+$/ || &fail("bad argument");
81 if (!rename( $Globals{ 'spool-dir' }."G$inputfilename", $Globals{ 'spool-dir' }."P$inputfilename"))
83 m/no such file or directory/i && exit 0;
84 &fail("renaming to lock: $!");
87 ############################################################################
88 # Set up MIME Message class
89 ############################################################################
90 my $parser = new MIME::Parser;
91 $parser->output_dir("$ENV{HOME}/mimemail");
92 $parser->output_prefix("part");
93 $parser->output_to_core(100000);
94 my $inputmail = $parser->parse_in("P$inputfilename") or die "couldn't parse MIME file";
95 #for use when stdin in stead of file is used
96 #my $inputmail = $parser->read(\*STDIN) or die "couldn't parse MIME stream";
98 ############################################################################
99 # Extract first part (if mime type) for processing. All else assumed junk
100 ############################################################################
101 if ( $inputmail->is_multipart )
102 { my $parts = $inputmail->parts( 0 );
103 while( $parts->is_multipart ) { $parts = $parts->parts( 0 ); }
104 @body = $parts->bodyhandle->as_lines;
106 else { @body = $inputmail->bodyhandle->as_lines; }
109 $inputmail->head->count('From') || &fail( "no From header" );
111 ############################################################################
112 # Determine Reply To address
113 ############################################################################
114 my $header = $input->mail->head;
115 $replyto= $header->count( "Reply-to" ) ? $header->get( "Reply-to" ) : $header->get( "From" );
117 ############################################################################
118 # Add Email info to Local Tags (LTags)
119 ############################################################################
120 $LTags{ 'REPLY_TO' ) = $replyto;
121 $LTags{ 'CC_TO' ) = $header->get( 'CC' ) if $header->count( 'CC' );
122 $LTags{ 'MESSAGE_ID' } = $header->get( 'Message-id' ) if $header->count( 'Message-id' );
123 $LTags{ 'MESSAGE_BODY' } = join( '\n', @body );
124 $LTags( 'MESSAGE_DATA' } = "control";
125 $LTags{ 'MESSAGE_DATE' } = $header->get( 'Date' ) if $header->count( 'Date');
126 if ( $header->count( 'Subject' ) )
127 { $LTags{ 'MESSAGE_SUBJECT' } = $header->get( 'Subject' ); }
128 else { &transcript( <<END ); }
129 Your email does not include a Subject line in the header. This is a
130 violation of the specifications and may cause your email to be rejected at
135 ############################################################################
136 # Start processing of commands
137 ############################################################################
138 if ( $control ) { &transcript("Processing commands for control message:\n\n"); }
139 else { &transcript("Processing commands for request message:\n\n"); }
141 ####################################### HERE ###############################
144 $mergelowstate= 'idle';
148 for ( my $procline=0; $procline<=$#body; $procline++)
151 $state eq 'idle' || print "$state ?\n";
152 $lowstate eq 'idle' || print "$lowstate ?\n";
153 $mergelowstate eq 'idle' || print "$mergelowstate ?\n";
157 s/\s+$//; #strip ending white space, including newlines
160 next unless m/\S/; #skip blank lines
161 next if m/^\s*\#/; #skip comment-only lines
162 &transcript("> $_\n");
166 if (m/^stop\s/i || m/^quit\s/i || m/^--/ || m/^thank\s/i)
167 { &transcript("Stopping processing here.\n\n");
169 } elsif (m/^debug\s+(\d+)$/i && $1 >= 0 && $1 <= 1000)
171 &transcript("Debug level $debug.\n\n");
172 } elsif (m/^(send|get)\s+\#?(\d{2,})$/i)
173 { $ref= $2+0; $reffile= $ref; $reffile =~ s,^..,$&/$&,;
174 &sendlynxdoc( "db/$reffile.html", "logs for $gBug#$ref" );
175 } elsif (m/^send-detail\s+\#?(\d+)$/i)
176 { $ref= $1+0; $reffile= $ref; $reffile =~ s,^..,$&/$&,;
177 &sendlynxdoc("db/$reffile-b.html","additional logs for $gBug#$ref");
178 } elsif (m/^index(\s+full)?$/i) {
179 &sendlynxdoc("db/ix/full.html",'full index');
180 } elsif (m/^index-summary\s+by-package$/i) {
181 &sendlynxdoc("db/ix/psummary.html",'summary index sorted by package/title');
182 } elsif (m/^index-summary(\s+by-number)?$/i) {
183 &sendlynxdoc("db/ix/summary.html",'summary index sorted by number/date');
184 } elsif (m/^index(\s+|-)pack(age)?s?$/i) {
185 &sendlynxdoc("db/ix/packages.html",'index of packages');
186 } elsif (m/^index(\s+|-)maints?$/i) {
187 &sendlynxdoc("db/ix/maintainers.html",'index of maintainers');
188 } elsif (m/^index(\s+|-)maint\s+(\S.*\S)$/i) {
189 $substrg= $2; $matches=0;
190 opendir(DBD,"$gWebDir/db/ma") || die $!;
191 while (defined($_=readdir(DBD))) {
192 next unless m/^l/ && m/\.html$/;
193 &transcript("F|$_\n") if $dl>1;
194 $filename= $_; s/^l//; s/\.html$//;
195 &transcript("P|$_\n") if $dl>2;
196 while (s/-(..)([^_])/-$1_-$2/) { }
197 &transcript("P|$_\n") if $dl>2;
198 s/^(.{0,2})_/$1-20_/g; while (s/([^-]..)_/$1-20_/) { };
199 &transcript("P|$_\n") if $dl>2;
200 s/^,(.*),(.*),([^,]+)$/$1-40_$2-20_-28_$3-29_/;
201 &transcript("P|$_\n") if $dl>2;
202 s/^([^,]+),(.*),(.*),$/$1-20_-3c_$2-40_$3-3e_/;
203 &transcript("P|$_\n") if $dl>2;
205 &transcript("P|$_\n") if $dl>2;
207 while (m/-(..)_/) { $out.= $`.sprintf("%c",hex($1)); $_=$'; }
209 &transcript("M|$out\n") if $dl>1;
210 next unless index(lc $out, lc $substrg)>=0;
211 &transcript("S|$filename\n") if $dl>0;
212 &transcript("S|$out\n") if $dl>0;
214 &sendlynxdocraw("db/ma/$filename","$gBug list for maintainer \`$out'");
217 &transcript("$gBug list(s) for $matches maintainer(s) sent.\n\n");
219 &transcript("No maintainers found containing \`$substrg'.\n".
220 "Use \`index-maint' to get list of maintainers.\n\n");
223 } elsif (m/^index(\s+|-)pack(age)?s?\s+(\S.*\S)$/i) {
224 $substrg= $+; $matches=0;
225 opendir(DBD,"$gWebDir/db/pa") || die $!;
226 while (defined($_=readdir(DBD))) {
227 next unless m/^l/ && m/\.html$/;
228 &transcript("F|$_\n") if $dl>1;
229 $filename= $_; s/^l//; s/\.html$//;
230 next unless index(lc $_, lc $substrg)>=0;
231 &transcript("S|$filename\n") if $dl>0;
232 &transcript("S|$out\n") if $dl>0;
234 &sendlynxdocraw("db/pa/$filename","$gBug list for package \`$_'");
237 &transcript("$gBug list(s) for $matches package(s) sent.\n\n");
239 &transcript("No packages found containing \`$substrg'.\n".
240 "Use \`index-packages' to get list of packages.\n\n");
243 } elsif (m/^send-unmatched(\s+this|\s+-?0)?$/i) {
244 &sendlynxdoc("db/ju/unmatched-1.html","junk (this week)");
245 } elsif (m/^send-unmatched\s+(last|-1)$/i) {
246 &sendlynxdoc("db/ju/unmatched-2.html","junk (last week)");
247 } elsif (m/^send-unmatched\s+(old|-2)$/i) {
248 &sendlynxdoc("db/ju/unmatched-3.html","junk (two weeks ago)");
249 } elsif (m/^getinfo\s+(\S+)$/i) {
251 if ($file =~ m/^\./ || $file !~ m/^[-.0-9a-z]+$/ || $file =~ m/\.gz$/) {
252 &transcript("Filename $file is badly formatted.\n\n");
253 } elsif (open(P,"$gDocDir/$file")) {
255 &transcript("Info file $file appears below.\n\n");
256 $extras.= "\n---------- Info file $file follows:\n\n";
257 while(<P>) { $extras.= $_; }
260 &transcript("Info file $file does not exist.\n\n");
262 } elsif (m/^help$/i) {
266 } elsif (m/^refcard$/i) {
267 &sendtxthelp("bug-mailserver-refcard.txt","mailservers' reference card");
268 } elsif (m/^subscribe/i) {
270 There is no $gProject $gBug mailing list. If you wish to review bug reports
271 please do so via http://$gWebUrl/ or ask this mailserver
273 soon: MAILINGLISTS_TEXT
275 } elsif (m/^unsubscribe/i) {
277 soon: UNSUBSCRIBE_TEXT
278 soon: MAILINGLISTS_TEXT
280 } elsif (!$control) {
282 Unknown command or malformed arguments to command.
283 (Use control\@$gEmailDomain to manipulate reports.)
286 if (++$unknowns >= 3) {
287 &transcript("Too many unknown commands, stopping here.\n\n");
290 } elsif (m/^close\s+\#?(\d+)$/i) {
294 if(length($s_done)) {
295 &transcript("$gBug is already closed, cannot re-close.\n\n");
298 $action= "$gBug closed, ack sent to submitter - they'd better know why !";
301 &addmaintainers($s_package);
302 if ( length( $gDoneList ) > 0 && length( $gListDomain ) > 0 )
303 { &addccaddress("$gDoneList\@$gListDomain"); }
305 @message = @notify_done_email;
306 &Debbugs::Email::ProcessTags( \@message, \@BTags, "BTAG" );
307 &Debbugs::Email::ProcessTags( \@message, \@LTags, "LTAG" );
308 &sendmailmessage( join( "\n", @message), $s_originator );
310 } while (&getnextbug);
313 } elsif (m/^reassign\s+\#?(\d+)\s+(\S.*\S)$/i) {
315 $ref= $1; $newpackage= $2;
316 $newpackage =~ y/A-Z/a-z/;
318 if (length($s_package)) {
319 $action= "$gBug reassigned from package \`$s_package'".
320 " to \`$newpackage'.";
322 $action= "$gBug assigned to package \`$newpackage'.";
325 &addmaintainers($s_package);
326 &addmaintainers($newpackage);
327 $s_package= $newpackage;
328 } while (&getnextbug);
330 } elsif (m/^reopen\s+\#?(\d+)$/i ? ($noriginator='', 1) :
331 m/^reopen\s+\#?(\d+)\s+\=$/i ? ($noriginator='', 1) :
332 m/^reopen\s+\#?(\d+)\s+\!$/i ? ($noriginator=$replyto, 1) :
333 m/^reopen\s+\#?(\d+)\s+(\S.*\S)$/i ? ($noriginator=$2, 1) : 0) {
337 if (!length($s_done)) {
338 &transcript("$gByg is already open, cannot reopen.\n\n");
342 $noriginator eq '' ? "$gBug reopened, originator not changed." :
343 "$gBug reopened, originator set to $noriginator.";
345 &addmaintainers($s_package);
346 $s_originator= $noriginator eq '' ? $s_originator : $noriginator;
348 } while (&getnextbug);
351 } elsif (m/^forwarded\s+\#?(\d+)\s+(\S.*\S)$/i) {
353 $ref= $1; $whereto= $2;
355 if (length($s_forwarded)) {
356 $action= "Forwarded-to-address changed from $s_forwarded to $whereto.";
358 $action= "Noted your statement that $gBug has been forwarded to $whereto.";
360 if (length($s_done)) {
361 $extramessage= "(By the way, this $gBug is currently marked as done.)\n";
364 &addmaintainers($s_package);
365 if (length($gFowardList)>0 && length($gListDomain)>0 )
366 { &addccaddress("$gFowardList\@$gListDomain"); }
367 $s_forwarded= $whereto;
368 } while (&getnextbug);
370 } elsif (m/^notforwarded\s+\#?(\d+)$/i) {
374 if (!length($s_forwarded)) {
375 &transcript("$gBug is not marked as having been forwarded.\n\n");
378 $action= "Removed annotation that $gBug had been forwarded to $s_forwarded.";
380 &addmaintainers($s_package);
382 } while (&getnextbug);
385 } elsif (m/^severity\s+\#?(\d+)\s+([-0-9a-z]+)$/i ||
386 m/^priority\s+\#?(\d+)\s+([-0-9a-z]+)$/i) {
390 if (!grep($_ eq $newseverity, @severities, "$gDefaultSeverity")) {
391 &transcript("Severity level \`$newseverity' is not known.\n".
392 "Recognised are: ".join(' ',@showseverities).".\n\n");
394 $printseverity= $s_severity;
395 $printseverity= "$gDefaultSeverity" if $printseverity eq '';
396 $action= "Severity set to \`$newseverity'.";
398 &addmaintainers($s_package);
399 $s_severity= $newseverity;
400 } while (&getnextbug);
402 } elsif (m/^retitle\s+\#?(\d+)\s+(\S.*\S)\s*$/i) {
404 $ref= $1; $newtitle= $2;
407 &addmaintainers($s_package);
408 $s_subject= $newtitle;
409 $action= "Changed $gBug title.";
411 &transcript("$action\n");
412 if (length($s_done)) {
413 &transcript("(By the way, that $gBug is currently marked as done.)\n");
419 } elsif (m/^unmerge\s+\#?(\d+)$/i) {
423 if (!length($s_mergedwith)) {
424 &transcript("$gBug is not marked as being merged with any others.\n\n");
427 $mergelowstate eq 'locked' || die "$mergelowstate ?";
428 $action= "Disconnected #$ref from all other report(s).";
429 @newmergelist= split(/ /,$s_mergedwith);
432 &addmaintainers($s_package);
433 $s_mergedwith= ($ref == $discref) ? ''
434 : join(' ',grep($_ ne $ref,@newmergelist));
435 } while (&getnextbug);
438 } elsif (m/^merge\s+(\d+(\s+\d+)+)\s*$/i) {
440 @tomerge= sort { $a <=> $b } split(/\s+/,$1);
443 while (defined($ref= shift(@tomerge))) {
444 &transcript("D| checking merge $ref\n") if $dl;
446 next if grep($_ eq $ref,@newmergelist);
447 if (!&getbug) { ¬foundbug; @newmergelist=(); last }
449 &transcript("D| adding $ref ($s_mergewith)\n") if $dl;
451 &checkmatch('package','m_package',$s_package);
452 &checkmatch('forwarded addr','m_forwarded',$s_forwarded);
453 &checkmatch('severity','m_severity',$s_severity);
454 &checkmatch('done mark','m_done',length($s_done) ? 'done' : 'open');
455 if (length($mismatch)) {
456 &transcript("Mismatch - only $Bugs in same state can be merged:\n".
458 &cancelbug; @newmergelist=(); last;
460 push(@newmergelist,$ref);
461 push(@tomerge,split(/ /,$s_mergedwith));
465 @newmergelist= sort { $a <=> $b } @newmergelist;
466 $action= "Merged @newmergelist.";
467 for $ref (@newmergelist) {
468 &getbug || die "huh ? $gBug $ref disappeared during merge";
469 &addmaintainers($s_package);
470 $s_mergedwith= join(' ',grep($_ ne $ref,@newmergelist));
473 &transcript("$action\n\n");
477 &transcript("Unknown command or malformed arguments to command.\n\n");
478 if (++$unknowns >= 5) {
479 &transcript("Too many unknown commands, stopping here.\n\n");
484 if ($procline>$#msg) {
485 &transcript(">\nEnd of message, stopping processing here.\n\n");
488 &transcript("No commands successfully parsed; sending the help text(s).\n");
493 &transcript("MC\n") if $dl>1;
495 for $maint (keys %maintccreasons) {
496 &transcript("MM|$maint|\n") if $dl>1;
497 next if $maint eq $replyto;
499 $reasonsref= $maintccreasons{$maint};
500 &transcript("MY|$maint|\n") if $dl>2;
501 for $p (sort keys %$reasonsref) {
502 &transcript("MP|$p|\n") if $dl>2;
503 $reasonstring.= ', ' if length($reasonstring);
504 $reasonstring.= $p.' ' if length($p);
505 $reasonstring.= join(' ',map("#$_",sort keys %{$$reasonsref{$p}}));
507 push(@maintccs,"$maint ($reasonstring)");
508 push(@maintccaddrs,"$maint");
511 &transcript("MC|@maintccs|\n") if $dl>2;
512 $maintccs= "Cc: ".join(",\n ",@maintccs)."\n";
513 } else { $maintccs = ""; }
516 From: $gMaintainerEmail ($gProject $gBug Tracking System)
518 ${maintccs}Subject: Processed: $header{'subject'}
519 In-Reply-To: $header{'message-id'}
520 References: $header{'message-id'}
521 Message-ID: <handler.s.$nn.transcript\@$gEmailDomain>
523 ${transcript}Please contact me if you need assistance.
526 (administrator, $gProject $gBugs database)
530 $repliedshow= join(', ',$replyto,@maintccaddrs);
531 &filelock("lock/-1");
532 open(AP,">>db/-1.log") || &quit("open db/-1.log: $!");
534 "\2\n$repliedshow\n\5\n$reply\n\3\n".
536 "<strong>Request received</strong> from <code>".
537 &sani($header{'from'})."</code>\n".
538 "to <code>".&sani($controlrequestaddr)."</code>\n".
540 "\7\n",@log,"\n\3\n") || &quit("writing db/-1.log: $!");
541 close(AP) || &quit("open db/-1.log: $!");
543 utime(time,time,"db");
545 &sendmailmessage($reply,$replyto,@maintccaddrs);
547 unlink("incoming/P$nn") || &quit("unlinking incoming/P$nn: $!");
551 map { $_->address() }
552 map { Mail::Address->parse($_) } @_;
555 sub sendmailmessage {
556 local ($message,@recips) = @_;
557 print "mailing to >@recips<\n" if $debug;
559 defined($c) || &quit("mailing forking for sendmail: $!");
560 if (!$c) { # ie, we are the child process
561 exec '/usr/lib/sendmail','-f'."$gMaintainerEmail",'-odi','-oem','-oi',get_addresses(@recips);
564 print(D $message) || &quit("writing to sendmail process: $!");
565 $!=0; close(D); $? && &quit("sendmail gave exit status $? ($!)");
570 &sendtxthelpraw("bug-log-mailserver.txt","instructions for request\@$gEmailDomain");
571 &sendtxthelpraw("bug-maint-mailcontrol.txt","instructions for control\@$gEmailDomain")
576 # &transcript("Sorry, command $_[0] not yet implemented.\n\n");
580 local ($string,$mvarname,$svarvalue) = @_;
583 eval "\$mvarvalue= \$$mvarname";
584 &transcript("D| checkmatch \`$string' /$mvarname/$mvarvalue/$svarvalue/\n")
587 "Values for \`$string' don't match:\n".
588 " #$newmergelist[0] has \`$mvarvalue';\n".
589 " #$ref has \`$svarvalue'\n"
590 if $mvarvalue ne $svarvalue;
592 &transcript("D| setupmatch \`$string' /$mvarname/$svarvalue/\n")
594 eval "\$$mvarname= \$svarvalue";
598 # High-level bug manipulation calls
599 # Do announcements themselves
601 # Possible calling sequences:
605 # &transcript(something)
609 # $action= (something)
611 # (modify s_* variables)
612 # } while (getnextbug);
615 &dlen("nochangebug");
616 $state eq 'single' || $state eq 'multiple' || die "$state ?";
618 &endmerge if $manybugs;
620 &dlex("nochangebug");
624 &dlen("setbug $ref");
625 $state eq 'idle' || die "$state ?";
628 &dlex("setbug => 0s");
631 @thisbugmergelist= split(/ /,$s_mergedwith);
632 if (!@thisbugmergelist) {
637 &dlex("setbug => 1s");
646 &dlex("setbug => 0mc");
650 $state= 'multiple'; $sref=$ref;
651 &dlex("setbug => 1m");
657 $state eq 'single' || $state eq 'multiple' || die "$state ?";
659 if (!$manybugs || !@thisbugmergelist) {
660 length($action) || die;
661 &transcript("$action\n$extramessage\n");
662 &endmerge if $manybugs;
664 &dlex("getnextbug => 0");
667 $ref= shift(@thisbugmergelist);
668 &getbug || die "bug $ref disappeared";
670 &dlex("getnextbug => 1");
674 # Low-level bug-manipulation calls
675 # Do no announcements
683 # $action= (something)
688 # [getbug (returns 0)]
689 # &transcript("$action\n\n")
692 sub notfoundbug { &transcript("$gBug number $ref not found.\n\n"); }
693 sub foundbug { &transcript("$gBug#$ref: $s_subject\n"); }
697 $mergelowstate eq 'idle' || die "$mergelowstate ?";
698 &filelock('lock/merge');
699 $mergelowstate='locked';
705 $mergelowstate eq 'locked' || die "$mergelowstate ?";
707 $mergelowstate='idle';
712 &dlen("getbug $ref");
713 $lowstate eq 'idle' || die "$state ?";
714 if (&lockreadbug($ref)) {
717 &dlex("getbug => 1");
722 &dlex("getbug => 0");
728 $lowstate eq 'open' || die "$state ?";
735 &dlen("savebug $ref");
736 $lowstate eq 'open' || die "$lowstate ?";
737 length($action) || die;
738 $ref == $sref || die "read $sref but saving $ref ?";
739 open(L,">>db/$ref.log") || &quit("opening db/$ref.log: $!");
742 "<strong>".&sani($action)."</strong>\n".
743 "Request was from <code>".&sani($header{'from'})."</code>\n".
744 "to <code>".&sani($controlrequestaddr)."</code>. \n".
746 "\7\n",@log,"\n\3\n") || &quit("writing db/$ref.log: $!");
747 close(L) || &quit("closing db/$ref.log: $!");
748 open(S,">db/$ref.status.new") || &quit("opening db/$ref.status.new: $!");
759 "$s_severity\n") || &quit("writing db/$ref.status.new: $!");
760 close(S) || &quit("closing db/$ref.status.new: $!");
761 rename("db/$ref.status.new","db/$ref.status") ||
762 &quit("installing new db/$ref.status: $!");
770 &transcript("C> @_ ($state $lowstate $mergelowstate)\n");
775 &transcript("R> @_ ($state $lowstate $mergelowstate)\n");
779 print $_[0] if $debug;
796 local ($relpath,$description) = @_;
798 open(D,"$gDocDir/$relpath") || &quit("open doc file $relpath: $!");
799 while(<D>) { $doc.=$_; }
801 &transcript("Sending $description in separate message.\n");
802 &sendmailmessage(<<END.$doc,$replyto);
803 From: $gMaintainerEmail ($gProject $gBug Tracking System)
805 Subject: $gProject $gBug help: $description
806 References: $header{'message-id'}
807 In-Reply-To: $header{'message-id'}
808 Message-ID: <handler.s.$nn.help.$midix\@$gEmailDomain>
815 local ($relpath,$description) = @_;
817 open(L,"lynx -nolist -dump $wwwbase/$relpath 2>&1 |") || &quit("fork for lynx: $!");
818 while(<L>) { $doc.=$_; }
820 if ($? == 255 && $doc =~ m/^\n*lynx: Can\'t access start file/) {
821 &transcript("Information ($description) is not available -\n".
822 "perhaps the $gBug does not exist or is not on the WWW yet.\n");
825 &transcript("Error getting $description (code $? $!):\n$doc\n");
827 &transcript("Sending $description.\n");
828 &sendmailmessage(<<END.$doc,$replyto);
829 From: $gMaintainerEmail ($gProject $gBug Tracking System)
831 Subject: $gProject $gBugs information: $description
832 References: $header{'message-id'}
833 In-Reply-To: $header{'message-id'}
834 Message-ID: <handler.s.$nn.info.$midix\@$gEmailDomain>
843 $maintccreasons{$cca}{''}{$ref}= 1;
847 { # Data structure is:
848 # maintainer email address &c -> assoc of packages -> assoc of bug#'s
849 my ($p, $addmaint, $pshow);
850 &ensuremaintainersloaded;
851 $anymaintfound=0; $anymaintnotfound=0;
852 for $p (split(m/[ \t?,()]+/,$_[0]))
854 $pshow= ($p =~ m/[-+.a-z0-9]+/ ? $& : '');
855 if (defined($maintainerof{$p}))
856 { $addmaint= $maintainerof{$p};
857 &transcript("MR|$addmaint|$p|$ref|\n") if $dl>2;
858 $maintccreasons{$addmaint}{$p}{$ref}= 1;
859 print "maintainer add >$p|$addmaint<\n" if $debug;
860 } else { print "maintainer none >$p<\n" if $debug; }
864 sub ensuremaintainersloaded {
866 return if $maintainersloaded++;
867 open(MAINT,"$gMaintainerFile") || die &quit("maintainers open: $!");
869 m/^(\S+)\s+(\S.*\S)\n$/ || &quit("maintainers bogus \`$_'");
870 $a= $1; $b= $2; $a =~ y/A-Z/a-z/;
871 $maintainerof{$1}= $2;
878 print <<"EOT-EOT-EOT";
879 Syntax: $FILE [options]
880 -c, --config CFGFILE read CFGFILE for configuration (default=./debvote.cfg)
881 -h, --help display this help text
882 -v, --verbose verbose messages
883 -q, --quiet cancels verbose in a config file
884 -V, --version display Debvote version and exit
885 -d, --debug turn debug messages ON (multiple -d for more verbose)