[Top][All Lists]

[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 (X11/20100623)

On 09/02/2013 09:59 AM, Ineiev wrote:
I think the script should get the list of files from; 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:// www-cvs/ \
 | sed '/^www\/.*,v$/!d; s/..$//' > $list


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:]]*//' \

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')
$(egrep "^www/($bases)\.($lang)\.po$" $list)"

rm -r www
cvs -z3  -d:pserver:address@hidden:/webcvs/www \
  co www/server/gnun/ 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/

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$" \
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$')
$(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
$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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]