]> git.donarmstrong.com Git - debbugs.git/commitdiff
[project @ 2000-10-07 16:17:09 by joy]
authorjoy <>
Sat, 7 Oct 2000 23:17:09 +0000 (15:17 -0800)
committerjoy <>
Sat, 7 Oct 2000 23:17:09 +0000 (15:17 -0800)
test if lynx is available before using it; use links if available; changed dependencies to Recommends: links | lynx; shortened output messages

debian/control
debian/debbugsconfig

index ea403dba37fce4904c9ac6d03cd7d898300fd11a..6dc5429cc5a6580b6d2165f776abf7020a2ef29b 100644 (file)
@@ -7,8 +7,8 @@ Build-Depends: debhelper
 
 Package: debbugs
 Architecture: all
-Depends: perl5 | perl, mail-transport-agent, mailtools, ed, lynx
-Recommends: httpd
+Depends: perl5 | perl, mail-transport-agent, mailtools, ed
+Recommends: httpd, links | lynx
 Description: The bug tracking system based on the active Debian BTS
  Debian has a bug tracking system which files details of bugs reported by
  users and developers. Each bug is given a number, and is kept on file until
index 8819962d939b4bb4a82d18f728eade520e456fd5..622ddd45cf35ecdaaa0d78c96736b9fc847ca298 100755 (executable)
@@ -27,9 +27,17 @@ require "text";
 
 &template("nextnumber");
 
+# stuff used when testing (comment out the above)
+#unshift @INC, "../";
+#require "../scripts/config.in";
+#require "../scripts/text.in";
+#$gWebDir = "gWebDir";
+#$gDocDir = "gWebDir";
+
 my $dtime = strftime "%a, %e %b %Y %T UTC", localtime;
 $gHTMLTail =~ s/SUBSTITUTE_DTIME/$dtime/;
 
+print "Creating files in $gWebDir:\n";
 require('html/index.html.in');
 &writefiles ('index', '', $gIndexHtml );
 require('html/Access.html.in');
@@ -44,6 +52,7 @@ require('html/server-refcard.html.in');
 &writefiles ('server-refcard', 'bug-mailserver-refcard', $gRefcardHtml );
 require('html/server-request.html.in');
 &writefiles ('server-request', 'bug-log-mailserver', $gRequestHtml );
+print "\n";
 
 exit(0);
 
@@ -62,23 +71,34 @@ sub writefiles {
   local ($html, $text, $name) = @_;
 # first HTML
   unlink("$gWebDir/$html.html");
-  open(DEST, ">$gWebDir/$html.html") || die "$gWebDir/$html.html: $!";
+  open(DEST, ">$gWebDir/$html.html") || die "\n$gWebDir/$html.html: $!";
   print DEST $name;
   close(DEST);
-  print "wrote $gWebDir/$html.html\n";
+  print "$html.html ";
 # now text
   return if ($text eq ""); # for index.html
 # This should be done with pipes instead of a temporary files, but lynx
 # doesn't read HTML from stdin :/
-  open(DEST, ">$gDocDir/$text.html") || die "$gDocDir/$text.html: $!";
+  open(DEST, ">$gDocDir/$text.html") || die "\n$gDocDir/$text.html: $!";
   $name =~ s,\nOther pages:\n.*?<hr>,,si;
   print DEST $name;
   close(DEST);
   unlink("$gDocDir/$text.txt");
-  $ENV{'HOME'} = "/dev/null";
+  $ENV{'HOME'} = "/tmp";
   $ENV{'TERM'} = "linux";
-  system ("lynx -nolist -dump -cfg=$gConfigDir/html/lynx-cfg $gDocDir/$text.html > $gDocDir/$text.txt") == 0 ||
-    die "unable to write $gDocDir/$text.txt\n";
-  unlink("$gDocDir/$text.html") || die "can't remove temporary file $gDocDir/$text.html: $!";
-  print "wrote $gDocDir/$text.txt\n";
+  if (-x "/usr/bin/links") {
+    system ("rm -rf /tmp/.links/") == 0 || die;
+    system ("links -dump $gDocDir/$text.html > $gDocDir/$text.txt") == 0 ||
+      die "\nunable to write $gDocDir/$text.txt\n";
+    system ("rm -rf /tmp/.links/");
+  } elsif (-x "/usr/bin/lynx") {
+    system ("lynx -nolist -dump -cfg=$gConfigDir/html/lynx-cfg $gDocDir/$text.html > $gDocDir/$text.txt") == 0 ||
+      die "\nunable to write $gDocDir/$text.txt\n";
+  } else {
+    print "unable to write text versions of the HTMLs!";
+    print "if you need them, install links or lynx and run debbugsconfig again";
+    return;
+  }
+  unlink("$gDocDir/$text.html") || die "\ncan't remove temporary file $gDocDir/$text.html: $!";
+  print "$text.txt ";
 }