| 1 |
#!/bin/bash |
#!/bin/bash |
| 2 |
|
|
| 3 |
|
# Copyright 2002 Raphaël Hertzog |
| 4 |
|
# This file is distributed under the terms of the General Public License |
| 5 |
|
# version 2 or (at your option) any later version. |
| 6 |
|
|
| 7 |
verbose= |
verbose= |
| 8 |
|
|
| 9 |
|
PATH="/bin:/sbin:/usr/bin:/usr/sbin" |
| 10 |
|
|
| 11 |
if [ -d "incoming" ]; then |
if [ -d "incoming" ]; then |
| 12 |
root="$PWD" |
root="$PWD" |
| 13 |
elif [ -d "../incoming" ]; then |
elif [ -d "../incoming" ]; then |
| 16 |
root="/org/packages.qa.debian.org/www" |
root="/org/packages.qa.debian.org/www" |
| 17 |
fi |
fi |
| 18 |
|
|
| 19 |
if [ "$1" = "-v" ]; then |
if [ "$1" = "-v" -o "$2" = "-v" ]; then |
| 20 |
verbose=1 |
verbose=1 |
| 21 |
fi |
fi |
| 22 |
|
if [ "$1" = "-f" -o "$2" = "-f" ]; then |
| 23 |
|
force="yes" |
| 24 |
|
fi |
| 25 |
|
|
| 26 |
cd $root/base |
cd $root/base |
| 27 |
date=`LC_ALL=C date -u` |
date=`LC_ALL=C date -u` |
| 33 |
hash=${package:0:4} |
hash=${package:0:4} |
| 34 |
fi |
fi |
| 35 |
dir=$hash/$package |
dir=$hash/$package |
| 36 |
|
htmlfile=$root/web/$dir.html |
| 37 |
|
needupdate="no" |
| 38 |
param="--stringparam dir $dir --stringparam package $package" |
param="--stringparam dir $dir --stringparam package $package" |
| 39 |
for i in other experimental stable testing unstable |
# If the file doesn't exist, then require a generation ! |
| 40 |
|
if [ ! -f $htmlfile ]; then |
| 41 |
|
needupdate="yes" |
| 42 |
|
fi |
| 43 |
|
# Force regeneration |
| 44 |
|
if [ "$force" = "yes" ]; then |
| 45 |
|
needupdate="yes" |
| 46 |
|
fi |
| 47 |
|
# Check if force-rebuild exists |
| 48 |
|
if [ -e $dir/force-rebuild ]; then |
| 49 |
|
needupdate="yes" |
| 50 |
|
fi |
| 51 |
|
# If the XSL file is newer than the HTML file, then force update |
| 52 |
|
if [ "../xsl/pts.xsl" -nt "$htmlfile" ]; then |
| 53 |
|
needupdate="yes" |
| 54 |
|
fi |
| 55 |
|
# Create parameters and check if an update is needed |
| 56 |
|
for i in news excuse other s-p-u t-p-u stable-security testing-security experimental stable testing unstable |
| 57 |
do |
do |
| 58 |
if [ -f $dir/$i.xml ]; then |
if [ -f "$dir/$i.xml" ]; then |
| 59 |
|
# Input is the main xml file used by xsltproc to generate the HTML |
| 60 |
|
# page. By default it is unstable.xml but it has many |
| 61 |
|
# fallbacks (testing.xml, stable.xml, experimental.xml, ...) |
| 62 |
input=$dir/$i.xml |
input=$dir/$i.xml |
| 63 |
param="$param --stringparam has$i yes" |
param="$param --stringparam has$i yes" |
| 64 |
fi |
fi |
| 65 |
|
if [ "$needupdate" = "no" -a "$dir/$i.xml" -nt "$htmlfile" ]; then |
| 66 |
|
needupdate="yes" |
| 67 |
|
fi |
| 68 |
done |
done |
| 69 |
if [ ! -d ../web/$dir/static ]; then |
if [ ! -d ../web/$dir/static ]; then |
| 70 |
mkdir -p ../web/$dir/{static,auto,news} || true |
mkdir -p ../web/$dir/{static,news} || true |
| 71 |
fi |
fi |
| 72 |
if [ -n "$verbose" ]; then |
if [ -n "$verbose" ]; then |
| 73 |
echo "Doing $package ..." |
echo "Doing $package ..." |
| 74 |
fi |
fi |
| 75 |
xsltproc -o $root/web/$dir.html --stringparam date "$date" \ |
if [ "$needupdate" = "yes" ]; then |
| 76 |
$param ../xsl/pts.xsl $input |
xsltproc -o $htmlfile --stringparam date "$date" \ |
| 77 |
|
$param ../xsl/pts.xsl $input |
| 78 |
|
rm -f $dir/force-rebuild || true |
| 79 |
|
fi |
| 80 |
done |
done |
| 81 |
|
|