{"thread":{"id":"34137","subject":"[PATCH V2] git-remote-mediawiki: remove hardcoded version number in the test suite","startedAt":"2013-06-14T10:19:11Z","lastAt":"2013-06-14T18:09:27Z","messageCount":2,"participants":["benoit.person@ensimag.fr","Junio C Hamano"],"isPatch":true,"patchVersion":2,"patchTotal":null},"messages":[{"id":"220795","messageId":"1371205151-13549-1-git-send-email-benoit.person@ensimag.fr","threadId":"34137","inReplyTo":null,"subject":"[PATCH V2] git-remote-mediawiki: remove hardcoded version number in the test suite","fromName":"","fromEmail":"benoit.person@ensimag.fr","sentAt":"2013-06-14T10:19:11Z","receivedAt":"2013-06-14T10:19:11Z","isPatch":true,"sender":{"key":"benoit.person@ensimag.fr","avatar":null},"body":"From: Benoit Person <benoit.person@ensimag.fr>\n\nUpdates the code to make it more easy to switch mediawiki version when\ntesting. Before that, the version number was partly hardcoded, partly\nin a var.\n\nSigned-off-by: Benoit Person <benoit.person@ensimag.fr>\nSigned-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>\n\n---\n contrib/mw-to-git/t/test-gitmw-lib.sh | 19 ++++++++++---------\n contrib/mw-to-git/t/test.config       |  4 +++-\n 2 files changed, 13 insertions(+), 10 deletions(-)\n\ndiff --git a/contrib/mw-to-git/t/test-gitmw-lib.sh b/contrib/mw-to-git/t/test-gitmw-lib.sh\nindex 3b2cfac..bb76cee 100755\n--- a/contrib/mw-to-git/t/test-gitmw-lib.sh\n+++ b/contrib/mw-to-git/t/test-gitmw-lib.sh\n@@ -336,20 +336,21 @@ wiki_install () {\n \tfi\n \n \t# Fetch MediaWiki's archive if not already present in the TMP directory\n+\tMW_FILENAME=\"mediawiki-$MW_VERSION_MAJOR.$MW_VERSION_MINOR.tar.gz\"\n \tcd \"$TMP\"\n-\tif [ ! -f \"$MW_VERSION.tar.gz\" ] ; then\n-\t\techo \"Downloading $MW_VERSION sources ...\"\n-\t\twget \"http://download.wikimedia.org/mediawiki/1.19/mediawiki-1.19.0.tar.gz\" ||\n+\tif [ ! -f $MW_FILENAME ] ; then\n+\t\techo \"Downloading $MW_VERSION_MAJOR.$MW_VERSION_MINOR sources ...\"\n+\t\twget \"http://download.wikimedia.org/mediawiki/$MW_VERSION_MAJOR/$MW_FILENAME\" ||\n \t\t\terror \"Unable to download \"\\\n-\t\t\t\"http://download.wikimedia.org/mediawiki/1.19/\"\\\n-\t\t\t\"mediawiki-1.19.0.tar.gz. \"\\\n+\t\t\t\"http://download.wikimedia.org/mediawiki/$MW_VERSION_MAJOR/\"\\\n+\t\t\t\"$MW_FILENAME. \"\\\n \t\t\t\"Please fix your connection and launch the script again.\"\n-\t\techo \"$MW_VERSION.tar.gz downloaded in `pwd`. \"\\\n+\t\techo \"$MW_FILENAME downloaded in `pwd`. \"\\\n \t\t\t\"You can delete it later if you want.\"\n \telse\n-\t\techo \"Reusing existing $MW_VERSION.tar.gz downloaded in `pwd`.\"\n+\t\techo \"Reusing existing $MW_FILENAME downloaded in `pwd`.\"\n \tfi\n-\tarchive_abs_path=$(pwd)/\"$MW_VERSION.tar.gz\"\n+\tarchive_abs_path=$(pwd)/$MW_FILENAME\n \tcd \"$WIKI_DIR_INST/$WIKI_DIR_NAME/\" ||\n \t\terror \"can't cd to $WIKI_DIR_INST/$WIKI_DIR_NAME/\"\n \ttar xzf \"$archive_abs_path\" --strip-components=1 ||\n@@ -431,5 +432,5 @@ wiki_delete () {\n \t# Delete the wiki's SQLite database\n \trm -f \"$TMP/$DB_FILE\" || error \"Database $TMP/$DB_FILE could not be deleted.\"\n \trm -f \"$FILES_FOLDER/$DB_FILE\"\n-\trm -rf \"$TMP/$MW_VERSION\"\n+\trm -rf \"$TMP/mediawiki-$MW_VERSION_MAJOR.$MW_VERSION_MINOR.tar.gz\"\n }\ndiff --git a/contrib/mw-to-git/t/test.config b/contrib/mw-to-git/t/test.config\nindex 958b37b..4cfebe9 100644\n--- a/contrib/mw-to-git/t/test.config\n+++ b/contrib/mw-to-git/t/test.config\n@@ -30,6 +30,8 @@ WEB_WWW=$WEB/www\n \n # The variables below are used by the script to install a wiki.\n # You should not modify these unless you are modifying the script itself.\n-MW_VERSION=mediawiki-1.19.0\n+# tested versions: 1.19.X -> 1.21.1\n+MW_VERSION_MAJOR=1.21\n+MW_VERSION_MINOR=1\n FILES_FOLDER=install-wiki\n DB_INSTALL_SCRIPT=db_install.php\n-- \n1.8.3.GIT\n"},{"id":"220899","messageId":"7vsj0ko97s.fsf@alter.siamese.dyndns.org","threadId":"34137","inReplyTo":"1371205151-13549-1-git-send-email-benoit.person@ensimag.fr","subject":"Re: [PATCH V2] git-remote-mediawiki: remove hardcoded version number in the test suite","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-06-14T18:09:27Z","receivedAt":"2013-06-14T18:09:27Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"benoit.person@ensimag.fr writes:\n\n> From: Benoit Person <benoit.person@ensimag.fr>\n>\n> Updates the code to make it more easy to switch mediawiki version when\n> testing. Before that, the version number was partly hardcoded, partly\n> in a var.\n\nThis definitely goes in a good direction; you no longer have to\ntouch random lines in test-gitmw-lib.sh and what you have to edit \nis very much localized.\n\nIt seems t/test.config that is tracked is also designed to be\nrandomly edited to suit user's needs.\n\nThe patch does not make things any worse, but I would imagine that a\nbetter longer term structure would be for contrib/mw-to-git/Makefile\nto create contrib/mw-to-git/t/test.config by replacing variables in\ncontrib/mw-to-git/t/test.config-template, so that the user could say\n\n\tcd contrib/mw-to-git\n        make MW_VERSION_MAJOR=1.20 MW_VERSION_MINOR=0 test\n\nor something like that.\n\nBut of course, that is a totally unrelated issue.\n\nWill apply.  Thanks.\n"}]}