factor out common HTML header output into 'html_header' function
[bugscan.git] / dohtml
1 #! /bin/sh
2
3 htmldir=/org/bugs.debian.org/www/bugscan
4
5 header() {
6         local   title="$1"      # Title of page
7         local   date="$2"       # Date
8
9         cat <<EOF
10 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
11 <html>
12   <head>
13     <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
14     <title>$title, $date</title>
15   </head>
16 <body bgcolor="white">
17 <h1 align="center">$title</h1>
18
19 <h2 align="center">$date</h2>
20
21 EOF
22 }
23
24 realmakepage() {
25         local   filter="$1"     # Distributions to list
26         local   title="$2"      # Title of page
27         local   date="$3"       # Date
28         local   worry="$4"      # Worry about testing only?
29         local   descr           # Description of filter
30
31         if [ -z "$filter" ]; then
32                 descr="all"
33         else
34                 descr="$filter"
35                 filter="-d $filter"
36         fi
37
38         filter="$filter $worry"
39
40         header "$title" "$date"
41
42         cat <<EOF
43
44 <p align="center">for distribution(s): $descr</p>
45
46 <p align="center">You might also want to check out <a href="http://udd.debian.org/bugs/">UDD</a> instead of this page.</p>
47 <hr>
48
49 <p>
50 EOF
51         ./bugreport -H -s $filter
52         
53         cat <<EOF
54 <p>
55 Explanation for <a href="http://www.debian.org/Bugs/Developer#tags">bug
56 tags</a>:
57
58 <ul>
59    <li><strong>P</strong>: pending</li>
60    <li><strong>+</strong>: patch</li>
61    <li><strong>H</strong>: help</li>
62    <li><strong>M</strong>: moreinfo</li>
63    <li><strong>R</strong>: unreproducible</li>
64    <li><strong>S</strong>: security</li>
65    <li><strong>U</strong>: upstream</li>
66    <li><strong>I</strong>: wheezy-ignore or jessie-ignore</li>
67 </ul>
68
69 <p>
70 The second set of tags indicate what releases a bug applies to:
71 O for oldstable (squeeze), S for stable (wheezy), T for testing (jessie),
72 U for unstable (sid) or E for experimental.
73
74 <p>
75
76 EOF
77         ./bugreport -H -l $filter
78
79         cat <<EOF
80 <hr>
81 This page is automatically generated.<br>
82 Please contact
83 <a href="mailto:owner@bugs.debian.org">owner@bugs.debian.org</a> for comments.
84 </body>
85 </html>
86 EOF
87 }
88
89 makemainpage() {
90
91         header "$title" "$date"
92
93         cat <<EOF
94
95 <p align="center">
96 EOF
97
98         ./bugreport -Hs
99
100         cat <<EOF
101 </p>
102
103 <div align="center"><img src="graph-release.png" alt="Graph of RC bugs"></div>
104
105 <p>Other graphs:
106   <ul>
107     <li><a href="graph-month.png">Graph for the last month</a></li>
108     <li><a href="graph.png">Graph with all the history</a></li>
109   </ul>
110 </p>
111
112 <p>The red line graphs all bugs with release-critical severities; the green
113 line graphs the number of bugs that are actually a concern for the next
114 release (excluding ignored bugs, bugs on packages not in testing, and bugs
115 whose tags and/or versioning information indicate that they don't apply to
116 testing), and the blue line graphs the number of bugs that are a concern
117 for the <em>current</em> stable release.</p>
118
119 <h2>Recent changes</h2>
120 EOF
121
122         ./bugdiff -Hncs status-old status
123
124         cat <<EOF
125
126 <h2>Detailed lists of RC bug reports:</h2>
127
128 <ul>
129   <li> <a href="debian/all.html">All</a>
130   <li> <a href="debian/main.html">main</a>
131   <li> <a href="debian/source.html">source</a> 
132   <li> <a href="debian/contrib.html">contrib</a>
133   <li> <a href="debian/non-free.html">non-free</a>
134   <li><a href="other/pseudo.html">pseudo-packages</a>
135        <a href="http://www.debian.org/Bugs/pseudo-packages">(?)</a>
136   <li><a href="other/all.html">Everything in one page</a>
137     <br>
138      + <a href="other/stable.html">Only bugs relevant to stable</a>
139     <br>
140      + <a href="other/testing.html">Only bugs relevant to testing</a>
141 </ul>
142 <p clear=both>
143 <hr>
144 This page is automatically generated.<br>
145 Please contact
146 <a href="mailto:owner@bugs.debian.org">owner@bugs.debian.org</a> for comments.
147 To receive all mails sent to release-critical bugs, subscribe to the
148 <a href="http://lists.debian.org/debian-bugs-rc/">debian-bugs-rc</a>
149 mailing list.
150
151 EOF
152 }
153
154 makepage() {
155         if [ ! -d "`dirname $3`" ]; then mkdir -p "`dirname $3`"; fi
156         realmakepage "$1" "$2" "$4" "$5" > $3.new
157         mv -f $3.new $3
158 }
159
160 time=$(date -u -d '@'$(($(stat -c '%Y' status) / 3600 * 3600)))
161 oldtime=$(date -u -d '@'$(($(stat -c '%Y' status-old) / 3600 * 3600)))
162 title="Release-critical bugs status"
163
164 makepage "debian" "$title" "$htmldir/debian/all.html" "$time"
165 makepage "debian/main" "$title" $htmldir/debian/main.html "$time"
166 makepage "debian/contrib" "$title" $htmldir/debian/contrib.html "$time"
167 makepage "debian/non-free" "$title" $htmldir/debian/non-free.html "$time"
168 makepage "debian/source" "$title" $htmldir/debian/source.html "$time"
169
170 makepage "" "$title" $htmldir/other/all.html "$time"
171 makepage "" "$title" "$htmldir/other/stable.html" "$time" "-b"
172 makepage "" "$title" "$htmldir/other/testing.html" "$time" "-t"
173 makepage "" "$title" "$htmldir/other/pseudo.html" "$time" "pseudo"
174
175 makemainpage > $htmldir/index.html.new
176 mv -f $htmldir/index.html.new $htmldir/index.html
177