[Erp5-report] r36096 luke - in /erp5/trunk/utils/erp5.recipe.mysqlserver: ./ src/erp5/recip...

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Jun 8 14:59:50 CEST 2010


Author: luke
Date: Tue Jun  8 14:59:47 2010
New Revision: 36096

URL: http://svn.erp5.org?rev=36096&view=rev
Log:
 - release new version 1.1, which contains own template file for mysql server,
   but still allow to use template provided from buildout
 - update documentation to reflect new options and fix small issues

Added:
    erp5/trunk/utils/erp5.recipe.mysqlserver/src/erp5/recipe/mysqlserver/my.cnf.in
      - copied, changed from r36084, erp5/trunk/buildout/templates/my.cnf.in
Modified:
    erp5/trunk/utils/erp5.recipe.mysqlserver/CHANGES.txt
    erp5/trunk/utils/erp5.recipe.mysqlserver/README.txt
    erp5/trunk/utils/erp5.recipe.mysqlserver/setup.py
    erp5/trunk/utils/erp5.recipe.mysqlserver/src/erp5/recipe/mysqlserver/__init__.py

Modified: erp5/trunk/utils/erp5.recipe.mysqlserver/CHANGES.txt
URL: http://svn.erp5.org/erp5/trunk/utils/erp5.recipe.mysqlserver/CHANGES.txt?rev=36096&r1=36095&r2=36096&view=diff
==============================================================================
--- erp5/trunk/utils/erp5.recipe.mysqlserver/CHANGES.txt [utf8] (original)
+++ erp5/trunk/utils/erp5.recipe.mysqlserver/CHANGES.txt [utf8] Tue Jun  8 14:59:47 2010
@@ -1,5 +1,12 @@
 Changelog
 =========
+
+1.1 (2010-06-08)
+------------------
+
+- Generate my.cnf file internally and have own default template. Allow to
+  use own template from part description.
+  [Lukasz Nowak]
 
 1.0.4 (2010-04-19)
 ------------------

Modified: erp5/trunk/utils/erp5.recipe.mysqlserver/README.txt
URL: http://svn.erp5.org/erp5/trunk/utils/erp5.recipe.mysqlserver/README.txt?rev=36096&r1=36095&r2=36096&view=diff
==============================================================================
--- erp5/trunk/utils/erp5.recipe.mysqlserver/README.txt [utf8] (original)
+++ erp5/trunk/utils/erp5.recipe.mysqlserver/README.txt [utf8] Tue Jun  8 14:59:47 2010
@@ -2,44 +2,47 @@
 ============
 
 This recipe generates a new server setup for MySQL, and allow to have multiple
-MySQL servers running in the same machine. This does not compile new MySQL Software 
-only reuse some existing one.
+MySQL servers running in the same machine. This does not compile new MySQL
+Software only reuse some existing one.
 
 Example
 =======
 
 You can use it with a part like this::
 
-  [default-database]
+  [default-server]
   recipe = erp5.recipe.mysqlserver
   mysql_software_bin = /usr/bin
   mysql_bin_folder = ${buildout:bin-directory}
   mysql_datadir = ${buildout:directory}/var/mysql
   mysql_cnf_file = ${buildout:etc-directory}/my.cnf
- 
+
 
 Options
 =======
 
 mysql_software_bin
 
-   Where the Orginal Software Binaries are installed, like /usr/bin when 
+   Where the Orginal Software Binaries are installed, like /usr/bin when
    are provided by Linux Packages.
 
 mysql_bin_folder
 
-   Where the Executable Wrapper scripts like mysql, mysqladmin, mysqldump, 
-   mysqld_safe will be created. 
+   Where the Executable Wrapper scripts like mysql, mysqladmin, mysqldump,
+   mysqld_safe will be created.
 
 mysql_datadir
-  
+
    Where the MYSQL data will be kept.
 
 mysql_cnf_file
 
-   Define the configuration file path used by The Mysql Server.
+   Define the configuration file path generated and used by the server.
 
-mysql_auto_start
+mysql_auto_start (optional)
 
-   if true this start the MySQL server when run this recipe.
+   If true this start the MySQL server when run this recipe.
 
+mysql_cnf_template (optional)
+
+   Optional own template which will be used to generate my.cnf file.

Modified: erp5/trunk/utils/erp5.recipe.mysqlserver/setup.py
URL: http://svn.erp5.org/erp5/trunk/utils/erp5.recipe.mysqlserver/setup.py?rev=36096&r1=36095&r2=36096&view=diff
==============================================================================
--- erp5/trunk/utils/erp5.recipe.mysqlserver/setup.py [utf8] (original)
+++ erp5/trunk/utils/erp5.recipe.mysqlserver/setup.py [utf8] Tue Jun  8 14:59:47 2010
@@ -1,7 +1,7 @@
 from setuptools import setup, find_packages
 
 name = "erp5.recipe.mysqlserver"
-version = '1.0.4'
+version = '1.1'
 
 def read(name):
     return open(name).read()

Modified: erp5/trunk/utils/erp5.recipe.mysqlserver/src/erp5/recipe/mysqlserver/__init__.py
URL: http://svn.erp5.org/erp5/trunk/utils/erp5.recipe.mysqlserver/src/erp5/recipe/mysqlserver/__init__.py?rev=36096&r1=36095&r2=36096&view=diff
==============================================================================
--- erp5/trunk/utils/erp5.recipe.mysqlserver/src/erp5/recipe/mysqlserver/__init__.py [utf8] (original)
+++ erp5/trunk/utils/erp5.recipe.mysqlserver/src/erp5/recipe/mysqlserver/__init__.py [utf8] Tue Jun  8 14:59:47 2010
@@ -14,12 +14,17 @@
 ##############################################################################
 
 import os
+from string import Template
 import logging
 from time import sleep
 import subprocess
 import zc.buildout
 import zc.buildout.easy_install
 import zc.recipe.egg
+import pkg_resources
+
+class WithMinusTemplate(Template):
+  idpattern = '[_a-z][-_a-z0-9]*'
 
 class Recipe(object):
   def __init__(self, buildout, name, options):
@@ -53,11 +58,23 @@
                                                    script_name,
                                                    mysql_cnf_file)))
 
+  def build_configuration_file(self):
+    template_file = self.options.get('mysql_cnf_template', '').strip()
+    if template_file:
+      template_input_data = file(template_file).read()
+    else:
+      template_input_data = pkg_resources.resource_stream(__name__,
+          'my.cnf.in').read()
+
+    file(self.options['mysql_cnf_file'], 'w').write(
+        WithMinusTemplate(template_input_data).substitute(
+          self.options.copy()))
+
   def install(self):
     options = self.options
     location = options['location']
-
     datadir = options.get('mysql_datadir')
+    self.build_configuration_file()
     if not os.path.exists(datadir):
       os.mkdir(datadir)
 

Copied: erp5/trunk/utils/erp5.recipe.mysqlserver/src/erp5/recipe/mysqlserver/my.cnf.in (from r36084, erp5/trunk/buildout/templates/my.cnf.in)
URL: http://svn.erp5.org/erp5/trunk/utils/erp5.recipe.mysqlserver/src/erp5/recipe/mysqlserver/my.cnf.in?p2=erp5/trunk/utils/erp5.recipe.mysqlserver/src/erp5/recipe/mysqlserver/my.cnf.in&p1=erp5/trunk/buildout/templates/my.cnf.in&r1=36084&r2=36096&rev=36096&view=diff
==============================================================================
--- erp5/trunk/buildout/templates/my.cnf.in [utf8] (original)
+++ erp5/trunk/utils/erp5.recipe.mysqlserver/src/erp5/recipe/mysqlserver/my.cnf.in [utf8] Tue Jun  8 14:59:47 2010
@@ -2,8 +2,8 @@
 # The following options will be passed to all MySQL clients
 [client]
 user = 
-port = ${configuration:mysql_port}
-socket = ${configuration:mysql_sock}
+port = ${mysql_port}
+socket = ${mysql_sock}
 
 # The MySQL server
 [mysqld]
@@ -14,13 +14,13 @@
 # Loud fail is really required in such case.
 sql-mode="NO_ENGINE_SUBSTITUTION"
 
-port = ${configuration:mysql_port}
-socket = ${configuration:mysql_sock}
-datadir = ${configuration:mysql_datadir}
-pid-file = ${configuration:mysql_pid}
-log-error = ${configuration:mysql_error_log}
-log-slow-queries = ${configuration:mysql_slow_query_log}
-long_query_time = ${configuration:mysql_slow_query_time}
+port = ${mysql_port}
+socket = ${mysql_sock}
+datadir = ${mysql_datadir}
+pid-file = ${mysql_pid}
+log-error = ${mysql_error_log}
+log-slow-queries = ${mysql_slow_query_log}
+long_query_time = ${mysql_slow_query_time}
 skip-locking
 key_buffer = 384M
 max_allowed_packet = 128M
@@ -51,7 +51,7 @@
 character_set_server = utf8
 default-character-set = utf8
 skip-character-set-client-handshake
-${:mysqld-extra-configuration}
+${mysqld-extra-configuration}
 
 [mysqldump]
 quick




More information about the Erp5-report mailing list