* [PATCH V2] git-remote-mediawiki: remove hardcoded version number in the test suite
@ 2013-06-14 10:19 benoit.person
2013-06-14 18:09 ` Junio C Hamano
0 siblings, 1 reply; 2+ messages in thread
From: benoit.person @ 2013-06-14 10:19 UTC (permalink / raw)
To: git; +Cc: Celestin Matte, Benoit Person, Matthieu Moy
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.
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 | 4 +++-
2 files changed, 13 insertions(+), 10 deletions(-)
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..4cfebe9 100644
--- a/contrib/mw-to-git/t/test.config
+++ b/contrib/mw-to-git/t/test.config
@@ -30,6 +30,8 @@ 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
+# tested versions: 1.19.X -> 1.21.1
+MW_VERSION_MAJOR=1.21
+MW_VERSION_MINOR=1
FILES_FOLDER=install-wiki
DB_INSTALL_SCRIPT=db_install.php
--
1.8.3.GIT
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH V2] git-remote-mediawiki: remove hardcoded version number in the test suite
2013-06-14 10:19 [PATCH V2] git-remote-mediawiki: remove hardcoded version number in the test suite benoit.person
@ 2013-06-14 18:09 ` Junio C Hamano
0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2013-06-14 18:09 UTC (permalink / raw)
To: benoit.person; +Cc: git, Celestin Matte, Matthieu Moy
benoit.person@ensimag.fr writes:
> 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.
This definitely goes in a good direction; you no longer have to
touch random lines in test-gitmw-lib.sh and what you have to edit
is very much localized.
It seems t/test.config that is tracked is also designed to be
randomly edited to suit user's needs.
The patch does not make things any worse, but I would imagine that a
better longer term structure would be for contrib/mw-to-git/Makefile
to create contrib/mw-to-git/t/test.config by replacing variables in
contrib/mw-to-git/t/test.config-template, so that the user could say
cd contrib/mw-to-git
make MW_VERSION_MAJOR=1.20 MW_VERSION_MINOR=0 test
or something like that.
But of course, that is a totally unrelated issue.
Will apply. Thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-06-14 18:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-14 10:19 [PATCH V2] git-remote-mediawiki: remove hardcoded version number in the test suite benoit.person
2013-06-14 18:09 ` Junio C Hamano
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).