Hello Don,

attached is a patch agains bugscan.git that implements the change proposed by Stéphane in http://bugs.debian.org/728455

It's a series of patches:

d6cd984,
4c853f1,
f4bb796 - Factor out common HTML code printing. Without this,
          Stéphanes style fix would need to get applied twice, to
          both the 'realmakepage' and the 'makemainpage' functions
          that print out whole HTML pages.

87a9b22 - Fix a bug in HTML generation

44c6e21 - Fix bug introduced by myself

dd3167c,
7303cc0,
f25f2c2 - improve code readability

909a440 - more HTML bug fixes

373282c - improve code readability

e99321d - finally apply Stéphanes suggestion

021b0d6 - better naming of a function introduced by mysel


Is there a way to test what I have produced here? I think it is correct, but I'm missing the bug database, so I can not test in real.

The proble is I'm only allowed to transfer 300MB data per day, so I'm unable to clone the bug database.

In case there's no easy way to test for me - are you able to test without much effort if my patch is OK?

I'd appreciate if you could have a look or test it and apply - that would make it one bugreport less ;-)

Thanks,
*t

PS: Re: my proposition over PM: I know I have not tackled the most
    pressing bug - it's because I'd much prefer to dive gently into the
    subject matter...
commit 021b0d6
Author: Tomas Pospisek <tpo...@sourcepole.ch>
Date:   Sat Jan 24 01:50:00 2015 +0100

    more precise function naming

diff --git dohtml dohtml
index 1cf6995..5e5be86 100755
--- dohtml
+++ dohtml
@@ -52,7 +52,7 @@ html_header() {
 EOF
 }
 
-html_page_creation_notice() {
+html_end_of_content() {
 	cat <<EOF
 </div><!-- end of 'div id="content"'-->
 <hr>
@@ -123,7 +123,7 @@ tags</a>:
 EOF
 	./bugreport -H -l $filter
 
-	html_page_creation_notice
+	html_end_of_content
 
 	html_closing_tags
 }
@@ -188,7 +188,7 @@ EOF
 <p clear=both></p>
 EOF
 
-	html_page_creation_notice
+	html_end_of_content
 
 	cat <<EOF
 To receive all mails sent to release-critical bugs, subscribe to the

commit e99321d
Author: Tomas Pospisek <tpo...@sourcepole.ch>
Date:   Sat Jan 24 01:42:42 2015 +0100

    use same CSS styles as rest of Debian's web pages
    
    applied patch from http://bugs.debian.org/728455 by Stéphane Blondon

diff --git dohtml dohtml
index b005949..1cf6995 100755
--- dohtml
+++ dohtml
@@ -14,15 +14,47 @@ html_header() {
     <title>$title, $date</title>
   </head>
 <body bgcolor="white">
-<h1 align="center">$title</h1>
-
-<h2 align="center">$date</h2>
+<div id="header">
+  <div id="upperheader">
+    <div id="logo">
+      <a href="http://www.debian.org/"; title="Debian Home"><img src="http://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="http://www.debian.org/intro/about";>About Debian</a></li>
+       <li><a href="http://www.debian.org/distrib/";>Getting Debian</a></li>
+       <li><a href="http://www.debian.org/support";>Support</a></li>
+       <li><a href="http://www.debian.org/devel/";>Developers' Corner</a></li>
+    </ul>
+  </div>
+  <p id="breadcrumbs">
+    <a href="http://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_page_creation_notice() {
 	cat <<EOF
+</div><!-- end of 'div id="content"'-->
 <hr>
 This page is automatically generated.<br>
 Please contact
@@ -57,9 +89,9 @@ realmakepage() {
 
 	cat <<EOF
 
-<p align="center">for distribution(s): $descr</p>
+<p>for distribution(s): $descr</p>
 
-<p align="center">You might also want to check out <a href="http://udd.debian.org/bugs/";>UDD</a> instead of this page.</p>
+<p>You might also want to check out <a href="http://udd.debian.org/bugs/";>UDD</a> instead of this page.</p>
 <hr>
 
 <p>
@@ -104,7 +136,7 @@ makemainpage() {
 
 	cat <<EOF
 
-<p align="center">
+<p>
 EOF
 
 	./bugreport -Hs
@@ -112,7 +144,7 @@ EOF
 	cat <<EOF
 </p>
 
-<div align="center"><img src="graph-release.png" alt="Graph of RC bugs"></div>
+<div><img src="graph-release.png" alt="Graph of RC bugs"></div>
 
 <p>Other graphs:
   <ul>

commit 373282c
Author: Tomas Pospisek <tpo...@sourcepole.ch>
Date:   Sat Jan 24 01:36:39 2015 +0100

    prettify

diff --git dohtml dohtml
index 7ae7036..b005949 100755
--- dohtml
+++ dohtml
@@ -121,12 +121,14 @@ EOF
   </ul>
 </p>
 
-<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 and/or versioning information indicate that they don't apply to
-testing), and the blue line graphs the number of bugs that are a concern
-for the <em>current</em> stable release.</p>
+<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 and/or versioning information indicate that they don't apply to
+  testing), and the blue line graphs the number of bugs that are a concern
+  for the <em>current</em> stable release.
+</p>
 
 <h2>Recent changes</h2>
 EOF
@@ -143,9 +145,9 @@ EOF
   <li> <a href="debian/source.html">source</a> 
   <li> <a href="debian/contrib.html">contrib</a>
   <li> <a href="debian/non-free.html">non-free</a>
-  <li><a href="other/pseudo.html">pseudo-packages</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>
+  <li> <a href="other/all.html">Everything in one page</a>
     <br>
      + <a href="other/stable.html">Only bugs relevant to stable</a>
     <br>

commit 909a440
Author: Tomas Pospisek <tpo...@sourcepole.ch>
Date:   Sat Jan 24 01:35:19 2015 +0100

    fix HTML code

diff --git dohtml dohtml
index afc81fe..7ae7036 100755
--- dohtml
+++ dohtml
@@ -67,7 +67,7 @@ EOF
 	./bugreport -H -s $filter
 	
 	cat <<EOF
-<p>
+</p>
 Explanation for <a href="http://www.debian.org/Bugs/Developer#tags";>bug
 tags</a>:
 
@@ -83,11 +83,10 @@ tags</a>:
 </ul>
 
 <p>
-The second set of tags indicate what releases a bug applies to:
-O for oldstable (squeeze), S for stable (wheezy), T for testing (jessie),
-U for unstable (sid) or E for experimental.
-
-<p>
+  The second set of tags indicate what releases a bug applies to:
+  O for oldstable (squeeze), S for stable (wheezy), T for testing (jessie),
+  U for unstable (sid) or E for experimental.
+</p>
 
 EOF
 	./bugreport -H -l $filter
@@ -152,7 +151,7 @@ EOF
     <br>
      + <a href="other/testing.html">Only bugs relevant to testing</a>
 </ul>
-<p clear=both>
+<p clear=both></p>
 EOF
 
 	html_page_creation_notice

commit f25f2c2
Author: Tomas Pospisek <tpo...@sourcepole.ch>
Date:   Sat Jan 24 01:24:23 2015 +0100

    add whitespace to make easier to read

diff --git dohtml dohtml
index 95d786f..afc81fe 100755
--- dohtml
+++ dohtml
@@ -177,17 +177,17 @@ 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" "$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 "$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 "$title" "$date_time" > $htmldir/index.html.new
+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"       "$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  "$title"  "$date_time" > $htmldir/index.html.new
 mv -f $htmldir/index.html.new $htmldir/index.html
 

commit 7303cc0
Author: Tomas Pospisek <tpo...@sourcepole.ch>
Date:   Sat Jan 24 01:21:21 2015 +0100

    consistently use 'date_time' for the same variable

diff --git dohtml dohtml
index cbef6c0..95d786f 100755
--- dohtml
+++ dohtml
@@ -40,7 +40,7 @@ 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
 
@@ -53,7 +53,7 @@ realmakepage() {
 
 	filter="$filter $worry"
 
-	html_header "$title" "$date"
+	html_header "$title" "$date_time"
 
 	cat <<EOF
 
@@ -99,9 +99,9 @@ EOF
 
 makemainpage() {
 	local	title="$1"	# Title of page
-	local	time="$2"	# Date
+	local	date_time="$2"	# Date
 
-	header "$title" "$time"
+	header "$title" "$date_time"
 
 	cat <<EOF
 
@@ -173,21 +173,21 @@ makepage() {
 	mv -f $3.new $3
 }
 
-time=$(date -u -d '@'$(($(stat -c '%Y' status) / 3600 * 3600)))
-oldtime=$(date -u -d '@'$(($(stat -c '%Y' status-old) / 3600 * 3600)))
+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/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/stable.html" "$time" "-b"
-makepage "" "$title" "$htmldir/other/testing.html" "$time" "-t"
-makepage "" "$title" "$htmldir/other/pseudo.html" "$time" "pseudo"
+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 "$title" "$time" > $htmldir/index.html.new
+makemainpage "$title" "$date_time" > $htmldir/index.html.new
 mv -f $htmldir/index.html.new $htmldir/index.html
 

commit dd3167c
Author: Tomas Pospisek <tpo...@sourcepole.ch>
Date:   Sat Jan 24 01:17:33 2015 +0100

    name parameters to make code easier to understand

diff --git dohtml dohtml
index 07e5bb3..cbef6c0 100755
--- dohtml
+++ dohtml
@@ -98,6 +98,8 @@ EOF
 }
 
 makemainpage() {
+	local	title="$1"	# Title of page
+	local	time="$2"	# Date
 
 	header "$title" "$time"
 
@@ -186,6 +188,6 @@ makepage "" "$title" "$htmldir/other/stable.html" "$time" "-b"
 makepage "" "$title" "$htmldir/other/testing.html" "$time" "-t"
 makepage "" "$title" "$htmldir/other/pseudo.html" "$time" "pseudo"
 
-makemainpage > $htmldir/index.html.new
+makemainpage "$title" "$time" > $htmldir/index.html.new
 mv -f $htmldir/index.html.new $htmldir/index.html
 

commit 44c6e21
Author: Tomas Pospisek <tpo...@sourcepole.ch>
Date:   Sat Jan 24 01:12:59 2015 +0100

    bugfix

diff --git dohtml dohtml
index 54dbb27..07e5bb3 100755
--- dohtml
+++ dohtml
@@ -99,7 +99,7 @@ EOF
 
 makemainpage() {
 
-	header "$title" "$date"
+	header "$title" "$time"
 
 	cat <<EOF
 

commit 87a9b22
Author: Tomas Pospisek <tpo...@sourcepole.ch>
Date:   Sat Jan 24 01:07:45 2015 +0100

    add missing HTML closing tags

diff --git dohtml dohtml
index 6727673..54dbb27 100755
--- dohtml
+++ dohtml
@@ -161,6 +161,8 @@ To receive all mails sent to release-critical bugs, subscribe to the
 mailing list.
 
 EOF
+
+	html_closing_tags
 }
 
 makepage() {

commit f4bb796
Author: Tomas Pospisek <tpo...@sourcepole.ch>
Date:   Sat Jan 24 01:06:53 2015 +0100

    factor out HTML closing tags
    
    into 'html_closing_tags' function

diff --git dohtml dohtml
index b8d0a44..6727673 100755
--- dohtml
+++ dohtml
@@ -30,6 +30,13 @@ Please contact
 EOF
 }
 
+html_closing_tags() {
+	cat <<EOF
+</body>
+</html>
+EOF
+}
+
 realmakepage() {
 	local	filter="$1"	# Distributions to list
 	local	title="$2"	# Title of page
@@ -87,10 +94,7 @@ EOF
 
 	html_page_creation_notice
 
-	cat <<EOF
-</body>
-</html>
-EOF
+	html_closing_tags
 }
 
 makemainpage() {

commit 4c853f1
Author: Tomas Pospisek <tpo...@sourcepole.ch>
Date:   Sat Jan 24 01:03:47 2015 +0100

    factor out common HTML page creation notice ...
    
    into 'html_page_creation_notice' function

diff --git dohtml dohtml
index d3a8bd1..b8d0a44 100755
--- dohtml
+++ dohtml
@@ -2,7 +2,7 @@
 
 htmldir=/org/bugs.debian.org/www/bugscan
 
-header() {
+html_header() {
 	local	title="$1"	# Title of page
 	local	date="$2"	# Date
 
@@ -21,6 +21,15 @@ header() {
 EOF
 }
 
+html_page_creation_notice() {
+	cat <<EOF
+<hr>
+This page is automatically generated.<br>
+Please contact
+<a href="mailto:ow...@bugs.debian.org">ow...@bugs.debian.org</a> for comments.
+EOF
+}
+
 realmakepage() {
 	local	filter="$1"	# Distributions to list
 	local	title="$2"	# Title of page
@@ -37,7 +46,7 @@ realmakepage() {
 
 	filter="$filter $worry"
 
-	header "$title" "$date"
+	html_header "$title" "$date"
 
 	cat <<EOF
 
@@ -76,11 +85,9 @@ U for unstable (sid) or E for experimental.
 EOF
 	./bugreport -H -l $filter
 
+	html_page_creation_notice
+
 	cat <<EOF
-<hr>
-This page is automatically generated.<br>
-Please contact
-<a href="mailto:ow...@bugs.debian.org">ow...@bugs.debian.org</a> for comments.
 </body>
 </html>
 EOF
@@ -140,10 +147,11 @@ EOF
      + <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:ow...@bugs.debian.org">ow...@bugs.debian.org</a> for comments.
+EOF
+
+	html_page_creation_notice
+
+	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>
 mailing list.

commit d6cd984
Author: Tomas Pospisek <tpo...@sourcepole.ch>
Date:   Sat Jan 24 00:56:02 2015 +0100

    factor out common HTML header output into 'html_header' function

diff --git dohtml dohtml
index 62eea00..d3a8bd1 100755
--- dohtml
+++ dohtml
@@ -2,6 +2,25 @@
 
 htmldir=/org/bugs.debian.org/www/bugscan
 
+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">
+    <title>$title, $date</title>
+  </head>
+<body bgcolor="white">
+<h1 align="center">$title</h1>
+
+<h2 align="center">$date</h2>
+
+EOF
+}
+
 realmakepage() {
 	local	filter="$1"	# Distributions to list
 	local	title="$2"	# Title of page
@@ -18,17 +37,9 @@ 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>
+	header "$title" "$date"
 
-<h2 align="center">$date</h2>
+	cat <<EOF
 
 <p align="center">for distribution(s): $descr</p>
 
@@ -76,17 +87,10 @@ EOF
 }
 
 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>
 
-<h2 align="center">$time</h2>
+	header "$title" "$date"
+
+	cat <<EOF
 
 <p align="center">
 EOF

Reply via email to