Commit 334e0615 authored by Viktor Horvath's avatar Viktor Horvath

Instead of patching Mioga, rather modify the configuration

dynamically through a pre-configure-hook.
parent 814e91da
# import fnmatch
import grp
import os
import pprint
import pwd
import re
import shutil
import sys
class FileModifier:
def __init__(self, filename):
self.filename = filename
f = open(filename, 'rb')
self.content = f.read()
f.close()
def modify(self, key, value):
(self.content, count) = re.subn(
r'(<parameter[^>]*\sname\s*=\s*"' + re.escape(key) + r'"[^>]*\sdefault\s*=\s*")[^"]*',
r"\g<1>" + value,
self.content)
return count
def save(self):
f = open(self.filename, 'w')
f.write(self.content)
f.close()
def pre_configure_hook(options, bo, env):
location = options['location']
# TODO: double-check which one of these values must be set
# at instantiation time!
fm = FileModifier('conf/Config.xml')
fm.modify('apache_user', pwd.getpwuid(os.getuid())[0])
fm.modify('apache_group', grp.getgrgid(os.getgid())[0])
mioga_base = os.path.join(location, 'var', 'lib', 'Mioga2')
fm.modify('install_dir', mioga_base)
fm.modify('tmp_dir', os.path.join(mioga_base, 'tmp'))
fm.modify('search_tmp_dir', os.path.join(mioga_base, 'mioga_search'))
fm.modify('maildir', os.path.join(location, 'var', 'spool', 'mioga', 'maildir'))
fm.modify('maildirerror', os.path.join(location, 'var', 'spool', 'mioga', 'error'))
fm.modify('mailfifo', os.path.join(location, 'var', 'spool', 'mioga', 'fifo'))
fm.save()
# TODO: mail settings are certainly wrong, what is the domain name?
def post_make_hook(options, buildout):
# location = options['location']
# print "Mioga - postmakehook"
# print "We are currently in", os.getcwd()
# shutil.move("var", location)
return None
diff -r c0f4c1b8b448 -r 9ee4fec6ee34 lib/MiogaConf.pm diff -r c0f4c1b8b448 Makefile.PL
--- a/Makefile.PL Sat Oct 06 16:15:43 2012 +0200
+++ b/Makefile.PL Mon Oct 08 14:47:20 2012 +0200
@@ -115,7 +115,7 @@
# ----------------------------------------------------------------------------
sub MY::processPL {
return '
-# Not realy in the good section, but at a good place:
+# Not really in the good section, but at a good place:
# between "all" and next "tardist"
include config.mk
diff -r c0f4c1b8b448 lib/MiogaConf.pm
--- a/lib/MiogaConf.pm Sat Oct 06 16:15:43 2012 +0200 --- a/lib/MiogaConf.pm Sat Oct 06 16:15:43 2012 +0200
+++ b/lib/MiogaConf.pm Sat Oct 06 16:17:31 2012 +0200 +++ b/lib/MiogaConf.pm Mon Oct 08 14:47:20 2012 +0200
@@ -811,6 +811,10 @@ @@ -811,6 +811,10 @@
my @missing; my @missing;
my @missing_clib; my @missing_clib;
......
# import fnmatch
import os
import shutil
# import pprint
def post_make_hook(options, buildout):
location = options['location']
print "Mioga - postmakehook"
print "We are currently in", os.getcwd()
shutil.move("var", location)
...@@ -14,6 +14,8 @@ extends = ...@@ -14,6 +14,8 @@ extends =
../../component/perl-Image-Magick/buildout.cfg ../../component/perl-Image-Magick/buildout.cfg
../../component/postgresql/buildout.cfg ../../component/postgresql/buildout.cfg
../../component/perl-DBD-Pg/buildout.cfg ../../component/perl-DBD-Pg/buildout.cfg
../../component/perl-Search-Xapian/buildout.cfg
../../component/libxslt/buildout.cfg
../../component/lxml-python/buildout.cfg ../../component/lxml-python/buildout.cfg
../../stack/slapos.cfg ../../stack/slapos.cfg
...@@ -31,7 +33,9 @@ parts = ...@@ -31,7 +33,9 @@ parts =
perl-Text-Iconv perl-Text-Iconv
perl-Image-Magick perl-Image-Magick
perl-String-Checker-mioga perl-String-Checker-mioga
perl-Search-Xapian
cpan-simple-modules cpan-simple-modules
mioga
[eggs] [eggs]
recipe = zc.recipe.egg recipe = zc.recipe.egg
...@@ -93,6 +97,34 @@ md5sum = c750a33505609544f95eace7a2896c84 ...@@ -93,6 +97,34 @@ md5sum = c750a33505609544f95eace7a2896c84
configure-command = configure-command =
${perl:location}/bin/perl Makefile.PL ${perl:location}/bin/perl Makefile.PL
[mioga]
recipe = hexagonit.recipe.cmmi
url = http://www.alixen.org/attachments/download/87/Mioga2-2.4.14.tar.gz
md5sum = 8282ae4b93fcea3f346168e6a855f65c
environment =
PATH=${libxslt:location}/bin:${libxml2:location}/bin:%(PATH)s
patch-options = -p1
patches =
${mioga-patch:location}/${mioga-patch:filename}
# post-make-hook = ${mioga-postmakehook:location}/${mioga-postmakehook:filename}:post_make_hook
pre-configure-hook = ${mioga-hooks:location}/${mioga-hooks:filename}:pre_configure_hook
configure-command =
${perl:location}/bin/perl Makefile.PL
[mioga-patch]
recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/${:filename}
# md5sum = b836ad89902d1ea68b091a5b9800edd8
download-only = true
filename = ${:_buildout_section_name_}
[mioga-hooks]
recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/${:filename}
# md5sum = c7ceec7788749238cb5fbe09beb647b1
download-only = true
filename = mioga-hooks.py
[networkcache] [networkcache]
# Cedric de Saint Martin signature certificate # Cedric de Saint Martin signature certificate
signature-certificate-list = signature-certificate-list =
......
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