Commit 63967191 authored by Alain Takoudjou's avatar Alain Takoudjou

Use Trac with LD_LIBRARY_PATH

parent 3411b14d
...@@ -54,6 +54,8 @@ class Recipe(GenericBaseRecipe): ...@@ -54,6 +54,8 @@ class Recipe(GenericBaseRecipe):
def install(self): def install(self):
install_path = [] install_path = []
env = os.environ
env['LD_LIBRARY_PATH'] = self.options['python-lib']
project_dir = self.options['site-dir'].strip() project_dir = self.options['site-dir'].strip()
trac_admin = self.options['trac-admin'].strip() trac_admin = self.options['trac-admin'].strip()
admin = self.options['admin-user'].strip() admin = self.options['admin-user'].strip()
...@@ -74,7 +76,7 @@ class Recipe(GenericBaseRecipe): ...@@ -74,7 +76,7 @@ class Recipe(GenericBaseRecipe):
self.options['mysql-database'].strip() self.options['mysql-database'].strip()
) )
process_install = subprocess.Popen(trac_args, stdout=subprocess.PIPE, process_install = subprocess.Popen(trac_args, stdout=subprocess.PIPE,
stdin=subprocess.PIPE, stderr=subprocess.STDOUT) stdin=subprocess.PIPE, stderr=subprocess.STDOUT, env=env)
process_install.stdin.write('%s\n%s\n' % (self.options['project'].strip(), process_install.stdin.write('%s\n%s\n' % (self.options['project'].strip(),
db_string)) db_string))
result = process_install.communicate()[0] result = process_install.communicate()[0]
...@@ -96,7 +98,7 @@ class Recipe(GenericBaseRecipe): ...@@ -96,7 +98,7 @@ class Recipe(GenericBaseRecipe):
% project_dir) % project_dir)
trac_args = [trac_admin, project_dir, 'upgrade'] trac_args = [trac_admin, project_dir, 'upgrade']
process_upgrade = subprocess.Popen(trac_args, stdout=subprocess.PIPE, process_upgrade = subprocess.Popen(trac_args, stdout=subprocess.PIPE,
stderr=subprocess.STDOUT) stderr=subprocess.STDOUT, env=env)
result = process_upgrade.communicate()[0] result = process_upgrade.communicate()[0]
if process_upgrade.returncode is None or process_upgrade.returncode != 0: if process_upgrade.returncode is None or process_upgrade.returncode != 0:
self.logger.error("Failed to upgrade Trac.\nThe error was: %s" % result) self.logger.error("Failed to upgrade Trac.\nThe error was: %s" % result)
...@@ -106,7 +108,7 @@ class Recipe(GenericBaseRecipe): ...@@ -106,7 +108,7 @@ class Recipe(GenericBaseRecipe):
self.logger.info("Granting admin rights to the admin user.") self.logger.info("Granting admin rights to the admin user.")
trac_grant = [trac_admin, project_dir, "permission add %s TRAC_ADMIN" % admin] trac_grant = [trac_admin, project_dir, "permission add %s TRAC_ADMIN" % admin]
process = subprocess.Popen(trac_grant, stdout=subprocess.PIPE, process = subprocess.Popen(trac_grant, stdout=subprocess.PIPE,
stderr=subprocess.STDOUT) stderr=subprocess.STDOUT, env=env)
result = process.communicate()[0] result = process.communicate()[0]
if process.returncode is None or process.returncode != 0: if process.returncode is None or process.returncode != 0:
raise Exception("Failed to execute Trac-admin.\nThe error was: %s" % result) raise Exception("Failed to execute Trac-admin.\nThe error was: %s" % result)
...@@ -146,9 +148,9 @@ class Recipe(GenericBaseRecipe): ...@@ -146,9 +148,9 @@ class Recipe(GenericBaseRecipe):
subprocess.check_call([self.options['git-binary'], 'init', subprocess.check_call([self.options['git-binary'], 'init',
'--bare', absolute_path]) '--bare', absolute_path])
subprocess.check_call([trac_admin, project_dir, 'repository', subprocess.check_call([trac_admin, project_dir, 'repository',
'add', repo, absolute_path, 'git']) 'add', repo, absolute_path, 'git'], env=env)
subprocess.check_call([trac_admin, project_dir, 'repository', subprocess.check_call([trac_admin, project_dir, 'repository',
'resync', repo]) 'resync', repo], env=env)
# XXX: Hardcoded path # XXX: Hardcoded path
shutil.copy(self.options['trac-git-hook'].strip(), shutil.copy(self.options['trac-git-hook'].strip(),
os.path.join(absolute_path, 'hooks/post-commit')) os.path.join(absolute_path, 'hooks/post-commit'))
......
...@@ -280,6 +280,7 @@ mode = 0700 ...@@ -280,6 +280,7 @@ mode = 0700
trac_admin = ${buildout:bin-directory} trac_admin = ${buildout:bin-directory}
svn_bin = ${subversion-1.9:location}/bin svn_bin = ${subversion-1.9:location}/bin
svn_python = ${subversion-1.9:location}/lib/svn-python svn_python = ${subversion-1.9:location}/lib/svn-python
python_lib = ${python2.7:location}/lib
[gitweb-conf] [gitweb-conf]
recipe = slapos.recipe.template recipe = slapos.recipe.template
...@@ -326,6 +327,7 @@ plugins-egg-dir = ${trac-plugins-egg:location} ...@@ -326,6 +327,7 @@ plugins-egg-dir = ${trac-plugins-egg:location}
eggs-dirs = eggs-dirs =
${buildout:eggs-directory} ${buildout:eggs-directory}
${buildout:develop-eggs-directory} ${buildout:develop-eggs-directory}
python-lib = ${python2.7:location}/lib
trac-admin = ${buildout:bin-directory}/trac-admin trac-admin = ${buildout:bin-directory}/trac-admin
admin-user = $${trac-admin:user} admin-user = $${trac-admin:user}
admin-password = $${trac-admin:password} admin-password = $${trac-admin:password}
......
...@@ -89,7 +89,7 @@ md5sum = bc6ed91a1862a10af661713aa0691848 ...@@ -89,7 +89,7 @@ md5sum = bc6ed91a1862a10af661713aa0691848
recipe = slapos.recipe.template recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-trac.cfg url = ${:_profile_base_location_}/instance-trac.cfg
output = ${buildout:directory}/template-trac.cfg output = ${buildout:directory}/template-trac.cfg
md5sum = 8c05ef460aa15ba5b6c2a1250afbba82 md5sum = bbdadd638ac10c5ca652fca27bf18fff
mode = 0644 mode = 0644
[instance-mariadb] [instance-mariadb]
...@@ -133,7 +133,7 @@ md5sum = 917deaeda572ca3e98c2baaf15fcdacc ...@@ -133,7 +133,7 @@ md5sum = 917deaeda572ca3e98c2baaf15fcdacc
[create-svn-repo] [create-svn-repo]
<= template-download <= template-download
filename = create-svn-repo.sh.in filename = create-svn-repo.sh.in
md5sum = 7ec8822bd5676c3506f079e33ed9f771 md5sum = 3e4d25ce53dcc3729f4bc682e0d2d239
[template-httpd-conf] [template-httpd-conf]
<= template-download <= template-download
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
export PATH=${:trac_admin}:${:svn_bin}:$PATH export PATH=${:trac_admin}:${:svn_bin}:$PATH
export PYTHONPATH=${:svn_python}:$PYTHONPATH export PYTHONPATH=${:svn_python}:$PYTHONPATH
export LD_LIBRARY_PATH=${:python_lib}:$LD_LIBRARY_PATH
ENV="$1" ENV="$1"
REPO="$2" REPO="$2"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment