2 # $Id: html-control.in,v 1.12 2004/10/26 14:00:05 cjwatson Exp $
4 use POSIX qw(strftime tzset ENOENT);
8 $config_path = '/etc/debbugs';
9 $lib_path = '/usr/lib/debbugs';
11 require("$config_path/config");
12 require("$lib_path/errorlib");
13 $ENV{'PATH'} = $lib_path.':'.$ENV{'PATH'};
15 chdir("$gSpoolDir") || die "chdir spool: $!\n";
16 #push(@INC,"$lib_path");
18 &filelock("html.fcntl-lock");
20 unlink("html-data.gz") || $!==&ENOENT or die "remove html-data.gz: $!";
23 rename("stamp.html.run","stamp.html") or warn "warning: put back stamp.html: $!";
27 if (open(US,'updateseqs') && -f 'stamp.html') {
33 $args= "-diff -stampfile=stamp.html.run";
34 rename("stamp.html","stamp.html.run") or die "rename stamp.html: $!";
37 $lastmain = strftime "%Y%m%d%H%M%S", localtime;
39 unlink('stamp.html') || $!==&ENOENT or die "excise stale stamp.html: $!";
42 open(X,">stamp.html.new") or die "stamp.html.new: $!";
43 close(X) or die "close stamp.html.new: $!";
45 open(US,'>updateseqs.new') || die "create updateseqs.new: $!";
46 print(US "$lastmain\n$lastsub\n") || die "write updateseqs.new: $!";
47 close(US) || die "close updateseqs.new: $!";
48 rename('updateseqs.new','updateseqs') or nonawful("install updateseqs: $!");
51 my ($cmd,$errhref) = @_;
54 !$? && !length($stderr) or &$errhref("$cmd failed - gave $? / $stderr");
57 $sequences="$lastmain $lastsub";
58 $seqmid= $sequences; $seqmid =~ y/ /-/;
59 open(MM,">html-data.mail") or nonawful("open html-data.mail: $!");
60 if ( length( $gListDomain ) > 0 && length( $gMirrorList ) > 0 ) {
62 From: $gMaintainerEmail ($gProject $gBug Tracking System)
63 To: $gMirrorList\@$gListDomain
64 Subject: $gProject $gBugs autoupdate 259012
65 Message-ID: <handle.htmlup.$seqmid\@$gEmailDomain>
66 X-$gProject-PR: update $sequences
69 ) or nonawful("write html-data.mail header: $!");
72 From: $gMaintainerEmail ($gProject $gBug Tracking System)
74 Subject: $gProject $gBugs autoupdate 259012
75 Message-ID: <handle.htmlup.$seqmid\@$gEmailDomain>
76 X-$gProject-PR: update $sequences
79 ) or nonawful("write html-data.mail header: $!");
81 close(MM) or nonawful("close html-data.mail: $!");
83 runshell("$lib_path/db2html $args 2>&1 >html-data $gWebDir/db",
85 runshell("$lib_path/html-install $gWebDir/db <html-data 2>&1",sub { &quit; });
86 #runshell("gzip -9 html-data 2>&1",sub { &quit; });
87 #runshell("btoa 2>&1 <html-data.gz >>html-data.mail",sub { &quit; });
88 #runshell('2>&1 '.join(' ',('/usr/lib/sendmail','-f'."$gMaintainerEmail")).' -oem -oi -t <html-data.mail',
91 rename("stamp.html.new","stamp.html") or die "install new stamp.html: $!";
93 unlink("html-data") or warn "remove html-data: $!";
94 #unlink("html-data.gz") or warn "remove html-data.gz: $!";
95 #unlink("html-data.mail") or warn "remove html-data.mail: $!";
96 unlink("stamp.html.run") || $!==&ENOENT or warn "remove stamp.html.run: $!";
98 print "sequences $lastmain $lastsub\n";