From 9eb45d112a52db205c2d4f1a3dea439620176ca5 Mon Sep 17 00:00:00 2001
From: Romain Courteaud <romain@nexedi.com>
Date: Tue, 21 Jun 2011 14:09:34 +0200
Subject: [PATCH] Use librecipe.execute to provide perl binary. Without this,
 system perl will be used.

---
 slapos/recipe/erp5/__init__.py | 24 ++++++++++++++++++++++++
 software/sanef/instance.cfg    | 16 ++++++++--------
 software/sanef/software.cfg    |  2 +-
 3 files changed, 33 insertions(+), 9 deletions(-)

diff --git a/slapos/recipe/erp5/__init__.py b/slapos/recipe/erp5/__init__.py
index b0a4dda45..8ef69da40 100644
--- a/slapos/recipe/erp5/__init__.py
+++ b/slapos/recipe/erp5/__init__.py
@@ -930,5 +930,29 @@ class Recipe(BaseSlapRecipe):
     mysql_backup_cron = os.path.join(self.cron_d, 'mysql_backup')
     open(mysql_backup_cron, 'w').write('0 0 * * * ' + backup_controller)
     self.path_list.append(mysql_backup_cron)
+
+    # maatkit installation
+    for mk_script_name in (
+        'mk-variable-advisor',
+        'mk-table-usage-binary',
+        'mk-visual-explain',
+        'mk-config-diff',
+        'mk-deadlock-logger',
+        'mk-error-log',
+        'mk-index-usage',
+        'mk-query-advisor',
+        ):
+      mk_argument_list = [self.options['perl_binary'],
+          self.options['%s_binary' % mk_script_name],
+          '--defaults-file=%s' % mysql_conf_path,
+          '--socket=%s' %mysql_conf['socket'].strip(), '--user=root',
+          ]
+      environment = dict(PATH='%s' % self.bin_directory)
+      mk_exe = zc.buildout.easy_install.scripts([(
+        mk_script_name,'slapos.recipe.librecipe.execute', 'executee')],
+        self.ws, sys.executable, self.bin_directory, arguments=[
+          mk_argument_list, environment])[0]
+      self.path_list.append(mk_exe)
+
     # The return could be more explicit database, user ...
     return mysql_conf
diff --git a/software/sanef/instance.cfg b/software/sanef/instance.cfg
index af2466adb..36d522816 100644
--- a/software/sanef/instance.cfg
+++ b/software/sanef/instance.cfg
@@ -32,6 +32,14 @@ tidstorage_repozo_binary = ${buildout:bin-directory}/tidstorage_repozo
 tidstoraged_binary = ${buildout:bin-directory}/tidstoraged
 xtrabackup_binary = ${xtrabackup:location}/bin/xtrabackup_51
 zabbix_agent_binary = ${zabbix-agent:location}/sbin/zabbix_agent
+mk-variable-advisor-binary = ${perl:siteprefix}/bin/mk-variable-advisor
+mk-table-usage-binary = ${perl:siteprefix}/bin/mk-table-usage
+mk-visual-explain-binary = ${perl:siteprefix}/bin/mk-visual-explain
+mk-config-diff-binary = ${perl:siteprefix}/bin/mk-config-diff
+mk-deadlock-logger-binary = ${perl:siteprefix}/bin/mk-deadlock-logger
+mk-error-log-binary = ${perl:siteprefix}/bin/mk-error-log
+mk-index-usage-binary = ${perl:siteprefix}/bin/mk-index-usage
+mk-query-advisor-binary = ${perl:siteprefix}/bin/mk-query-advisor
 
 # cloudooo specific configuration
 ooo_binary_path = ${libreoffice-bin:location}/program
@@ -59,14 +67,6 @@ link_binary_list =
   ${poppler:location}/bin/pdfinfo
   ${poppler:location}/bin/pdftotext
   ${poppler:location}/bin/pdftohtml
-  ${maatkit:location}/bin/mk-variable-advisor
-  ${maatkit:location}/bin/mk-table-usage
-  ${maatkit:location}/bin/mk-visual-explain
-  ${maatkit:location}/bin/mk-config-diff
-  ${maatkit:location}/bin/mk-deadlock-logger
-  ${maatkit:location}/bin/mk-error-log
-  ${maatkit:location}/bin/mk-index-usage
-  ${maatkit:location}/bin/mk-query-advisor
 
 bt5_repo_list = 
   ${erp5:location}/product/ERP5/bootstrap bt5bootstrap
diff --git a/software/sanef/software.cfg b/software/sanef/software.cfg
index e819b3881..e5656e7cb 100644
--- a/software/sanef/software.cfg
+++ b/software/sanef/software.cfg
@@ -40,7 +40,7 @@ extra-paths +=
 
 [template]
 url = ${:_profile_base_location_}/instance.cfg
-md5sum = dc7b3515924a4d18bfb9094fa9538f56
+md5sum = 4d06f3e4b80e8e9bd0d18a3fba3100a3
 
 [eggcheck]
 recipe = plone.recipe.command
-- 
2.30.9