[Erp5-report] r36544 luke - in /erp5/trunk/utils/erp5.recipe.ooodinstance: ./ src/ src/erp5...
nobody at svn.erp5.org
nobody at svn.erp5.org
Wed Jun 23 16:56:33 CEST 2010
Author: luke
Date: Wed Jun 23 16:56:29 2010
New Revision: 36544
URL: http://svn.erp5.org?rev=36544&view=rev
Log:
- recipe to create clean oood instance
Added:
erp5/trunk/utils/erp5.recipe.ooodinstance/CHANGES.txt (with props)
erp5/trunk/utils/erp5.recipe.ooodinstance/README.txt (with props)
erp5/trunk/utils/erp5.recipe.ooodinstance/setup.py
erp5/trunk/utils/erp5.recipe.ooodinstance/src/
erp5/trunk/utils/erp5.recipe.ooodinstance/src/erp5/
erp5/trunk/utils/erp5.recipe.ooodinstance/src/erp5/__init__.py
erp5/trunk/utils/erp5.recipe.ooodinstance/src/erp5/recipe/
erp5/trunk/utils/erp5.recipe.ooodinstance/src/erp5/recipe/__init__.py
erp5/trunk/utils/erp5.recipe.ooodinstance/src/erp5/recipe/ooodinstance/
erp5/trunk/utils/erp5.recipe.ooodinstance/src/erp5/recipe/ooodinstance/__init__.py
erp5/trunk/utils/erp5.recipe.ooodinstance/src/erp5/recipe/ooodinstance/oood-runserw.in
erp5/trunk/utils/erp5.recipe.ooodinstance/src/erp5/recipe/ooodinstance/oood.conf.in
Added: erp5/trunk/utils/erp5.recipe.ooodinstance/CHANGES.txt
URL: http://svn.erp5.org/erp5/trunk/utils/erp5.recipe.ooodinstance/CHANGES.txt?rev=36544&view=auto
==============================================================================
--- erp5/trunk/utils/erp5.recipe.ooodinstance/CHANGES.txt (added)
+++ erp5/trunk/utils/erp5.recipe.ooodinstance/CHANGES.txt [utf8] Wed Jun 23 16:56:29 2010
@@ -0,0 +1,8 @@
+Changelog
+=========
+
+0.0.1 (2010-06-23)
+----------------
+
+- Initial version.
+ [Lukasz Nowak]
Propchange: erp5/trunk/utils/erp5.recipe.ooodinstance/CHANGES.txt
------------------------------------------------------------------------------
svn:eol-style = native
Added: erp5/trunk/utils/erp5.recipe.ooodinstance/README.txt
URL: http://svn.erp5.org/erp5/trunk/utils/erp5.recipe.ooodinstance/README.txt?rev=36544&view=auto
==============================================================================
--- erp5/trunk/utils/erp5.recipe.ooodinstance/README.txt (added)
+++ erp5/trunk/utils/erp5.recipe.ooodinstance/README.txt [utf8] Wed Jun 23 16:56:29 2010
@@ -0,0 +1,4 @@
+Introduction
+============
+
+Recipe to create oood instance.
Propchange: erp5/trunk/utils/erp5.recipe.ooodinstance/README.txt
------------------------------------------------------------------------------
svn:eol-style = native
Added: erp5/trunk/utils/erp5.recipe.ooodinstance/setup.py
URL: http://svn.erp5.org/erp5/trunk/utils/erp5.recipe.ooodinstance/setup.py?rev=36544&view=auto
==============================================================================
--- erp5/trunk/utils/erp5.recipe.ooodinstance/setup.py (added)
+++ erp5/trunk/utils/erp5.recipe.ooodinstance/setup.py [utf8] Wed Jun 23 16:56:29 2010
@@ -0,0 +1,34 @@
+from setuptools import setup, find_packages
+
+name = "erp5.recipe.ooodinstance"
+version = '0.0.1'
+
+def read(name):
+ return open(name).read()
+
+long_description=(
+ read('README.txt')
+ + '\n' +
+ read('CHANGES.txt')
+ )
+
+setup(
+ name = name,
+ version = version,
+ author = "Lukasz Nowak",
+ author_email = "luke at nexedi.com",
+ description = "ZC Buildout recipe for installing a oood instance",
+ long_description=long_description,
+ license = "ZPL 2.1",
+ keywords = "oood buildout",
+ classifiers=[
+ "License :: OSI Approved :: Zope Public License",
+ "Framework :: Buildout",
+ ],
+ packages = find_packages('src'),
+ include_package_data = True,
+ package_dir = {'':'src'},
+ namespace_packages = ['erp5', 'erp5.recipe'],
+ zip_safe=False,
+ entry_points = {'zc.buildout': ['default = %s:Recipe' % name]},
+ )
Added: erp5/trunk/utils/erp5.recipe.ooodinstance/src/erp5/__init__.py
URL: http://svn.erp5.org/erp5/trunk/utils/erp5.recipe.ooodinstance/src/erp5/__init__.py?rev=36544&view=auto
==============================================================================
--- erp5/trunk/utils/erp5.recipe.ooodinstance/src/erp5/__init__.py (added)
+++ erp5/trunk/utils/erp5.recipe.ooodinstance/src/erp5/__init__.py [utf8] Wed Jun 23 16:56:29 2010
@@ -0,0 +1,6 @@
+# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages
+try:
+ __import__('pkg_resources').declare_namespace(__name__)
+except ImportError:
+ from pkgutil import extend_path
+ __path__ = extend_path(__path__, __name__)
Added: erp5/trunk/utils/erp5.recipe.ooodinstance/src/erp5/recipe/__init__.py
URL: http://svn.erp5.org/erp5/trunk/utils/erp5.recipe.ooodinstance/src/erp5/recipe/__init__.py?rev=36544&view=auto
==============================================================================
--- erp5/trunk/utils/erp5.recipe.ooodinstance/src/erp5/recipe/__init__.py (added)
+++ erp5/trunk/utils/erp5.recipe.ooodinstance/src/erp5/recipe/__init__.py [utf8] Wed Jun 23 16:56:29 2010
@@ -0,0 +1,6 @@
+# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages
+try:
+ __import__('pkg_resources').declare_namespace(__name__)
+except ImportError:
+ from pkgutil import extend_path
+ __path__ = extend_path(__path__, __name__)
Added: erp5/trunk/utils/erp5.recipe.ooodinstance/src/erp5/recipe/ooodinstance/__init__.py
URL: http://svn.erp5.org/erp5/trunk/utils/erp5.recipe.ooodinstance/src/erp5/recipe/ooodinstance/__init__.py?rev=36544&view=auto
==============================================================================
--- erp5/trunk/utils/erp5.recipe.ooodinstance/src/erp5/recipe/ooodinstance/__init__.py (added)
+++ erp5/trunk/utils/erp5.recipe.ooodinstance/src/erp5/recipe/ooodinstance/__init__.py [utf8] Wed Jun 23 16:56:29 2010
@@ -0,0 +1,47 @@
+import os
+from string import Template
+import logging
+import pkg_resources
+class WithMinusTemplate(Template):
+ __module__ = __name__
+ idpattern = '[_a-z][-_a-z0-9]*'
+
+class Recipe(object):
+ __module__ = __name__
+
+ def __init__(self, buildout, name, options):
+ self.options,self.name,self.buildout = options,name,buildout
+ self.logger = logging.getLogger(self.name)
+
+ def install_configuration(self):
+ template_file = self.options.get('oood_conf_template', '').strip()
+ if template_file:
+ template_input_data = file(template_file).read()
+ else:
+ template_input_data = pkg_resources.resource_stream(__name__,
+ 'oood.conf.in').read()
+ file(self.options['oood_conf_file'], 'w').write(WithMinusTemplate(
+ template_input_data).substitute(self.buildout[
+ self.options['configuration_part']].copy()))
+ self.logger.info(('Installed configuration %r.' %
+ self.options['oood_conf_file']))
+
+ def install_wrapper(self):
+ template_file = self.options.get('oood_wrapper_template', '').strip()
+ if template_file:
+ template_input_data = file(template_file).read()
+ else:
+ template_input_data = pkg_resources.resource_stream(__name__,
+ 'oood-runserw.in').read()
+ file(self.options['wrapper_path'], 'w').write(WithMinusTemplate(
+ template_input_data).substitute(self.buildout[
+ self.options['wrapper_part']].copy()))
+ os.chmod(self.options['wrapper_path'], 0755)
+ self.logger.info(('Installed wrapper %r.' % self.options['wrapper_path']))
+
+ def install(self):
+ self.install_configuration()
+ self.install_wrapper()
+ return []
+
+ update = install
Added: erp5/trunk/utils/erp5.recipe.ooodinstance/src/erp5/recipe/ooodinstance/oood-runserw.in
URL: http://svn.erp5.org/erp5/trunk/utils/erp5.recipe.ooodinstance/src/erp5/recipe/ooodinstance/oood-runserw.in?rev=36544&view=auto
==============================================================================
--- erp5/trunk/utils/erp5.recipe.ooodinstance/src/erp5/recipe/ooodinstance/oood-runserw.in (added)
+++ erp5/trunk/utils/erp5.recipe.ooodinstance/src/erp5/recipe/ooodinstance/oood-runserw.in [utf8] Wed Jun 23 16:56:29 2010
@@ -0,0 +1,101 @@
+#!${openoffice_python}
+
+import signal
+import time
+import subprocess
+import sys
+import os
+
+PID_FILE = "${oood_pid}"
+
+OOOD_COMMAND = " PYTHONPATH=${openoffice_uno} " + \
+ " ${openoffice_python} " + \
+ " ${oood_software}/runserw.py "
+
+FLUSH_COMMAND = " PYTHONPATH=${openoffice_uno} " + \
+ " ${openoffice_python} " + \
+ " ${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()
Added: erp5/trunk/utils/erp5.recipe.ooodinstance/src/erp5/recipe/ooodinstance/oood.conf.in
URL: http://svn.erp5.org/erp5/trunk/utils/erp5.recipe.ooodinstance/src/erp5/recipe/ooodinstance/oood.conf.in?rev=36544&view=auto
==============================================================================
--- erp5/trunk/utils/erp5.recipe.ooodinstance/src/erp5/recipe/ooodinstance/oood.conf.in (added)
+++ erp5/trunk/utils/erp5.recipe.ooodinstance/src/erp5/recipe/ooodinstance/oood.conf.in [utf8] Wed Jun 23 16:56:29 2010
@@ -0,0 +1,111 @@
+##############################################################################
+#
+# 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 = ${oood_software}
+# Folder where pid files, lock files and virtual frame buffer mappings are
+# stored
+run_dir = ${oood_run}
+tmp_dir = ${oood_tmp}
+# Folder where OpenOffice Uno interpreter is installed
+uno_path = ${openoffice_uno}
+# Folder where soffice is installed (default: uno_path)
+prog_dir = ${openoffice_program}
+# Complete absolute path to the log file
+log_file = ${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 = ${oood_host}
+# Other http-alt ports are 591 and 8080
+server_port = ${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 = ${oood_pool_host}
+# According www.iana.org/assignments/port-numbers , 4060-4088 port range is
+# unassigned
+pool_port_range_start = ${oood_pool_range_start}
+# time in seconds we have to give one OOo instance to load in restart
+instance_load_time = ${oood_instance_load_time}
+# seconds to wait before killing and restarting OOo instance
+instance_timeout = ${oood_instance_timeout}
+# ID of the virtual display where OOo instances are launched
+virtual_display_id = ${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