threads / patch / 34123

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

Subject: [PATCH] git-remote-mediawiki: remove hardcoded version number in the test suite

## tl;dr

2 messages between Jun 13, 2013 and Jun 13, 2013. Diffs are folded; open one to read it.

replies: 1people: 2as markdown or json

benoit.person@ensimag.fr· Jun 13, 2013, 11:30 UTC · lore
From: Benoit Person <benoit.person@ensimag.fr>

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.

Maybe I should add a warning that the installation procedure may not work in the future ? It seems to work for the range 1.19.X - 1.21.X though :) ? Should I also update the version number to the latest one (1.21.1) ?

Signed-off-by: Benoit Person <benoit.person@ensimag.fr>
Signed-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
---
 contrib/mw-to-git/t/test-gitmw-lib.sh | 19 ++++++++++---------
 contrib/mw-to-git/t/test.config       |  3 ++-
 2 files changed, 12 insertions(+), 10 deletions(-)
Show changes to 2 files +12 −10

contrib/mw-to-git/t/test-gitmw-lib.sh, contrib/mw-to-git/t/test.config

diff --git a/contrib/mw-to-git/t/test-gitmw-lib.sh b/contrib/mw-to-git/t/test-gitmw-lib.sh
index 3b2cfac..bb76cee 100755
--- a/contrib/mw-to-git/t/test-gitmw-lib.sh
+++ b/contrib/mw-to-git/t/test-gitmw-lib.sh
@@ -336,20 +336,21 @@ wiki_install () {
 	fi
 
 	# Fetch MediaWiki's archive if not already present in the TMP directory
+	MW_FILENAME="mediawiki-$MW_VERSION_MAJOR.$MW_VERSION_MINOR.tar.gz"
 	cd "$TMP"
-	if [ ! -f "$MW_VERSION.tar.gz" ] ; then
-		echo "Downloading $MW_VERSION sources ..."
-		wget "http://download.wikimedia.org/mediawiki/1.19/mediawiki-1.19.0.tar.gz" ||
+	if [ ! -f $MW_FILENAME ] ; then
+		echo "Downloading $MW_VERSION_MAJOR.$MW_VERSION_MINOR sources ..."
+		wget "http://download.wikimedia.org/mediawiki/$MW_VERSION_MAJOR/$MW_FILENAME" ||
 			error "Unable to download "\
-			"http://download.wikimedia.org/mediawiki/1.19/"\
-			"mediawiki-1.19.0.tar.gz. "\
+			"http://download.wikimedia.org/mediawiki/$MW_VERSION_MAJOR/"\
+			"$MW_FILENAME. "\
 			"Please fix your connection and launch the script again."
-		echo "$MW_VERSION.tar.gz downloaded in `pwd`. "\
+		echo "$MW_FILENAME downloaded in `pwd`. "\
 			"You can delete it later if you want."
 	else
-		echo "Reusing existing $MW_VERSION.tar.gz downloaded in `pwd`."
+		echo "Reusing existing $MW_FILENAME downloaded in `pwd`."
 	fi
-	archive_abs_path=$(pwd)/"$MW_VERSION.tar.gz"
+	archive_abs_path=$(pwd)/$MW_FILENAME
 	cd "$WIKI_DIR_INST/$WIKI_DIR_NAME/" ||
 		error "can't cd to $WIKI_DIR_INST/$WIKI_DIR_NAME/"
 	tar xzf "$archive_abs_path" --strip-components=1 ||
@@ -431,5 +432,5 @@ wiki_delete () {
 	# Delete the wiki's SQLite database
 	rm -f "$TMP/$DB_FILE" || error "Database $TMP/$DB_FILE could not be deleted."
 	rm -f "$FILES_FOLDER/$DB_FILE"
-	rm -rf "$TMP/$MW_VERSION"
+	rm -rf "$TMP/mediawiki-$MW_VERSION_MAJOR.$MW_VERSION_MINOR.tar.gz"
 }
diff --git a/contrib/mw-to-git/t/test.config b/contrib/mw-to-git/t/test.config
index 958b37b..f835dcc 100644
--- a/contrib/mw-to-git/t/test.config
+++ b/contrib/mw-to-git/t/test.config
@@ -30,6 +30,7 @@ WEB_WWW=$WEB/www
 
 # The variables below are used by the script to install a wiki.
 # You should not modify these unless you are modifying the script itself.
-MW_VERSION=mediawiki-1.19.0
+MW_VERSION_MAJOR=1.20
+MW_VERSION_MINOR=0
 FILES_FOLDER=install-wiki
 DB_INSTALL_SCRIPT=db_install.php
-- 
1.8.3.GIT
Matthieu Moy· Jun 13, 2013, 11:38 UTC · re: benoit.person@ensimag.fr · lore

Re: [PATCH] git-remote-mediawiki: remove hardcoded version number in the test suite

benoit.person@ensimag.fr writes:
> 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.
This is obviously good.
> Maybe I should add a warning that the installation procedure may not work 
> in the future ? It seems to work for the range 1.19.X - 1.21.X though :) ?
> Should I also update the version number to the latest one (1.21.1) ?

This kind of remarks does not belong to the commit message, it should be below the --- (before the diffstat).

And yes, I think a comment saying "# Versions foo, bar and boz have been tested" or so would be welcome.

Thanks,
-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

← back to recent threads