From 69fb40c3821cdb3a1d42c96f61568bf4c6eac9ee Mon Sep 17 00:00:00 2001
From: Antoine Catton <acatton@tiolive.com>
Date: Wed, 19 Oct 2011 11:31:21 +0200
Subject: [PATCH] Add mydumper component.

Mydumper generate doc with installation, that's why it depends on Sphinx
python egg.

This is a dirty buildout. But it is the only way to have proper mydumper
installation.
---
 component/mydumper/buildout.cfg | 76 +++++++++++++++++++++++++++++++++
 1 file changed, 76 insertions(+)
 create mode 100644 component/mydumper/buildout.cfg

diff --git a/component/mydumper/buildout.cfg b/component/mydumper/buildout.cfg
new file mode 100644
index 000000000..3751b71d3
--- /dev/null
+++ b/component/mydumper/buildout.cfg
@@ -0,0 +1,76 @@
+[buildout]
+
+extends =
+    ../cmake/buildout.cfg
+    ../glib/buildout.cfg
+    ../pcre/buildout.cfg
+    ../mariadb/buildout.cfg
+
+parts = mydumper
+
+# XXX-Antoine:
+# This is really dirty, but it's the only way to install
+# mydumper that works
+[mydumper]
+recipe = slapos.recipe.build
+url = http://launchpad.net/mydumper/0.2/0.2.3/+download/mydumper-0.2.3.tar.gz
+md5sum = 36e6a1c97a9634a6882ddaac5e2697d5
+buildout-bin-dir = ${buildout:bin-directory}
+cmake-command = ${cmake:location}/bin/cmake
+mysql-config = ${mariadb:location}/bin/mysql_config
+doc-dependency = ${mydumper-doc:eggs}
+mysqllib = ${mariadb:location}/lib
+pkg-config-path = ${glib:location}/lib/pkgconfig/:${pcre:location}/lib/pkgconfig/
+libraries = ${zlib:location}/lib/:${glib:location}/lib/:${pcre:location}/lib/:${mariadb:location}/lib/mysql/
+includes = ${zlib:location}/include/:${glib:location}/include/:${pcre:location}/include/:${mariadb:location}/include/mysql/
+cflags = -I${zlib:location}/include/ -I${glib:location}/include/ -I${pcre:location}/include/ -I${mariadb:location}/include/mysql/
+slapos_promise =
+    directory:bin
+    file:bin/mydumper
+    file:bin/myloader
+script =
+    import os
+    url = self.download(self.options['url'], self.options.get('md5sum'))
+    extract_dir = self.extract(url)
+    workdir = guessworkdir(extract_dir)
+    env['PATH'] = self.options['buildout-bin-dir'] + ':' + env.get('PATH', '')
+    env['PKG_CONFIG_PATH'] = self.options['pkg-config-path'] + ':' + \
+                             env.get('PKG_CONFIG_PATH', '')
+    env['CMAKE_INCLUDE_PATH'] = self.options['includes']
+    env['CMAKE_LIBRARY_PATH'] = self.options['libraries']
+    command_line = [self.options['cmake-command'],
+                    '-DWITH_ZLIB=system',
+                    '-DCMAKE_INSTALL_PREFIX=%%s' %% self.options['location'],
+                    '-DMYSQL_CONFIG=%%s' %% self.options['mysql-config'],
+                    '-DCMAKE_C_FLAGS=%%s' %% self.options['cflags'],
+                    '-DCMAKE_INSTALL_RPATH=%%s' %% self.options['libraries'],
+                    '.']
+    call(command_line, cwd=workdir, env=env)
+    call(['make'], cwd=workdir, env=env)
+    call(['make', 'install'], cwd=workdir, env=env)
+
+[mydumper-doc]
+recipe = zc.recipe.egg
+eggs =
+    Sphinx
+dependent-scripts = true
+
+# XXX-Antoine: here's what I did using hexagonit.recipe.cmmi.
+# and it wasn't working !
+#[mydumper]
+#recipe = hexagonit.recipe.cmmi
+#url = http://launchpad.net/mydumper/0.2/0.2.3/+download/mydumper-0.2.3.tar.gz
+#md5sum = 36e6a1c97a9634a6882ddaac5e2697d5
+#strip-top-level-dir = true
+#location = ${buildout:parts-directory}/${:_buildout_section_name_}
+#configure-command =
+#    ${cmake:location}/bin/cmake \
+#    -DCMAKE_INSTALL_PREFIX=${:location} \
+#    -DMYSQL_CONFIG=${mariadb:location}/bin/mysql_config \
+#    -DCMAKE_INCLUDE_PATH=${zlib:location}/include \
+#    -DCMAKE_LIBRARY_PATH=${zlib:location}/lib \
+#    .
+#environment=
+#    PATH=$PATH:${buildout:bin-directory}
+#    PKG_CONFIG_PATH=${glib:location}/lib/pkgconfig/:${pcre:location}/lib/pkgconfig/
+
-- 
2.30.9