Automate initial source checkouts
authorPeter Eisentraut <peter_e@gmx.net>
Thu, 28 Jun 2012 17:22:06 +0000 (20:22 +0300)
committerPeter Eisentraut <peter_e@gmx.net>
Thu, 28 Jun 2012 17:22:06 +0000 (20:22 +0300)
Use mr to handle repositories, so that they are automatically checked
out when update-nls-www is run for the first time.  Also adjust the
directory structure so everything is under the admin directory.

wwwtools/.gitignore [new file with mode: 0644]
wwwtools/messages-branches.txt [new file with mode: 0644]
wwwtools/mrconfig [new file with mode: 0644]
wwwtools/postgresql-branches.txt [new file with mode: 0644]
wwwtools/update-nls-www

diff --git a/wwwtools/.gitignore b/wwwtools/.gitignore
new file mode 100644 (file)
index 0000000..1417d8a
--- /dev/null
@@ -0,0 +1,3 @@
+/htwork/
+/lock
+/scm/
diff --git a/wwwtools/messages-branches.txt b/wwwtools/messages-branches.txt
new file mode 100644 (file)
index 0000000..a4480cb
--- /dev/null
@@ -0,0 +1,6 @@
+messages-current               master
+messages-9.2-branch            master
+messages-9.1-branch            REL9_1_STABLE
+messages-9.0-branch            REL9_0_STABLE
+messages-8.4-branch            REL8_4_STABLE
+messages-8.3-branch            REL8_3_STABLE
diff --git a/wwwtools/mrconfig b/wwwtools/mrconfig
new file mode 100644 (file)
index 0000000..500a077
--- /dev/null
@@ -0,0 +1,3 @@
+include = cat messages-branches.txt | while read dir branch; do echo "[scm/$dir]"; echo "checkout = git clone --depth=1 -b $branch git://git.postgresql.org/git/pgtranslation/messages.git $dir"; echo "pre_update = git checkout $branch"; echo; done
+
+include = cat postgresql-branches.txt | while read dir branch; do echo "[scm/$dir]"; echo "checkout = git clone --depth=1 -b $branch git://git.postgresql.org/git/postgresql.git $dir"; echo "pre_update = git checkout $branch"; echo; done
diff --git a/wwwtools/postgresql-branches.txt b/wwwtools/postgresql-branches.txt
new file mode 100644 (file)
index 0000000..b4416c0
--- /dev/null
@@ -0,0 +1,6 @@
+postgresql-current             master
+postgresql-9.2-branch  REL9_2_STABLE
+postgresql-9.1-branch  REL9_1_STABLE
+postgresql-9.0-branch  REL9_0_STABLE
+postgresql-8.4-branch  REL8_4_STABLE
+postgresql-8.3-branch  REL8_3_STABLE
index 015d23a435375b62c15fd21f5364c6f8a66dde57..412ed309e6f6c71f9c1878f7ec00df4cdec44671 100755 (executable)
@@ -11,19 +11,20 @@ me=$(basename $0)
 set -ex
 
 MYDIR=$(cd $(dirname $0) && pwd)
-WEBDIR=$MYDIR/../../htwork
-CVSDIR=$(cd $MYDIR/../../cvs && pwd)
+WEBDIR=$MYDIR/htwork
+SCMDIR=$MYDIR/scm
 output_dir=~/htdocs
 
 GMAKE=make
 which gmake >/dev/null && GMAKE=gmake
 export GMAKE
 
-TEMP=$(getopt o: "$@")
+TEMP=$(getopt fo: "$@")
 eval set -- "$TEMP"
 
 while true; do
        case $1 in
+               -f) force=true; shift;;
                -o) output_dir=$2; shift; shift;;
                --) shift; break;;
        esac
@@ -33,42 +34,45 @@ active_branches="9.2-branch 9.1-branch 9.0-branch 8.4-branch 8.3-branch"
 
 if [ -n "$1" ]; then
        active_branches=$1
-       force=true
 fi
 
+pushd $MYDIR
+
 (
 flock -n 9 || exit 0
 
 for branch in $active_branches; do
-       PGSRC=$CVSDIR/postgresql-$branch
+       PGSRC=$SCMDIR/postgresql-$branch
 
        pgsrc_updated=false
+       if [ -d $PGSRC ]; then
+               pushd $PGSRC
+               git reset --hard
+               git clean -dfqx
+               popd
+       fi
+       mr -t -c mrconfig -d scm/postgresql-$branch update  # git pull
        pushd $PGSRC
-       git pull
-       if [ $(git rev-parse --verify --quiet HEAD) != $(git rev-parse --verify --quiet ORIG_HEAD) ]; then
+       if [ x$(git rev-parse --verify --quiet HEAD) != x$(git rev-parse --verify --quiet ORIG_HEAD) ]; then
            pgsrc_updated=true
        fi
        popd
 
-       rm -rf $PGSRC.work
-       cp -R $PGSRC $PGSRC.work
-
        pgmessages_updated=false
-       if [ -d "$CVSDIR/messages-$branch" ]; then
-               pushd $CVSDIR/messages-$branch
-               git pull
-               if [ $(git rev-parse --verify --quiet HEAD) != $(git rev-parse --verify --quiet ORIG_HEAD) ]; then
-                       pgmessages_updated=true
-               fi
-               popd
-               $MYDIR/../cp-po -f -k $CVSDIR/messages-$branch $PGSRC.work
+       mr -t -c mrconfig -d scm/messages-$branch update  # git pull
+       pushd $SCMDIR/messages-$branch
+       if [ x$(git rev-parse --verify --quiet HEAD) != x$(git rev-parse --verify --quiet ORIG_HEAD) ]; then
+               pgmessages_updated=true
        fi
+       popd
 
        if [ "$force" != true ] && ! $pgmessages_updated && ! $pgsrc_updated; then
                continue
        fi
 
-       pushd $PGSRC.work
+       $MYDIR/../cp-po -f -k $SCMDIR/messages-$branch $PGSRC
+
+       pushd $PGSRC
        ./configure --prefix=$MYDIR/pg-install --cache=/dev/null --enable-nls --with-includes=/usr/local/include --with-libraries=/usr/local/lib \
                --with-perl --with-tcl --without-tk
        popd
@@ -77,17 +81,15 @@ for branch in $active_branches; do
        rm -rf $WEBDIR/po-$branch $WEBDIR/qualified-list-$branch.txt $WEBDIR/table-$branch.html
 
        mkdir -p $WEBDIR/po-$branch
-       files=`find $PGSRC.work -name nls.mk`
+       files=`find $PGSRC -name nls.mk`
        $MYDIR/pg-make-po -o $WEBDIR/po-$branch -v $branch $files
 
        (cd $WEBDIR/po-$branch && $MYDIR/nls-status-table -U po-$branch -l $WEBDIR/qualified-list-$branch.txt *.po *.pot >$WEBDIR/table-$branch.html)
 
-#      $MYDIR/pg-make-conflicts $branch $MYDIR $WEBDIR
-
        $MYDIR/nls-status-page $WEBDIR > $WEBDIR/index.html
        rsync -l -r --delete --delete-excluded --exclude='table-*.html' $WEBDIR/ "$output_dir"
 done
 
 date -u +%FT%T
 
-) 9>"$PWD/lock"
+) 9>"$MYDIR/lock"