Commit 85676999 authored by Viktor Horvath's avatar Viktor Horvath

Progress on Mioga compilation, but not yet complete.

parent da310364
...@@ -101,6 +101,7 @@ setup(name=name, ...@@ -101,6 +101,7 @@ setup(name=name,
'logrotate.d = slapos.recipe.logrotate:Part', 'logrotate.d = slapos.recipe.logrotate:Part',
'logrotate = slapos.recipe.logrotate:Recipe', 'logrotate = slapos.recipe.logrotate:Recipe',
'memcached = slapos.recipe.memcached:Recipe', 'memcached = slapos.recipe.memcached:Recipe',
'mioga.instantiate = slapos.recipe.mioga.instantiate:Recipe',
'mkdirectory = slapos.recipe.mkdirectory:Recipe', 'mkdirectory = slapos.recipe.mkdirectory:Recipe',
'mydumper = slapos.recipe.mydumper:Recipe', 'mydumper = slapos.recipe.mydumper:Recipe',
'mysql = slapos.recipe.mysql:Recipe', 'mysql = slapos.recipe.mysql:Recipe',
......
##############################################################################
#
# Copyright (c) 2012 Vifib SARL and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
import os
import pprint
import re
import subprocess
from slapos.recipe.librecipe import GenericBaseRecipe
class Recipe(GenericBaseRecipe):
"""\
Configure a Mioga instance:
- call "make install-all"
"""
def install(self):
print "This is the Mioga recipe"
print "Looking for compile folder:"
print self.options['mioga_compile_dir']
# TODO: this will only work for a SINGLE instance in the Slaprunner.
# In a real environment we cannot mess around with the compile directory
# like that.
former_directory = os.getcwd()
os.chdir(self.options['mioga_compile_dir'])
vardir = self.options['var_directory']
mioga_base = os.path.join(vardir, 'lib', 'Mioga2')
fm = FileModifier('conf/Config.xml')
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(vardir, 'spool', 'mioga', 'maildir'))
fm.modify('maildirerror', os.path.join(vardir, 'spool', 'mioga', 'error'))
fm.modify('mailfifo', os.path.join(vardir, 'spool', 'mioga', 'fifo'))
fm.modify('dbi_passwd', self.options['db_password'])
fm.modify('db_host', self.options['db_host'])
fm.modify('db_port', self.options['db_port'])
# TODO: Mioga must be able to use an external Postgres server! IPv6 address!
fm.save()
os.remove("config.mk") # otherwise we don't see the values in the Makefiles
environ = os.environ
environ['PATH'] = self.options['mioga_add_to_path'] + ':' + environ['PATH']
# environ = self.options['mioga_compile_env']
print pprint.pformat(environ)
# We must call "make installall" in the SAME environment that
# "perl Makefile.PL" left!
cmd = subprocess.Popen(self.options['perl_binary'] + ' Makefile.PL'
+ ' && make installall',
env=environ, shell=True)
cmd.communicate()
# cmd_configure = subprocess.Popen([ self.options['perl_binary'],
# 'Makefile.PL' ],
# env=environ)
# cmd_configure.communicate()
# if cmd_configure.returncode == 0:
# # TODO: no "make" on SlapOS ?
# cmd_make = subprocess.Popen(['make', 'installall'],
# env=environ)
# cmd_make.communicate()
# else:
# print "Mioga instantiate.py::install: Configure failed."
os.chdir(former_directory)
print "Mioga instantiate.py::install finished!"
# Copied verbatim from mioga-hooks.py - how to reuse code?
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()
...@@ -3,7 +3,7 @@ parts = ...@@ -3,7 +3,7 @@ parts =
postgres-urlparse postgres-urlparse
apacheperl-promise apacheperl-promise
publish-connection-information publish-connection-information
# mioga-instance mioga-instance
eggs-directory = ${buildout:eggs-directory} eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory} develop-eggs-directory = ${buildout:develop-eggs-directory}
...@@ -14,6 +14,7 @@ recipe = slapos.cookbook:mkdirectory ...@@ -14,6 +14,7 @@ recipe = slapos.cookbook:mkdirectory
etc = $${buildout:directory}/etc etc = $${buildout:directory}/etc
srv = $${buildout:directory}/srv srv = $${buildout:directory}/srv
log = $${buildout:directory}/log log = $${buildout:directory}/log
var = $${buildout:directory}/var
[basedirectory] [basedirectory]
recipe = slapos.cookbook:mkdirectory recipe = slapos.cookbook:mkdirectory
...@@ -67,4 +68,17 @@ recipe = cns.recipe.symlink ...@@ -67,4 +68,17 @@ recipe = cns.recipe.symlink
symlink_target = $${rootdirectory:bin} symlink_target = $${rootdirectory:bin}
symlink_base = ${postgresql:location}/bin symlink_base = ${postgresql:location}/bin
# [mioga-instance] [mioga-instance]
\ No newline at end of file recipe = slapos.cookbook:mioga.instantiate
mioga_compile_dir = ${template-apacheperl:compile-directory}
# Pity that the following line does not work. Or does it?
# mioga_compile_env = ${mioga:environment}
mioga_add_to_path = ${libxslt:location}/bin:${libxml2:location}/bin
var_directory = $${rootdirectory:var}
perl_binary = ${perl:location}/bin/perl
htdocs = $${apacheperl-instance:htdocs}
db_host = $${postgres-urlparse:host}
db_port = $${postgres-urlparse:port}
db_dbname = $${postgres-urlparse:path}
db_username = $${postgres-urlparse:username}
db_password = $${postgres-urlparse:password}
...@@ -43,9 +43,9 @@ recipe = slapos.cookbook:postgres ...@@ -43,9 +43,9 @@ recipe = slapos.cookbook:postgres
# Options # Options
ipv6_host = $${slap-network-information:global-ipv6} ipv6_host = $${slap-network-information:global-ipv6}
user = postgres user = mioga
port = 5432 port = 5432
dbname = db dbname = mioga2
# pgdata_directory is created by initdb, and should not exist beforehand. # pgdata_directory is created by initdb, and should not exist beforehand.
pgdata-directory = $${rootdirectory:var}/data pgdata-directory = $${rootdirectory:var}/data
services = $${rootdirectory:services} services = $${rootdirectory:services}
......
diff -r c0f4c1b8b448 Makefile.PL diff -r c0f4c1b8b448 Makefile.PL
--- a/Makefile.PL Sat Oct 06 16:15:43 2012 +0200 --- a/Makefile.PL Sat Oct 06 16:15:43 2012 +0200
+++ b/Makefile.PL Mon Oct 08 14:47:20 2012 +0200 +++ b/Makefile.PL Tue Oct 09 16:40:31 2012 +0200
@@ -115,7 +115,7 @@ @@ -115,7 +115,7 @@
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
sub MY::processPL { sub MY::processPL {
...@@ -10,9 +10,37 @@ diff -r c0f4c1b8b448 Makefile.PL ...@@ -10,9 +10,37 @@ diff -r c0f4c1b8b448 Makefile.PL
# between "all" and next "tardist" # between "all" and next "tardist"
include config.mk include config.mk
@@ -124,10 +124,7 @@
dist: doc
install ::
if test -e $(TMP_DIR) ; then \
- if test -d $(TMP_DIR) ; then \
- ( su - $(APACHE_USER) -c "id" -s /bin/sh || \
- ( echo "===> Problem with \"$(APACHE_USER)\" user" ; exit 1 ) ) \
- else \
+ if ! test -d $(TMP_DIR) ; then \
echo "===> File $(TMP_DIR) exists but is not a directory ..." ; \
exit 1 ; \
fi \
diff -r c0f4c1b8b448 conf/Config.xml
--- a/conf/Config.xml Sat Oct 06 16:15:43 2012 +0200
+++ b/conf/Config.xml Tue Oct 09 16:40:31 2012 +0200
@@ -37,6 +37,12 @@
xpath="/authentication"/>
<parameter name="Database settings" type="submenu">
+ <parameter name="db_host" question=" Mioga database server name or address ?"
+ type="text" default="localhost"
+ xpath="/database/DBhost"/>
+ <parameter name="db_port" question=" Mioga database server port ?"
+ type="text" default="5432"
+ xpath="/database/DBport"/>
<parameter name="db_name" question=" Name of Mioga database ?"
type="text" default="mioga2"
xpath="/database/DBname"/>
diff -r c0f4c1b8b448 lib/MiogaConf.pm 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 Mon Oct 08 14:47:20 2012 +0200 +++ b/lib/MiogaConf.pm Tue Oct 09 16:40:31 2012 +0200
@@ -811,6 +811,10 @@ @@ -811,6 +811,10 @@
my @missing; my @missing;
my @missing_clib; my @missing_clib;
...@@ -32,3 +60,14 @@ diff -r c0f4c1b8b448 lib/MiogaConf.pm ...@@ -32,3 +60,14 @@ diff -r c0f4c1b8b448 lib/MiogaConf.pm
foreach my $dep (@{$self->{CONFIG}->{dependencies}->[0]->{clib}}) { foreach my $dep (@{$self->{CONFIG}->{dependencies}->[0]->{clib}}) {
my $version; my $version;
diff -r c0f4c1b8b448 sql/Makefile
--- a/sql/Makefile Sat Oct 06 16:15:43 2012 +0200
+++ b/sql/Makefile Tue Oct 09 16:40:31 2012 +0200
@@ -18,6 +18,7 @@
if [ $(INIT_SQL) = 'yes' ] ; \
then \
echo "Initialize database"; \
+ echo "Database server will be: $(DBI_LOGIN) on $(DB_HOST) : $(DB_PORT)" \
su - $(POSTGRES_USER) -c "dropdb $(DB_NAME)" ; \
su - $(POSTGRES_USER) -c "createdb --encoding UTF8 $(DB_NAME)" && \
su $(POSTGRES_USER) -c "psql $(DB_NAME) < create_lang.sql" && \
...@@ -88,6 +88,8 @@ configure-command = ...@@ -88,6 +88,8 @@ configure-command =
[mioga] [mioga]
recipe = hexagonit.recipe.cmmi recipe = hexagonit.recipe.cmmi
version = 2.4.14
# No use re-using "version", the whole URL will change for the next one
url = http://www.alixen.org/attachments/download/87/Mioga2-2.4.14.tar.gz url = http://www.alixen.org/attachments/download/87/Mioga2-2.4.14.tar.gz
md5sum = 8282ae4b93fcea3f346168e6a855f65c md5sum = 8282ae4b93fcea3f346168e6a855f65c
environment = environment =
...@@ -128,6 +130,8 @@ url = ${:_profile_base_location_}/instance-apacheperl.cfg ...@@ -128,6 +130,8 @@ url = ${:_profile_base_location_}/instance-apacheperl.cfg
# md5sum = # md5sum =
output = ${buildout:directory}/template-apacheperl.cfg output = ${buildout:directory}/template-apacheperl.cfg
mode = 0644 mode = 0644
compile-directory = ${mioga:compile-directory}/Mioga2-${mioga:version}
[template-postgres] [template-postgres]
recipe = slapos.recipe.template recipe = slapos.recipe.template
......
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