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