Index: trunk/wikiation/installer/extension_installer.py |
— | — | @@ -3,7 +3,7 @@ |
4 | 4 | # |
5 | 5 | # Distributed under the terms of the MIT license. |
6 | 6 | |
7 | | -import settings |
| 7 | +import settings_handler as settings |
8 | 8 | import os, os.path, shutil |
9 | 9 | import subprocess |
10 | 10 | |
— | — | @@ -15,14 +15,11 @@ |
16 | 16 | class Extension_Installer(Installation_System): |
17 | 17 | system_name='extensions' |
18 | 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 | 19 | |
| 20 | + def set_instance(self,instance): |
| 21 | + self.destination_dir=os.path.join(settings.instancesdir,instance,"extensions") |
| 22 | + self.instance=instance |
| 23 | + |
27 | 24 | |
28 | 25 | def install_settings(self, installer_name): |
29 | 26 | installdir=self.installdir_name(installer_name) |
— | — | @@ -47,8 +44,8 @@ |
48 | 45 | |
49 | 46 | |
50 | 47 | 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> ?") |
| 48 | + if self.instance==None: |
| 49 | + raise Extension_Installer_Exception("no instance specified ... did you try doing ... in <instance> ?") |
53 | 50 | return Installation_System.is_installed(self, installer_name) |
54 | 51 | |
55 | 52 | def exec_task(self,installer_name,task,env=None): |
Index: trunk/wikiation/installer/installer.py |
— | — | @@ -9,7 +9,7 @@ |
10 | 10 | import readline |
11 | 11 | import re |
12 | 12 | import shutil |
13 | | -import settings |
| 13 | +import settings_handler as settings |
14 | 14 | |
15 | 15 | import installers |
16 | 16 | |
Index: trunk/wikiation/installer/settings_handler.py |
— | — | @@ -0,0 +1,57 @@ |
| 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 | +#Default settings file. DO NOT EDIT (edit settings.py instead) |
| 8 | +# ======================================= |
| 9 | + |
| 10 | +import os |
| 11 | + |
| 12 | +# "You Are Here" |
| 13 | +installerdir=os.path.dirname(os.path.abspath(__file__)) |
| 14 | + |
| 15 | +# where to find .install directories and the files contained therein |
| 16 | +installfiles=os.path.join(installerdir,'installfiles') |
| 17 | + |
| 18 | + |
| 19 | +# where to find mediawiki tags and trunk on svn |
| 20 | +tagsdir="http://svn.wikimedia.org/svnroot/mediawiki/tags" |
| 21 | +trunkdir="http://svn.wikimedia.org/svnroot/mediawiki/trunk" |
| 22 | +# we could alternately/additionally take a tag version for extensions. (future) |
| 23 | +extensionsdir=trunkdir+"/extensions" |
| 24 | + |
| 25 | +# where to install diverse revisions |
| 26 | +instancesdir='/var/www/revisions' |
| 27 | + |
| 28 | + |
| 29 | +# base scriptpath for every installation (ie, where to reach the above over the web) |
| 30 | +base_scriptpath="/revisions/" |
| 31 | + |
| 32 | +# where to install the toolkit |
| 33 | +toolkit_dir='/usr/local/wikiation' |
| 34 | + |
| 35 | + |
| 36 | +#where wikiation_check_isolation can be found |
| 37 | +isolation_create=toolkit_dir+'/wikiation_check_isolation/create_and_ul.sh' |
| 38 | +isolation_test=toolkit_dir+'/wikiation_check_isolation/dl_and_check.sh' |
| 39 | + |
| 40 | +# what mysql command should be used. (Who us? Use horrible hacks?) |
| 41 | + |
| 42 | +mysql_command="mysql -uwiki -pwiki1234" |
| 43 | + |
| 44 | +# run automated tests during installation |
| 45 | +# this is useful if you are in a testing environment. |
| 46 | +# If you are running production, you might want to leave |
| 47 | +# this set to False. |
| 48 | +run_automated_tests=False |
| 49 | + |
| 50 | + |
| 51 | + |
| 52 | +if os.path.exists(os.path.join(installerdir, 'settings.py')): |
| 53 | + from settings import * |
| 54 | + |
| 55 | +#legacy support (rename old variables, etc) |
| 56 | +if 'revisionsdir' in globals(): |
| 57 | + instancesdir=revisionsdir |
| 58 | + |
Index: trunk/wikiation/installer/isolation.py |
— | — | @@ -4,7 +4,7 @@ |
5 | 5 | # Distributed under the terms of the MIT license. |
6 | 6 | |
7 | 7 | import sys,os, os.path |
8 | | -import settings |
| 8 | +import settings_handler as settings |
9 | 9 | |
10 | 10 | #support for wikiation_check_isolation |
11 | 11 | |
Index: trunk/wikiation/installer/toolkit_installer.py |
— | — | @@ -1,13 +1,12 @@ |
2 | | -import settings |
| 2 | +import settings_handler as settings |
3 | 3 | import os, os.path, shutil |
4 | 4 | import subprocess |
5 | 5 | |
6 | 6 | from installation_system import Installation_System |
7 | 7 | |
8 | | - |
9 | 8 | class Toolkit_Installer(Installation_System): |
10 | 9 | system_name='wikiation_toolkit' |
11 | 10 | destination_dir=settings.toolkit_dir |
12 | | -# def __init__(self,revision): |
| 11 | +# def __init__(self,instance): |
13 | 12 | # Installation_System.__init__(self) |
14 | | - |
| 13 | + |
Index: trunk/wikiation/installer/installation_system.py |
— | — | @@ -3,7 +3,7 @@ |
4 | 4 | # |
5 | 5 | # Distributed under the terms of the MIT license. |
6 | 6 | |
7 | | -import settings |
| 7 | +import settings_handler as settings |
8 | 8 | import os, os.path, shutil |
9 | 9 | import subprocess |
10 | 10 | |
— | — | @@ -14,18 +14,19 @@ |
15 | 15 | class Installation_System: |
16 | 16 | system_name=None |
17 | 17 | destination_dir=None |
18 | | - revision=None |
19 | 18 | as_alias=None |
20 | 19 | |
21 | | - def __init__(self,revision=None): |
| 20 | + def __init__(self,instance=None): |
22 | 21 | self.subsystemdir=os.path.join(settings.installfiles, self.system_name) |
| 22 | + self.destination_dir=None |
| 23 | + self.instance=None |
| 24 | + self.as_alias=None |
| 25 | + if instance: |
| 26 | + self.set_instance(instance) |
23 | 27 | |
24 | | - if revision: |
25 | | - self.set_revision(revision) |
| 28 | + def set_instance(self,instance): |
| 29 | + self.instance=instance |
26 | 30 | |
27 | | - def set_revision(self,revision): |
28 | | - self.revision=revision |
29 | | - |
30 | 31 | def get_installers(self): |
31 | 32 | installers=os.listdir(self.subsystemdir) |
32 | 33 | installers2=[] |
— | — | @@ -49,7 +50,7 @@ |
50 | 51 | * if more than one match exists, one match is picked |
51 | 52 | Exactly Which match is picked is not defined |
52 | 53 | (so Don't Do That) |
53 | | - * destination_dir is passed as a parameter |
| 54 | + * destination_dir is passed as a parameter |
54 | 55 | returns |
55 | 56 | * stdout returned by task command if successful |
56 | 57 | * None if task not available |
Index: trunk/wikiation/installer/naive_installer.py |
— | — | @@ -3,7 +3,7 @@ |
4 | 4 | # |
5 | 5 | # Distributed under the terms of the MIT license. |
6 | 6 | |
7 | | -import settings |
| 7 | +import settings_handler as settings |
8 | 8 | import os, os.path, shutil |
9 | 9 | import subprocess |
10 | 10 | |
Index: trunk/wikiation/installer/installers.py |
— | — | @@ -3,7 +3,7 @@ |
4 | 4 | # |
5 | 5 | # Distributed under the terms of the MIT license. |
6 | 6 | |
7 | | -import settings |
| 7 | +import settings_handler as settings |
8 | 8 | import os, os.path, shutil |
9 | 9 | import subprocess |
10 | 10 | import installer_util |
— | — | @@ -72,7 +72,7 @@ |
73 | 73 | return |
74 | 74 | |
75 | 75 | if ppath["in_installer"]: |
76 | | - system.set_revision(ppath["in_installer"]) |
| 76 | + system.set_instance(ppath["in_installer"]) |
77 | 77 | installed=None |
78 | 78 | try: |
79 | 79 | installed=system.get_installed() |
— | — | @@ -117,7 +117,7 @@ |
118 | 118 | |
119 | 119 | system=get_system(ppath["system"]) |
120 | 120 | if ppath["in_installer"]: |
121 | | - system.set_revision(ppath["in_installer"]) |
| 121 | + system.set_instance(ppath["in_installer"]) |
122 | 122 | if ppath["as_alias"]: |
123 | 123 | system.as_alias=ppath["as_alias"] |
124 | 124 | |
— | — | @@ -150,7 +150,7 @@ |
151 | 151 | |
152 | 152 | system=get_system(ppath["system"]) |
153 | 153 | if ppath["in_installer"]: |
154 | | - system.set_revision(ppath["in_installer"]) |
| 154 | + system.set_instance(ppath["in_installer"]) |
155 | 155 | if ppath["as_alias"]: |
156 | 156 | system.as_alias=ppath["as_alias"] |
157 | 157 | try: |
— | — | @@ -261,7 +261,7 @@ |
262 | 262 | # mysystem=get_system(system) |
263 | 263 | # |
264 | 264 | # if in_installer: |
265 | | - # system.set_revision(ppath["in_installer"]) |
| 265 | + # system.set_instance(ppath["in_installer"]) |
266 | 266 | # |
267 | 267 | # if system.is_installed(installer) |
268 | 268 | |
Index: trunk/wikiation/installer/mediawiki_installer.py |
— | — | @@ -2,7 +2,7 @@ |
3 | 3 | # |
4 | 4 | # Distributed under the terms of the MIT license. |
5 | 5 | |
6 | | -import settings |
| 6 | +import settings_handler as settings |
7 | 7 | import os, os.path, shutil |
8 | 8 | import subprocess |
9 | 9 | |
— | — | @@ -27,9 +27,9 @@ |
28 | 28 | """installer for mediawiki revisions""" |
29 | 29 | system_name='mediawiki_installer' |
30 | 30 | # TODO: destination_dir isn't quite changable until we have finished refactoring everything (not today) |
31 | | - destination_dir=settings.revisionsdir |
32 | 31 | def __init__(self): |
33 | 32 | Installation_System.__init__(self) |
| 33 | + self.destination_dir=settings.instancesdir |
34 | 34 | |
35 | 35 | def get_installers(self): |
36 | 36 | """list available items""" |
— | — | @@ -51,6 +51,8 @@ |
52 | 52 | |
53 | 53 | def get_installed(self): |
54 | 54 | """list installed items""" |
| 55 | + if not self.destination_dir: |
| 56 | + raise Exception("Internal Error: Mediawiki_Installer: get_installed, self.destination_dir not set") |
55 | 57 | return os.listdir(self.destination_dir) |
56 | 58 | |
57 | 59 | def is_installed(self, installer_name): |
— | — | @@ -83,7 +85,7 @@ |
84 | 86 | #duplicate of get_installed() TODO: Refactor |
85 | 87 | def installed(): |
86 | 88 | """list installed items""" |
87 | | - return os.listdir(settings.revisionsdir) |
| 89 | + return os.listdir(settings.instancesdir) |
88 | 90 | |
89 | 91 | #duplicate of get_installers() TODO: Refactor |
90 | 92 | def available(): |
— | — | @@ -121,7 +123,7 @@ |
122 | 124 | return |
123 | 125 | |
124 | 126 | #Everything checks out ok, so let's install. |
125 | | - os.chdir(settings.revisionsdir) |
| 127 | + os.chdir(settings.instancesdir) |
126 | 128 | print "Checking out code from subversion (please be patient)..." |
127 | 129 | if latest: |
128 | 130 | checkout_latest(name) |
— | — | @@ -150,7 +152,7 @@ |
151 | 153 | return |
152 | 154 | |
153 | 155 | #Ok, looks like our arguments are valid. |
154 | | - os.chdir(settings.revisionsdir) |
| 156 | + os.chdir(settings.instancesdir) |
155 | 157 | print "Dropping database..." |
156 | 158 | dropdb(target) |
157 | 159 | print "Deleting directory..." |
— | — | @@ -182,17 +184,17 @@ |
183 | 185 | LocalSettings.php is the main configuration file for mediawiki.""" |
184 | 186 | |
185 | 187 | template=settings.installerdir+"/LocalSettings.php.template" |
186 | | - localsettings=settings.revisionsdir+"/"+target+"/LocalSettings.php" |
| 188 | + localsettings=settings.instancesdir+"/"+target+"/LocalSettings.php" |
187 | 189 | replacements={'<<TARGET>>':target,"<<BASE_SCRIPTPATH>>":settings.base_scriptpath} |
188 | 190 | replace_generic(replacements,template,localsettings) |
189 | | - subdir=settings.revisionsdir+"/"+target+"/LocalSettings" |
| 191 | + subdir=settings.instancesdir+"/"+target+"/LocalSettings" |
190 | 192 | os.mkdir(subdir) |
191 | 193 | |
192 | 194 | def logo(target): |
193 | 195 | """copy a nice logo""" |
194 | 196 | |
195 | 197 | logo=settings.installerdir+"/Logo.png" |
196 | | - dest=settings.revisionsdir+"/"+target+"/Logo.png" |
| 198 | + dest=settings.instancesdir+"/"+target+"/Logo.png" |
197 | 199 | shutil.copy(logo,dest) |
198 | 200 | |
199 | 201 | def makedb(target): |
— | — | @@ -207,7 +209,7 @@ |
208 | 210 | """use the maintenance/tables.sql file provided by target mediawiki |
209 | 211 | instance to generate our tables""" |
210 | 212 | |
211 | | - target_file=settings.revisionsdir+"/"+target+"/maintenance/tables.sql" |
| 213 | + target_file=settings.instancesdir+"/"+target+"/maintenance/tables.sql" |
212 | 214 | do_sql(target, target_file) |
213 | 215 | |
214 | 216 | def make_admin(target): |
Index: trunk/wikiation/installer/download_installer.py |
— | — | @@ -3,7 +3,7 @@ |
4 | 4 | # |
5 | 5 | # Distributed under the terms of the MIT license. |
6 | 6 | |
7 | | -import settings |
| 7 | +import settings_handler as settings |
8 | 8 | import os, os.path, shutil |
9 | 9 | import subprocess |
10 | 10 | |
— | — | @@ -21,9 +21,9 @@ |
22 | 22 | system_name='download' |
23 | 23 | destination_dir=None |
24 | 24 | |
25 | | - def set_revision(self,revision): |
26 | | - self.destination_dir=os.path.join(settings.revisionsdir,revision,"extensions") |
27 | | - Installation_System.set_revision(self,revision) |
| 25 | + def set_instance(self,instance): |
| 26 | + self.destination_dir=os.path.join(settings.instancesdir,instance,"extensions") |
| 27 | + Installation_System.set_instance(self,instance) |
28 | 28 | |
29 | 29 | def get_installers(self): |
30 | 30 | l=list(os.popen('svn ls '+settings.extensionsdir)) |
— | — | @@ -36,10 +36,10 @@ |
37 | 37 | #exists() ok. |
38 | 38 | |
39 | 39 | def installdir_name(): |
40 | | - raise Unsupported_Exception("naive installer does not use installdirs") |
| 40 | + raise Unsupported_Exception("download installer does not use installdirs") |
41 | 41 | |
42 | 42 | def exec_task(): |
43 | | - raise Unsupported_Exception("naive installer does not use installdirs, and therefore also does not exec scripts in installdirs") |
| 43 | + raise Unsupported_Exception("download installer does not use installdirs, and therefore also does not exec scripts in installdirs") |
44 | 44 | |
45 | 45 | def can_exec(self, installer_name, task): |
46 | 46 | return False # we don't have an installdir, so we |
— | — | @@ -48,8 +48,8 @@ |
49 | 49 | # get_installed: works ok. |
50 | 50 | |
51 | 51 | def is_installed(self, installer_name): |
52 | | - if self.revision==None: |
53 | | - raise Download_Installer_Exception("no revision specified ... did you try doing ... in <Revision> ?") |
| 52 | + if self.instance==None: |
| 53 | + raise Download_Installer_Exception("no instance specified ... did you try doing ... in <instance> ?") |
54 | 54 | path=os.path.join(self.destination_dir,installer_name) |
55 | 55 | return os.path.isdir(path) |
56 | 56 | |
Index: trunk/wikiation/installer/util/allnaive.py |
— | — | @@ -28,7 +28,7 @@ |
29 | 29 | |
30 | 30 | def test_extension(extension_name): |
31 | 31 | installer=Naive_Installer() |
32 | | - installer.set_revision(target_wiki) |
| 32 | + installer.set_instance(target_wiki) |
33 | 33 | installer.install(extension_name) |
34 | 34 | result=do_test() |
35 | 35 | print "result=",result |
— | — | @@ -40,7 +40,7 @@ |
41 | 41 | installer=Naive_Installer() |
42 | 42 | # NOTE TO SELF set_revision is a bad name for this... |
43 | 43 | # needs refactoring |
44 | | - installer.set_revision(target_wiki) |
| 44 | + installer.set_instance(target_wiki) |
45 | 45 | naive_extensions=installer.get_installers() |
46 | 46 | for extension_name in naive_extensions: |
47 | 47 | print extension_name, |