r47339 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r47338‎ | r47339 | r47340 >
Date:22:14, 16 February 2009
Author:kim
Status:deferred
Tags:
Comment:
Putting the wikiation installer into mediawiki svn
Modified paths:
  • /trunk/wiki (added) (history)
  • /trunk/wiki/wikiation (added) (history)
  • /trunk/wiki/wikiation/installer (added) (history)
  • /trunk/wiki/wikiation/installer/LICENSE (added) (history)
  • /trunk/wiki/wikiation/installer/LocalSettings.php.template (added) (history)
  • /trunk/wiki/wikiation/installer/Logo.png (added) (history)
  • /trunk/wiki/wikiation/installer/extension_installer.py (added) (history)
  • /trunk/wiki/wikiation/installer/installation_system.py (added) (history)
  • /trunk/wiki/wikiation/installer/installer.py (added) (history)
  • /trunk/wiki/wikiation/installer/installer_util.py (added) (history)
  • /trunk/wiki/wikiation/installer/installers.py (added) (history)
  • /trunk/wiki/wikiation/installer/installfiles (added) (history)
  • /trunk/wiki/wikiation/installer/installfiles/extensions (added) (history)
  • /trunk/wiki/wikiation/installer/installfiles/extensions/Cite.install (added) (history)
  • /trunk/wiki/wikiation/installer/installfiles/extensions/Cite.install/Cite.settings.php (added) (history)
  • /trunk/wiki/wikiation/installer/installfiles/extensions/Cite.install/download.sh (added) (history)
  • /trunk/wiki/wikiation/installer/installfiles/extensions/Cite.install/info (added) (history)
  • /trunk/wiki/wikiation/installer/installfiles/extensions/Cite.install/is_installed.sh (added) (history)
  • /trunk/wiki/wikiation/installer/installfiles/extensions/Cite.install/uninstall.sh (added) (history)
  • /trunk/wiki/wikiation/installer/installfiles/extensions/Cite.install/update.sh (added) (history)
  • /trunk/wiki/wikiation/installer/installfiles/extensions/ImageMap.install (added) (history)
  • /trunk/wiki/wikiation/installer/installfiles/extensions/ImageMap.install/ImageMap.settings.php (added) (history)
  • /trunk/wiki/wikiation/installer/installfiles/extensions/ImageMap.install/download.sh (added) (history)
  • /trunk/wiki/wikiation/installer/installfiles/extensions/ImageMap.install/info (added) (history)
  • /trunk/wiki/wikiation/installer/installfiles/extensions/ImageMap.install/is_installed.sh (added) (history)
  • /trunk/wiki/wikiation/installer/installfiles/extensions/ImageMap.install/uninstall.sh (added) (history)
  • /trunk/wiki/wikiation/installer/installfiles/extensions/ImageMap.install/update.sh (added) (history)
  • /trunk/wiki/wikiation/installer/installfiles/extensions/InputBox.install (added) (history)
  • /trunk/wiki/wikiation/installer/installfiles/extensions/InputBox.install/InputBox.settings.php (added) (history)
  • /trunk/wiki/wikiation/installer/installfiles/extensions/InputBox.install/download.sh (added) (history)
  • /trunk/wiki/wikiation/installer/installfiles/extensions/InputBox.install/info (added) (history)
  • /trunk/wiki/wikiation/installer/installfiles/extensions/InputBox.install/is_installed.sh (added) (history)
  • /trunk/wiki/wikiation/installer/installfiles/extensions/InputBox.install/uninstall.sh (added) (history)
  • /trunk/wiki/wikiation/installer/installfiles/extensions/InputBox.install/update.sh (added) (history)
  • /trunk/wiki/wikiation/installer/installfiles/extensions/ParserFunctions.install (added) (history)
  • /trunk/wiki/wikiation/installer/installfiles/extensions/ParserFunctions.install/ParserFunctions.settings.php (added) (history)
  • /trunk/wiki/wikiation/installer/installfiles/extensions/ParserFunctions.install/download.sh (added) (history)
  • /trunk/wiki/wikiation/installer/installfiles/extensions/ParserFunctions.install/info (added) (history)
  • /trunk/wiki/wikiation/installer/installfiles/extensions/ParserFunctions.install/is_installed.sh (added) (history)
  • /trunk/wiki/wikiation/installer/installfiles/extensions/ParserFunctions.install/uninstall.sh (added) (history)
  • /trunk/wiki/wikiation/installer/installfiles/extensions/ParserFunctions.install/update.sh (added) (history)
  • /trunk/wiki/wikiation/installer/installfiles/wikiation_toolkit (added) (history)
  • /trunk/wiki/wikiation/installer/installfiles/wikiation_toolkit/pywikipedia.install (added) (history)
  • /trunk/wiki/wikiation/installer/installfiles/wikiation_toolkit/pywikipedia.install/download.sh (added) (history)
  • /trunk/wiki/wikiation/installer/installfiles/wikiation_toolkit/pywikipedia.install/info (added) (history)
  • /trunk/wiki/wikiation/installer/installfiles/wikiation_toolkit/pywikipedia.install/is_installed.sh (added) (history)
  • /trunk/wiki/wikiation/installer/installfiles/wikiation_toolkit/pywikipedia.install/uninstall.sh (added) (history)
  • /trunk/wiki/wikiation/installer/installfiles/wikiation_toolkit/wikiation_check_isolation.install (added) (history)
  • /trunk/wiki/wikiation/installer/installfiles/wikiation_toolkit/wikiation_check_isolation.install/download.sh (added) (history)
  • /trunk/wiki/wikiation/installer/installfiles/wikiation_toolkit/wikiation_check_isolation.install/info (added) (history)
  • /trunk/wiki/wikiation/installer/installfiles/wikiation_toolkit/wikiation_check_isolation.install/is_installed.sh (added) (history)
  • /trunk/wiki/wikiation/installer/installfiles/wikiation_toolkit/wikiation_check_isolation.install/test.sh (added) (history)
  • /trunk/wiki/wikiation/installer/installfiles/wikiation_toolkit/wikiation_check_isolation.install/uninstall.sh (added) (history)
  • /trunk/wiki/wikiation/installer/installfiles/wikiation_toolkit/wikiation_check_isolation.install/update.sh (added) (history)
  • /trunk/wiki/wikiation/installer/installfiles/wikiation_toolkit/wikiation_exttest.install (added) (history)
  • /trunk/wiki/wikiation/installer/installfiles/wikiation_toolkit/wikiation_exttest.install/ImageMap.settings.php (added) (history)
  • /trunk/wiki/wikiation/installer/installfiles/wikiation_toolkit/wikiation_exttest.install/download.sh (added) (history)
  • /trunk/wiki/wikiation/installer/installfiles/wikiation_toolkit/wikiation_exttest.install/info (added) (history)
  • /trunk/wiki/wikiation/installer/installfiles/wikiation_toolkit/wikiation_exttest.install/is_installed.sh (added) (history)
  • /trunk/wiki/wikiation/installer/installfiles/wikiation_toolkit/wikiation_exttest.install/uninstall.sh (added) (history)
  • /trunk/wiki/wikiation/installer/installfiles/wikiation_toolkit/wikiation_exttest.install/update.sh (added) (history)
  • /trunk/wiki/wikiation/installer/isolation.py (added) (history)
  • /trunk/wiki/wikiation/installer/mediawiki_installer.py (added) (history)
  • /trunk/wiki/wikiation/installer/settings.py.example (added) (history)
  • /trunk/wiki/wikiation/installer/toolkit_installer.py (added) (history)
  • /trunk/wiki/wikiation/installer/user.sql (added) (history)

Diff [purge]

Index: trunk/wiki/wikiation/installer/extension_installer.py
@@ -0,0 +1,57 @@
 2+import settings
 3+import os, os.path, shutil
 4+import subprocess
 5+
 6+from installation_system import Installation_System, Installer_Exception
 7+
 8+class Extension_Installer_Exception(Installer_Exception):
 9+ pass
 10+
 11+class Extension_Installer(Installation_System):
 12+ system_name='extensions'
 13+ destination_dir=None
 14+
 15+# def __init__(self, revision):
 16+# Installation_System.__init__(self, revision)
 17+
 18+ def set_revision(self,revision):
 19+ self.destination_dir=os.path.join(settings.revisionsdir,revision,"extensions")
 20+ self.revision=revision
 21+
 22+
 23+ def install_settings(self, installer_name):
 24+ installdir=self.installdir_name(installer_name)
 25+ settingsdir=os.path.join(self.destination_dir,"../LocalSettings")
 26+ dirlist=os.listdir(installdir)
 27+ for filename in dirlist:
 28+ filepath=os.path.join(installdir,filename)
 29+ if filename.endswith('.settings.php') and os.access(filepath, os.R_OK):
 30+ shutil.copy(filepath,settingsdir)
 31+
 32+ def uninstall_settings(self,installer_name):
 33+ settingsdir=os.path.join(self.destination_dir,"..","LocalSettings")
 34+ installdir=self.installdir_name(installer_name)
 35+ dirlist=os.listdir(installdir)
 36+ #compare which files were originally installed, then remove those
 37+ for filename in dirlist:
 38+ filepath=os.path.join(installdir,filename)
 39+ if filename.endswith('.settings.php') and os.access(filepath, os.R_OK):
 40+ destpath=os.path.join(settingsdir,filename)
 41+ if os.access(destpath, os.R_OK):
 42+ os.unlink(destpath)
 43+
 44+
 45+ def is_installed(self, installer_name):
 46+ if self.revision==None:
 47+ raise Extension_Installer_Exception("no revision specified ... did you try doing ... in <Revision> ?")
 48+ return Installation_System.is_installed(self, installer_name)
 49+
 50+ def exec_task(self,installer_name,task,env=None):
 51+ if env==None:
 52+ env={}
 53+
 54+ env=dict(env)
 55+ env["EXTENSIONS_SVN"]=settings.extensionsdir
 56+
 57+ return Installation_System.exec_task(self, installer_name,task,env)
 58+
Index: trunk/wiki/wikiation/installer/installer_util.py
@@ -0,0 +1,65 @@
 2+import sys
 3+
 4+def replace_generic(replacements,infilename,outfilename):
 5+ """generic replace function, takes a dictionary of search/replace
 6+ strings (replacements), and applies them to the input file
 7+ specified by infilename, and saves the results to the
 8+ output file at outfilename"""
 9+
 10+ infile=file(infilename)
 11+ outfile=file(outfilename,"w")
 12+ for line in infile:
 13+ for search,replace in replacements.iteritems():
 14+ line=line.replace(search,replace)
 15+ outfile.write(line)
 16+ outfile.close()
 17+ infile.close()
 18+
 19+
 20+def help(args):
 21+ """implement help command: prints helpful messages"""
 22+
 23+ if len(args)>1 and args[1] in subhelp:
 24+ print
 25+ print subhelp[args[1]]
 26+ elif len(args)<=1:
 27+ print
 28+ print "wikiation installer, interactive mode"
 29+ print "help: get help"
 30+ print "quit: quit"
 31+ print "ls [item]: list information on available versions "
 32+ print "ls2 [item]: list information on extensions or wikiation components"
 33+ print "install <version>: installs the version specified"
 34+ print "install <version> as <name>: installs the version specified under an alternate name"
 35+ print "install latest ; install latest as <name>: installs the latest version available in svn."
 36+ print "uninstall <version/name>: uninstalls the version specified"
 37+ print "check_isolation <version/name>: shows all changes made to mediawiki or database since it was installed."
 38+ print "update_self: updates the installer and restarts in interactive mode"
 39+ print "revision [new revision]: query current default revision, or set a new one (will be implemented over time)"
 40+ print
 41+ print "instead of interactive mode, you can also access commands directly from the shell:"
 42+ print "wikiation_installer command [args]..."
 43+ else:
 44+ print 'no detailed help available'
 45+
 46+def help_for(something):
 47+ """If the user types incorrect input, try to gently correct them"""
 48+
 49+ print "correct syntax:"
 50+ help(["help",something])
 51+
 52+def quit(args):
 53+ """Quits the program."""
 54+ sys.exit(0)
 55+
 56+def clean_target(target):
 57+ """tidy up a target string, return in canonical form"""
 58+
 59+ target=str(target)
 60+ target=target.strip()
 61+ if target.endswith('/'):
 62+ target=target[:-1]
 63+
 64+ return target
 65+
 66+
Index: trunk/wiki/wikiation/installer/settings.py.example
@@ -0,0 +1,39 @@
 2+import os
 3+
 4+# "You Are Here"
 5+installerdir=os.path.dirname(os.path.abspath(__file__))
 6+
 7+# where to find .install directories and the files contained therein
 8+installfiles=os.path.join(installerdir,'installfiles')
 9+
 10+
 11+# where to find mediawiki tags and trunk on svn
 12+tagsdir="http://svn.wikimedia.org/svnroot/mediawiki/tags"
 13+trunkdir="http://svn.wikimedia.org/svnroot/mediawiki/trunk"
 14+# we could alternately/additionally take a tag version for extensions. (future)
 15+extensionsdir=trunkdir+"/extensions"
 16+
 17+# where to install diverse revisions
 18+revisionsdir='/var/www/revisions'
 19+
 20+
 21+# base scriptpath for every installation (ie, where to reach the above over the web)
 22+base_scriptpath="/revisions/"
 23+
 24+# where to install the toolkit
 25+toolkit_dir='/usr/local/wikiation'
 26+
 27+
 28+#where wikiation_check_isolation can be found
 29+isolation_create=toolkit_dir+'/wikiation_check_isolation/create_and_ul.sh'
 30+isolation_test=toolkit_dir+'/wikiation_check_isolation/dl_and_check.sh'
 31+
 32+# what mysql command should be used. (Who us? Use horrible hacks?)
 33+
 34+mysql_command="mysql -uwiki -pwiki1234"
 35+
 36+# run automated tests during installation
 37+# this is useful if you are in a testing environment.
 38+# If you are running production, you might want to leave
 39+# this set to False.
 40+run_automated_tests=False
Index: trunk/wiki/wikiation/installer/LICENSE
@@ -0,0 +1,9 @@
 2+license notes...
 3+
 4+copyright holder (C) www.wikiation.nl (kvk nr) 2008
 5+
 6+Code is GPL v3 or later
 7+Logo.png itself is a wikiation trademark and is (C) wikiation, all rights reserved (same as the wikimedia or wikipedia logos)
 8+
 9+
 10+(replace actual license text here)
Index: trunk/wiki/wikiation/installer/Logo.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes on: trunk/wiki/wikiation/installer/Logo.png
___________________________________________________________________
Added: svn:mime-type
111 + application/octet-stream
Index: trunk/wiki/wikiation/installer/installer.py
@@ -0,0 +1,163 @@
 2+#!/usr/bin/python
 3+import sys,os, os.path
 4+import readline
 5+import re
 6+import shutil
 7+import settings
 8+
 9+import installers
 10+
 11+from installer_util import *
 12+from isolation import *
 13+
 14+def intro():
 15+ """a nice banner/intro text for interactive mode"""
 16+
 17+ print "=== Wikiation installer (v. "+revision()+") ==="
 18+ print
 19+ print "Interactive mode.",
 20+ print "Automated testing is",
 21+ if settings.run_automated_tests:
 22+ print "enabled."
 23+ else:
 24+ print "disabled."
 25+ print
 26+ print "please type a command and hit enter"
 27+ print "help<enter> for help"
 28+ print "^D, or quit<enter> to quit"
 29+ print
 30+
 31+def revision():
 32+ """obtain revision number for wikiation_installer itself"""
 33+
 34+ revision_string=None
 35+ os.chdir(settings.installerdir)
 36+ info=os.popen("svn info .")
 37+ for line in info:
 38+ if line.startswith("Revision:"):
 39+ revision_string=line.strip()
 40+ break
 41+ info.close()
 42+ if revision_string==None:
 43+ revision="unknown"
 44+ else:
 45+ revision=revision_string.replace("Revision:","")
 46+
 47+ return revision
 48+
 49+def command():
 50+ """handle the command line in interactive mode"""
 51+
 52+ try:
 53+ command=raw_input('installer > ').strip()
 54+ except EOFError:
 55+ print "quit"
 56+ sys.exit(0)
 57+
 58+ if command:
 59+ args=command.split()
 60+ do_command(args)
 61+
 62+ return True
 63+
 64+def do_command(all_args):
 65+ """execute a command. Command is expected as a list (like we get from str.split(), or from sys.args). all_args[0] is expected to be the command name.
 66+ """
 67+
 68+ if all_args[0] in commands:
 69+ commands[all_args[0]](all_args)
 70+ else:
 71+ print "I don't know how to '"+all_args[0]+"'."
 72+
 73+def ls(args):
 74+ """implement local ls command, lists things we can install"""
 75+ installers.ls(args)
 76+
 77+def info(args):
 78+ """provide information on modules, where available"""
 79+ installers.info(args)
 80+
 81+def install(args):
 82+ """install something"""
 83+ installers.install(args)
 84+
 85+
 86+def uninstall(args):
 87+ """uninstall something"""
 88+ installers.uninstall(args)
 89+
 90+def update_self(ignored_args):
 91+ """update self to newest revision, (and switch to interactive mode)"""
 92+
 93+ os.chdir(settings.installerdir)
 94+ os.system("svn update")
 95+ print "\n\n"
 96+ print "wikiation_installer update attempted/completed. Restarting"
 97+ print "----------------------------------------------------------"
 98+ print "\n\n"
 99+ os.execl("/usr/bin/python","/usr/bin/python",__file__)
 100+
 101+
 102+def default_revision(args):
 103+ if len(args)>1:
 104+ defualt_revision=args[1]
 105+
 106+ print "current revision:",default_revision
 107+
 108+def main():
 109+ """main function. start of execution when run from shell"""
 110+ if len(sys.argv)>1:
 111+ args=sys.argv[1:]
 112+ do_command(args)
 113+ exit()
 114+
 115+
 116+ histfile=os.path.join(os.environ["HOME"], ".installerhist")
 117+ try:
 118+ readline.read_history_file(histfile)
 119+ except IOError:
 120+ pass
 121+ readline.parse_and_bind("tab: complete")
 122+
 123+ import atexit
 124+ atexit.register(readline.write_history_file, histfile)
 125+
 126+ intro()
 127+
 128+ # main loop.
 129+ while(command()):
 130+ pass
 131+
 132+# Global!
 133+default_revision=None
 134+
 135+#constants
 136+
 137+# bind commands to functions
 138+commands={
 139+ "help":help,
 140+ "quit":quit,
 141+ "ls":ls,
 142+ "install":install,
 143+ "uninstall":uninstall,
 144+ "info":info,
 145+ "check_isolation":check_isolation,
 146+ "update_self":update_self,
 147+ "revision":default_revision
 148+}
 149+
 150+# additional help texts for some commands.
 151+subhelp={
 152+ "ls":"""ls installed : list currently installed items
 153+ls available : list items available"""
 154+
 155+}
 156+
 157+
 158+# our internal "directory structure"
 159+internal_dirs=os.listdir(settings.installfiles)
 160+internal_dirs.extend(['mediawiki'])
 161+
 162+if __name__ == "__main__":
 163+ main()
 164+
Property changes on: trunk/wiki/wikiation/installer/installer.py
___________________________________________________________________
Added: svn:executable
1165 +
Index: trunk/wiki/wikiation/installer/installers.py
@@ -0,0 +1,358 @@
 2+import settings
 3+import os, os.path, shutil
 4+import subprocess
 5+
 6+#from installation_system import Installation_System
 7+from toolkit_installer import Toolkit_Installer
 8+from extension_installer import Extension_Installer
 9+from mediawiki_installer import Mediawiki_Installer
 10+from installation_system import Installer_Exception
 11+
 12+class Parse_Exception(Exception):
 13+ pass
 14+
 15+def ls(args):
 16+ if len(args)==0:
 17+ print "Internal error: args list too short"
 18+ return
 19+ if len(args)<=1:
 20+ args.append("")
 21+
 22+ ppath=None
 23+ try:
 24+ ppath=parse_path(" ".join(args[1:]))
 25+ except Parse_Exception,e:
 26+ print e.message
 27+ return
 28+
 29+ if ppath['ai']=='available':
 30+ output=ls_available(ppath)
 31+ elif ppath['ai']=='installed' or ppath['ai']==None: # XXX hardcoded default
 32+ output=ls_installed(ppath)
 33+
 34+ if output==None:
 35+ return
 36+
 37+ for line in output:
 38+ print line
 39+
 40+def ls_available(ppath):
 41+ if ppath["system"]==None:
 42+ return ls_systems()
 43+ else:
 44+ return ls_available_in_system(ppath)
 45+
 46+def ls_installed(ppath):
 47+ if ppath["system"]==None:
 48+ if ppath["installer"]==None:
 49+ return ls_systems()
 50+ else:
 51+ ppath["system"]="mediawiki" # XXX hardcoded default
 52+
 53+ return ls_installed_in_system(ppath)
 54+
 55+def ls_systems():
 56+ return [item+':' for item in systems.keys()]
 57+
 58+def ls_available_in_system(ppath):
 59+ system=get_system(ppath["system"])
 60+ if not system:
 61+ return
 62+ return system.get_installers()
 63+
 64+def ls_installed_in_system(ppath):
 65+ system=get_system(ppath["system"])
 66+ if not system:
 67+ return
 68+
 69+ if ppath["in_installer"]:
 70+ system.set_revision(ppath["in_installer"])
 71+ installed=None
 72+ try:
 73+ installed=system.get_installed()
 74+ except Installer_Exception,e:
 75+ print e.message
 76+ return
 77+
 78+ return installed
 79+
 80+
 81+def info(args):
 82+ if len(args)<1:
 83+ print "info: Internal error: expected more arguments"
 84+
 85+ ppath=None
 86+ try:
 87+ ppath=parse_path(" ".join(args[1:]),defaults={'ai':'available'})
 88+ except Parse_Exception,e:
 89+ print e.message
 90+ return
 91+
 92+ if not ppath["ai"]:
 93+ ppath["ai"]="available"
 94+
 95+ system=get_system(ppath["system"])
 96+ system.get_info(ppath["installer"])
 97+
 98+def install(args):
 99+ if len(args)<1:
 100+ print "install: Internal error: expected more arguments"
 101+
 102+ ppath=None
 103+ try:
 104+ ppath=parse_path(" ".join(args[1:]), defaults={'ai':'available','system':'mediawiki'})
 105+ except Parse_Exception,e:
 106+ print e.message
 107+ return
 108+
 109+ if ppath["ai"]=="installed":
 110+ print "Did you mean to install from available. ?"
 111+ return
 112+
 113+ system=get_system(ppath["system"])
 114+ if ppath["in_installer"]:
 115+ system.set_revision(ppath["in_installer"])
 116+ if ppath["as_alias"]:
 117+ system.as_alias=ppath["as_alias"]
 118+
 119+ try:
 120+ success=system.install(ppath["installer"])
 121+ if success:
 122+ print "Install successful."
 123+ else:
 124+ print "Install failed."
 125+
 126+ except Installer_Exception,e:
 127+ print e.message
 128+ return
 129+
 130+
 131+def uninstall(args):
 132+ if len(args)<1:
 133+ print "install: Internal error: expected more arguments"
 134+
 135+ ppath=None
 136+ try:
 137+ ppath=parse_path(" ".join(args[1:]),defaults={'ai':'installed','system':'mediawiki'})
 138+ except Parse_Exception,e:
 139+ print e.message
 140+ return
 141+
 142+ if ppath["ai"]=="available":
 143+ print "Did you mean to uninstall from installed. ?"
 144+ return
 145+
 146+ system=get_system(ppath["system"])
 147+ if ppath["in_installer"]:
 148+ system.set_revision(ppath["in_installer"])
 149+ if ppath["as_alias"]:
 150+ system.as_alias=ppath["as_alias"]
 151+ try:
 152+ success=system.uninstall(ppath["installer"])
 153+ if success:
 154+ print "Uninstall successful."
 155+ else:
 156+ print "Uninstall failed."
 157+ except Installer_Exception,e:
 158+ print e.message
 159+ return
 160+
 161+def _ppath_defaults(ppath,defaults):
 162+ for key in ppath.keys():
 163+ if key in defaults:
 164+ ppath[key]=ppath[key] or defaults[key]
 165+
 166+
 167+def parse_path(path,defaults=None):
 168+ ai=None
 169+ system=None
 170+ installer=None
 171+ in_installer=None
 172+ as_alias=None
 173+
 174+ #partial components
 175+ whence=None # eg. 'available.mediawiki:'
 176+ single_case=None # a single word without context
 177+ inpath=None # eg. 'ImageMap in REL1_13_2"
 178+
 179+ if ":" in path:
 180+ whence, inpath=path.split(':')
 181+ elif "." in path:
 182+ whence=path
 183+ else:
 184+ single_case=path
 185+
 186+ if whence:
 187+ if "." in whence:
 188+ ai,system=whence.split('.')
 189+ else:
 190+ single_case=whence
 191+
 192+ if single_case:
 193+ if single_case in systems.keys():
 194+ system=single_case
 195+ elif single_case in ["available","installed"]:
 196+ ai=single_case
 197+ elif single_case==path:
 198+ inpath=single_case
 199+ else:
 200+ raise Parse_Exception("I'm not sure what to do with '"+single_case+"' in this context.")
 201+
 202+ if inpath:
 203+ l=inpath.split()
 204+ if l[0] not in ["in","as"]:
 205+ installer=l[0]
 206+
 207+ if "in" in l:
 208+ i=l.index("in")
 209+ try:
 210+ in_installer=l[i+1]
 211+ except IndexError:
 212+ raise Parse_Exception("Syntax error. Nothing after 'in'.")
 213+
 214+ if "as" in l:
 215+ i=l.index("as")
 216+ try:
 217+ as_alias=l[i+1]
 218+ except IndexError:
 219+ raise Parse_Exception("Syntax error. Nothing after 'as'.")
 220+
 221+ # Ok, we have our basic return value now
 222+ ppath={
 223+ "ai":ai, #available or installed
 224+ "system":system,
 225+ "installer":installer,
 226+ "in_installer":in_installer,
 227+ "as_alias":as_alias}
 228+
 229+
 230+ # maybe we can assume some useful defaults (saves typing)
 231+ if defaults:
 232+ _ppath_defaults(ppath,defaults)
 233+
 234+ # let's check to see if what we get is sane.
 235+
 236+ if ppath['ai'] not in ["available","installed",None]:
 237+ raise Parse_Exception("By '"+ppath['ai']+"', did you mean available or did you mean installed?")
 238+
 239+ if ppath['system'] not in systems.keys() and not ppath['system']=="None":
 240+ system_names=", ".join(ls_systems())
 241+ raise Parse_Exception("Did you mean to specify any of "+system_names)
 242+
 243+ # we assume that the "in" directive always applies to a mediawiki instance
 244+ if ppath['in_installer']:
 245+ mediawiki=get_system('mediawiki')
 246+ if not mediawiki.is_installed(ppath['in_installer']):
 247+ raise Parse_Exception(ppath['in_installer']+' is not currently installed')
 248+
 249+ # :-(
 250+ #if installer:
 251+ # if not system:
 252+ # system='mediawiki' # XXX hardcoded default
 253+ # mysystem=get_system(system)
 254+ #
 255+ # if in_installer:
 256+ # system.set_revision(ppath["in_installer"])
 257+ #
 258+ # if system.is_installed(installer)
 259+
 260+ # we can only check if the installer name itself is valid
 261+ # somewhat later, once we know what context we are in.
 262+
 263+ return ppath
 264+
 265+
 266+
 267+def get_system(system_name):
 268+ if system_name not in systems:
 269+ print "Cannot find '"+system_name+"' in the list of supported installation systems."
 270+ return None
 271+ else:
 272+ system=systems[system_name]
 273+
 274+ return systems[system_name]
 275+
 276+
 277+
 278+systems={'wikiation_toolkit':Toolkit_Installer(),'extension': Extension_Installer(), 'mediawiki':Mediawiki_Installer()}
 279+
 280+
 281+if __name__=="__main__":
 282+ print "testing installers.py module"
 283+ print "CTRL-C to abort. run installer.py to actually use the installer"
 284+ print
 285+# print "ls"
 286+# ls2(["ls"])
 287+# print
 288+# print "ls available"
 289+# ls2(["ls","available"])
 290+# print
 291+# print "ls available/wikiation_toolkit"
 292+# ls2(["ls","available/wikiation_toolkit"])
 293+# print
 294+# print "ls installed/wikiation_toolkit"
 295+# ls2(["ls","installed/wikiation_toolkit"])
 296+# print
 297+# print "get info"
 298+# system=get_system("wikiation_toolkit")
 299+# system.get_info("pywikipedia")
 300+#
 301+# print "install"
 302+# print "pywiki",repr(system.install("pywikipedia"))
 303+# print "exttest", repr(system.install("wikiation_exttest"))
 304+# print "isolation", repr(system.install("wikiation_check_isolation"))
 305+# print "ls", os.listdir('..')
 306+#
 307+# print "uninstall"
 308+# print "pywiki", repr(system.uninstall("pywikipedia"))
 309+# print "exttest", repr(system.uninstall("wikiation_exttest"))
 310+# print "isolation", repr(system.uninstall("wikiation_check_isolation"))
 311+#
 312+# print "wikiation_extension (assumes existing wiki)"
 313+# extension_installer=Extension_Installer("REL1_13_3")
 314+#
 315+# print " \ uninstall " , repr (extension_installer.uninstall("ImageMap"))
 316+# print "ImageMap", repr (extension_installer.install("ImageMap"))
 317+#
 318+ #print "mediawiki installer"
 319+ #print "avail"
 320+ #ls2(["ls","available/mediawiki"])
 321+ #print "installed"
 322+ #ls2(["ls","installed/mediawiki"])
 323+#
 324+# print "try another wiki, say REL1_13_2"
 325+
 326+# mediawiki_installer=get_system("mediawiki")
 327+#
 328+# print "uninstl mediawiki 1_13_2", repr (mediawiki_installer.uninstall("REL1_13_2"))
 329+# print "install mediawiki 1_13_2", repr (mediawiki_installer.install("REL1_13_2"))
 330+#
 331+# print "extension (assumes existing wiki)"
 332+# extension_installer=Extension_Installer("REL1_13_2")
 333+#
 334+# print " \ uninstall " , repr (extension_installer.uninstall("ImageMap"))
 335+# print "ImageMap", repr (extension_installer.install("ImageMap"))
 336+#
 337+# print "try some ls stuff"
 338+# def qls(mystr): # q for "quick"
 339+# print "ls", repr(mystr)
 340+# ls(['ls',mystr])
 341+#
 342+# qls('')
 343+# qls('available')
 344+# qls('installed')
 345+# qls('available:')
 346+# qls('installed:')
 347+# qls('murp.morp:')
 348+# qls('installed.mediawiki:')
 349+# qls('installed.extension:')
 350+# qls('installed.toolkit:')
 351+# qls('installed.mediawiki:in REL1_13_2')
 352+# qls('available.extension:')
 353+# qls('installed.extension:in REL1_13_2')
 354+# qls('installed.extension:in FOO')
 355+# qls('installed.mediawiki:in FOO')
 356+# qls('available.wikiation')
 357+# qls('available.wikiation:in BAR as BAZ')
 358+# qls('available.wikiation:in BOG as BOT')
 359+# qls('available.wikiation:in BOG as BOT murp morp bla bla bla')
Index: trunk/wiki/wikiation/installer/mediawiki_installer.py
@@ -0,0 +1,232 @@
 2+import settings
 3+import os, os.path, shutil
 4+import subprocess
 5+
 6+from installation_system import Installation_System
 7+
 8+from installer_util import *
 9+from isolation import *
 10+
 11+#this still uses some legacy structured code, wrapped in a class so it can't do too much harm outside this file. Will refactor later when I have more time.
 12+
 13+# already partially refactored while creating class.
 14+
 15+
 16+#constants
 17+
 18+#Things that are not mediawiki revisions (in the svn tags directory on mediawiki svn)
 19+filter_available=['extensions/']
 20+
 21+
 22+class Mediawiki_Installer(Installation_System):
 23+ system_name='mediawiki_installer'
 24+ # TODO: destination_dir isn't quite changable until we have finished refactoring everything (not today)
 25+ destination_dir=settings.revisionsdir
 26+ def __init__(self):
 27+ Installation_System.__init__(self)
 28+
 29+ def get_installers(self):
 30+ """list available items"""
 31+
 32+ l=list(os.popen('svn ls '+settings.tagsdir))
 33+ stripped=[line.strip() for line in l]
 34+ #filter out things that are not mediawiki revisions
 35+ for item in filter_available:
 36+ if item in stripped:
 37+ stripped.remove(item)
 38+ return stripped
 39+
 40+ #def exists: same as super
 41+
 42+ # Hmm: perhaps these should really belong in a separate mixin?
 43+ #installdir_name: unused, but leave for future expansion
 44+ #exec_task: unused, but leave for future expansion
 45+ #can_exec: unused, but leave for future expansion
 46+
 47+ def get_installed(self):
 48+ """list installed items"""
 49+ return os.listdir(self.destination_dir)
 50+
 51+ def is_installed(self, installer_name):
 52+ return installer_name in self.get_installed()
 53+
 54+ # super.get_info does something sane here, let's leave it in.
 55+ # (we can even provide info files for certain releases if we want)
 56+
 57+ def install(self, installer_name, as_alias=None):
 58+ name=as_alias or self.as_alias or installer_name
 59+
 60+ install(installer_name, name)
 61+ return self.is_installed(name)
 62+
 63+ #download is unused, but leave for future expansion
 64+ #install_settings unused
 65+ #uninstall_settings
 66+
 67+ def uninstall(self,installer_name):
 68+ name=self.as_alias or installer_name
 69+ if not self.is_installed(name):
 70+ print name+" does not appear to be installed"
 71+ return
 72+
 73+ uninstall(name)
 74+ return not self.is_installed(name)
 75+
 76+
 77+
 78+#duplicate of get_installed()
 79+def installed():
 80+ """list installed items"""
 81+ return os.listdir(settings.revisionsdir)
 82+
 83+#duplicate of get_installers()
 84+def available():
 85+ """list available items"""
 86+
 87+ l=list(os.popen('svn ls '+settings.tagsdir))
 88+ stripped=[line.strip() for line in l]
 89+ for item in filter_available:
 90+ if item in stripped:
 91+ stripped.remove(item)
 92+ return stripped
 93+
 94+
 95+
 96+def install(target, option_as):
 97+ """implement install command. Installs a mediawiki version"""
 98+ target=clean_target(target)
 99+
 100+ latest=False
 101+ if target=="latest":
 102+ latest=True
 103+
 104+ if option_as:
 105+ name=clean_target(option_as)
 106+ else:
 107+ name=target
 108+
 109+ if name in installed():
 110+ print name+" already installed."
 111+ return
 112+
 113+ # available targets all end in '/', very consistent, this :-P
 114+ if not latest and target+'/' not in available():
 115+ print target+" is not available or invalid.\n(try: ls available )"
 116+ return
 117+
 118+ #Everything checks out ok, so let's install.
 119+ os.chdir(settings.revisionsdir)
 120+ print "Checking out code from subversion (please be patient)..."
 121+ if latest:
 122+ checkout_latest(name)
 123+ else:
 124+ checkout(target+"/", name)
 125+
 126+ print "Creating LocalSettings.php..."
 127+ localsettings(name)
 128+ print "Copy logo..."
 129+ logo(name)
 130+ print "Setting up database..."
 131+ makedb(name)
 132+ if settings.run_automated_tests:
 133+ print "Storing comparison data for check_isolation"
 134+ difftests(name)
 135+ print "Done."
 136+
 137+
 138+def uninstall(target):
 139+ """implements uninstall command: uninstall mediawiki version"""
 140+
 141+ target=clean_target(target)
 142+
 143+ if target not in installed():
 144+ print target+": can't find an installed revision by that name"
 145+ return
 146+
 147+ #Ok, looks like our arguments are valid.
 148+ os.chdir(settings.revisionsdir)
 149+ print "Dropping database..."
 150+ dropdb(target)
 151+ print "Deleting directory..."
 152+ delete(target)
 153+ print "Done."
 154+
 155+def checkout(target, name):
 156+ """checkout the given target revision"""
 157+
 158+ command="svn checkout "+settings.tagsdir+"/"+target+"phase3"
 159+ _checkout(command,name)
 160+
 161+def checkout_latest(name):
 162+ """checkout the latest trunk revision"""
 163+
 164+ command="svn checkout "+settings.trunkdir+"/phase3"
 165+ _checkout(command,name)
 166+
 167+def _checkout(command, name):
 168+ """perform the actual check out, and rename our checked out data to something more useful"""
 169+
 170+ os.system(command)
 171+ os.rename('phase3',name)
 172+
 173+
 174+def localsettings(target):
 175+ """create a localSettings.php file, for target mediawiki instance based
 176+ on the LocalSettings.php.template file
 177+ LocalSettings.php is the main configuration file for mediawiki."""
 178+
 179+ template=settings.installerdir+"/LocalSettings.php.template"
 180+ localsettings=settings.revisionsdir+"/"+target+"/LocalSettings.php"
 181+ replacements={'<<TARGET>>':target,"<<BASE_SCRIPTPATH>>":settings.base_scriptpath}
 182+ replace_generic(replacements,template,localsettings)
 183+ subdir=settings.revisionsdir+"/"+target+"/LocalSettings"
 184+ os.mkdir(subdir)
 185+
 186+def logo(target):
 187+ """copy a nice logo"""
 188+
 189+ logo=settings.installerdir+"/Logo.png"
 190+ dest=settings.revisionsdir+"/"+target+"/Logo.png"
 191+ shutil.copy(logo,dest)
 192+
 193+def makedb(target):
 194+ """make a mediawiki database for target mediawiki instance """
 195+
 196+ dropdb(target);
 197+ createdb(target);
 198+ make_tables(target)
 199+ make_admin(target)
 200+
 201+def make_tables(target):
 202+ """use the maintenance/tables.sql file provided by target mediawiki
 203+ instance to generate our tables"""
 204+
 205+ target_file=settings.revisionsdir+"/"+target+"/maintenance/tables.sql"
 206+ do_sql(target, target_file)
 207+
 208+def make_admin(target):
 209+ """use our usr.sql file to create an admin user"""
 210+ do_sql(target, settings.installerdir+"/user.sql")
 211+
 212+def do_sql(target, infile):
 213+ """execute an sql file, using mysql"""
 214+
 215+ command="< "+infile+" "+settings.mysql_command+"" +target
 216+ os.system(command)
 217+
 218+def createdb(target):
 219+ """create a database using mysql"""
 220+
 221+ command="echo 'CREATE DATABASE "+target+";' | "+settings.mysql_command
 222+ os.system(command)
 223+
 224+def dropdb(target):
 225+ """drop a database using mysql"""
 226+
 227+ command="echo 'DROP DATABASE IF EXISTS "+target+";' | "+settings.mysql_command
 228+ os.system(command)
 229+
 230+def delete(target):
 231+ """delete target mediawiki installation, assumes we are in the revisions directory"""
 232+ shutil.rmtree(target)
 233+
Index: trunk/wiki/wikiation/installer/isolation.py
@@ -0,0 +1,33 @@
 2+import sys,os, os.path
 3+import settings
 4+
 5+#support for wikiation_check_isolation
 6+
 7+def _check_isolation(args):
 8+ """wikiation_check_isolation: check diffs now"""
 9+ difftest=settings.isolation_test
 10+ command=difftest+" "+" ".join(args)
 11+ os.system(command)
 12+
 13+def check_isolation(args):
 14+ """implement check_isolation command"""
 15+
 16+ if len(args) < 2 :
 17+ print "Must specify a target!\n(try: ls installed )"
 18+ return
 19+ target=args[1]
 20+ if target not in installed():
 21+ print target+' is not currently installed'
 22+ return
 23+
 24+ _check_isolation(args[1:])
 25+
 26+
 27+def difftests(target):
 28+ """wikiation_check_isolation: store diffs, ready for testing later"""
 29+
 30+ difftest=settings.isolation_create
 31+ command=difftest+" "+target
 32+ os.system(command)
 33+
 34+
Index: trunk/wiki/wikiation/installer/installfiles/wikiation_toolkit/pywikipedia.install/info
@@ -0,0 +1 @@
 2+A version of pywikipedia suitable for wikiation exttest environments
Index: trunk/wiki/wikiation/installer/installfiles/wikiation_toolkit/pywikipedia.install/download.sh
@@ -0,0 +1,7 @@
 2+#!/bin/sh
 3+
 4+
 5+cd $DESTINATION_DIR
 6+wget 'http://6.wikiation.nl/revisions/pywikipedia.tar.gz'
 7+tar xvzf pywikipedia.tar.gz
 8+rm pywikipedia.tar.gz
Property changes on: trunk/wiki/wikiation/installer/installfiles/wikiation_toolkit/pywikipedia.install/download.sh
___________________________________________________________________
Added: svn:executable
19 +
Index: trunk/wiki/wikiation/installer/installfiles/wikiation_toolkit/pywikipedia.install/uninstall.sh
@@ -0,0 +1,4 @@
 2+#!/bin/sh
 3+
 4+cd $DESTINATION_DIR
 5+rm -rf pywikipedia
Property changes on: trunk/wiki/wikiation/installer/installfiles/wikiation_toolkit/pywikipedia.install/uninstall.sh
___________________________________________________________________
Added: svn:executable
16 +
Index: trunk/wiki/wikiation/installer/installfiles/wikiation_toolkit/pywikipedia.install/is_installed.sh
@@ -0,0 +1,5 @@
 2+#!/bin/sh
 3+
 4+
 5+
 6+test -d $DESTINATION_DIR/pywikipedia && echo "true" || echo "false"
Property changes on: trunk/wiki/wikiation/installer/installfiles/wikiation_toolkit/pywikipedia.install/is_installed.sh
___________________________________________________________________
Added: svn:executable
17 +
Index: trunk/wiki/wikiation/installer/installfiles/wikiation_toolkit/wikiation_check_isolation.install/download.sh
@@ -0,0 +1,10 @@
 2+#!/bin/sh
 3+
 4+repository="http://6.wikiation.nl/svn/wikiation_check_isolation"
 5+
 6+cd $DESTINATION_DIR
 7+if test -n "$REVISION"; then
 8+ svn checkout -r $REVISION $repository
 9+else
 10+ svn checkout $repository
 11+fi
Property changes on: trunk/wiki/wikiation/installer/installfiles/wikiation_toolkit/wikiation_check_isolation.install/download.sh
___________________________________________________________________
Added: svn:executable
112 +
Index: trunk/wiki/wikiation/installer/installfiles/wikiation_toolkit/wikiation_check_isolation.install/uninstall.sh
@@ -0,0 +1,5 @@
 2+#!/bin/sh
 3+
 4+cd $DESTINATION_DIR
 5+rm -f test
 6+rm -rf wikiation_check_isolation
Property changes on: trunk/wiki/wikiation/installer/installfiles/wikiation_toolkit/wikiation_check_isolation.install/uninstall.sh
___________________________________________________________________
Added: svn:executable
17 +
Index: trunk/wiki/wikiation/installer/installfiles/wikiation_toolkit/wikiation_check_isolation.install/is_installed.sh
@@ -0,0 +1,3 @@
 2+#!/bin/sh
 3+
 4+test -d $DESTINATION_DIR/wikiation_check_isolation && echo "true"|| echo "false"
Property changes on: trunk/wiki/wikiation/installer/installfiles/wikiation_toolkit/wikiation_check_isolation.install/is_installed.sh
___________________________________________________________________
Added: svn:executable
15 +
Index: trunk/wiki/wikiation/installer/installfiles/wikiation_toolkit/wikiation_check_isolation.install/test.sh
@@ -0,0 +1,3 @@
 2+#!/bin/sh
 3+
 4+echo $hello_world
Index: trunk/wiki/wikiation/installer/installfiles/wikiation_toolkit/wikiation_check_isolation.install/info
@@ -0,0 +1,7 @@
 2+Required by the wikiation installer
 3+stores information about database and mediawiki files before installation or testing
 4+later diffs this information against the installed system to see if anything
 5+has changed. If something changes, you (might) have some interesting issues.
 6+
 7+
 8+
Index: trunk/wiki/wikiation/installer/installfiles/wikiation_toolkit/wikiation_check_isolation.install/update.sh
@@ -0,0 +1,8 @@
 2+#!/bin/sh
 3+
 4+cd $DESTINATION_DIR/wikiation_check_isolation
 5+if test -n "$REVISION"; then
 6+ svn update -r $REVISION
 7+else
 8+ svn update
 9+fi
Property changes on: trunk/wiki/wikiation/installer/installfiles/wikiation_toolkit/wikiation_check_isolation.install/update.sh
___________________________________________________________________
Added: svn:executable
110 +
Index: trunk/wiki/wikiation/installer/installfiles/wikiation_toolkit/wikiation_exttest.install/download.sh
@@ -0,0 +1,10 @@
 2+#!/bin/sh
 3+
 4+repository="http://6.wikiation.nl/svn/wikiation_exttest"
 5+
 6+cd $DESTINATION_DIR
 7+if test -n "$REVISION"; then
 8+ svn checkout -r $REVISION $repository
 9+else
 10+ svn checkout $repository
 11+fi
Property changes on: trunk/wiki/wikiation/installer/installfiles/wikiation_toolkit/wikiation_exttest.install/download.sh
___________________________________________________________________
Added: svn:executable
112 +
Index: trunk/wiki/wikiation/installer/installfiles/wikiation_toolkit/wikiation_exttest.install/uninstall.sh
@@ -0,0 +1,4 @@
 2+#!/bin/sh
 3+
 4+cd $DESTINATION_DIR
 5+rm -rf $NAME
Property changes on: trunk/wiki/wikiation/installer/installfiles/wikiation_toolkit/wikiation_exttest.install/uninstall.sh
___________________________________________________________________
Added: svn:executable
16 +
Index: trunk/wiki/wikiation/installer/installfiles/wikiation_toolkit/wikiation_exttest.install/is_installed.sh
@@ -0,0 +1,3 @@
 2+#!/bin/sh
 3+
 4+test -d $DESTINATION_DIR/$NAME && echo "true" || echo "false"
Property changes on: trunk/wiki/wikiation/installer/installfiles/wikiation_toolkit/wikiation_exttest.install/is_installed.sh
___________________________________________________________________
Added: svn:executable
15 +
Index: trunk/wiki/wikiation/installer/installfiles/wikiation_toolkit/wikiation_exttest.install/ImageMap.settings.php
@@ -0,0 +1,6 @@
 2+<?PHP
 3+
 4+require_once("$IP/extensions/ImageMap/ImageMap.php");
 5+
 6+
 7+?>
Index: trunk/wiki/wikiation/installer/installfiles/wikiation_toolkit/wikiation_exttest.install/info
@@ -0,0 +1,2 @@
 2+imagemap:
 3+http://www.mediawiki.org/wiki/Extension:ImageMap
Index: trunk/wiki/wikiation/installer/installfiles/wikiation_toolkit/wikiation_exttest.install/update.sh
@@ -0,0 +1,8 @@
 2+#!/bin/sh
 3+
 4+cd $DESTINATION_DIR/$NAME
 5+if test -n "$REVISION"; then
 6+ svn update -r $REVISION
 7+else
 8+ svn update
 9+fi
Property changes on: trunk/wiki/wikiation/installer/installfiles/wikiation_toolkit/wikiation_exttest.install/update.sh
___________________________________________________________________
Added: svn:executable
110 +
Index: trunk/wiki/wikiation/installer/installfiles/extensions/ImageMap.install/download.sh
@@ -0,0 +1,10 @@
 2+#!/bin/sh
 3+
 4+repository="$EXTENSIONS_SVN/$NAME"
 5+
 6+cd $DESTINATION_DIR
 7+if test -n "$REVISION"; then
 8+ svn checkout -r $REVISION $repository
 9+else
 10+ svn checkout $repository
 11+fi
Property changes on: trunk/wiki/wikiation/installer/installfiles/extensions/ImageMap.install/download.sh
___________________________________________________________________
Added: svn:executable
112 +
Index: trunk/wiki/wikiation/installer/installfiles/extensions/ImageMap.install/uninstall.sh
@@ -0,0 +1,4 @@
 2+#!/bin/sh
 3+
 4+cd $DESTINATION_DIR
 5+rm -rf $NAME
Property changes on: trunk/wiki/wikiation/installer/installfiles/extensions/ImageMap.install/uninstall.sh
___________________________________________________________________
Added: svn:executable
16 +
Index: trunk/wiki/wikiation/installer/installfiles/extensions/ImageMap.install/is_installed.sh
@@ -0,0 +1,3 @@
 2+#!/bin/sh
 3+
 4+test -d $DESTINATION_DIR/$NAME && echo "true" || echo "false"
Property changes on: trunk/wiki/wikiation/installer/installfiles/extensions/ImageMap.install/is_installed.sh
___________________________________________________________________
Added: svn:executable
15 +
Index: trunk/wiki/wikiation/installer/installfiles/extensions/ImageMap.install/ImageMap.settings.php
@@ -0,0 +1,6 @@
 2+<?PHP
 3+
 4+require_once("$IP/extensions/ImageMap/ImageMap.php");
 5+
 6+
 7+?>
Index: trunk/wiki/wikiation/installer/installfiles/extensions/ImageMap.install/info
@@ -0,0 +1,2 @@
 2+imagemap:
 3+http://www.mediawiki.org/wiki/Extension:ImageMap
Index: trunk/wiki/wikiation/installer/installfiles/extensions/ImageMap.install/update.sh
@@ -0,0 +1,8 @@
 2+#!/bin/sh
 3+
 4+cd $DESTINATION_DIR/$NAME
 5+if test -n "$REVISION"; then
 6+ svn update -r $REVISION
 7+else
 8+ svn update
 9+fi
Property changes on: trunk/wiki/wikiation/installer/installfiles/extensions/ImageMap.install/update.sh
___________________________________________________________________
Added: svn:executable
110 +
Index: trunk/wiki/wikiation/installer/installfiles/extensions/Cite.install/download.sh
@@ -0,0 +1,10 @@
 2+#!/bin/sh
 3+
 4+repository="$EXTENSIONS_SVN/$NAME"
 5+
 6+cd $DESTINATION_DIR
 7+if test -n "$REVISION"; then
 8+ svn checkout -r $REVISION $repository
 9+else
 10+ svn checkout $repository
 11+fi
Property changes on: trunk/wiki/wikiation/installer/installfiles/extensions/Cite.install/download.sh
___________________________________________________________________
Added: svn:executable
112 +
Index: trunk/wiki/wikiation/installer/installfiles/extensions/Cite.install/uninstall.sh
@@ -0,0 +1,4 @@
 2+#!/bin/sh
 3+
 4+cd $DESTINATION_DIR
 5+rm -rf $NAME
Property changes on: trunk/wiki/wikiation/installer/installfiles/extensions/Cite.install/uninstall.sh
___________________________________________________________________
Added: svn:executable
16 +
Index: trunk/wiki/wikiation/installer/installfiles/extensions/Cite.install/is_installed.sh
@@ -0,0 +1,3 @@
 2+#!/bin/sh
 3+
 4+test -d $DESTINATION_DIR/$NAME && echo "true" || echo "false"
Property changes on: trunk/wiki/wikiation/installer/installfiles/extensions/Cite.install/is_installed.sh
___________________________________________________________________
Added: svn:executable
15 +
Index: trunk/wiki/wikiation/installer/installfiles/extensions/Cite.install/Cite.settings.php
@@ -0,0 +1 @@
 2+require_once("$IP/extensions/Cite/Cite.php");
Index: trunk/wiki/wikiation/installer/installfiles/extensions/Cite.install/info
@@ -0,0 +1,2 @@
 2+cite:
 3+http://www.mediawiki.org/wiki/Extension:Cite
Index: trunk/wiki/wikiation/installer/installfiles/extensions/Cite.install/update.sh
@@ -0,0 +1,8 @@
 2+#!/bin/sh
 3+
 4+cd $DESTINATION_DIR/$NAME
 5+if test -n "$REVISION"; then
 6+ svn update -r $REVISION
 7+else
 8+ svn update
 9+fi
Property changes on: trunk/wiki/wikiation/installer/installfiles/extensions/Cite.install/update.sh
___________________________________________________________________
Added: svn:executable
110 +
Index: trunk/wiki/wikiation/installer/installfiles/extensions/ParserFunctions.install/download.sh
@@ -0,0 +1,10 @@
 2+#!/bin/sh
 3+
 4+repository="$EXTENSIONS_SVN/$NAME"
 5+
 6+cd $DESTINATION_DIR
 7+if test -n "$REVISION"; then
 8+ svn checkout -r $REVISION $repository
 9+else
 10+ svn checkout $repository
 11+fi
Property changes on: trunk/wiki/wikiation/installer/installfiles/extensions/ParserFunctions.install/download.sh
___________________________________________________________________
Added: svn:executable
112 +
Index: trunk/wiki/wikiation/installer/installfiles/extensions/ParserFunctions.install/uninstall.sh
@@ -0,0 +1,4 @@
 2+#!/bin/sh
 3+
 4+cd $DESTINATION_DIR
 5+rm -rf $NAME
Property changes on: trunk/wiki/wikiation/installer/installfiles/extensions/ParserFunctions.install/uninstall.sh
___________________________________________________________________
Added: svn:executable
16 +
Index: trunk/wiki/wikiation/installer/installfiles/extensions/ParserFunctions.install/is_installed.sh
@@ -0,0 +1,3 @@
 2+#!/bin/sh
 3+
 4+test -d $DESTINATION_DIR/$NAME && echo "true" || echo "false"
Property changes on: trunk/wiki/wikiation/installer/installfiles/extensions/ParserFunctions.install/is_installed.sh
___________________________________________________________________
Added: svn:executable
15 +
Index: trunk/wiki/wikiation/installer/installfiles/extensions/ParserFunctions.install/ParserFunctions.settings.php
@@ -0,0 +1,5 @@
 2+<?PHP
 3+
 4+require_once("$IP/extensions/ParserFunctions/ParserFunctions.php");
 5+
 6+?>
\ No newline at end of file
Index: trunk/wiki/wikiation/installer/installfiles/extensions/ParserFunctions.install/info
@@ -0,0 +1,2 @@
 2+parserfunctions:
 3+http://www.mediawiki.org/wiki/Extension:ParserFunctions
Index: trunk/wiki/wikiation/installer/installfiles/extensions/ParserFunctions.install/update.sh
@@ -0,0 +1,8 @@
 2+#!/bin/sh
 3+
 4+cd $DESTINATION_DIR/$NAME
 5+if test -n "$REVISION"; then
 6+ svn update -r $REVISION
 7+else
 8+ svn update
 9+fi
Property changes on: trunk/wiki/wikiation/installer/installfiles/extensions/ParserFunctions.install/update.sh
___________________________________________________________________
Added: svn:executable
110 +
Index: trunk/wiki/wikiation/installer/installfiles/extensions/InputBox.install/info
@@ -0,0 +1,5 @@
 2+InputBox
 3+========
 4+http://www.mediawiki.org/wiki/Extension:InputBox
 5+
 6+The Inputbox extension is a MediaWiki extension which adds already created HTML forms to wiki pages.
Index: trunk/wiki/wikiation/installer/installfiles/extensions/InputBox.install/update.sh
@@ -0,0 +1,8 @@
 2+#!/bin/sh
 3+
 4+cd $DESTINATION_DIR/$NAME
 5+if test -n "$REVISION"; then
 6+ svn update -r $REVISION
 7+else
 8+ svn update
 9+fi
Property changes on: trunk/wiki/wikiation/installer/installfiles/extensions/InputBox.install/update.sh
___________________________________________________________________
Added: svn:executable
110 +
Index: trunk/wiki/wikiation/installer/installfiles/extensions/InputBox.install/InputBox.settings.php
@@ -0,0 +1,6 @@
 2+<?PHP
 3+
 4+require_once("$IP/extensions/InputBox/InputBox.php");
 5+
 6+
 7+?>
Index: trunk/wiki/wikiation/installer/installfiles/extensions/InputBox.install/download.sh
@@ -0,0 +1,10 @@
 2+#!/bin/sh
 3+
 4+repository="$EXTENSIONS_SVN/$NAME"
 5+
 6+cd $DESTINATION_DIR
 7+if test -n "$REVISION"; then
 8+ svn checkout -r $REVISION $repository
 9+else
 10+ svn checkout $repository
 11+fi
Property changes on: trunk/wiki/wikiation/installer/installfiles/extensions/InputBox.install/download.sh
___________________________________________________________________
Added: svn:executable
112 +
Index: trunk/wiki/wikiation/installer/installfiles/extensions/InputBox.install/uninstall.sh
@@ -0,0 +1,4 @@
 2+#!/bin/sh
 3+
 4+cd $DESTINATION_DIR
 5+rm -rf $NAME
Property changes on: trunk/wiki/wikiation/installer/installfiles/extensions/InputBox.install/uninstall.sh
___________________________________________________________________
Added: svn:executable
16 +
Index: trunk/wiki/wikiation/installer/installfiles/extensions/InputBox.install/is_installed.sh
@@ -0,0 +1,3 @@
 2+#!/bin/sh
 3+
 4+test -d $DESTINATION_DIR/$NAME && echo "true" || echo "false"
Property changes on: trunk/wiki/wikiation/installer/installfiles/extensions/InputBox.install/is_installed.sh
___________________________________________________________________
Added: svn:executable
15 +
Index: trunk/wiki/wikiation/installer/toolkit_installer.py
@@ -0,0 +1,13 @@
 2+import settings
 3+import os, os.path, shutil
 4+import subprocess
 5+
 6+from installation_system import Installation_System
 7+
 8+
 9+class Toolkit_Installer(Installation_System):
 10+ system_name='wikiation_toolkit'
 11+ destination_dir=settings.toolkit_dir
 12+# def __init__(self,revision):
 13+# Installation_System.__init__(self)
 14+
Index: trunk/wiki/wikiation/installer/LocalSettings.php.template
@@ -0,0 +1,145 @@
 2+<?php
 3+
 4+# This file was automatically generated by the MediaWiki installer.
 5+# If you make manual changes, please keep track in case you need to
 6+# recreate them later.
 7+#
 8+# See includes/DefaultSettings.php for all configurable settings
 9+# and their default values, but don't forget to make changes in _this_
 10+# file, not there.
 11+
 12+error_reporting( E_ALL | E_STRICT);
 13+
 14+# If you customize your file layout, set $IP to the directory that contains
 15+# the other MediaWiki files. It will be used as a base to locate files.
 16+if( defined( 'MW_INSTALL_PATH' ) ) {
 17+ $IP = MW_INSTALL_PATH;
 18+} else {
 19+ $IP = dirname( __FILE__ );
 20+}
 21+
 22+$path = array( $IP, "$IP/includes", "$IP/languages" );
 23+set_include_path( implode( PATH_SEPARATOR, $path ) . PATH_SEPARATOR . get_include_path() );
 24+
 25+require_once( "$IP/includes/DefaultSettings.php" );
 26+
 27+# If PHP's memory limit is very low, some operations may fail.
 28+# ini_set( 'memory_limit', '20M' );
 29+
 30+if ( $wgCommandLineMode ) {
 31+ if ( isset( $_SERVER ) && array_key_exists( 'REQUEST_METHOD', $_SERVER ) ) {
 32+ die( "This script must be run from the command line\n" );
 33+ }
 34+}
 35+## Uncomment this to disable output compression
 36+# $wgDisableOutputCompression = true;
 37+
 38+$wgSitename = "Wikiation_<<TARGET>>";
 39+
 40+## The URL base path to the directory containing the wiki;
 41+## defaults for all runtime URL paths are based off of this.
 42+$wgScriptPath = "<<BASE_SCRIPTPATH>><<TARGET>>";
 43+$wgScriptExtension = ".php";
 44+
 45+
 46+## For more information on customizing the URLs please see:
 47+## http://www.mediawiki.org/wiki/Manual:Short_URL
 48+
 49+$wgEnableEmail = true;
 50+$wgEnableUserEmail = true;
 51+
 52+$wgEmergencyContact = "webmaster@localhost";
 53+$wgPasswordSender = "webmaster@localhost";
 54+
 55+## For a detailed description of the following switches see
 56+## http://www.mediawiki.org/wiki/Extension:Email_notification
 57+## and http://www.mediawiki.org/wiki/Extension:Email_notification
 58+## There are many more options for fine tuning available see
 59+## /includes/DefaultSettings.php
 60+## UPO means: this is also a user preference option
 61+$wgEnotifUserTalk = true; # UPO
 62+$wgEnotifWatchlist = true; # UPO
 63+$wgEmailAuthentication = true;
 64+
 65+$wgDBtype = "mysql";
 66+$wgDBserver = "localhost";
 67+$wgDBname = '<<TARGET>>';
 68+$wgDBuser = "root";
 69+$wgDBpassword = "";
 70+
 71+# MySQL specific settings
 72+$wgDBprefix = "";
 73+
 74+# MySQL table options to use during installation or update
 75+$wgDBTableOptions = "TYPE=InnoDB";
 76+
 77+# Experimental charset support for MySQL 4.1/5.0.
 78+$wgDBmysql5 = false;
 79+
 80+# Postgres specific settings
 81+$wgDBport = "5432";
 82+$wgDBmwschema = "mediawiki";
 83+$wgDBts2schema = "public";
 84+
 85+## Shared memory settings
 86+$wgMainCacheType = CACHE_ACCEL;
 87+$wgMemCachedServers = array();
 88+
 89+## To enable image uploads, make sure the 'images' directory
 90+## is writable, then set this to true:
 91+$wgEnableUploads = false;
 92+# $wgUseImageMagick = true;
 93+# $wgImageMagickConvertCommand = "/usr/bin/convert";
 94+
 95+## If you want to use image uploads under safe mode,
 96+## create the directories images/archive, images/thumb and
 97+## images/temp, and make them all writable. Then uncomment
 98+## this, if it's not already uncommented:
 99+# $wgHashedUploadDirectory = false;
 100+
 101+## If you have the appropriate support software installed
 102+## you can enable inline LaTeX equations:
 103+$wgUseTeX = false;
 104+
 105+$wgLocalInterwiki = $wgSitename;
 106+
 107+$wgLanguageCode = "en";
 108+
 109+$wgProxyKey = "eeedfbcf7f4e6238a2db7959e50e5e19d0e0c1a6500dbfaa5d38f6dabe801c76";
 110+
 111+## Default skin: you can change the default skin. Use the internal symbolic
 112+## names, ie 'standard', 'nostalgia', 'cologneblue', 'monobook':
 113+$wgDefaultSkin = 'monobook';
 114+
 115+## For attaching licensing metadata to pages, and displaying an
 116+## appropriate copyright notice / icon. GNU Free Documentation
 117+## License and Creative Commons licenses are supported so far.
 118+# $wgEnableCreativeCommonsRdf = true;
 119+$wgRightsPage = ""; # Set to the title of a wiki page that describes your license/copyright
 120+$wgRightsUrl = "";
 121+$wgRightsText = "";
 122+$wgRightsIcon = "";
 123+# $wgRightsCode = ""; # Not yet used
 124+
 125+$wgDiff3 = "/usr/bin/diff3";
 126+
 127+# When you make changes to this configuration file, this will make
 128+# sure that cached pages are cleared.
 129+$wgCacheEpoch = max( $wgCacheEpoch, gmdate( 'YmdHis', @filemtime( __FILE__ ) ) );
 130+
 131+$wgGroupPermissions['*' ]['read'] = true;
 132+$wgGroupPermissions['*' ]['write'] = false;
 133+
 134+
 135+# No wiki is complete without a logo.
 136+$wgLogo="$wgScriptPath/Logo.png";
 137+
 138+# load Localsettings specific to particular modules
 139+
 140+$additional_settings=glob("$IP/LocalSettings/*.php");
 141+foreach ($additional_settings as $file) {
 142+ require_once($file);
 143+}
 144+
 145+
 146+?>
Index: trunk/wiki/wikiation/installer/installation_system.py
@@ -0,0 +1,205 @@
 2+import settings
 3+import os, os.path, shutil
 4+import subprocess
 5+
 6+
 7+class Installer_Exception (Exception):
 8+ pass
 9+
 10+class Installation_System:
 11+ system_name=None
 12+ destination_dir=None
 13+ revision=None
 14+ as_alias=None
 15+
 16+ def __init__(self,revision=None):
 17+ self.subsystemdir=os.path.join(settings.installfiles, self.system_name)
 18+
 19+ if revision:
 20+ self.set_revision(revision)
 21+
 22+ def set_revision(self,revision):
 23+ self.revision=revision
 24+
 25+ def get_installers(self):
 26+ installers=os.listdir(self.subsystemdir)
 27+ installers2=[]
 28+ for line in installers:
 29+ if line.endswith(".install"):
 30+ installers2.append(line.replace(".install",""))
 31+
 32+ return installers2
 33+
 34+ def exists(self,installer_name):
 35+ return installer_name in self.get_installers()
 36+
 37+ def installdir_name(self, installer_name):
 38+ return os.path.join(self.subsystemdir, installer_name+".install")
 39+
 40+
 41+ def exec_task(self, installer_name, task, env=None):
 42+ """attempt to execute a file starting with the name of task[o] (ie. task.sh, task.py, task.pl, etc)
 43+ * task is name of task. If task requires args, provide a list, task[0] is name of task, task[1:] is args
 44+ * if no such file exists or file fails to run, return an exception.
 45+ * if more than one match exists, one match is picked
 46+ Exactly Which match is picked is not defined
 47+ (so Don't Do That)
 48+ * destination_dir is passed as a parameter
 49+ returns
 50+ * stdout returned by task command if successful
 51+ * None if task not available
 52+
 53+ raises exception if problems occur
 54+ """
 55+
 56+ installdir=self.installdir_name(installer_name)
 57+ dirlist=os.listdir(installdir)
 58+
 59+ if env==None:
 60+ env={}
 61+
 62+ env=dict(env)
 63+
 64+ env["INSTALL_DIR"]=installdir
 65+ env["DESTINATION_DIR"]=self.destination_dir
 66+ env["NAME"]=installer_name
 67+ env["REVISION"]="" #reserved for future expansion
 68+
 69+ if isinstance(task,str):
 70+ task2=[task]
 71+ else:
 72+ task2=list(task)
 73+
 74+ for filename in dirlist:
 75+ if filename.startswith(task2[0]):
 76+ task2[0]=os.path.join(installdir,filename)
 77+ try:
 78+ #print task2,env #useful for debugging. Might want to make a flag! :-)
 79+ process=subprocess.Popen(task2 ,stdout=subprocess.PIPE, env=env)
 80+ stdout,stderr=process.communicate()
 81+ except Exception, e:
 82+ #reraise with task and env info included, to give us a clue where we went wrong
 83+ raise Exception((e,task2,env))
 84+ return stdout
 85+ return None
 86+
 87+ def can_exec(self, installer_name, task):
 88+ installdir=self.installdir_name(installer_name)
 89+ dirlist=os.listdir(installdir)
 90+ for filename in dirlist:
 91+ if filename.startswith(task) and os.access(os.path.join(installdir,filename), os.X_OK):
 92+ return True
 93+
 94+ return False
 95+
 96+
 97+ def get_installed(self):
 98+
 99+ installed=[]
 100+ for installer_name in self.get_installers():
 101+ if self.is_installed(installer_name):
 102+ installed.append(installer_name)
 103+
 104+ return installed
 105+
 106+ def is_installed(self,installer_name):
 107+ if not self.destination_dir:
 108+ raise Installer_Exception("Installation_system: Internal Error: No destination_dir provided")
 109+
 110+ if self.can_exec(installer_name,"is_installed"):
 111+ rv=self.exec_task(installer_name,"is_installed")
 112+ if rv==None:
 113+ print "Warning: "+installer_name+" does not support 'is_installed'."
 114+ elif "true" in rv:
 115+ return True
 116+ elif "false" in rv:
 117+ return False
 118+ else:
 119+ print "Warning: "+installer_name+" 'is_installed' provides unexpected output "
 120+ else:
 121+ print "Warning: "+installer_name+" has some problems with 'is_installed'."
 122+
 123+ return None
 124+
 125+
 126+ def get_info(self,installer_name):
 127+ """print out information about the target from the info file"""
 128+ info_filename=os.path.join(self.installdir_name(installer_name),"info")
 129+ if not self.exists(installer_name):
 130+ raise Installer_Exception("Can't find installer "+installer_name)
 131+
 132+ if os.path.exists(info_filename):
 133+ print file(info_filename).read()
 134+ else:
 135+ print "This installer provides no information."
 136+
 137+ def install (self, installer_name):
 138+ """use the installation dir to actually install the program
 139+ returns True if installation successful, false if not, and None if unknown"""
 140+ if not self.exists(installer_name):
 141+ raise Installer_Exception("Can't find installer "+installer_name)
 142+
 143+ if self.is_installed(installer_name):
 144+ print installer_name,"already installed."
 145+ return
 146+
 147+ self.download(installer_name)
 148+ self.install_settings(installer_name)
 149+ # ...
 150+ # ...
 151+
 152+ #query the installer to see if ot thinks the component is properly installed
 153+ # any flaws at this point are the fault of the installer :-P
 154+ return self.is_installed(installer_name)
 155+
 156+ def download (self, installer_name, destination_dir=None):
 157+ """perform actions needed to download all the files we need"""
 158+
 159+ destination_dir=destination_dir or self.destination_dir
 160+ if not destination_dir:
 161+ raise Exception("Installation_system: Internal Error: No destination_dir provided")
 162+
 163+ if not self.exists(installer_name):
 164+ raise Installer_Exception("Can't find installer "+installer_name)
 165+
 166+ # if a particular step in the install procedure is not provided
 167+ # we simply skip it
 168+ if not self.can_exec(installer_name,"download"):
 169+ print "notice: cannot execute download script for "+installer_name
 170+ return
 171+
 172+ self.exec_task(installer_name,"download")
 173+
 174+ def install_settings(self,installer_name):
 175+ """do setup for settings files, etc... override to do something useful"""
 176+ pass
 177+
 178+ def uninstall_settings(self,installer_name):
 179+ """remove settings files etc... override to do something useful"""
 180+ pass
 181+
 182+ def uninstall (self, installer_name, destination_dir=None):
 183+ """uninstall the component"""
 184+
 185+ destination_dir=destination_dir or self.destination_dir
 186+ if not destination_dir:
 187+ raise Installer_Exception("Installation_system: Internal Error: No destination_dir provided")
 188+
 189+ if not self.exists(installer_name):
 190+ raise Installer_Exception("Can't find installer "+str(installer_name))
 191+
 192+ if not self.is_installed(installer_name):
 193+ print installer_name+" does not appear to be installed"
 194+ return
 195+
 196+ # if a particular step in the install procedure is not provided
 197+ # we simply skip it
 198+ if not self.can_exec(installer_name,"uninstall"):
 199+ return
 200+
 201+ self.exec_task(installer_name,"uninstall")
 202+
 203+ self.uninstall_settings(installer_name)
 204+ # use is_installed to determine success.
 205+ return not self.is_installed(installer_name)
 206+
Index: trunk/wiki/wikiation/installer/user.sql
@@ -0,0 +1,3 @@
 2+INSERT INTO `user` VALUES (1,'Admin','',':B:29526fc8:111474e311dc91032803281b181d571b','',NULL,'','quickbar=1\nunderline=2\ncols=80\nrows=25\nsearchlimit=20\ncontextlines=5\ncontextchars=50\ndisablesuggest=0\nskin=\nmath=1\nusenewrc=0\nrcdays=7\nrclimit=50\nwllimit=250\nhideminor=0\nhighlightbroken=1\nstubthreshold=0\npreviewontop=1\npreviewonfirst=0\neditsection=1\neditsectiononrightclick=0\neditondblclick=0\neditwidth=0\nshowtoc=1\nshowtoolbar=1\nminordefault=0\ndate=default\nimagesize=2\nthumbsize=2\nrememberpassword=0\nenotifwatchlistpages=0\nenotifusertalkpages=1\nenotifminoredits=0\nenotifrevealaddr=0\nshownumberswatching=1\nfancysig=0\nexternaleditor=0\nexternaldiff=0\nshowjumplinks=1\nnumberheadings=0\nuselivepreview=0\nwatchlistdays=3\nextendwatchlist=0\nwatchlisthideminor=0\nwatchlisthidebots=0\nwatchlisthideown=0\nwatchcreations=0\nwatchdefault=0\nwatchmoves=0\nwatchdeletion=0\nnoconvertlink=0\nvariant=en\nlanguage=en\nsearchNs0=1','20081102094116','861f88b75764364721f25d7ffd44670e',NULL,'\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0',NULL,'20081102094111',0);
 3+INSERT INTO `user_groups` VALUES(1,'sysop');
 4+INSERT INTO `user_groups` VALUES(1,'bureaucrat');

Status & tagging log