[Erp5-report] r36550 luke - in /erp5/trunk/buildout: instance-profiles/ templates/
nobody at svn.erp5.org
nobody at svn.erp5.org
Wed Jun 23 17:45:36 CEST 2010
Author: luke
Date: Wed Jun 23 17:45:30 2010
New Revision: 36550
URL: http://svn.erp5.org?rev=36550&view=rev
Log:
- use dedicated recipe to install oood instance (erp5.recipe.ooodinstance)
- as templates are inside this recipe remove them
- rearrange configuration of oood instance to make it maintainable and readable
Removed:
erp5/trunk/buildout/templates/oood-runserw.in
erp5/trunk/buildout/templates/oood.conf.in
Modified:
erp5/trunk/buildout/instance-profiles/oood.cfg
Modified: erp5/trunk/buildout/instance-profiles/oood.cfg
URL: http://svn.erp5.org/erp5/trunk/buildout/instance-profiles/oood.cfg?rev=36550&r1=36549&r2=36550&view=diff
==============================================================================
--- erp5/trunk/buildout/instance-profiles/oood.cfg [utf8] (original)
+++ erp5/trunk/buildout/instance-profiles/oood.cfg [utf8] Wed Jun 23 17:45:30 2010
@@ -1,43 +1,45 @@
[buildout]
parts = oood-instance
-[configuration]
-openoffice_python = ${software_definition:openoffice_software}/program/python
-openoffice_program = ${software_definition:openoffice_software}/program
-openoffice_uno = ${software_definition:openoffice_software}/basis-link/program/
+[oood-instance]
+depends =
+ ${oood-directories:command}
+recipe = erp5.recipe.ooodinstance
+wrapper_path = ${buildout:data-bin-directory}/oood-runserw
oood_conf_file = ${buildout:etc-directory}/oood.conf
-oood_log_file = ${buildout:log-directory}/oood.log
+
+wrapper_part = oood-wrapper
+configuration_part = oood-configuration
+
+[oood-wrapper]
+openoffice_python = ${software_definition:openoffice_software}/program/python
+oood_pid = ${oood-configuration:oood_run}/server_pid.lock
+openoffice_uno = ${oood-configuration:openoffice_uno}
+oood_software = ${oood-configuration:oood_software}
+
+[oood-configuration]
+oood_software = ${software_definition:oood_software}
oood_run = ${buildout:var-directory}/oood
-oood_pid = ${:oood_run}/server_pid.lock
oood_tmp = ${:oood_run}
oood_host = 127.0.0.1
-oood_port = 8008
+oood_port = ${configuration:oood_port}
oood_pool_host = localhost
oood_pool_range_start = 4060
oood_instance_load_time = 20
oood_instance_timeout = 360
oood_virtual_display_id = 99
+openoffice_uno = ${software_definition:openoffice_software}/basis-link/program/
+openoffice_program = ${software_definition:openoffice_software}/program
+oood_log_file = ${buildout:log-directory}/oood.log
+
+[configuration]
+oood_port = 8008
[oood-directories]
recipe = plone.recipe.command
-command = mkdir -p ${configuration:oood_run}
+depends = ${create-directories:command}
+command = mkdir -p ${oood-configuration:oood_run}
update-command = ${:command}
-[oood-etc]
-recipe = collective.recipe.template
-input = ${software_definition:software_home}/templates/oood.conf.in
-output = ${configuration:oood_conf_file}
-
-[oood-instance]
-depends =
- ${oood-etc:output}
- ${oood-directories:command}
-recipe = collective.recipe.template
-input = ${software_definition:software_home}/templates/oood-runserw.in
-output = ${buildout:data-bin-directory}/oood-runserw
-
[conversion-server-template]
<= oood-instance
-
-[requirements]
-binary = Xvfb
Removed: erp5/trunk/buildout/templates/oood-runserw.in
URL: http://svn.erp5.org/erp5/trunk/buildout/templates/oood-runserw.in?rev=36549&view=auto
==============================================================================
--- erp5/trunk/buildout/templates/oood-runserw.in [utf8] (original)
+++ erp5/trunk/buildout/templates/oood-runserw.in (removed)
@@ -1,101 +0,0 @@
-#!${configuration:openoffice_python}
-
-import signal
-import time
-import subprocess
-import sys
-import os
-
-PID_FILE = "${configuration:oood_pid}"
-
-OOOD_COMMAND = " PYTHONPATH=${configuration:openoffice_uno} " + \
- " ${configuration:openoffice_python} " + \
- " ${software_definition:oood_software}/runserw.py "
-
-FLUSH_COMMAND = " PYTHONPATH=${configuration:openoffice_uno} " + \
- " ${configuration:openoffice_python} " + \
- " ${software_definition:oood_software}/start.py " + \
- " --flush > /dev/null 2>&1 /dev/null"
-
-INSTANCE_PID_FILE = "/".join(PID_FILE.split("/")[:-1] + ["instance_0.pid"])
-
-class Oood:
- pid = None
- openoffice_pid = None
-
- def __init__(self):
- self.setsignals()
-
- def run(self):
- subprocess.call(OOOD_COMMAND + "--start > /dev/null 2>&1 /dev/null &",
- shell=True)
- subprocess.call(FLUSH_COMMAND, shell=True)
- while 1:
- # Load the soffice pid for make sure it will be killed
- # when this wrapper is killed.
- # The oood does a real mess with the open office pid file and we cannot
- # trust always into the pid file. So if the process still running, don't
- # upload the openoffice_pid.
- update_pid_required = True
- if self.openoffice_pid is not None:
- try:
- os.kill(self.openoffice_pid, 0)
- update_pid_required = False
- except OSError:
- # Process is running ignore.
- pass
-
- if os.path.exists(INSTANCE_PID_FILE) and update_pid_required:
- self.openoffice_pid = int(open(INSTANCE_PID_FILE, "r").read())
-
- # Update the file, if it is not removed by oood by mistake.
- if os.path.exists(PID_FILE):
- self.pid = int(open(PID_FILE, "r").read())
- time.sleep(40)
- time.sleep(5)
-
- def setsignals(self):
- signal.signal(signal.SIGTERM, self.stop)
- signal.signal(signal.SIGHUP, self.stop)
- signal.signal(signal.SIGINT, self.stop)
- signal.signal(signal.SIGUSR1, self.stop)
- signal.signal(signal.SIGUSR2, self.stop)
-
- def stop(self, sig, frame):
- if os.path.exists(PID_FILE):
- self.pid = int(open(PID_FILE, "r").read())
- else:
- print "Pid File does not exist!"
-
- # Stop command in an appropriate way.
- subprocess.call(OOOD_COMMAND + "--stop > /dev/null 2>&1 /dev/null ",
- shell=True)
-
- # Call Flush Command to stop openoffices.
- subprocess.call(FLUSH_COMMAND, shell=True)
-
- if self.pid is not None:
- try:
- # If oood process still running be brutal and force it stop.
- os.kill(self.pid, 9)
- print "Kill runserw pid (%s)" % self.pid
- except OSError:
- pass # OOOD is already stopped, nothing to do.
-
- if self.openoffice_pid is not None:
- try:
- # Use SIGTERM is required for this case, because openoffice use
- # a shell script to run and "trap" to kill the childrens.
- os.kill(self.openoffice_pid , 15)
- print "Kill openoffice pid (%s)" % self.pid
- except OSError:
- pass # OpenOffice is already stopped, nothing to do.
-
- sys.exit(0)
-
-def main():
- pp = Oood()
- pp.run()
-
-if __name__ == '__main__':
- main()
Removed: erp5/trunk/buildout/templates/oood.conf.in
URL: http://svn.erp5.org/erp5/trunk/buildout/templates/oood.conf.in?rev=36549&view=auto
==============================================================================
--- erp5/trunk/buildout/templates/oood.conf.in [utf8] (original)
+++ erp5/trunk/buildout/templates/oood.conf.in (removed)
@@ -1,111 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2010 Nexedi SA 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 advised 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 2
-# 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.
-#
-##############################################################################
-
-###################################################################
-# System config
-###################################################################
-
-[System]
-# Folder where all oood core files are installed
-oood_home = ${software_definition:oood_software}
-# Folder where pid files, lock files and virtual frame buffer mappings are
-# stored
-run_dir = ${configuration:oood_run}
-tmp_dir = ${configuration:oood_tmp}
-# Folder where OpenOffice Uno interpreter is installed
-uno_path = ${configuration:openoffice_uno}
-# Folder where soffice is installed (default: uno_path)
-prog_dir = ${configuration:openoffice_program}
-# Complete absolute path to the log file
-log_file = ${configuration:oood_log_file}
-# debug_mode tells oood to leave files in tmp directory
-debug_mode = False
-log_level = logging.DEBUG
-
-
-###################################################################
-# Server settings
-###################################################################
-
-[Server]
-server_host = ${configuration:oood_host}
-# Other http-alt ports are 591 and 8080
-server_port = ${configuration:oood_port}
-# name of local printer to print files directly
-printer_name = default_printer
-
-
-###################################################################
-# Pool settings
-###################################################################
-
-[Pool]
-# The pool consist of several OpenOffice.org instances
-pool_host = ${configuration:oood_pool_host}
-# According www.iana.org/assignments/port-numbers , 4060-4088 port range is
-# unassigned
-pool_port_range_start = ${configuration:oood_pool_range_start}
-# time in seconds we have to give one OOo instance to load in restart
-instance_load_time = ${configuration:oood_instance_load_time}
-# seconds to wait before killing and restarting OOo instance
-instance_timeout = ${configuration:oood_instance_timeout}
-# ID of the virtual display where OOo instances are launched
-virtual_display_id = ${configuration:oood_virtual_display_id}
-
-###################################################################
-# Formats
-###################################################################
-# Here you can configure which file formats should be included on the
-# "target format item list" and which should be skipped
-# by either specifying formats to use, or formats to skip
-# default is using all formats defined in mimemapper
-# Format list should be given as comma-separated list of extensions
-# (as defined in mimemapper)
-# example:
-# [Text]
-# use_formats = odt, doc, rtf, html-writer, pdf
-# [Spreadsheet]
-# skip_formats = slk, pxl, 3_0.sdc.vor
-# XXX for now, if you use this option, you MUST include ODF format in
-# your "use" list, otherwise oood will return an empty list. This is a
-# bug and will be fixed.
-
-[Text]
-#use_formats = All
-#skip_formats = None
-
-[Spreadsheet]
-#use_formats = All
-#skip_formats = None
-
-[Presentation]
-#use_formats = All
-#skip_formats = None
-
-[Drawing]
-#use_formats = All
-#skip_formats = None
More information about the Erp5-report
mailing list