Deleted unneeded temporary scripts

svn path=/trunk/; revision=13823
This commit is contained in:
cri 2009-12-23 22:21:53 +00:00
parent 9c2c4613b1
commit a6568cdf00
3 changed files with 0 additions and 496 deletions

View File

@ -1,166 +0,0 @@
#!/bin/bash
# -----------------------------------------------------------------------------
# Web page build script
# -----------------------------------------------------------------------------
# This script is called every 5 minutes on www.fsfe.org to rebuild the
# HTML pages from the .xhtml, .xml and .xsl source files. Most of the work,
# however, is done by the Perl script build.pl.
# -----------------------------------------------------------------------------
SOURCE=/home/www/fsfe
DEST=/home/www/html
TMP=/home/www/tmp.$$
STATUS=/var/www/web
ALARM_LOCKFILE=alarm_lockfile
# Since we must grep for svn output messages,
# let's ensure we get English messages
export LANG=C
# If there is a build.pl script started more than 30 minutes ago, mail alarm
BUILD_STARTED=$(ps --no-headers -C build.pl -o etime | cut -c 7-8 | sort -r | head -n 1)
if [[ -n "$BUILD_STARTED" && "10#${BUILD_STARTED}" -gt 30 && ! -f ${STATUS}/${ALARM_LOCKFILE} ]] ; then
echo -e "
A build.pl script has been running for more than 30 minutes!
Please:
- run 'ps aux | grep build.pl' and kill build.pl processes older than 30 minutes
- Check the build script log at http://status.fsfe.org/web/
- Fix the cause of the problem
- Delete the lockfile ${STATUS}/${ALARM_LOCKFILE}
" | mail -s "www.fsfe.org: build.pl warning" system-hackers@fsfeurope.org
# This lockfile avoids sending the mail alarm more than once;
# it must be deleted when the problem is solved.
touch ${STATUS}/${ALARM_LOCKFILE}
fi
# If build is already running, don't run it again.
if ps -C build.sh -o pid= | grep -q -v "$$"; then
exit
fi
# Redirect output
exec 1> ${STATUS}/status.txt 2>&1
cd ${SOURCE}
# -----------------------------------------------------------------------------
echo "$(date) Cleaning old build directories."
# -----------------------------------------------------------------------------
rm -rf /home/www/tmp.*
# -----------------------------------------------------------------------------
echo "$(date) Updating source files from SVN."
# -----------------------------------------------------------------------------
# Rebuild only if changes were made to the SVN or it hasn't run yet today
# (unless "-f" option is used)
#
# We must run it once every day at least to move events from future to current
# and from current to past.
#
# Since the "svn update" exit status cannot be trusted, and "svn update -q" is
# always quiet, we have to test the output of "svn update" (ignoring the final
# "At revision" line) and check for any output lines
if test -z "$(svn update 2>/dev/null | grep -v 'At revision')" \
-a "$(date -r ${STATUS}/last-run +%F)" == "$(date +%F)" \
-a "$1" != "-f" ; then
echo "$(date) No changes to SVN."
# In this case we only append to the cumulative status-log.txt file, we don't touch status-finished.txt
cat ${STATUS}/status.txt >> ${STATUS}/status-log.txt
exit
fi
# Make sure build.sh and build.pl are executable
# TODO: this can be removed once we set the "executable" svn property
# to these files
chmod +x tools/build.sh tools/build.pl
chmod +x cgi-bin/weborder.pl cgi-bin/stacs-register-capacity.pl
chmod +x cgi-bin/stacs-register-workshop.pl
if test "$1" == "-f" ; then
echo "Forced rebuild"
fi
# -----------------------------------------------------------------------------
echo "$(date) Running Makefiles."
# -----------------------------------------------------------------------------
make --silent
# -----------------------------------------------------------------------------
echo "$(date) Building HTML pages."
# -----------------------------------------------------------------------------
touch ${STATUS}/last-run
if test "x`hostname`" = "xekeberg"; then
tools/build.pl -t 16 -q -o ${TMP} -i .
elif test "x`hostname`" = "xberzelius"; then
tools/build.pl -t 2 -q -o ${TMP} -i .
else
tools/build.pl -q -o ${TMP} -i .
fi
if test $? -ne 0; then
echo "$(date) Build not complete. Aborting."
cp ${STATUS}/status.txt ${STATUS}/status-finished.txt
cat ${STATUS}/status-finished.txt >> ${STATUS}/status-log.txt
exit 1
fi
# -----------------------------------------------------------------------------
echo "$(date) Linking source files."
# -----------------------------------------------------------------------------
for target in ${TMP}/*; do
test -d ${target} && ln -s ${SOURCE} ${target}/source
done
# -----------------------------------------------------------------------------
echo "$(date) Creating symlinks."
# -----------------------------------------------------------------------------
for f in $(find ${TMP} -name .symlinks); do
cd $(dirname $f)
cat $f | while read source destination; do
ln -sf ${source} ${destination} 2>/dev/null
done
done
cd ${SOURCE}
# -----------------------------------------------------------------------------
echo "$(date) Obfuscating email addresses."
# -----------------------------------------------------------------------------
# This replaces all '@' in all html files with '@'. We use '-type f'
# because we want to exclude symlinks. Because 'sed -i' is a very expensive
# operation, even if there is no replacement done anyway, we first limit the
# files to operate on to those files that actually contain an '@'.
find ${TMP} -type f -name "*.html" | xargs grep -l '@' | xargs sed -i 's/@/\@/g'
# -----------------------------------------------------------------------------
echo "$(date) Activating new output."
# -----------------------------------------------------------------------------
mv ${DEST} ${DEST}.old
mv ${TMP} ${DEST}
rm -rf ${DEST}.old
# -----------------------------------------------------------------------------
echo "$(date) Generating translation logs."
# -----------------------------------------------------------------------------
tools/translation-log.sh ${DEST}/translations.log ${STATUS}
# -----------------------------------------------------------------------------
echo "$(date) Build complete."
# -----------------------------------------------------------------------------
cp ${STATUS}/status.txt ${STATUS}/status-finished.txt
cat ${STATUS}/status-finished.txt >> ${STATUS}/status-log.txt
cp tools/status.php ${STATUS}/index.php

View File

@ -1,47 +0,0 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>Build script output</title>
</head>
<body>
<h1>Build script output</h1>
<p><a href="http://status.fsfe.org/">« Back to <em>Web server status</em></a></p>
<h2>Last attempted or currently running build</h2>
<p>
<pre>
<?php
$status = file_get_contents("status.txt");
echo htmlspecialchars($status);
?>
</pre>
</p>
<h2>Last finished build</h2>
<p>
<pre>
<?php
$statusfinished = file_get_contents("status-finished.txt");
echo htmlspecialchars($statusfinished);
?>
</pre>
</p>
<h2>Other tools</h2>
<ul>
<li><a href="./status-log.txt">Previously finished builds</a></li>
<li><a href="https://trac.fsfe.org/fsfe-web/browser/trunk">SVN web browser</a></li>
</ul>
</body>
</html>

View File

@ -1,283 +0,0 @@
#!/bin/bash
# This script is called by build.sh to create the translation log html
# files from the translations.log file created by build.pl.
#
# Copyright (C) 2005 Free Software Foundation Europe
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
# -----------------------------------------------------------------------------
# Constants
# -----------------------------------------------------------------------------
srcroot="http://www.fsfe.org/source"
cvsroot="https://trac.fsfe.org/fsfe-web/log/trunk"
# -----------------------------------------------------------------------------
# Parameters
# -----------------------------------------------------------------------------
infile=$1
outdir=$2
# -----------------------------------------------------------------------------
# Create a separate file per language
# -----------------------------------------------------------------------------
# Remove all "./" at the beginning of filenames, and create a separate file per
# language. For missing translations, remove all files mentioned in
# translation-ignore.txt.
# Performance seems to be much better if we do it in 2 separate runs.
# Otherwise, we would have to run the grep for each line of the file.
# First run: missing translations
sort "${infile}" \
| uniq \
| sed --expression='s/\.\///g' \
| grep --invert-match --file="tools/translation-ignore.txt" \
| while read language wantfile havefile; do
if [ ! -f "${wantfile}" ]; then
date="$(date --iso-8601 --reference=${havefile})"
echo "missing ${date} ${wantfile} NONE ${havefile}" >> "${infile}.${language}"
fi
done
# Second run: outdated translations
sort "${infile}" \
| uniq \
| sed --expression='s/\.\///g' \
| while read language wantfile havefile; do
if [ -f "${wantfile}" ]; then
date1="$(date --iso-8601 --reference=${wantfile})"
date2="$(date --iso-8601 --reference=${havefile})"
echo "outdated ${date2} ${wantfile} ${date1} ${havefile}" >> "${infile}.${language}"
fi
done
# -----------------------------------------------------------------------------
# Convert the ASCII files to HTML files
# -----------------------------------------------------------------------------
for file in ${infile}.*; do
language=${file##*.}
(
echo "<!doctype html>"
echo "<html>"
echo " <head>"
echo " <meta charset=\"utf-8\" />"
echo " <title>Translation status for ${language}</title>"
echo " </head>"
echo " <body>"
echo " <h1>Translation status for ${language}</h1>"
echo " <p>"
echo " <a href=\"translations.html\">« Back to <em>Translation status overview</em></a>"
echo " </p>"
lastgroup=""
sort --reverse ${file} | while read group date2 wantfile date1 havefile; do
if [ "${group}" != "${lastgroup}" ]; then
if [ "${group}" == "outdated" ]; then
echo " <h2>Outdated translations</h2>"
echo " <p>"
echo " The following pages are already translated. However, the"
echo " original version has been changed since the translation"
echo " was done, and the translation has not been updated so far"
echo " to reflect these changes."
echo " </p>"
echo " <p>"
echo " Updating these translations is generally considered more"
echo " urgent than translating new pages."
echo " </p>"
echo " <table border=\"1\" cellspacing=\"0\" cellpadding=\"3\">"
echo " <tr>"
echo " <th colspan=\"3\">translated file</th>"
echo " <th colspan=\"3\">original file</th>"
echo " </tr>"
elif [ "${group}" == "missing" ]; then
if [ "${lastgroup}" == "outdated" ]; then
echo " </table>"
fi
echo " <h2>Missing translations</h2>"
echo " <p>"
echo " The following pages have not yet been translated."
echo " </p>"
echo " <p>"
echo " This list is ordered by the date of the original version,"
echo " newest first. Generally, it's a good idea to translate"
echo " newer texts before older ones, as people will probably be"
echo " more interested in current information."
echo " </p>"
echo " <table border=\"1\" cellspacing=\"0\" cellpadding=\"3\">"
echo " <tr>"
echo " <th>translated file</th>"
echo " <th>original file</th>"
echo " <th align=\"center\">last change of original</th>"
echo " </tr>"
fi
lastgroup="${group}"
fi
echo " <tr>"
if [ "${group}" = "outdated" ]; then
echo " <td>"
echo " <a href=\"${srcroot}/${wantfile}\">${wantfile}</a>"
echo " </td>"
echo " <td align=\"center\">${date1}</td>"
echo " <td>"
echo " <a href=\"${cvsroot}/${wantfile}\">[changelog]</a>"
echo " </td>"
echo " <td>"
echo " <a href=\"${srcroot}/${havefile}\">${havefile}</a>"
echo " </td>"
echo " <td align=\"center\">${date2}</td>"
echo " <td>"
echo " <a href=\"${cvsroot}/${havefile}\">[changelog]</a>"
echo " </td>"
else
echo " <td>"
echo " ${wantfile}"
echo " </td>"
echo " <td>"
echo " <a href=\"${srcroot}/${havefile}\">${havefile}</a>"
echo " </td>"
echo " <td align=\"center\">${date2}</td>"
fi
echo " </tr>"
done
if [ "${lastgroup}" != "" ]; then
echo " </table>"
fi
echo " </body>"
echo "</html>"
) > $outdir/$language.html
done
# -----------------------------------------------------------------------------
# Create hit parade of outdated translations
# -----------------------------------------------------------------------------
grep --no-filename "^outdated" ${infile}.* \
| sort --key=2 \
| (
echo "<!doctype html>"
echo "<html>"
echo " <head>"
echo " <meta charset=\"utf-8\" />"
echo " <title>Hit parade of outdated translations</title>"
echo " <style>"
echo " table,"
echo " th,"
echo " td {"
echo " border: 1px outset gray;"
echo " }"
echo " th,"
echo " td {"
echo " padding: 3px;"
echo " }"
echo " </style>"
echo " </head>"
echo " <body>"
echo " <h1>Hit parade of outdated translations</h1>"
echo " <p>"
echo " <a href=\"translations.html\">« Back to <em>Translation status overview</em></a>"
echo " </p>"
echo " <table>"
echo " <tr>"
echo " <th colspan=\"3\">translated file</th>"
echo " <th colspan=\"3\">original file</th>"
echo " </tr>"
while read group date2 wantfile date1 havefile; do
echo " <tr>"
echo " <td>"
echo " <a href=\"${srcroot}/${wantfile}\">${wantfile}</a>"
echo " </td>"
echo " <td align=\"center\">${date1}</td>"
echo " <td>"
echo " <a href=\"${cvsroot}/${wantfile}\">[changelog]</a>"
echo " </td>"
echo " <td>"
echo " <a href=\"${srcroot}/${havefile}\">${havefile}</a>"
echo " </td>"
echo " <td align=\"center\">${date2}</td>"
echo " <td>"
echo " <a href=\"${cvsroot}/${havefile}\">[changelog]</a>"
echo " </td>"
done
echo " </tr>"
echo " </table>"
echo " </body>"
echo "</html>"
) > $outdir/outdated.html
# -----------------------------------------------------------------------------
# Create the overview page
# -----------------------------------------------------------------------------
(
echo "<!doctype html>"
echo "<html>"
echo " <head>"
echo " <meta charset=\"utf-8\" />"
echo " <title>Translation status overview</title>"
echo " <style>"
echo " table,"
echo " th,"
echo " td {"
echo " border: 1px outset gray;"
echo " }"
echo " th,"
echo " td {"
echo " padding: 3px;"
echo " text-align: center;"
echo " }"
echo " </style>"
echo " </head>"
echo " <body>"
echo " <h1>Translation status overview</h1>"
echo " <p>"
echo " <a href=\"http://status.fsfe.org/\">« Back to <em>Web server status</em></a>"
echo " </p>"
echo " <table>"
echo " <tr>"
echo " <th>language</td>"
echo " <th>outdated translations</td>"
echo " <th>missing translations</td>"
echo " </tr>"
for file in ${infile}.*; do
language=${file##*.}
outdated=$(grep "^outdated" ${file} | wc --lines)
missing=$(grep "^missing" ${file} | wc --lines)
echo " <tr>"
echo " <td><a href=\"${language}.html\">${language}</a></td>"
echo " <td>${outdated}</td>"
echo " <td>${missing}</td>"
echo " </tr>"
done
echo " </table>"
echo " <p>"
echo " A <a href=\"outdated.html\">hit parade of outdated translations</a>"
echo " for all languages is also available."
echo " </p>"
echo " </body>"
echo "</html>"
) > $outdir/translations.html