Index: trunk/wikiation/installer/installer.py |
— | — | @@ -0,0 +1,169 @@ |
| 2 | +#!/usr/bin/python |
| 3 | + |
| 4 | +# This software, copyright (C) 2008-2009 by Wikiation. |
| 5 | +# This software is developed by Kim Bruning. |
| 6 | +# |
| 7 | +# Distributed under the terms of the MIT license. |
| 8 | + |
| 9 | +import sys,os, os.path |
| 10 | +import readline |
| 11 | +import re |
| 12 | +import shutil |
| 13 | +import settings |
| 14 | + |
| 15 | +import installers |
| 16 | + |
| 17 | +from installer_util import * |
| 18 | +from isolation import * |
| 19 | + |
| 20 | +def intro(): |
| 21 | + """a nice banner/intro text for interactive mode""" |
| 22 | + |
| 23 | + print "=== Wikiation installer (v. "+revision()+") ===" |
| 24 | + print |
| 25 | + print "Interactive mode.", |
| 26 | + print "Automated testing is", |
| 27 | + if settings.run_automated_tests: |
| 28 | + print "enabled." |
| 29 | + else: |
| 30 | + print "disabled." |
| 31 | + print |
| 32 | + print "please type a command and hit enter" |
| 33 | + print "help<enter> for help" |
| 34 | + print "^D, or quit<enter> to quit" |
| 35 | + print |
| 36 | + |
| 37 | +def revision(): |
| 38 | + """obtain revision number for wikiation_installer itself""" |
| 39 | + |
| 40 | + revision_string=None |
| 41 | + os.chdir(settings.installerdir) |
| 42 | + info=os.popen("svn info .") |
| 43 | + for line in info: |
| 44 | + if line.startswith("Revision:"): |
| 45 | + revision_string=line.strip() |
| 46 | + break |
| 47 | + info.close() |
| 48 | + if revision_string==None: |
| 49 | + revision="unknown" |
| 50 | + else: |
| 51 | + revision=revision_string.replace("Revision:","") |
| 52 | + |
| 53 | + return revision |
| 54 | + |
| 55 | +def command(): |
| 56 | + """handle the command line in interactive mode""" |
| 57 | + |
| 58 | + try: |
| 59 | + command=raw_input('installer > ').strip() |
| 60 | + except EOFError: |
| 61 | + print "quit" |
| 62 | + sys.exit(0) |
| 63 | + |
| 64 | + if command: |
| 65 | + args=command.split() |
| 66 | + do_command(args) |
| 67 | + |
| 68 | + return True |
| 69 | + |
| 70 | +def do_command(all_args): |
| 71 | + """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. |
| 72 | + """ |
| 73 | + |
| 74 | + if all_args[0] in commands: |
| 75 | + commands[all_args[0]](all_args) |
| 76 | + else: |
| 77 | + print "I don't know how to '"+all_args[0]+"'." |
| 78 | + |
| 79 | +def ls(args): |
| 80 | + """implement local ls command, lists things we can install""" |
| 81 | + installers.ls(args) |
| 82 | + |
| 83 | +def info(args): |
| 84 | + """provide information on modules, where available""" |
| 85 | + installers.info(args) |
| 86 | + |
| 87 | +def install(args): |
| 88 | + """install something""" |
| 89 | + installers.install(args) |
| 90 | + |
| 91 | + |
| 92 | +def uninstall(args): |
| 93 | + """uninstall something""" |
| 94 | + installers.uninstall(args) |
| 95 | + |
| 96 | +def update_self(ignored_args): |
| 97 | + """update self to newest revision, (and switch to interactive mode)""" |
| 98 | + |
| 99 | + os.chdir(settings.installerdir) |
| 100 | + os.system("svn update") |
| 101 | + print "\n\n" |
| 102 | + print "wikiation_installer update attempted/completed. Restarting" |
| 103 | + print "----------------------------------------------------------" |
| 104 | + print "\n\n" |
| 105 | + os.execl("/usr/bin/python","/usr/bin/python",__file__) |
| 106 | + |
| 107 | + |
| 108 | +def default_revision(args): |
| 109 | + if len(args)>1: |
| 110 | + defualt_revision=args[1] |
| 111 | + |
| 112 | + print "current revision:",default_revision |
| 113 | + |
| 114 | +def main(): |
| 115 | + """main function. start of execution when run from shell""" |
| 116 | + if len(sys.argv)>1: |
| 117 | + args=sys.argv[1:] |
| 118 | + do_command(args) |
| 119 | + exit() |
| 120 | + |
| 121 | + |
| 122 | + histfile=os.path.join(os.environ["HOME"], ".installerhist") |
| 123 | + try: |
| 124 | + readline.read_history_file(histfile) |
| 125 | + except IOError: |
| 126 | + pass |
| 127 | + readline.parse_and_bind("tab: complete") |
| 128 | + |
| 129 | + import atexit |
| 130 | + atexit.register(readline.write_history_file, histfile) |
| 131 | + |
| 132 | + intro() |
| 133 | + |
| 134 | + # main loop. |
| 135 | + while(command()): |
| 136 | + pass |
| 137 | + |
| 138 | +# Global! |
| 139 | +default_revision=None |
| 140 | + |
| 141 | +#constants |
| 142 | + |
| 143 | +# bind commands to functions |
| 144 | +commands={ |
| 145 | + "help":help, |
| 146 | + "quit":quit, |
| 147 | + "ls":ls, |
| 148 | + "install":install, |
| 149 | + "uninstall":uninstall, |
| 150 | + "info":info, |
| 151 | + "check_isolation":check_isolation, |
| 152 | + "update_self":update_self, |
| 153 | + "revision":default_revision |
| 154 | +} |
| 155 | + |
| 156 | +# additional help texts for some commands. |
| 157 | +subhelp={ |
| 158 | + "ls":"""ls installed : list currently installed items |
| 159 | +ls available : list items available""" |
| 160 | + |
| 161 | +} |
| 162 | + |
| 163 | + |
| 164 | +# our internal "directory structure" |
| 165 | +internal_dirs=os.listdir(settings.installfiles) |
| 166 | +internal_dirs.extend(['mediawiki']) |
| 167 | + |
| 168 | +if __name__ == "__main__": |
| 169 | + main() |
| 170 | + |
Property changes on: trunk/wikiation/installer/installer.py |
___________________________________________________________________ |
Added: svn:executable |
1 | 171 | + |
Index: trunk/wikiation/installer/installers.py |
— | — | @@ -0,0 +1,363 @@ |
| 2 | +# This software, copyright (C) 2008-2009 by Wikiation. |
| 3 | +# This software is developed by Kim Bruning. |
| 4 | +# |
| 5 | +# Distributed under the terms of the MIT license. |
| 6 | + |
| 7 | +import settings |
| 8 | +import os, os.path, shutil |
| 9 | +import subprocess |
| 10 | + |
| 11 | +#from installation_system import Installation_System |
| 12 | +from toolkit_installer import Toolkit_Installer |
| 13 | +from extension_installer import Extension_Installer |
| 14 | +from mediawiki_installer import Mediawiki_Installer |
| 15 | +from installation_system import Installer_Exception |
| 16 | + |
| 17 | +class Parse_Exception(Exception): |
| 18 | + pass |
| 19 | + |
| 20 | +def ls(args): |
| 21 | + if len(args)==0: |
| 22 | + print "Internal error: args list too short" |
| 23 | + return |
| 24 | + if len(args)<=1: |
| 25 | + args.append("") |
| 26 | + |
| 27 | + ppath=None |
| 28 | + try: |
| 29 | + ppath=parse_path(" ".join(args[1:])) |
| 30 | + except Parse_Exception,e: |
| 31 | + print e.message |
| 32 | + return |
| 33 | + |
| 34 | + if ppath['ai']=='available': |
| 35 | + output=ls_available(ppath) |
| 36 | + elif ppath['ai']=='installed' or ppath['ai']==None: # XXX hardcoded default |
| 37 | + output=ls_installed(ppath) |
| 38 | + |
| 39 | + if output==None: |
| 40 | + return |
| 41 | + |
| 42 | + for line in output: |
| 43 | + print line |
| 44 | + |
| 45 | +def ls_available(ppath): |
| 46 | + if ppath["system"]==None: |
| 47 | + return ls_systems() |
| 48 | + else: |
| 49 | + return ls_available_in_system(ppath) |
| 50 | + |
| 51 | +def ls_installed(ppath): |
| 52 | + if ppath["system"]==None: |
| 53 | + if ppath["installer"]==None: |
| 54 | + return ls_systems() |
| 55 | + else: |
| 56 | + ppath["system"]="mediawiki" # XXX hardcoded default |
| 57 | + |
| 58 | + return ls_installed_in_system(ppath) |
| 59 | + |
| 60 | +def ls_systems(): |
| 61 | + return [item+':' for item in systems.keys()] |
| 62 | + |
| 63 | +def ls_available_in_system(ppath): |
| 64 | + system=get_system(ppath["system"]) |
| 65 | + if not system: |
| 66 | + return |
| 67 | + return system.get_installers() |
| 68 | + |
| 69 | +def ls_installed_in_system(ppath): |
| 70 | + system=get_system(ppath["system"]) |
| 71 | + if not system: |
| 72 | + return |
| 73 | + |
| 74 | + if ppath["in_installer"]: |
| 75 | + system.set_revision(ppath["in_installer"]) |
| 76 | + installed=None |
| 77 | + try: |
| 78 | + installed=system.get_installed() |
| 79 | + except Installer_Exception,e: |
| 80 | + print e.message |
| 81 | + return |
| 82 | + |
| 83 | + return installed |
| 84 | + |
| 85 | + |
| 86 | +def info(args): |
| 87 | + if len(args)<1: |
| 88 | + print "info: Internal error: expected more arguments" |
| 89 | + |
| 90 | + ppath=None |
| 91 | + try: |
| 92 | + ppath=parse_path(" ".join(args[1:]),defaults={'ai':'available'}) |
| 93 | + except Parse_Exception,e: |
| 94 | + print e.message |
| 95 | + return |
| 96 | + |
| 97 | + if not ppath["ai"]: |
| 98 | + ppath["ai"]="available" |
| 99 | + |
| 100 | + system=get_system(ppath["system"]) |
| 101 | + system.get_info(ppath["installer"]) |
| 102 | + |
| 103 | +def install(args): |
| 104 | + if len(args)<1: |
| 105 | + print "install: Internal error: expected more arguments" |
| 106 | + |
| 107 | + ppath=None |
| 108 | + try: |
| 109 | + ppath=parse_path(" ".join(args[1:]), defaults={'ai':'available','system':'mediawiki'}) |
| 110 | + except Parse_Exception,e: |
| 111 | + print e.message |
| 112 | + return |
| 113 | + |
| 114 | + if ppath["ai"]=="installed": |
| 115 | + print "Did you mean to install from available. ?" |
| 116 | + return |
| 117 | + |
| 118 | + system=get_system(ppath["system"]) |
| 119 | + if ppath["in_installer"]: |
| 120 | + system.set_revision(ppath["in_installer"]) |
| 121 | + if ppath["as_alias"]: |
| 122 | + system.as_alias=ppath["as_alias"] |
| 123 | + |
| 124 | + try: |
| 125 | + success=system.install(ppath["installer"]) |
| 126 | + if success: |
| 127 | + print "Install successful." |
| 128 | + else: |
| 129 | + print "Install failed." |
| 130 | + |
| 131 | + except Installer_Exception,e: |
| 132 | + print e.message |
| 133 | + return |
| 134 | + |
| 135 | + |
| 136 | +def uninstall(args): |
| 137 | + if len(args)<1: |
| 138 | + print "install: Internal error: expected more arguments" |
| 139 | + |
| 140 | + ppath=None |
| 141 | + try: |
| 142 | + ppath=parse_path(" ".join(args[1:]),defaults={'ai':'installed','system':'mediawiki'}) |
| 143 | + except Parse_Exception,e: |
| 144 | + print e.message |
| 145 | + return |
| 146 | + |
| 147 | + if ppath["ai"]=="available": |
| 148 | + print "Did you mean to uninstall from installed. ?" |
| 149 | + return |
| 150 | + |
| 151 | + system=get_system(ppath["system"]) |
| 152 | + if ppath["in_installer"]: |
| 153 | + system.set_revision(ppath["in_installer"]) |
| 154 | + if ppath["as_alias"]: |
| 155 | + system.as_alias=ppath["as_alias"] |
| 156 | + try: |
| 157 | + success=system.uninstall(ppath["installer"]) |
| 158 | + if success: |
| 159 | + print "Uninstall successful." |
| 160 | + else: |
| 161 | + print "Uninstall failed." |
| 162 | + except Installer_Exception,e: |
| 163 | + print e.message |
| 164 | + return |
| 165 | + |
| 166 | +def _ppath_defaults(ppath,defaults): |
| 167 | + for key in ppath.keys(): |
| 168 | + if key in defaults: |
| 169 | + ppath[key]=ppath[key] or defaults[key] |
| 170 | + |
| 171 | + |
| 172 | +def parse_path(path,defaults=None): |
| 173 | + ai=None |
| 174 | + system=None |
| 175 | + installer=None |
| 176 | + in_installer=None |
| 177 | + as_alias=None |
| 178 | + |
| 179 | + #partial components |
| 180 | + whence=None # eg. 'available.mediawiki:' |
| 181 | + single_case=None # a single word without context |
| 182 | + inpath=None # eg. 'ImageMap in REL1_13_2" |
| 183 | + |
| 184 | + if ":" in path: |
| 185 | + whence, inpath=path.split(':') |
| 186 | + elif "." in path: |
| 187 | + whence=path |
| 188 | + else: |
| 189 | + single_case=path |
| 190 | + |
| 191 | + if whence: |
| 192 | + if "." in whence: |
| 193 | + ai,system=whence.split('.') |
| 194 | + else: |
| 195 | + single_case=whence |
| 196 | + |
| 197 | + if single_case: |
| 198 | + if single_case in systems.keys(): |
| 199 | + system=single_case |
| 200 | + elif single_case in ["available","installed"]: |
| 201 | + ai=single_case |
| 202 | + elif single_case==path: |
| 203 | + inpath=single_case |
| 204 | + else: |
| 205 | + raise Parse_Exception("I'm not sure what to do with '"+single_case+"' in this context.") |
| 206 | + |
| 207 | + if inpath: |
| 208 | + l=inpath.split() |
| 209 | + if l[0] not in ["in","as"]: |
| 210 | + installer=l[0] |
| 211 | + |
| 212 | + if "in" in l: |
| 213 | + i=l.index("in") |
| 214 | + try: |
| 215 | + in_installer=l[i+1] |
| 216 | + except IndexError: |
| 217 | + raise Parse_Exception("Syntax error. Nothing after 'in'.") |
| 218 | + |
| 219 | + if "as" in l: |
| 220 | + i=l.index("as") |
| 221 | + try: |
| 222 | + as_alias=l[i+1] |
| 223 | + except IndexError: |
| 224 | + raise Parse_Exception("Syntax error. Nothing after 'as'.") |
| 225 | + |
| 226 | + # Ok, we have our basic return value now |
| 227 | + ppath={ |
| 228 | + "ai":ai, #available or installed |
| 229 | + "system":system, |
| 230 | + "installer":installer, |
| 231 | + "in_installer":in_installer, |
| 232 | + "as_alias":as_alias} |
| 233 | + |
| 234 | + |
| 235 | + # maybe we can assume some useful defaults (saves typing) |
| 236 | + if defaults: |
| 237 | + _ppath_defaults(ppath,defaults) |
| 238 | + |
| 239 | + # let's check to see if what we get is sane. |
| 240 | + |
| 241 | + if ppath['ai'] not in ["available","installed",None]: |
| 242 | + raise Parse_Exception("By '"+ppath['ai']+"', did you mean available or did you mean installed?") |
| 243 | + |
| 244 | + if ppath['system'] not in systems.keys() and not ppath['system']=="None": |
| 245 | + system_names=", ".join(ls_systems()) |
| 246 | + raise Parse_Exception("Did you mean to specify any of "+system_names) |
| 247 | + |
| 248 | + # we assume that the "in" directive always applies to a mediawiki instance |
| 249 | + if ppath['in_installer']: |
| 250 | + mediawiki=get_system('mediawiki') |
| 251 | + if not mediawiki.is_installed(ppath['in_installer']): |
| 252 | + raise Parse_Exception(ppath['in_installer']+' is not currently installed') |
| 253 | + |
| 254 | + # :-( |
| 255 | + #if installer: |
| 256 | + # if not system: |
| 257 | + # system='mediawiki' # XXX hardcoded default |
| 258 | + # mysystem=get_system(system) |
| 259 | + # |
| 260 | + # if in_installer: |
| 261 | + # system.set_revision(ppath["in_installer"]) |
| 262 | + # |
| 263 | + # if system.is_installed(installer) |
| 264 | + |
| 265 | + # we can only check if the installer name itself is valid |
| 266 | + # somewhat later, once we know what context we are in. |
| 267 | + |
| 268 | + return ppath |
| 269 | + |
| 270 | + |
| 271 | + |
| 272 | +def get_system(system_name): |
| 273 | + if system_name not in systems: |
| 274 | + print "Cannot find '"+system_name+"' in the list of supported installation systems." |
| 275 | + return None |
| 276 | + else: |
| 277 | + system=systems[system_name] |
| 278 | + |
| 279 | + return systems[system_name] |
| 280 | + |
| 281 | + |
| 282 | + |
| 283 | +systems={'wikiation_toolkit':Toolkit_Installer(),'extension': Extension_Installer(), 'mediawiki':Mediawiki_Installer()} |
| 284 | + |
| 285 | + |
| 286 | +if __name__=="__main__": |
| 287 | + print "testing installers.py module" |
| 288 | + print "CTRL-C to abort. run installer.py to actually use the installer" |
| 289 | + print |
| 290 | +# print "ls" |
| 291 | +# ls2(["ls"]) |
| 292 | +# print |
| 293 | +# print "ls available" |
| 294 | +# ls2(["ls","available"]) |
| 295 | +# print |
| 296 | +# print "ls available/wikiation_toolkit" |
| 297 | +# ls2(["ls","available/wikiation_toolkit"]) |
| 298 | +# print |
| 299 | +# print "ls installed/wikiation_toolkit" |
| 300 | +# ls2(["ls","installed/wikiation_toolkit"]) |
| 301 | +# print |
| 302 | +# print "get info" |
| 303 | +# system=get_system("wikiation_toolkit") |
| 304 | +# system.get_info("pywikipedia") |
| 305 | +# |
| 306 | +# print "install" |
| 307 | +# print "pywiki",repr(system.install("pywikipedia")) |
| 308 | +# print "exttest", repr(system.install("wikiation_exttest")) |
| 309 | +# print "isolation", repr(system.install("wikiation_check_isolation")) |
| 310 | +# print "ls", os.listdir('..') |
| 311 | +# |
| 312 | +# print "uninstall" |
| 313 | +# print "pywiki", repr(system.uninstall("pywikipedia")) |
| 314 | +# print "exttest", repr(system.uninstall("wikiation_exttest")) |
| 315 | +# print "isolation", repr(system.uninstall("wikiation_check_isolation")) |
| 316 | +# |
| 317 | +# print "wikiation_extension (assumes existing wiki)" |
| 318 | +# extension_installer=Extension_Installer("REL1_13_3") |
| 319 | +# |
| 320 | +# print " \ uninstall " , repr (extension_installer.uninstall("ImageMap")) |
| 321 | +# print "ImageMap", repr (extension_installer.install("ImageMap")) |
| 322 | +# |
| 323 | + #print "mediawiki installer" |
| 324 | + #print "avail" |
| 325 | + #ls2(["ls","available/mediawiki"]) |
| 326 | + #print "installed" |
| 327 | + #ls2(["ls","installed/mediawiki"]) |
| 328 | +# |
| 329 | +# print "try another wiki, say REL1_13_2" |
| 330 | + |
| 331 | +# mediawiki_installer=get_system("mediawiki") |
| 332 | +# |
| 333 | +# print "uninstl mediawiki 1_13_2", repr (mediawiki_installer.uninstall("REL1_13_2")) |
| 334 | +# print "install mediawiki 1_13_2", repr (mediawiki_installer.install("REL1_13_2")) |
| 335 | +# |
| 336 | +# print "extension (assumes existing wiki)" |
| 337 | +# extension_installer=Extension_Installer("REL1_13_2") |
| 338 | +# |
| 339 | +# print " \ uninstall " , repr (extension_installer.uninstall("ImageMap")) |
| 340 | +# print "ImageMap", repr (extension_installer.install("ImageMap")) |
| 341 | +# |
| 342 | +# print "try some ls stuff" |
| 343 | +# def qls(mystr): # q for "quick" |
| 344 | +# print "ls", repr(mystr) |
| 345 | +# ls(['ls',mystr]) |
| 346 | +# |
| 347 | +# qls('') |
| 348 | +# qls('available') |
| 349 | +# qls('installed') |
| 350 | +# qls('available:') |
| 351 | +# qls('installed:') |
| 352 | +# qls('murp.morp:') |
| 353 | +# qls('installed.mediawiki:') |
| 354 | +# qls('installed.extension:') |
| 355 | +# qls('installed.toolkit:') |
| 356 | +# qls('installed.mediawiki:in REL1_13_2') |
| 357 | +# qls('available.extension:') |
| 358 | +# qls('installed.extension:in REL1_13_2') |
| 359 | +# qls('installed.extension:in FOO') |
| 360 | +# qls('installed.mediawiki:in FOO') |
| 361 | +# qls('available.wikiation') |
| 362 | +# qls('available.wikiation:in BAR as BAZ') |
| 363 | +# qls('available.wikiation:in BOG as BOT') |
| 364 | +# qls('available.wikiation:in BOG as BOT murp morp bla bla bla') |
Index: trunk/wikiation/installer/mediawiki_installer.py |
— | — | @@ -0,0 +1,238 @@ |
| 2 | +# This software is developed by Kim Bruning. |
| 3 | +# |
| 4 | +# Distributed under the terms of the MIT license. |
| 5 | + |
| 6 | +import settings |
| 7 | +import os, os.path, shutil |
| 8 | +import subprocess |
| 9 | + |
| 10 | +from installation_system import Installation_System |
| 11 | + |
| 12 | +from installer_util import * |
| 13 | +from isolation import * |
| 14 | + |
| 15 | +# this still uses some legacy structured code, wrapped in a class so it can't do |
| 16 | +#too much harm outside this file. Will refactor later when I have more time. |
| 17 | + |
| 18 | +# already partially refactored while creating class. |
| 19 | + |
| 20 | + |
| 21 | +#constants |
| 22 | + |
| 23 | +#Things that are not mediawiki revisions (in the svn tags directory on mediawiki svn) |
| 24 | +filter_available=['extensions/'] |
| 25 | + |
| 26 | + |
| 27 | +class Mediawiki_Installer(Installation_System): |
| 28 | + """installer for mediawiki revisions""" |
| 29 | + system_name='mediawiki_installer' |
| 30 | + # TODO: destination_dir isn't quite changable until we have finished refactoring everything (not today) |
| 31 | + destination_dir=settings.revisionsdir |
| 32 | + def __init__(self): |
| 33 | + Installation_System.__init__(self) |
| 34 | + |
| 35 | + def get_installers(self): |
| 36 | + """list available items""" |
| 37 | + |
| 38 | + l=list(os.popen('svn ls '+settings.tagsdir)) |
| 39 | + stripped=[line.strip() for line in l] |
| 40 | + #filter out things that are not mediawiki revisions |
| 41 | + for item in filter_available: |
| 42 | + if item in stripped: |
| 43 | + stripped.remove(item) |
| 44 | + return stripped |
| 45 | + |
| 46 | + #def exists: same as super |
| 47 | + |
| 48 | + # Hmm: perhaps these should really belong in a separate mixin? |
| 49 | + #installdir_name: unused, but leave for future expansion |
| 50 | + #exec_task: unused, but leave for future expansion |
| 51 | + #can_exec: unused, but leave for future expansion |
| 52 | + |
| 53 | + def get_installed(self): |
| 54 | + """list installed items""" |
| 55 | + return os.listdir(self.destination_dir) |
| 56 | + |
| 57 | + def is_installed(self, installer_name): |
| 58 | + return installer_name in self.get_installed() |
| 59 | + |
| 60 | + # super.get_info does something sane here, let's leave it in. |
| 61 | + # (we can even provide info files for certain releases if we want) |
| 62 | + |
| 63 | + def install(self, installer_name, as_alias=None): |
| 64 | + name=as_alias or self.as_alias or installer_name |
| 65 | + |
| 66 | + install(installer_name, name) |
| 67 | + return self.is_installed(name) |
| 68 | + |
| 69 | + #download is unused, but leave for future expansion |
| 70 | + #install_settings unused |
| 71 | + #uninstall_settings |
| 72 | + |
| 73 | + def uninstall(self,installer_name): |
| 74 | + name=self.as_alias or installer_name |
| 75 | + if not self.is_installed(name): |
| 76 | + print name+" does not appear to be installed" |
| 77 | + return |
| 78 | + |
| 79 | + uninstall(name) |
| 80 | + return not self.is_installed(name) |
| 81 | + |
| 82 | + |
| 83 | + |
| 84 | +#duplicate of get_installed() TODO: Refactor |
| 85 | +def installed(): |
| 86 | + """list installed items""" |
| 87 | + return os.listdir(settings.revisionsdir) |
| 88 | + |
| 89 | +#duplicate of get_installers() TODO: Refactor |
| 90 | +def available(): |
| 91 | + """list available items""" |
| 92 | + |
| 93 | + l=list(os.popen('svn ls '+settings.tagsdir)) |
| 94 | + stripped=[line.strip() for line in l] |
| 95 | + for item in filter_available: |
| 96 | + if item in stripped: |
| 97 | + stripped.remove(item) |
| 98 | + return stripped |
| 99 | + |
| 100 | + |
| 101 | + |
| 102 | +def install(target, option_as): |
| 103 | + """implement install command. Installs a mediawiki version""" |
| 104 | + target=clean_target(target) |
| 105 | + |
| 106 | + latest=False |
| 107 | + if target=="latest": |
| 108 | + latest=True |
| 109 | + |
| 110 | + if option_as: |
| 111 | + name=clean_target(option_as) |
| 112 | + else: |
| 113 | + name=target |
| 114 | + |
| 115 | + if name in installed(): |
| 116 | + print name+" already installed." |
| 117 | + return |
| 118 | + |
| 119 | + # available targets all end in '/', very consistent, this :-P |
| 120 | + if not latest and target+'/' not in available(): |
| 121 | + print target+" is not available or invalid.\n(try: ls available )" |
| 122 | + return |
| 123 | + |
| 124 | + #Everything checks out ok, so let's install. |
| 125 | + os.chdir(settings.revisionsdir) |
| 126 | + print "Checking out code from subversion (please be patient)..." |
| 127 | + if latest: |
| 128 | + checkout_latest(name) |
| 129 | + else: |
| 130 | + checkout(target+"/", name) |
| 131 | + |
| 132 | + print "Creating LocalSettings.php..." |
| 133 | + localsettings(name) |
| 134 | + print "Copy logo..." |
| 135 | + logo(name) |
| 136 | + print "Setting up database..." |
| 137 | + makedb(name) |
| 138 | + if settings.run_automated_tests: |
| 139 | + print "Storing comparison data for check_isolation" |
| 140 | + difftests(name) |
| 141 | + print "Done." |
| 142 | + |
| 143 | + |
| 144 | +def uninstall(target): |
| 145 | + """implements uninstall command: uninstall mediawiki version""" |
| 146 | + |
| 147 | + target=clean_target(target) |
| 148 | + |
| 149 | + if target not in installed(): |
| 150 | + print target+": can't find an installed revision by that name" |
| 151 | + return |
| 152 | + |
| 153 | + #Ok, looks like our arguments are valid. |
| 154 | + os.chdir(settings.revisionsdir) |
| 155 | + print "Dropping database..." |
| 156 | + dropdb(target) |
| 157 | + print "Deleting directory..." |
| 158 | + delete(target) |
| 159 | + print "Done." |
| 160 | + |
| 161 | +def checkout(target, name): |
| 162 | + """checkout the given target revision""" |
| 163 | + |
| 164 | + command="svn checkout "+settings.tagsdir+"/"+target+"phase3" |
| 165 | + _checkout(command,name) |
| 166 | + |
| 167 | +def checkout_latest(name): |
| 168 | + """checkout the latest trunk revision""" |
| 169 | + |
| 170 | + command="svn checkout "+settings.trunkdir+"/phase3" |
| 171 | + _checkout(command,name) |
| 172 | + |
| 173 | +def _checkout(command, name): |
| 174 | + """perform the actual check out, and rename our checked out data to something more useful""" |
| 175 | + |
| 176 | + os.system(command) |
| 177 | + os.rename('phase3',name) |
| 178 | + |
| 179 | + |
| 180 | +def localsettings(target): |
| 181 | + """create a localSettings.php file, for target mediawiki instance based |
| 182 | + on the LocalSettings.php.template file |
| 183 | + LocalSettings.php is the main configuration file for mediawiki.""" |
| 184 | + |
| 185 | + template=settings.installerdir+"/LocalSettings.php.template" |
| 186 | + localsettings=settings.revisionsdir+"/"+target+"/LocalSettings.php" |
| 187 | + replacements={'<<TARGET>>':target,"<<BASE_SCRIPTPATH>>":settings.base_scriptpath} |
| 188 | + replace_generic(replacements,template,localsettings) |
| 189 | + subdir=settings.revisionsdir+"/"+target+"/LocalSettings" |
| 190 | + os.mkdir(subdir) |
| 191 | + |
| 192 | +def logo(target): |
| 193 | + """copy a nice logo""" |
| 194 | + |
| 195 | + logo=settings.installerdir+"/Logo.png" |
| 196 | + dest=settings.revisionsdir+"/"+target+"/Logo.png" |
| 197 | + shutil.copy(logo,dest) |
| 198 | + |
| 199 | +def makedb(target): |
| 200 | + """make a mediawiki database for target mediawiki instance """ |
| 201 | + |
| 202 | + dropdb(target); |
| 203 | + createdb(target); |
| 204 | + make_tables(target) |
| 205 | + make_admin(target) |
| 206 | + |
| 207 | +def make_tables(target): |
| 208 | + """use the maintenance/tables.sql file provided by target mediawiki |
| 209 | + instance to generate our tables""" |
| 210 | + |
| 211 | + target_file=settings.revisionsdir+"/"+target+"/maintenance/tables.sql" |
| 212 | + do_sql(target, target_file) |
| 213 | + |
| 214 | +def make_admin(target): |
| 215 | + """use our usr.sql file to create an admin user""" |
| 216 | + do_sql(target, settings.installerdir+"/user.sql") |
| 217 | + |
| 218 | +def do_sql(target, infile): |
| 219 | + """execute an sql file, using mysql""" |
| 220 | + |
| 221 | + command="< "+infile+" "+settings.mysql_command+"" +target |
| 222 | + os.system(command) |
| 223 | + |
| 224 | +def createdb(target): |
| 225 | + """create a database using mysql""" |
| 226 | + |
| 227 | + command="echo 'CREATE DATABASE "+target+";' | "+settings.mysql_command |
| 228 | + os.system(command) |
| 229 | + |
| 230 | +def dropdb(target): |
| 231 | + """drop a database using mysql""" |
| 232 | + |
| 233 | + command="echo 'DROP DATABASE IF EXISTS "+target+";' | "+settings.mysql_command |
| 234 | + os.system(command) |
| 235 | + |
| 236 | +def delete(target): |
| 237 | + """delete target mediawiki installation, assumes we are in the revisions directory""" |
| 238 | + shutil.rmtree(target) |
| 239 | + |
Index: trunk/wikiation/installer/isolation.py |
— | — | @@ -0,0 +1,38 @@ |
| 2 | +# This software, copyright (C) 2008-2009 by Wikiation. |
| 3 | +# This software is developed by Kim Bruning. |
| 4 | +# |
| 5 | +# Distributed under the terms of the MIT license. |
| 6 | + |
| 7 | +import sys,os, os.path |
| 8 | +import settings |
| 9 | + |
| 10 | +#support for wikiation_check_isolation |
| 11 | + |
| 12 | +def _check_isolation(args): |
| 13 | + """wikiation_check_isolation: check diffs now""" |
| 14 | + difftest=settings.isolation_test |
| 15 | + command=difftest+" "+" ".join(args) |
| 16 | + os.system(command) |
| 17 | + |
| 18 | +def check_isolation(args): |
| 19 | + """implement check_isolation command""" |
| 20 | + |
| 21 | + if len(args) < 2 : |
| 22 | + print "Must specify a target!\n(try: ls installed )" |
| 23 | + return |
| 24 | + target=args[1] |
| 25 | + if target not in installed(): |
| 26 | + print target+' is not currently installed' |
| 27 | + return |
| 28 | + |
| 29 | + _check_isolation(args[1:]) |
| 30 | + |
| 31 | + |
| 32 | +def difftests(target): |
| 33 | + """wikiation_check_isolation: store diffs, ready for testing later""" |
| 34 | + |
| 35 | + difftest=settings.isolation_create |
| 36 | + command=difftest+" "+target |
| 37 | + os.system(command) |
| 38 | + |
| 39 | + |
Index: trunk/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/wikiation/installer/installfiles/extensions/ImageMap.install/uninstall.sh |
___________________________________________________________________ |
Added: svn:executable |
1 | 6 | + |
Index: trunk/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/wikiation/installer/installfiles/extensions/ImageMap.install/is_installed.sh |
___________________________________________________________________ |
Added: svn:executable |
1 | 5 | + |
Index: trunk/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/wikiation/installer/installfiles/extensions/ImageMap.install/info |
— | — | @@ -0,0 +1,2 @@ |
| 2 | +imagemap: |
| 3 | +http://www.mediawiki.org/wiki/Extension:ImageMap |
Index: trunk/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/wikiation/installer/installfiles/extensions/ImageMap.install/update.sh |
___________________________________________________________________ |
Added: svn:executable |
1 | 10 | + |
Index: trunk/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/wikiation/installer/installfiles/extensions/ImageMap.install/download.sh |
___________________________________________________________________ |
Added: svn:executable |
1 | 12 | + |
Index: trunk/wikiation/installer/installfiles/extensions/Cite.install/info |
— | — | @@ -0,0 +1,2 @@ |
| 2 | +cite: |
| 3 | +http://www.mediawiki.org/wiki/Extension:Cite |
Index: trunk/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/wikiation/installer/installfiles/extensions/Cite.install/update.sh |
___________________________________________________________________ |
Added: svn:executable |
1 | 10 | + |
Index: trunk/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/wikiation/installer/installfiles/extensions/Cite.install/download.sh |
___________________________________________________________________ |
Added: svn:executable |
1 | 12 | + |
Index: trunk/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/wikiation/installer/installfiles/extensions/Cite.install/uninstall.sh |
___________________________________________________________________ |
Added: svn:executable |
1 | 6 | + |
Index: trunk/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/wikiation/installer/installfiles/extensions/Cite.install/is_installed.sh |
___________________________________________________________________ |
Added: svn:executable |
1 | 5 | + |
Index: trunk/wikiation/installer/installfiles/extensions/Cite.install/Cite.settings.php |
— | — | @@ -0,0 +1 @@ |
| 2 | +require_once("$IP/extensions/Cite/Cite.php"); |
Index: trunk/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/wikiation/installer/installfiles/extensions/ParserFunctions.install/info |
— | — | @@ -0,0 +1,2 @@ |
| 2 | +parserfunctions: |
| 3 | +http://www.mediawiki.org/wiki/Extension:ParserFunctions |
Index: trunk/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/wikiation/installer/installfiles/extensions/ParserFunctions.install/update.sh |
___________________________________________________________________ |
Added: svn:executable |
1 | 10 | + |
Index: trunk/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/wikiation/installer/installfiles/extensions/ParserFunctions.install/download.sh |
___________________________________________________________________ |
Added: svn:executable |
1 | 12 | + |
Index: trunk/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/wikiation/installer/installfiles/extensions/ParserFunctions.install/uninstall.sh |
___________________________________________________________________ |
Added: svn:executable |
1 | 6 | + |
Index: trunk/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/wikiation/installer/installfiles/extensions/ParserFunctions.install/is_installed.sh |
___________________________________________________________________ |
Added: svn:executable |
1 | 5 | + |
Index: trunk/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/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/wikiation/installer/installfiles/extensions/InputBox.install/update.sh |
___________________________________________________________________ |
Added: svn:executable |
1 | 10 | + |
Index: trunk/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/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/wikiation/installer/installfiles/extensions/InputBox.install/download.sh |
___________________________________________________________________ |
Added: svn:executable |
1 | 12 | + |
Index: trunk/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/wikiation/installer/installfiles/extensions/InputBox.install/uninstall.sh |
___________________________________________________________________ |
Added: svn:executable |
1 | 6 | + |
Index: trunk/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/wikiation/installer/installfiles/extensions/InputBox.install/is_installed.sh |
___________________________________________________________________ |
Added: svn:executable |
1 | 5 | + |
Index: trunk/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/wikiation/installer/installfiles/wikiation_toolkit/wikiation_check_isolation.install/download.sh |
___________________________________________________________________ |
Added: svn:executable |
1 | 12 | + |
Index: trunk/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/wikiation/installer/installfiles/wikiation_toolkit/wikiation_check_isolation.install/uninstall.sh |
___________________________________________________________________ |
Added: svn:executable |
1 | 7 | + |
Index: trunk/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/wikiation/installer/installfiles/wikiation_toolkit/wikiation_check_isolation.install/is_installed.sh |
___________________________________________________________________ |
Added: svn:executable |
1 | 5 | + |
Index: trunk/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/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/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/wikiation/installer/installfiles/wikiation_toolkit/wikiation_check_isolation.install/update.sh |
___________________________________________________________________ |
Added: svn:executable |
1 | 10 | + |
Index: trunk/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/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/wikiation/installer/installfiles/wikiation_toolkit/wikiation_exttest.install/update.sh |
___________________________________________________________________ |
Added: svn:executable |
1 | 10 | + |
Index: trunk/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/wikiation/installer/installfiles/wikiation_toolkit/wikiation_exttest.install/download.sh |
___________________________________________________________________ |
Added: svn:executable |
1 | 12 | + |
Index: trunk/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/wikiation/installer/installfiles/wikiation_toolkit/wikiation_exttest.install/uninstall.sh |
___________________________________________________________________ |
Added: svn:executable |
1 | 6 | + |
Index: trunk/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/wikiation/installer/installfiles/wikiation_toolkit/wikiation_exttest.install/is_installed.sh |
___________________________________________________________________ |
Added: svn:executable |
1 | 5 | + |
Index: trunk/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/wikiation/installer/installfiles/wikiation_toolkit/pywikipedia.install/info |
— | — | @@ -0,0 +1 @@ |
| 2 | +A version of pywikipedia suitable for wikiation exttest environments |
Index: trunk/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/wikiation/installer/installfiles/wikiation_toolkit/pywikipedia.install/download.sh |
___________________________________________________________________ |
Added: svn:executable |
1 | 9 | + |
Index: trunk/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/wikiation/installer/installfiles/wikiation_toolkit/pywikipedia.install/uninstall.sh |
___________________________________________________________________ |
Added: svn:executable |
1 | 6 | + |
Index: trunk/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/wikiation/installer/installfiles/wikiation_toolkit/pywikipedia.install/is_installed.sh |
___________________________________________________________________ |
Added: svn:executable |
1 | 7 | + |
Index: trunk/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/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/wikiation/installer/installation_system.py |
— | — | @@ -0,0 +1,210 @@ |
| 2 | +# This software, copyright (C) 2008-2009 by Wikiation. |
| 3 | +# This software is developed by Kim Bruning. |
| 4 | +# |
| 5 | +# Distributed under the terms of the MIT license. |
| 6 | +` |
| 7 | +import settings |
| 8 | +import os, os.path, shutil |
| 9 | +import subprocess |
| 10 | + |
| 11 | + |
| 12 | +class Installer_Exception (Exception): |
| 13 | + pass |
| 14 | + |
| 15 | +class Installation_System: |
| 16 | + system_name=None |
| 17 | + destination_dir=None |
| 18 | + revision=None |
| 19 | + as_alias=None |
| 20 | + |
| 21 | + def __init__(self,revision=None): |
| 22 | + self.subsystemdir=os.path.join(settings.installfiles, self.system_name) |
| 23 | + |
| 24 | + if revision: |
| 25 | + self.set_revision(revision) |
| 26 | + |
| 27 | + def set_revision(self,revision): |
| 28 | + self.revision=revision |
| 29 | + |
| 30 | + def get_installers(self): |
| 31 | + installers=os.listdir(self.subsystemdir) |
| 32 | + installers2=[] |
| 33 | + for line in installers: |
| 34 | + if line.endswith(".install"): |
| 35 | + installers2.append(line.replace(".install","")) |
| 36 | + |
| 37 | + return installers2 |
| 38 | + |
| 39 | + def exists(self,installer_name): |
| 40 | + return installer_name in self.get_installers() |
| 41 | + |
| 42 | + def installdir_name(self, installer_name): |
| 43 | + return os.path.join(self.subsystemdir, installer_name+".install") |
| 44 | + |
| 45 | + |
| 46 | + def exec_task(self, installer_name, task, env=None): |
| 47 | + """attempt to execute a file starting with the name of task[o] (ie. task.sh, task.py, task.pl, etc) |
| 48 | + * task is name of task. If task requires args, provide a list, task[0] is name of task, task[1:] is args |
| 49 | + * if no such file exists or file fails to run, return an exception. |
| 50 | + * if more than one match exists, one match is picked |
| 51 | + Exactly Which match is picked is not defined |
| 52 | + (so Don't Do That) |
| 53 | + * destination_dir is passed as a parameter |
| 54 | + returns |
| 55 | + * stdout returned by task command if successful |
| 56 | + * None if task not available |
| 57 | + |
| 58 | + raises exception if problems occur |
| 59 | + """ |
| 60 | + |
| 61 | + installdir=self.installdir_name(installer_name) |
| 62 | + dirlist=os.listdir(installdir) |
| 63 | + |
| 64 | + if env==None: |
| 65 | + env={} |
| 66 | + |
| 67 | + env=dict(env) |
| 68 | + |
| 69 | + env["INSTALL_DIR"]=installdir |
| 70 | + env["DESTINATION_DIR"]=self.destination_dir |
| 71 | + env["NAME"]=installer_name |
| 72 | + env["REVISION"]="" #reserved for future expansion |
| 73 | + |
| 74 | + if isinstance(task,str): |
| 75 | + task2=[task] |
| 76 | + else: |
| 77 | + task2=list(task) |
| 78 | + |
| 79 | + for filename in dirlist: |
| 80 | + if filename.startswith(task2[0]): |
| 81 | + task2[0]=os.path.join(installdir,filename) |
| 82 | + try: |
| 83 | + #print task2,env #useful for debugging. Might want to make a flag! :-) |
| 84 | + process=subprocess.Popen(task2 ,stdout=subprocess.PIPE, env=env) |
| 85 | + stdout,stderr=process.communicate() |
| 86 | + except Exception, e: |
| 87 | + #reraise with task and env info included, to give us a clue where we went wrong |
| 88 | + raise Exception((e,task2,env)) |
| 89 | + return stdout |
| 90 | + return None |
| 91 | + |
| 92 | + def can_exec(self, installer_name, task): |
| 93 | + installdir=self.installdir_name(installer_name) |
| 94 | + dirlist=os.listdir(installdir) |
| 95 | + for filename in dirlist: |
| 96 | + if filename.startswith(task) and os.access(os.path.join(installdir,filename), os.X_OK): |
| 97 | + return True |
| 98 | + |
| 99 | + return False |
| 100 | + |
| 101 | + |
| 102 | + def get_installed(self): |
| 103 | + |
| 104 | + installed=[] |
| 105 | + for installer_name in self.get_installers(): |
| 106 | + if self.is_installed(installer_name): |
| 107 | + installed.append(installer_name) |
| 108 | + |
| 109 | + return installed |
| 110 | + |
| 111 | + def is_installed(self,installer_name): |
| 112 | + if not self.destination_dir: |
| 113 | + raise Installer_Exception("Installation_system: Internal Error: No destination_dir provided") |
| 114 | + |
| 115 | + if self.can_exec(installer_name,"is_installed"): |
| 116 | + rv=self.exec_task(installer_name,"is_installed") |
| 117 | + if rv==None: |
| 118 | + print "Warning: "+installer_name+" does not support 'is_installed'." |
| 119 | + elif "true" in rv: |
| 120 | + return True |
| 121 | + elif "false" in rv: |
| 122 | + return False |
| 123 | + else: |
| 124 | + print "Warning: "+installer_name+" 'is_installed' provides unexpected output " |
| 125 | + else: |
| 126 | + print "Warning: "+installer_name+" has some problems with 'is_installed'." |
| 127 | + |
| 128 | + return None |
| 129 | + |
| 130 | + |
| 131 | + def get_info(self,installer_name): |
| 132 | + """print out information about the target from the info file""" |
| 133 | + info_filename=os.path.join(self.installdir_name(installer_name),"info") |
| 134 | + if not self.exists(installer_name): |
| 135 | + raise Installer_Exception("Can't find installer "+installer_name) |
| 136 | + |
| 137 | + if os.path.exists(info_filename): |
| 138 | + print file(info_filename).read() |
| 139 | + else: |
| 140 | + print "This installer provides no information." |
| 141 | + |
| 142 | + def install (self, installer_name): |
| 143 | + """use the installation dir to actually install the program |
| 144 | + returns True if installation successful, false if not, and None if unknown""" |
| 145 | + if not self.exists(installer_name): |
| 146 | + raise Installer_Exception("Can't find installer "+installer_name) |
| 147 | + |
| 148 | + if self.is_installed(installer_name): |
| 149 | + print installer_name,"already installed." |
| 150 | + return |
| 151 | + |
| 152 | + self.download(installer_name) |
| 153 | + self.install_settings(installer_name) |
| 154 | + # ... |
| 155 | + # ... |
| 156 | + |
| 157 | + #query the installer to see if ot thinks the component is properly installed |
| 158 | + # any flaws at this point are the fault of the installer :-P |
| 159 | + return self.is_installed(installer_name) |
| 160 | + |
| 161 | + def download (self, installer_name, destination_dir=None): |
| 162 | + """perform actions needed to download all the files we need""" |
| 163 | + |
| 164 | + destination_dir=destination_dir or self.destination_dir |
| 165 | + if not destination_dir: |
| 166 | + raise Exception("Installation_system: Internal Error: No destination_dir provided") |
| 167 | + |
| 168 | + if not self.exists(installer_name): |
| 169 | + raise Installer_Exception("Can't find installer "+installer_name) |
| 170 | + |
| 171 | + # if a particular step in the install procedure is not provided |
| 172 | + # we simply skip it |
| 173 | + if not self.can_exec(installer_name,"download"): |
| 174 | + print "notice: cannot execute download script for "+installer_name |
| 175 | + return |
| 176 | + |
| 177 | + self.exec_task(installer_name,"download") |
| 178 | + |
| 179 | + def install_settings(self,installer_name): |
| 180 | + """do setup for settings files, etc... override to do something useful""" |
| 181 | + pass |
| 182 | + |
| 183 | + def uninstall_settings(self,installer_name): |
| 184 | + """remove settings files etc... override to do something useful""" |
| 185 | + pass |
| 186 | + |
| 187 | + def uninstall (self, installer_name, destination_dir=None): |
| 188 | + """uninstall the component""" |
| 189 | + |
| 190 | + destination_dir=destination_dir or self.destination_dir |
| 191 | + if not destination_dir: |
| 192 | + raise Installer_Exception("Installation_system: Internal Error: No destination_dir provided") |
| 193 | + |
| 194 | + if not self.exists(installer_name): |
| 195 | + raise Installer_Exception("Can't find installer "+str(installer_name)) |
| 196 | + |
| 197 | + if not self.is_installed(installer_name): |
| 198 | + print installer_name+" does not appear to be installed" |
| 199 | + return |
| 200 | + |
| 201 | + # if a particular step in the install procedure is not provided |
| 202 | + # we simply skip it |
| 203 | + if not self.can_exec(installer_name,"uninstall"): |
| 204 | + return |
| 205 | + |
| 206 | + self.exec_task(installer_name,"uninstall") |
| 207 | + |
| 208 | + self.uninstall_settings(installer_name) |
| 209 | + # use is_installed to determine success. |
| 210 | + return not self.is_installed(installer_name) |
| 211 | + |
Index: trunk/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'); |
Index: trunk/wikiation/installer/extension_installer.py |
— | — | @@ -0,0 +1,62 @@ |
| 2 | +# This software, copyright (C) 2008-2009 by Wikiation. |
| 3 | +# This software is developed by Kim Bruning. |
| 4 | +# |
| 5 | +# Distributed under the terms of the MIT license. |
| 6 | + |
| 7 | +import settings |
| 8 | +import os, os.path, shutil |
| 9 | +import subprocess |
| 10 | + |
| 11 | +from installation_system import Installation_System, Installer_Exception |
| 12 | + |
| 13 | +class Extension_Installer_Exception(Installer_Exception): |
| 14 | + pass |
| 15 | + |
| 16 | +class Extension_Installer(Installation_System): |
| 17 | + system_name='extensions' |
| 18 | + destination_dir=None |
| 19 | + |
| 20 | +# def __init__(self, revision): |
| 21 | +# Installation_System.__init__(self, revision) |
| 22 | + |
| 23 | + def set_revision(self,revision): |
| 24 | + self.destination_dir=os.path.join(settings.revisionsdir,revision,"extensions") |
| 25 | + self.revision=revision |
| 26 | + |
| 27 | + |
| 28 | + def install_settings(self, installer_name): |
| 29 | + installdir=self.installdir_name(installer_name) |
| 30 | + settingsdir=os.path.join(self.destination_dir,"../LocalSettings") |
| 31 | + dirlist=os.listdir(installdir) |
| 32 | + for filename in dirlist: |
| 33 | + filepath=os.path.join(installdir,filename) |
| 34 | + if filename.endswith('.settings.php') and os.access(filepath, os.R_OK): |
| 35 | + shutil.copy(filepath,settingsdir) |
| 36 | + |
| 37 | + def uninstall_settings(self,installer_name): |
| 38 | + settingsdir=os.path.join(self.destination_dir,"..","LocalSettings") |
| 39 | + installdir=self.installdir_name(installer_name) |
| 40 | + dirlist=os.listdir(installdir) |
| 41 | + #compare which files were originally installed, then remove those |
| 42 | + for filename in dirlist: |
| 43 | + filepath=os.path.join(installdir,filename) |
| 44 | + if filename.endswith('.settings.php') and os.access(filepath, os.R_OK): |
| 45 | + destpath=os.path.join(settingsdir,filename) |
| 46 | + if os.access(destpath, os.R_OK): |
| 47 | + os.unlink(destpath) |
| 48 | + |
| 49 | + |
| 50 | + def is_installed(self, installer_name): |
| 51 | + if self.revision==None: |
| 52 | + raise Extension_Installer_Exception("no revision specified ... did you try doing ... in <Revision> ?") |
| 53 | + return Installation_System.is_installed(self, installer_name) |
| 54 | + |
| 55 | + def exec_task(self,installer_name,task,env=None): |
| 56 | + if env==None: |
| 57 | + env={} |
| 58 | + |
| 59 | + env=dict(env) |
| 60 | + env["EXTENSIONS_SVN"]=settings.extensionsdir |
| 61 | + |
| 62 | + return Installation_System.exec_task(self, installer_name,task,env) |
| 63 | + |
Index: trunk/wikiation/installer/installer_util.py |
— | — | @@ -0,0 +1,70 @@ |
| 2 | +# This software, copyright (C) 2008-2009 by Wikiation. |
| 3 | +# This software is developed by Kim Bruning. |
| 4 | +# |
| 5 | +# Distributed under the terms of the MIT license. |
| 6 | + |
| 7 | +import sys |
| 8 | + |
| 9 | +def replace_generic(replacements,infilename,outfilename): |
| 10 | + """generic replace function, takes a dictionary of search/replace |
| 11 | + strings (replacements), and applies them to the input file |
| 12 | + specified by infilename, and saves the results to the |
| 13 | + output file at outfilename""" |
| 14 | + |
| 15 | + infile=file(infilename) |
| 16 | + outfile=file(outfilename,"w") |
| 17 | + for line in infile: |
| 18 | + for search,replace in replacements.iteritems(): |
| 19 | + line=line.replace(search,replace) |
| 20 | + outfile.write(line) |
| 21 | + outfile.close() |
| 22 | + infile.close() |
| 23 | + |
| 24 | + |
| 25 | +def help(args): |
| 26 | + """implement help command: prints helpful messages""" |
| 27 | + |
| 28 | + if len(args)>1 and args[1] in subhelp: |
| 29 | + print |
| 30 | + print subhelp[args[1]] |
| 31 | + elif len(args)<=1: |
| 32 | + print |
| 33 | + print "wikiation installer, interactive mode" |
| 34 | + print "help: get help" |
| 35 | + print "quit: quit" |
| 36 | + print "ls [item]: list information on available versions " |
| 37 | + print "ls2 [item]: list information on extensions or wikiation components" |
| 38 | + print "install <version>: installs the version specified" |
| 39 | + print "install <version> as <name>: installs the version specified under an alternate name" |
| 40 | + print "install latest ; install latest as <name>: installs the latest version available in svn." |
| 41 | + print "uninstall <version/name>: uninstalls the version specified" |
| 42 | + print "check_isolation <version/name>: shows all changes made to mediawiki or database since it was installed." |
| 43 | + print "update_self: updates the installer and restarts in interactive mode" |
| 44 | + print "revision [new revision]: query current default revision, or set a new one (will be implemented over time)" |
| 45 | + print |
| 46 | + print "instead of interactive mode, you can also access commands directly from the shell:" |
| 47 | + print "wikiation_installer command [args]..." |
| 48 | + else: |
| 49 | + print 'no detailed help available' |
| 50 | + |
| 51 | +def help_for(something): |
| 52 | + """If the user types incorrect input, try to gently correct them""" |
| 53 | + |
| 54 | + print "correct syntax:" |
| 55 | + help(["help",something]) |
| 56 | + |
| 57 | +def quit(args): |
| 58 | + """Quits the program.""" |
| 59 | + sys.exit(0) |
| 60 | + |
| 61 | +def clean_target(target): |
| 62 | + """tidy up a target string, return in canonical form""" |
| 63 | + |
| 64 | + target=str(target) |
| 65 | + target=target.strip() |
| 66 | + if target.endswith('/'): |
| 67 | + target=target[:-1] |
| 68 | + |
| 69 | + return target |
| 70 | + |
| 71 | + |
Index: trunk/wikiation/installer/settings.py.example |
— | — | @@ -0,0 +1,46 @@ |
| 2 | +# This software, copyright (C) 2008-2009 by Wikiation. |
| 3 | +# This software is developed by Kim Bruning. |
| 4 | +# |
| 5 | +# Distributed under the terms of the MIT license. |
| 6 | + |
| 7 | +#Example settings file. |
| 8 | + |
| 9 | +import os |
| 10 | + |
| 11 | +# "You Are Here" |
| 12 | +installerdir=os.path.dirname(os.path.abspath(__file__)) |
| 13 | + |
| 14 | +# where to find .install directories and the files contained therein |
| 15 | +installfiles=os.path.join(installerdir,'installfiles') |
| 16 | + |
| 17 | + |
| 18 | +# where to find mediawiki tags and trunk on svn |
| 19 | +tagsdir="http://svn.wikimedia.org/svnroot/mediawiki/tags" |
| 20 | +trunkdir="http://svn.wikimedia.org/svnroot/mediawiki/trunk" |
| 21 | +# we could alternately/additionally take a tag version for extensions. (future) |
| 22 | +extensionsdir=trunkdir+"/extensions" |
| 23 | + |
| 24 | +# where to install diverse revisions |
| 25 | +revisionsdir='/var/www/revisions' |
| 26 | + |
| 27 | + |
| 28 | +# base scriptpath for every installation (ie, where to reach the above over the web) |
| 29 | +base_scriptpath="/revisions/" |
| 30 | + |
| 31 | +# where to install the toolkit |
| 32 | +toolkit_dir='/usr/local/wikiation' |
| 33 | + |
| 34 | + |
| 35 | +#where wikiation_check_isolation can be found |
| 36 | +isolation_create=toolkit_dir+'/wikiation_check_isolation/create_and_ul.sh' |
| 37 | +isolation_test=toolkit_dir+'/wikiation_check_isolation/dl_and_check.sh' |
| 38 | + |
| 39 | +# what mysql command should be used. (Who us? Use horrible hacks?) |
| 40 | + |
| 41 | +mysql_command="mysql -uwiki -pwiki1234" |
| 42 | + |
| 43 | +# run automated tests during installation |
| 44 | +# this is useful if you are in a testing environment. |
| 45 | +# If you are running production, you might want to leave |
| 46 | +# this set to False. |
| 47 | +run_automated_tests=False |
Index: trunk/wikiation/installer/LICENSE |
— | — | @@ -0,0 +1,21 @@ |
| 2 | +This software, copyright (C) 2008-2009 by Wikiation. This software is developed by Kim Bruning. |
| 3 | + |
| 4 | +Permission is hereby granted, free of charge, to any person obtaining a copy |
| 5 | +of this software and associated documentation files (the "Software"), to deal |
| 6 | +in the Software without restriction, including without limitation the rights to |
| 7 | +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies |
| 8 | +of the Software, and to permit persons to whom the Software is furnished to do |
| 9 | +so, subject to the following conditions: |
| 10 | + |
| 11 | +The above copyright notice and this permission notice shall be included in all |
| 12 | +copies or substantial portions of the Software. |
| 13 | + |
| 14 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 15 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 16 | +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 17 | +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 18 | +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 19 | +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 20 | +SOFTWARE. |
| 21 | + |
| 22 | +Logo.png itself is a wikiation trademark and is (C) wikiation, all rights reserved (same as the wikimedia or wikipedia logos) |
Index: trunk/wikiation/installer/Logo.png |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: trunk/wikiation/installer/Logo.png |
___________________________________________________________________ |
Added: svn:mime-type |
1 | 23 | + application/octet-stream |