use Debbugs::Common::open_compressed_file instead
[bugscan.git] / dohtml
diff --git a/dohtml b/dohtml
index 7f9bc10..bd83bf8 100755 (executable)
--- a/dohtml
+++ b/dohtml
@@ -2,10 +2,79 @@
 
 htmldir=/org/bugs.debian.org/www/bugscan
 
+html_header() {
+       local   title="$1"      # Title of page
+       local   date="$2"       # Date
+
+       cat <<EOF
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+    <link href="//www.debian.org/debhome.css" rel="stylesheet" type="text/css">
+
+    <title>$title, $date</title>
+  </head>
+<body bgcolor="white">
+<div id="header">
+  <div id="upperheader">
+    <div id="logo">
+      <a href="//www.debian.org/" title="Debian Home"><img src="//www.debian.org/Pics/openlogo-50.png" alt="Debian" width="50" height="61"></a>
+    </div>
+    <div id="searchbox">
+      <form name="p" method="get" action="http://search.debian.org/cgi-bin/omega">
+        <p>
+          <input type="hidden" name="DB" value="en">
+          <input name="P" value="" size="27">
+          <input type="submit" value="Search">
+        </p>
+      </form>
+    </div>
+  </div>
+  <div id="navbar">
+    <p class="hidecss"><a href="#content">Skip Quicknav</a></p>
+    <ul>
+       <li><a href="//www.debian.org/intro/about">About Debian</a></li>
+       <li><a href="//www.debian.org/distrib/">Getting Debian</a></li>
+       <li><a href="//www.debian.org/support">Support</a></li>
+       <li><a href="//www.debian.org/devel/">Developers' Corner</a></li>
+    </ul>
+  </div>
+  <p id="breadcrumbs">
+    <a href="//www.debian.org/Bugs/">Debian bug tracking system</a>
+    &#x2F;
+    Debian BTS &mdash; rc bugs status
+  </p>
+</div>
+<div id="content">
+  <h1>$title</h1>
+  
+  <h2>$date</h2>
+
+EOF
+}
+
+html_end_of_content() {
+       cat <<EOF
+</div><!-- end of 'div id="content"'-->
+<hr>
+This page is automatically generated.<br>
+Please contact
+<a href="mailto:owner@bugs.debian.org">owner@bugs.debian.org</a> for comments.
+EOF
+}
+
+html_closing_tags() {
+       cat <<EOF
+</body>
+</html>
+EOF
+}
+
 realmakepage() {
        local   filter="$1"     # Distributions to list
        local   title="$2"      # Title of page
-       local   date="$3"       # Date
+       local   date_time="$3"  # Date
        local   worry="$4"      # Worry about testing only?
        local   descr           # Description of filter
 
@@ -18,20 +87,13 @@ realmakepage() {
 
        filter="$filter $worry"
 
-       cat <<EOF
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-  <head>
-    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-    <title>$title, $date</title>
-  </head>
-<body bgcolor="white">
-<h1 align="center">$title</h1>
+       html_header "$title" "$date_time"
 
-<h2 align="center">$date</h2>
+       cat <<EOF
 
-<p align="center">for distribution(s): $descr</p>
+<p>for distribution(s): $descr</p>
 
+<p>You might also want to check out <a href="//udd.debian.org/bugs/">UDD</a> instead of this page.</p>
 <hr>
 
 <p>
@@ -39,19 +101,8 @@ EOF
        ./bugreport -H -s $filter
        
        cat <<EOF
-<p>
-Explanation for comment tags:
-<ul>
-   <li><strong>[FIX]</strong>: describes a simple method to deal with
-       the bug.
-   <li><strong>[STRATEGY]</strong>: describes a possible approach for
-       fixing the bug.
-   <li><strong>[HELP]</strong>: help is needed to fix this bug.
-   <li><strong>[REMOVE]</strong>: package will be removed if bug is not fixed
-</ul>
-
-<p>
-Explanation for <a href="http://www.debian.org/Bugs/Developer#tags">bug
+</p>
+Explanation for <a href="//www.debian.org/Bugs/Developer#tags">bug
 tags</a>:
 
 <ul>
@@ -62,44 +113,32 @@ tags</a>:
    <li><strong>R</strong>: unreproducible</li>
    <li><strong>S</strong>: security</li>
    <li><strong>U</strong>: upstream</li>
-   <li><strong>I</strong>: etch-ignore</li>
+   <li><strong>I</strong>: stretch-ignore or buster-ignore</li>
 </ul>
 
 <p>
-Some bugs have an additional set of tags indicating they only apply
-to a particular release: O for oldstable (woody), S for stable (sarge),
-T for testing (etch), U for unstable (sid) or E for experimental. X
-indicates that the package is not in testing.
-
-<p>
+  The second set of tags indicate what releases a bug applies to:
+  O for oldstable (jessie), S for stable (stretch), T for testing (buster),
+  U for unstable (sid) or E for experimental.
+</p>
 
 EOF
        ./bugreport -H -l $filter
 
-       cat <<EOF
-<hr>
-This page is automatically generated.<br>
-Please contact
-<a href="mailto:owner@bugs.debian.org">owner@bugs.debian.org</a> for comments.
-</body>
-</html>
-EOF
+       html_end_of_content
+
+       html_closing_tags
 }
 
 makemainpage() {
-       cat <<EOF
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-  <head>
-    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-    <title>$title, $time</title>
-  </head>
-<body bgcolor="white">
-<h1 align="center">$title</h1>
+       local   title="$1"      # Title of page
+       local   date_time="$2"  # Date
+
+       html_header "$title" "$date_time"
 
-<h2 align="center">$time</h2>
+       cat <<EOF
 
-<p align="center">
+<p>
 EOF
 
        ./bugreport -Hs
@@ -107,12 +146,23 @@ EOF
        cat <<EOF
 </p>
 
-<div align="center"><img src="graph.png" alt="Graph of RC bugs"></div>
+<div><img src="graph-release.png" alt="Graph of RC bugs"></div>
 
-<p>The red line graphs all bugs with release-critical severities; the green
-line graphs the number of bugs that are actually a concern for the next
-release (excluding ignored bugs, bugs on packages not in testing, and bugs
-whose tags indicate that they don't apply to testing).</p>
+<p>Other graphs:
+  <ul>
+    <li><a href="graph-month.png">Graph for the last month</a></li>
+    <li><a href="graph.png">Graph with all the history</a></li>
+  </ul>
+</p>
+
+<p>
+  The <font color="#9400D3">dark-violet line</font> graphs all bugs with release-critical severities; 
+  the <font color="#009e73">dark green line</font> graphs the number of bugs that are actually a concern for the next
+  release (excluding ignored bugs, bugs on packages not in testing, and bugs
+  whose tags and/or versioning information indicate that they don't apply to
+  testing), and the <font color="#56b4e9">cyan line</font> graphs the number of bugs that are a concern
+  for the <em>current</em> stable release.
+</p>
 
 <h2>Recent changes</h2>
 EOF
@@ -125,36 +175,31 @@ EOF
 
 <ul>
   <li> <a href="debian/all.html">All</a>
-    <br>
-     + <a href="debian/testing.html">Only bugs relevant to testing</a>
-    <br>
-     + <a href="debian-non-US/all.html">All non-US</a>
   <li> <a href="debian/main.html">main</a>
-    <br>
-     + <a href="debian-non-US/main.html">main non-US</a>
   <li> <a href="debian/source.html">source</a> 
-    <br>
-     + <a href="debian-non-US/source.html">source non-US</a> 
   <li> <a href="debian/contrib.html">contrib</a>
-    <br>
-     + <a href="debian-non-US/contrib.html">contrib non-US</a>
   <li> <a href="debian/non-free.html">non-free</a>
+  <li> <a href="other/pseudo.html">pseudo-packages</a>
+       <a href="//www.debian.org/Bugs/pseudo-packages">(?)</a>
+  <li> <a href="other/all.html">Everything in one page</a>
+    <br>
+     + <a href="other/stable.html">Only bugs relevant to stable</a>
     <br>
-     + <a href="debian-non-US/non-free.html">non-free non-US</a>
-  <li><a href="other/pseudo.html">pseudo-packages</a>
-       <a href="http://www.debian.org/Bugs/pseudo-packages">(?)</a>
-  <li><a href="other/all.html">Everything in one page</a>
+     + <a href="other/testing.html">Only bugs relevant to testing</a>
 </ul>
-<p clear=both>
-<hr>
-This page is automatically generated.<br>
-Please contact
-<a href="mailto:owner@bugs.debian.org">owner@bugs.debian.org</a> for comments.
+<p clear=both></p>
+EOF
+
+       html_end_of_content
+
+       cat <<EOF
 To receive all mails sent to release-critical bugs, subscribe to the
-<a href="http://lists.debian.org/debian-bugs-rc/">debian-bugs-rc</a>
+<a href="//lists.debian.org/debian-bugs-rc/">debian-bugs-rc</a>
 mailing list.
 
 EOF
+
+       html_closing_tags
 }
 
 makepage() {
@@ -163,28 +208,21 @@ makepage() {
        mv -f $3.new $3
 }
 
-time=$(date -u --date="$(ls -Ll status | awk '{print $6, $7}'):00 $(date +%z)")
-oldtime=$(date -u --date="$(ls -Ll status-old | awk '{print $6, $7}'):00 $(date +%z)")
+date_time=$(date -u -d '@'$(($(stat -c '%Y' status) / 3600 * 3600)))
+olddate_time=$(date -u -d '@'$(($(stat -c '%Y' status-old) / 3600 * 3600)))
 title="Release-critical bugs status"
 
-makepage "debian" "$title" "$htmldir/debian/all.html" "$time"
-makepage "debian/main" "$title" $htmldir/debian/main.html "$time"
-makepage "debian/contrib" "$title" $htmldir/debian/contrib.html "$time"
-makepage "debian/non-free" "$title" $htmldir/debian/non-free.html "$time"
-makepage "debian/source" "$title" $htmldir/debian/source.html "$time"
-
-makepage "debian" "$title" "$htmldir/debian/testing.html" "$time" "-t"
-
-makepage "non-US" "$title" "$htmldir/debian-non-US/all.html" "$time"
-makepage "non-US/main" "$title" $htmldir/debian-non-US/main.html "$time"
-makepage "non-US/contrib" "$title" $htmldir/debian-non-US/contrib.html "$time"
-makepage "non-US/non-free" "$title" $htmldir/debian-non-US/non-free.html "$time"
-makepage "non-US/source" "$title" $htmldir/debian-non-US/source.html "$time"
-
-makepage "other/pseudo" "$title" $htmldir/other/pseudo.html "$time"
+makepage "debian"          "$title" "$htmldir/debian/all.html"      "$date_time"
+makepage "debian/main"     "$title" "$htmldir/debian/main.html"     "$date_time"
+makepage "debian/contrib"  "$title" "$htmldir/debian/contrib.html"  "$date_time"
+makepage "debian/non-free" "$title" "$htmldir/debian/non-free.html" "$date_time"
+makepage "debian/source"   "$title" "$htmldir/debian/source.html"   "$date_time"
 
-makepage "" "$title" $htmldir/other/all.html "$time"
+makepage ""                "$title" "$htmldir/other/all.html"       "$date_time"
+makepage ""                "$title" "$htmldir/other/stable.html"    "$date_time" "-b"
+makepage ""                "$title" "$htmldir/other/testing.html"   "$date_time" "-t"
+makepage ""                "$title" "$htmldir/other/pseudo.html"    "$date_time" "pseudo"
 
-makemainpage > $htmldir/index.html.new
+makemainpage  "$title"  "$date_time" > $htmldir/index.html.new
 mv -f $htmldir/index.html.new $htmldir/index.html