[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Selective checkout of www
From: |
Ineiev |
Subject: |
Re: Selective checkout of www |
Date: |
Tue, 03 Sep 2013 12:29:23 +0400 |
User-agent: |
Thunderbird 2.0.0.24 (X11/20100623) |
On 09/02/2013 09:59 AM, Ineiev wrote:
I think the script should get the list of files from gnun.mk; I'll post
a prototype implementation later.
Attached; it is not that simple, but it does checkout all files
needed to regenerate translations of any given team.
#! /bin/bash
list=$(mktemp -t gnun-sc.XXXXXX)
trap "rm -f $list" EXIT
rsync -anv --exclude "Attic" rsync://cvs.sv.gnu.org/web/www/www www-cvs/ \
| sed '/^www\/.*,v$/!d; s/..$//' > $list
lang=${1:-fr}
function extract-var ()
{
sed -e '/^[[:space:]]*\(#.*\)\?$/d; /:=/!d;' \
-e ':cycle /\\$/ { N; s/.\n[[:space:]]*/ /; b cycle;}' \
-e 's/^[[:space:]]*//' \
-e '/^'${1//\//\\\/}'[[:space:]]*:=/!d; s/.*:=[[:space:]]*//' \
www/server/gnun/gnun.mk
}
function enumerate-var ()
{
for base in $(extract-var $1); do
echo -n "$base|";
done | sed 's/.$//; s/\./\\./g'
}
function process-dir ()
{
files=$(extract-var $1);
bases=$(for base in $files; do echo -n "${2}po/$base|"; done \
| sed 's/.$//; s/\./\\./g')
pos="$pos
$(egrep "^www/($bases)\.($lang)\.po$" $list)"
}
rm -r www
cvs -z3 -d:pserver:address@hidden:/webcvs/www \
co www/server/gnun/gnun.mk www/server/include-file-list.txt > /dev/null
# Files needed to regenerate texts of articles.
for dir in $(extract-var ALL_DIRS); do
process-dir $dir $dir/
done
process-dir ROOT ""
pot_bases=$(echo $pos \
| sed -e 's/\.\('${lang//|/\\|}'\).po\([[:space:]]\+\|$\)/|/g' \
-e 's,\.,\\.,g; s,.$,,')
pots=$(egrep "^($pot_bases)\.(pot|translist)$" $list)
html_bases=$(echo $pot_bases \
| sed ':cycle s,\(|\|/\)po/\([^/]*\(|\|$\)\),\1\2,; t cycle')
htmls=$(egrep "^($html_bases)\.html$" $list)
ssi_bases=$(enumerate-var localized-ssis)
ssis=$(egrep "^www/($ssi_bases)\.(($lang)\.)?html$" $list)
template_bases=$(enumerate-var extra-templates)
optional_bases=$(enumerate-var optional-templates)
templates=$(egrep "^www/($template_bases|$optional_bases)\.(($lang)\.)?html$" \
$list)
template_bases=$(echo "$template_bases|" \
| sed 's,|\(.\),|/\1,g; s,\([^/]*\)|,po/&,g; s,|/,|,g; s,.$,,')
template_pos=$(egrep "^www/($template_bases)\.(pot|($lang)\.po)$" $list)
optional_bases=$(echo "$optional_bases|" \
| sed 's,|\(.\),|/\1,g; s,\([^/]*\)|,po/&,g; s,|/,|,g; s,.$,,')
optional_pos=$(egrep "^www/($optional_bases)\.(pot\.opt|($lang)\.po)$" $list)
compendia=$(egrep '^www/server/gnun/compendia/.*\.(pot|('$lang')\.po)$' $list)
gnun_files=$(egrep '^www/server/gnun/[^/]*$' $list \
| egrep -v 'generic\...(-..)?\.html$')
gnun_files="$gnun_files
$(egrep '^www/server/gnun/generic\.('$lang')\.html$' $list)"
includes=$(sed '/^#/d; s/ .*//;' www/server/include-file-list.txt \
| while read base; do \
egrep '^www'${base//./\\./}'\.html$' $list; done)
rm -r www
files=$(echo "$pos
$pots
$htmls
$templates
$template_pos
$optional
$optional_pos
$ssis
$includes
$gnun_files
$compendia" | sort -u)
cvs -z3 -d:pserver:address@hidden:/webcvs/www co $files
more_includes=$(echo "$files" | egrep '\.html$' \
| while read html; do \
dir=${html%/*}; \
egrep '<!--#include virtual=' $html \
| sed 's/<!--#include virtual=\(["'"'"']\)\(.*\)\1 -->/\2/' \
| while read url; do \
case $url in \
( /* ) file=www$url ;; \
( * ) file=$dir/$url ;; \
esac; \
test -f $file || echo $file; \
done; \
done | sort -u)
if test "x$more_includes" != x; then
cvs -z3 -d:pserver:address@hidden:/webcvs/www \
co $more_includes
fi
- Selective checkout of www, Thérèse Godefroy, 2013/09/01
- Re: Selective checkout of www, Ineiev, 2013/09/02
- Re: Selective checkout of www, Thérèse Godefroy, 2013/09/02
- Re: Selective checkout of www,
Ineiev <=
- Re: Selective checkout of www, Thérèse Godefroy, 2013/09/03
- Re: Selective checkout of www, Ineiev, 2013/09/03
- Re: Selective checkout of www, Thérèse Godefroy, 2013/09/03
- Re: Selective checkout of www, Ineiev, 2013/09/04
- Re: Selective checkout of www, Thérèse Godefroy, 2013/09/04
- Re: Selective checkout of www, Ineiev, 2013/09/05