r92660 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r92659‎ | r92660 | r92661 >
Date:18:51, 20 July 2011
Author:aaron
Status:resolved (Comments)
Tags:
Comment:
* Changed l10 update and sync scripts to run for each active MW version
* Changed scap-2 to compile binaries for each active MW version
Modified paths:
  • /trunk/tools/mwmultiversion/scripts/l10nupdate (modified) (history)
  • /trunk/tools/mwmultiversion/scripts/mwversionsinuse (modified) (history)
  • /trunk/tools/mwmultiversion/scripts/scap-2 (modified) (history)
  • /trunk/tools/mwmultiversion/scripts/sync-l10nupdate (modified) (history)

Diff [purge]

Index: trunk/tools/mwmultiversion/scripts/mwversionsinuse
@@ -1,25 +1,36 @@
22 #!/bin/sh
33 # Returns a space separated list of all active MW versions (e.g. "x.xx").
4 -# This script belongs in /usr/bin/ and should be in PATH.
5 -declare -a mwVersionsionNums
 4+# The versions are defined in /usr/local/apache/common-local/wmf-config/wikiversions.cdb.
 5+# If --dbonly is passed in, then each item in the list will be a DB name
 6+# for *some* wiki that uses that version instead of the version number.
 7+# This script belongs in /usr/bin/.
 8+declare -a mwVersionsRes
 9+declare -a mwVersionsNums
610 while read line
711 do
 12+ mwDbName=${line% *}
813 mwVersion=${line#* }
914 mwVersionNum=${mwVersion#*-}
10 - if [ -n "$mwVersionNum" ]; then
 15+ if [ -n "$mwDatabase" -a -n "$mwVersionNum" ]; then
1116 mwVersionInArray=0
12 - for i in "${mwVersionsionNums[@]}"
 17+ for i in "${mwVersionsNums[@]}"
1318 do
1419 if [ "$i" -eq "$mwVersionNum" ]; then
1520 mwVersionInArray=1
1621 break
1722 fi
1823 done
 24+
1925 if [ $mwVersionInArray -eq 0 ]; then
20 - mwVersionsionNums=("${mwVersionsionNums[@]}" "$mwVersionNum")
 26+ mwVersionsNums=("${mwVersionsNums[@]}" "$mwVersionNum")
 27+ if [ "$1" -eq "--dbonly" ]; then
 28+ mwVersionsRes=("${mwVersionsRes[@]}" "$mwDbName")
 29+ else
 30+ mwVersionsRes=("${mwVersionsRes[@]}" "$mwVersionNum")
 31+ fi
2132 fi
2233 else
2334 exit 1
2435 fi
2536 done < /usr/local/apache/common-local/wmf-config/wikiversions.cdb
26 -echo "${mwVersionsionNums[@]}"
 37+echo "${mwVersionsRes[@]}"
Index: trunk/tools/mwmultiversion/scripts/scap-2
@@ -6,35 +6,41 @@
77 if rsync -a --delete --exclude=**/.svn/lock --no-perms \
88 10.0.5.8::common/ /usr/local/apache/common-local
99 then
10 - echo ok
 10+ echo "ok"
1111 else
12 - echo failed
 12+ echo "failed"
1313 exit 1
1414 fi
1515
16 -
17 -echo -n Compiling texvc...
18 -
19 -builddir=`mktemp -dt texvc-build.XXXXXXXXXX`
20 -if [ -z "$builddir" ]; then
21 - echo "Unable to create temporary directory"
 16+mwVersionNums=(`mwversionsinuse`)
 17+if [ -z "$mwVersionNums" ]; then
 18+ echo "Unable to read wikiversions.db or it is empty"
2219 exit 1
2320 fi
2421
25 -rsync -r --exclude=.svn/ /usr/local/apache/common-local/php-1.17/math/ "$builddir"
26 -cd "$builddir"
27 -if make -f Makefile texvc >/dev/null 2>/dev/null; then
28 - echo ok
29 - install -d /usr/local/apache/uncommon/1.17/bin
30 - install -m 755 "$builddir"/texvc /usr/local/apache/uncommon/1.17/bin
31 -else
32 - echo failed
33 - exit 1
34 -fi
35 -rm -r "$builddir"
36 -cd /
 22+for mwVerNum in "${mwVersionNums[@]}"
 23+do
 24+ echo "MediaWiki $mwVerNum:"
 25+ echo -n "Compiling texvc..."
 26+ builddir=`mktemp -dt texvc-build.XXXXXXXXXX`
 27+ if [ -z "$builddir" ]; then
 28+ echo "Unable to create temporary directory"
 29+ exit 1
 30+ fi
3731
 32+ rsync -r --exclude=.svn/ /usr/local/apache/common-local/php-"$mwVerNum"/math/ "$builddir"
 33+ cd "$builddir"
 34+ if make -f Makefile texvc >/dev/null 2>/dev/null; then
 35+ echo "ok"
 36+ install -d /usr/local/apache/uncommon/"$mwVerNum"/bin
 37+ install -m 755 "$builddir"/texvc /usr/local/apache/uncommon/"$mwVerNum"/bin
 38+ else
 39+ echo "failed"
 40+ exit 1
 41+ fi
 42+ rm -r "$builddir"
 43+ cd /
 44+done
3845
3946 #echo -n "Restarting apache... "
4047 #/usr/bin/apache-sanity-check && ( sudo /usr/sbin/apache2ctl stop; sudo killall -9 apache2;sleep 3; sudo /usr/sbin/apache2ctl start )
41 -
Index: trunk/tools/mwmultiversion/scripts/sync-l10nupdate
@@ -1,7 +1,14 @@
22 #!/bin/bash
 3+# This script belongs in /home/wikipedia/bin/.
 4+PATH=/bin:/usr/bin:/sbin:/usr/sbin:
35
4 -echo "Synchronizing /home/wikipedia/common/php/cache/l10n to /usr/local/apache/common-local/php/cache/l10n..."
5 -echo "mediawiki-installation:"
 6+mwVersionNums=(`mwversionsinuse`)
67
7 -ddsh -cM -g mediawiki-installation \
8 - 'sudo -u mwdeploy rsync -a 10.0.5.8::common/php/cache/l10n/ /usr/local/apache/common-local/php/cache/l10n'
 8+for mwVerNum in "${mwVersionNums[@]}"
 9+do
 10+ echo "Synchronizing /home/wikipedia/common/php-$mwVerNum/cache/l10n to /usr/local/apache/common-local/php-$mwVerNum/cache/l10n..."
 11+ echo "mediawiki-installation:"
 12+
 13+ ddsh -cM -g mediawiki-installation \
 14+ 'sudo -u mwdeploy rsync -a 10.0.5.8::common/php-$mwVerNum/cache/l10n/ /usr/local/apache/common-local/php-$mwVerNum/cache/l10n'
 15+done
Index: trunk/tools/mwmultiversion/scripts/l10nupdate
@@ -1,21 +1,44 @@
22 #!/bin/sh
 3+# This script belongs in /home/wikipedia/bin/.
 4+PATH=/bin:/usr/bin:/sbin:/usr/sbin:
 5+
36 umask 0002
 7+
48 echo "Starting l10nupdate at `date`."
59 if svn up --ignore-externals /home/wikipedia/l10n/trunk/phase3 &&
6 - svn up --ignore-externals /home/wikipedia/l10n/trunk/extensions &&
7 - php /home/wikipedia/common/php/extensions/LocalisationUpdate/update.php \
8 - --wiki=aawiki \
9 - --outdir=/home/wikipedia/common/php/cache/l10n \
10 - --all \
11 - --quiet
 10+ svn up --ignore-externals /home/wikipedia/l10n/trunk/extensions
1211 then
13 - echo "Completed. Syncing to Apaches"
14 - /home/wikipedia/bin/sync-l10nupdate
15 - echo "Clearing message blobs"
16 - php /home/wikipedia/common/php/maintenance/wmf/clearMessageBlobs.php
17 - echo "All done"
 12+ echo "SVN update completed."
1813 else
19 - /home/wikipedia/bin/dologmsg "!log LocalisationUpdate failed"; echo "FAILED";
 14+ /home/wikipedia/bin/dologmsg "!log LocalisationUpdate failed"
 15+ echo "FAILED"
 16+ exit 1;
2017 fi
 18+
 19+mwDbNames=(`mwversionsinuse --dbonly`)
 20+if [ -z "$mwDbNames" ]; then
 21+ /home/wikipedia/bin/dologmsg "!log LocalisationUpdate failed"
 22+ echo "FAILED"
 23+ exit 1;
 24+fi
 25+
 26+for mwDb in "${mwDbNames[@]}"
 27+do
 28+ if mwscript extensions/LocalisationUpdate/update.php \
 29+ --wiki="$mwDb" \
 30+ --outdir=/home/wikipedia/common/php/cache/l10n \
 31+ --all \
 32+ --quiet
 33+ then
 34+ echo "Completed. Syncing to Apaches"
 35+ /home/wikipedia/bin/sync-l10nupdate
 36+ echo "Clearing message blobs"
 37+ mwscript maintenance/wmf/clearMessageBlobs.php --wiki="$mwDb"
 38+ echo "All done"
 39+ else
 40+ /home/wikipedia/bin/dologmsg "!log LocalisationUpdate failed"
 41+ echo "FAILED"
 42+ fi
 43+done
2144 ## Apache clients should sync updates locally every X hours or at scap time
2245 # Not needed anymore as of 3/20/2011 --Roan

Sign-offs

UserFlagDate
Catropeinspected21:30, 20 July 2011

Follow-up revisions

RevisionCommit summaryAuthorDate
r92692Fixed r92660: output cache dir needs to be versionedaaron21:49, 20 July 2011

Comments

#Comment by Catrope (talk | contribs)   21:30, 20 July 2011
+		  --outdir=/home/wikipedia/common/php/cache/l10n \

This needs to be version-specific as well.

Looks mostly OK otherwise, deferring review to someone a bit more experienced with some of the bash features that are being used here.

Status & tagging log