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