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 !";
302 &addmaintainers($s_package);
303 if ( length( $gDoneList ) > 0 && length( $gListDomain ) > 0 )
304 { &addccaddress("$gDoneList\@$gListDomain"); }
306 @message = @notify_done_email;
307 &Debbugs::Email::ProcessTags( \@message, \@BTags, "BTAG" );
308 &Debbugs::Email::ProcessTags( \@message, \@LTags, "LTAG" );
309 &sendmailmessage( join( "\n", @message), $s_originator );
311 } while (&getnextbug);
314 } elsif (m/^reassign\s+\#?(\d+)\s+(\S.*\S)$/i) {
316 $ref= $1; $newpackage= $2;
317 $newpackage =~ y/A-Z/a-z/;
319 if (length($s_package)) {
320 $action= "$gBug reassigned from package \`$s_package'".
321 " to \`$newpackage'.";
323 $action= "$gBug assigned to package \`$newpackage'.";
326 &addmaintainers($s_package);
327 &addmaintainers($newpackage);
328 $s_package= $newpackage;
329 } while (&getnextbug);
331 } elsif (m/^reopen\s+\#?(\d+)$/i ? ($noriginator='', 1) :
332 m/^reopen\s+\#?(\d+)\s+\=$/i ? ($noriginator='', 1) :
333 m/^reopen\s+\#?(\d+)\s+\!$/i ? ($noriginator=$replyto, 1) :
334 m/^reopen\s+\#?(\d+)\s+(\S.*\S)$/i ? ($noriginator=$2, 1) : 0) {
338 if (!length($s_done)) {
339 &transcript("$gByg is already open, cannot reopen.\n\n");
343 $noriginator eq '' ? "$gBug reopened, originator not changed." :
344 "$gBug reopened, originator set to $noriginator.";
346 &addmaintainers($s_package);
347 $s_originator= $noriginator eq '' ? $s_originator : $noriginator;
349 } while (&getnextbug);
352 } elsif (m/^forwarded\s+\#?(\d+)\s+(\S.*\S)$/i) {
354 $ref= $1; $whereto= $2;
356 if (length($s_forwarded)) {
357 $action= "Forwarded-to-address changed from $s_forwarded to $whereto.";
359 $action= "Noted your statement that $gBug has been forwarded to $whereto.";
361 if (length($s_done)) {
362 $extramessage= "(By the way, this $gBug is currently marked as done.)\n";
365 &addmaintainers($s_package);
366 if (length($gFowardList)>0 && length($gListDomain)>0 )
367 { &addccaddress("$gFowardList\@$gListDomain"); }
368 $s_forwarded= $whereto;
369 } while (&getnextbug);
371 } elsif (m/^notforwarded\s+\#?(\d+)$/i) {
375 if (!length($s_forwarded)) {
376 &transcript("$gBug is not marked as having been forwarded.\n\n");
379 $action= "Removed annotation that $gBug had been forwarded to $s_forwarded.";
381 &addmaintainers($s_package);
383 } while (&getnextbug);
386 } elsif (m/^severity\s+\#?(\d+)\s+([-0-9a-z]+)$/i ||
387 m/^priority\s+\#?(\d+)\s+([-0-9a-z]+)$/i) {
391 if (!grep($_ eq $newseverity, @severities, "$gDefaultSeverity")) {
392 &transcript("Severity level \`$newseverity' is not known.\n".
393 "Recognised are: ".join(' ',@showseverities).".\n\n");
395 $printseverity= $s_severity;
396 $printseverity= "$gDefaultSeverity" if $printseverity eq '';
397 $action= "Severity set to \`$newseverity'.";
399 &addmaintainers($s_package);
400 $s_severity= $newseverity;
401 } while (&getnextbug);
403 } elsif (m/^retitle\s+\#?(\d+)\s+(\S.*\S)\s*$/i) {
405 $ref= $1; $newtitle= $2;
408 &addmaintainers($s_package);
409 $s_subject= $newtitle;
410 $action= "Changed $gBug title.";
412 &transcript("$action\n");
413 if (length($s_done)) {
414 &transcript("(By the way, that $gBug is currently marked as done.)\n");
420 } elsif (m/^unmerge\s+\#?(\d+)$/i) {
424 if (!length($s_mergedwith)) {
425 &transcript("$gBug is not marked as being merged with any others.\n\n");
428 $mergelowstate eq 'locked' || die "$mergelowstate ?";
429 $action= "Disconnected #$ref from all other report(s).";
430 @newmergelist= split(/ /,$s_mergedwith);
433 &addmaintainers($s_package);
434 $s_mergedwith= ($ref == $discref) ? ''
435 : join(' ',grep($_ ne $ref,@newmergelist));
436 } while (&getnextbug);
439 } elsif (m/^merge\s+(\d+(\s+\d+)+)\s*$/i) {
441 @tomerge= sort { $a <=> $b } split(/\s+/,$1);
444 while (defined($ref= shift(@tomerge))) {
445 &transcript("D| checking merge $ref\n") if $dl;
447 next if grep($_ eq $ref,@newmergelist);
448 if (!&getbug) { ¬foundbug; @newmergelist=(); last }
450 &transcript("D| adding $ref ($s_mergewith)\n") if $dl;
452 &checkmatch('package','m_package',$s_package);
453 &checkmatch('forwarded addr','m_forwarded',$s_forwarded);
454 &checkmatch('severity','m_severity',$s_severity);
455 &checkmatch('done mark','m_done',length($s_done) ? 'done' : 'open');
456 if (length($mismatch)) {
457 &transcript("Mismatch - only $Bugs in same state can be merged:\n".
459 &cancelbug; @newmergelist=(); last;
461 push(@newmergelist,$ref);
462 push(@tomerge,split(/ /,$s_mergedwith));
466 @newmergelist= sort { $a <=> $b } @newmergelist;
467 $action= "Merged @newmergelist.";
468 for $ref (@newmergelist) {
469 &getbug || die "huh ? $gBug $ref disappeared during merge";
470 &addmaintainers($s_package);
471 $s_mergedwith= join(' ',grep($_ ne $ref,@newmergelist));
474 &transcript("$action\n\n");
478 &transcript("Unknown command or malformed arguments to command.\n\n");
479 if (++$unknowns >= 5) {
480 &transcript("Too many unknown commands, stopping here.\n\n");
485 if ($procline>$#msg) {
486 &transcript(">\nEnd of message, stopping processing here.\n\n");
489 &transcript("No commands successfully parsed; sending the help text(s).\n");
494 &transcript("MC\n") if $dl>1;
496 for $maint (keys %maintccreasons) {
497 &transcript("MM|$maint|\n") if $dl>1;
498 next if $maint eq $replyto;
500 $reasonsref= $maintccreasons{$maint};
501 &transcript("MY|$maint|\n") if $dl>2;
502 for $p (sort keys %$reasonsref) {
503 &transcript("MP|$p|\n") if $dl>2;
504 $reasonstring.= ', ' if length($reasonstring);
505 $reasonstring.= $p.' ' if length($p);
506 $reasonstring.= join(' ',map("#$_",sort keys %{$$reasonsref{$p}}));
508 push(@maintccs,"$maint ($reasonstring)");
509 push(@maintccaddrs,"$maint");
512 &transcript("MC|@maintccs|\n") if $dl>2;
513 $maintccs= "Cc: ".join(",\n ",@maintccs)."\n";
514 } else { $maintccs = ""; }
517 From: $gMaintainerEmail ($gProject $gBug Tracking System)
519 ${maintccs}Subject: Processed: $header{'subject'}
520 In-Reply-To: $header{'message-id'}
521 References: $header{'message-id'}
522 Message-ID: <handler.s.$nn.transcript\@$gEmailDomain>
524 ${transcript}Please contact me if you need assistance.
527 (administrator, $gProject $gBugs database)
531 $repliedshow= join(', ',$replyto,@maintccaddrs);
532 &filelock("lock/-1");
533 open(AP,">>db/-1.log") || &quit("open db/-1.log: $!");
535 "\2\n$repliedshow\n\5\n$reply\n\3\n".
537 "<strong>Request received</strong> from <code>".
538 &sani($header{'from'})."</code>\n".
539 "to <code>".&sani($controlrequestaddr)."</code>\n".
541 "\7\n",@log,"\n\3\n") || &quit("writing db/-1.log: $!");
542 close(AP) || &quit("open db/-1.log: $!");
544 utime(time,time,"db");
546 &sendmailmessage($reply,$replyto,@maintccaddrs);
548 unlink("incoming/P$nn") || &quit("unlinking incoming/P$nn: $!");
552 map { $_->address() }
553 map { Mail::Address->parse($_) } @_;
556 sub sendmailmessage {
557 local ($message,@recips) = @_;
558 print "mailing to >@recips<\n" if $debug;
560 defined($c) || &quit("mailing forking for sendmail: $!");
561 if (!$c) { # ie, we are the child process
562 exec '/usr/lib/sendmail','-f'."$gMaintainerEmail",'-odi','-oem','-oi',get_addresses(@recips);
565 print(D $message) || &quit("writing to sendmail process: $!");
566 $!=0; close(D); $? && &quit("sendmail gave exit status $? ($!)");
571 &sendtxthelpraw("bug-log-mailserver.txt","instructions for request\@$gEmailDomain");
572 &sendtxthelpraw("bug-maint-mailcontrol.txt","instructions for control\@$gEmailDomain")
577 # &transcript("Sorry, command $_[0] not yet implemented.\n\n");
581 local ($string,$mvarname,$svarvalue) = @_;
584 eval "\$mvarvalue= \$$mvarname";
585 &transcript("D| checkmatch \`$string' /$mvarname/$mvarvalue/$svarvalue/\n")
588 "Values for \`$string' don't match:\n".
589 " #$newmergelist[0] has \`$mvarvalue';\n".
590 " #$ref has \`$svarvalue'\n"
591 if $mvarvalue ne $svarvalue;
593 &transcript("D| setupmatch \`$string' /$mvarname/$svarvalue/\n")
595 eval "\$$mvarname= \$svarvalue";
599 # High-level bug manipulation calls
600 # Do announcements themselves
602 # Possible calling sequences:
606 # &transcript(something)
610 # $action= (something)
612 # (modify s_* variables)
613 # } while (getnextbug);
616 &dlen("nochangebug");
617 $state eq 'single' || $state eq 'multiple' || die "$state ?";
619 &endmerge if $manybugs;
621 &dlex("nochangebug");
625 &dlen("setbug $ref");
626 $state eq 'idle' || die "$state ?";
629 &dlex("setbug => 0s");
632 @thisbugmergelist= split(/ /,$s_mergedwith);
633 if (!@thisbugmergelist) {
638 &dlex("setbug => 1s");
647 &dlex("setbug => 0mc");
651 $state= 'multiple'; $sref=$ref;
652 &dlex("setbug => 1m");
658 $state eq 'single' || $state eq 'multiple' || die "$state ?";
660 if (!$manybugs || !@thisbugmergelist) {
661 length($action) || die;
662 &transcript("$action\n$extramessage\n");
663 &endmerge if $manybugs;
665 &dlex("getnextbug => 0");
668 $ref= shift(@thisbugmergelist);
669 &getbug || die "bug $ref disappeared";
671 &dlex("getnextbug => 1");
675 # Low-level bug-manipulation calls
676 # Do no announcements
684 # $action= (something)
689 # [getbug (returns 0)]
690 # &transcript("$action\n\n")
693 sub notfoundbug { &transcript("$gBug number $ref not found.\n\n"); }
694 sub foundbug { &transcript("$gBug#$ref: $s_subject\n"); }
698 $mergelowstate eq 'idle' || die "$mergelowstate ?";
699 &filelock('lock/merge');
700 $mergelowstate='locked';
706 $mergelowstate eq 'locked' || die "$mergelowstate ?";
708 $mergelowstate='idle';
713 &dlen("getbug $ref");
714 $lowstate eq 'idle' || die "$state ?";
715 if (&lockreadbug($ref)) {
718 &dlex("getbug => 1");
723 &dlex("getbug => 0");
729 $lowstate eq 'open' || die "$state ?";
736 &dlen("savebug $ref");
737 $lowstate eq 'open' || die "$lowstate ?";
738 length($action) || die;
739 $ref == $sref || die "read $sref but saving $ref ?";
740 open(L,">>db/$ref.log") || &quit("opening db/$ref.log: $!");
743 "<strong>".&sani($action)."</strong>\n".
744 "Request was from <code>".&sani($header{'from'})."</code>\n".
745 "to <code>".&sani($controlrequestaddr)."</code>. \n".
747 "\7\n",@log,"\n\3\n") || &quit("writing db/$ref.log: $!");
748 close(L) || &quit("closing db/$ref.log: $!");
749 open(S,">db/$ref.status.new") || &quit("opening db/$ref.status.new: $!");
760 "$s_severity\n") || &quit("writing db/$ref.status.new: $!");
761 close(S) || &quit("closing db/$ref.status.new: $!");
762 rename("db/$ref.status.new","db/$ref.status") ||
763 &quit("installing new db/$ref.status: $!");
771 &transcript("C> @_ ($state $lowstate $mergelowstate)\n");
776 &transcript("R> @_ ($state $lowstate $mergelowstate)\n");
780 print $_[0] if $debug;
797 local ($relpath,$description) = @_;
799 open(D,"$gDocDir/$relpath") || &quit("open doc file $relpath: $!");
800 while(<D>) { $doc.=$_; }
802 &transcript("Sending $description in separate message.\n");
803 &sendmailmessage(<<END.$doc,$replyto);
804 From: $gMaintainerEmail ($gProject $gBug Tracking System)
806 Subject: $gProject $gBug help: $description
807 References: $header{'message-id'}
808 In-Reply-To: $header{'message-id'}
809 Message-ID: <handler.s.$nn.help.$midix\@$gEmailDomain>
816 local ($relpath,$description) = @_;
818 open(L,"lynx -nolist -dump $wwwbase/$relpath 2>&1 |") || &quit("fork for lynx: $!");
819 while(<L>) { $doc.=$_; }
821 if ($? == 255 && $doc =~ m/^\n*lynx: Can\'t access start file/) {
822 &transcript("Information ($description) is not available -\n".
823 "perhaps the $gBug does not exist or is not on the WWW yet.\n");
826 &transcript("Error getting $description (code $? $!):\n$doc\n");
828 &transcript("Sending $description.\n");
829 &sendmailmessage(<<END.$doc,$replyto);
830 From: $gMaintainerEmail ($gProject $gBug Tracking System)
832 Subject: $gProject $gBugs information: $description
833 References: $header{'message-id'}
834 In-Reply-To: $header{'message-id'}
835 Message-ID: <handler.s.$nn.info.$midix\@$gEmailDomain>
844 $maintccreasons{$cca}{''}{$ref}= 1;
848 { # Data structure is:
849 # maintainer email address &c -> assoc of packages -> assoc of bug#'s
850 my ($p, $addmaint, $pshow);
851 &ensuremaintainersloaded;
852 $anymaintfound=0; $anymaintnotfound=0;
853 for $p (split(m/[ \t?,()]+/,$_[0]))
855 $pshow= ($p =~ m/[-+.a-z0-9]+/ ? $& : '');
856 if (defined($maintainerof{$p}))
857 { $addmaint= $maintainerof{$p};
858 &transcript("MR|$addmaint|$p|$ref|\n") if $dl>2;
859 $maintccreasons{$addmaint}{$p}{$ref}= 1;
860 print "maintainer add >$p|$addmaint<\n" if $debug;
861 } else { print "maintainer none >$p<\n" if $debug; }
865 sub ensuremaintainersloaded {
867 return if $maintainersloaded++;
868 open(MAINT,"$gMaintainerFile") || die &quit("maintainers open: $!");
870 m/^(\S+)\s+(\S.*\S)\n$/ || &quit("maintainers bogus \`$_'");
871 $a= $1; $b= $2; $a =~ y/A-Z/a-z/;
872 $maintainerof{$1}= $2;
879 print <<"EOT-EOT-EOT";
880 Syntax: $FILE [options]
881 -c, --config CFGFILE read CFGFILE for configuration (default=./debvote.cfg)
882 -h, --help display this help text
883 -v, --verbose verbose messages
884 -q, --quiet cancels verbose in a config file
885 -V, --version display Debvote version and exit
886 -d, --debug turn debug messages ON (multiple -d for more verbose)