/[qa]/trunk/pts/www/bin/generate_html.sh
ViewVC logotype

Contents of /trunk/pts/www/bin/generate_html.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2284 - (show annotations) (download) (as text)
Sun Sep 27 08:28:34 2009 UTC (3 years, 7 months ago) by hertzog
File MIME type: application/x-sh
File size: 3483 byte(s)
Fix generate_html.sh to regenerate the HTML files also
when pts-issuse.xsl has changed.
1 #!/bin/bash
2
3 # Copyright 2002-2009 Raphaƫl Hertzog
4 # Copyright 2007-2008 Stefano Zacchiroli
5 # This file is distributed under the terms of the General Public License
6 # version 2 or (at your option) any later version.
7
8 verbose=
9
10 PATH="/bin:/sbin:/usr/bin:/usr/sbin"
11
12 if [ -d "incoming" ]; then
13 root="$PWD"
14 elif [ -d "../incoming" ]; then
15 root="$PWD/.."
16 else
17 root="/org/packages.qa.debian.org/www"
18 fi
19
20 if [ "$1" = "-v" -o "$2" = "-v" ]; then
21 verbose=1
22 fi
23 if [ "$1" = "-f" -o "$2" = "-f" ]; then
24 force="yes"
25 fi
26
27 cd $root/base
28 date=`LC_ALL=C date -u`
29
30 while read package
31 do
32 hash=${package:0:1}
33 if [ "${package:0:3}" = "lib" ]; then
34 hash=${package:0:4}
35 fi
36 dir=$hash/$package
37 htmlfile=$root/web/$dir.html
38 rssfile=$root/web/$dir/news.rss20.xml
39 needupdate="no"
40 param=""
41 param="$param --stringparam dir $dir"
42 param="$param --stringparam package $package"
43 param="$param --stringparam hash $hash"
44 # If the file doesn't exist, then require a generation !
45 if [ ! -f $htmlfile ]; then
46 needupdate="yes"
47 fi
48 # Force regeneration
49 if [ "$force" = "yes" ]; then
50 needupdate="yes"
51 fi
52 # Check if force-rebuild exists
53 if [ -e $dir/force-rebuild ]; then
54 needupdate="yes"
55 fi
56 # If the XSL file is newer than the HTML file, then force update
57 if [ "../xsl/pts.xsl" -nt "$htmlfile" ] || \
58 [ "../xsl/pts-issues.xsl" -nt "$htmlfile" ]; then
59 needupdate="yes"
60 fi
61 # Create parameters and check if an update is needed
62 # XXX order _does_ matter, the latter has precedence over the former
63 for i in news excuse other \
64 mentors volatile \
65 stable-proposed-updates testing-proposed-updates \
66 oldstable \
67 security-oldstable security-stable security-testing \
68 experimental stable testing unstable
69 do
70 if [ -f "$dir/$i.xml" ]; then
71 # Input is the main xml file used by xsltproc to generate the HTML
72 # page. By default it is unstable.xml but it has many
73 # fallbacks (testing.xml, stable.xml, experimental.xml, ...)
74 if [ "$i" != "mentors" ] ; then
75 # mentors.d.n needs special handling, because we don't want a PTS
76 # page to exist for packages only available on mentors.d.n
77 input=$dir/$i.xml
78 fi
79 param="$param --stringparam has$i yes"
80 fi
81 if [ "$needupdate" = "no" -a "$dir/$i.xml" -nt "$htmlfile" ]; then
82 needupdate="yes"
83 fi
84 done
85 # If no distribution-related input files has been found,
86 # then the package has been removed
87 if [ "$input" = "$dir/other.xml" ]; then
88 input="../xsl/default.xml"
89 param="$param --stringparam removed yes"
90 if [ "$needupdate" = "no" -a "../xsl/default.xml" -nt "$htmlfile" ]; then
91 needupdate="yes"
92 fi
93 else
94 param="$param --stringparam removed no"
95 fi
96 if [ ! -d ../web/$dir/static ]; then
97 mkdir -p ../web/$dir/{static,news} || true
98 fi
99 if [ "$needupdate" = "yes" ]; then
100 if [ -n "$verbose" ]; then
101 echo "Doing $package ..."
102 fi
103 errors="no"
104 xsltproc -o $htmlfile \
105 --stringparam date "$date" $param \
106 ../xsl/pts.xsl $input
107 test "$?" -ne 0 && errors="yes"
108 if [ -f "$dir/news.xml" ]; then
109 xsltproc -o $rssfile \
110 --stringparam date "$date" $param \
111 ../xsl/news2rss.xsl $dir/news.xml
112 test "$?" -ne 0 && errors="yes"
113 fi
114 test "$errors" = "yes" && \
115 echo "PTS: non-0 exit code while generating output for package $package"
116 rm -f $dir/force-rebuild || true
117 fi
118 done
119

Properties

Name Value
svn:eol-style native
svn:executable *
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.5