git-remote-mediawiki: remove hardcoded version number in the test suite

Updates the code to make it more easy to switch mediawiki version when testing. Before that, the version number was partly hardcoded, partly in a var. Signed-off-by: Benoit Person <benoit.person@ensimag.fr> Signed-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Benoit Person committed Jun 14, 2013 at 12:19 UTC 3e3d5fd276d636e24e97e5ee361dc940ee490137
2 files changed +13 -10
contrib/mw-to-git/t/test-gitmw-lib.sh
+10 -9
@@ -336,20 +336,21 @@ wiki_install () {
336 fi
337
338 # Fetch MediaWiki's archive if not already present in the TMP directory
339 + MW_FILENAME="mediawiki-$MW_VERSION_MAJOR.$MW_VERSION_MINOR.tar.gz"
340 cd "$TMP"
340 - if [ ! -f "$MW_VERSION.tar.gz" ] ; then
341 - echo "Downloading $MW_VERSION sources ..."
342 - wget "http://download.wikimedia.org/mediawiki/1.19/mediawiki-1.19.0.tar.gz" ||
341 + if [ ! -f $MW_FILENAME ] ; then
342 + echo "Downloading $MW_VERSION_MAJOR.$MW_VERSION_MINOR sources ..."
343 + wget "http://download.wikimedia.org/mediawiki/$MW_VERSION_MAJOR/$MW_FILENAME" ||
344 error "Unable to download "\
344 - "http://download.wikimedia.org/mediawiki/1.19/"\
345 - "mediawiki-1.19.0.tar.gz. "\
345 + "http://download.wikimedia.org/mediawiki/$MW_VERSION_MAJOR/"\
346 + "$MW_FILENAME. "\
347 "Please fix your connection and launch the script again."
347 - echo "$MW_VERSION.tar.gz downloaded in `pwd`. "\
348 + echo "$MW_FILENAME downloaded in `pwd`. "\
349 "You can delete it later if you want."
350 else
350 - echo "Reusing existing $MW_VERSION.tar.gz downloaded in `pwd`."
351 + echo "Reusing existing $MW_FILENAME downloaded in `pwd`."
352 fi
352 - archive_abs_path=$(pwd)/"$MW_VERSION.tar.gz"
353 + archive_abs_path=$(pwd)/$MW_FILENAME
354 cd "$WIKI_DIR_INST/$WIKI_DIR_NAME/" ||
355 error "can't cd to $WIKI_DIR_INST/$WIKI_DIR_NAME/"
356 tar xzf "$archive_abs_path" --strip-components=1 ||
@@ -431,5 +432,5 @@ wiki_delete () {
432 # Delete the wiki's SQLite database
433 rm -f "$TMP/$DB_FILE" || error "Database $TMP/$DB_FILE could not be deleted."
434 rm -f "$FILES_FOLDER/$DB_FILE"
434 - rm -rf "$TMP/$MW_VERSION"
435 + rm -rf "$TMP/mediawiki-$MW_VERSION_MAJOR.$MW_VERSION_MINOR.tar.gz"
436 }
contrib/mw-to-git/t/test.config
+3 -1
@@ -30,6 +30,8 @@ WEB_WWW=$WEB/www
30
31 # The variables below are used by the script to install a wiki.
32 # You should not modify these unless you are modifying the script itself.
33 -MW_VERSION=mediawiki-1.19.0
33 +# tested versions: 1.19.X -> 1.21.1
34 +MW_VERSION_MAJOR=1.21
35 +MW_VERSION_MINOR=1
36 FILES_FOLDER=install-wiki
37 DB_INSTALL_SCRIPT=db_install.php