# Note on LXML/END LXML: they delimit areas where lxml magic is needed. lxml is
# a slapos.cookbook dependency, so it should be fetched automatically. But when
# automatically fetched, it gets built against system headers/libs, which is
# forbidden in slapos. So we need to fetch lxml explicitly so it is properly
# built.

[buildout]
extends =
    buildout.hash.cfg
    ../../stack/slapos.cfg
    ../../stack/logrotate/buildout.cfg
    ../../stack/monitor/buildout.cfg
    ../../component/cython-zstd/buildout.cfg
#LXML
    ../../component/lxml-python/buildout.cfg
#END LXML
    ../../component/msgpack-python/buildout.cfg
    ../../component/python-mysqlclient/buildout.cfg
    ../../component/python-cryptography/buildout.cfg
    ../../component/pycurl/buildout.cfg
    ../../component/ZODB/buildout.cfg
    ../../component/ZEO/buildout.cfg
    ../../component/zodbtools/buildout.cfg

parts =
# keep neoppod first so that ZODB is built correctly,
# before any other section that would depend on it
    neoppod-develop
    neoppod
    slapos-cookbook

[python]
part = python2.7

[neoppod-repository]
recipe = slapos.recipe.build:gitclone
repository = https://lab.nexedi.com/nexedi/neoppod.git
git-executable = ${git:location}/bin/git

[neoppod-setup-env]
PATH = ${git:location}/bin:%(PATH)s

[neoppod-develop]
recipe = zc.recipe.egg:develop
setup = ${neoppod-repository:location}
environment = neoppod-setup-env

[neoppod]
recipe = zc.recipe.egg
eggs = neoppod[admin, ctl, master]
  ${cython-zstd:egg}
  ${msgpack-python:egg}
  ${:adapter-egg}
  ${ZODB:egg}
  ${zodbtools:egg}
  psutil
  zope.testing
  coverage
  setproctitle
adapter-egg =
  ${python-mysqlclient:egg}
  PyMySQL

[download-base-neo]
recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/${:filename}

# XXX: must be rendered, not just dled
[instance-common]
recipe = slapos.recipe.template:jinja2
url = ${:_profile_base_location_}/${:filename}
output = ${buildout:directory}/${:_buildout_section_name_}.cfg
context =
    key bin_directory buildout:bin-directory
    key develop_eggs_directory buildout:develop-eggs-directory
    key eggs_directory buildout:eggs-directory
    key neo_admin instance-neo-admin:target
    key neo_master instance-neo-master:target
    key neo instance-neo:target
    key template_logrotate_base template-logrotate-base:output
    key template_monitor monitor2-template:output
    ${:adapter-context}
adapter-context =
    key mariadb_location mariadb:location
    key template_mysqld_wrapper template-mysqld-wrapper:output
    key template_neo_my_cnf template-neo-my-cnf:target

[root-common]
<= download-base-neo

[instance-neo-admin]
<= download-base-neo

[instance-neo-master]
<= download-base-neo

[instance-neo]
<= download-base-neo

[template-neo-my-cnf]
<= download-base-neo

[template-mysqld-wrapper]
recipe = slapos.recipe.template
output = ${buildout:parts-directory}/${:_buildout_section_name_}/mysqld.in
inline =
  #!/bin/sh -e
  basedir='${mariadb:location}'
  datadir='{{datadir}}'
  marker=$datadir/.slapos_initializing
  [ -d "$datadir/mysql" ] && [ ! -f "$marker" ] || {
    find "$datadir/" -mindepth 1 ! -path $marker -delete || mkdir "$datadir"
    touch "$marker"
    "$basedir/scripts/mysql_install_db" \
      --defaults-file='{{defaults_file}}' \
      --skip-name-resolve \
      --auth-root-authentication-method=normal \
      --basedir="$basedir" --plugin_dir="$basedir/lib/plugin" \
      --datadir="$datadir"
    rm "$marker"
  }
  {%- if environ is defined %}
  {%-   for variable in environ.splitlines() %}
  {{ variable }} \
  {%-   endfor %}
  {%- endif %}
  exec "$basedir/bin/mysqld" --defaults-file='{{defaults_file}}' "$@"

[versions]
coverage = 5.5
ecdsa = 0.13
mysqlclient = 1.3.12
PyMySQL = 0.10.1
pycrypto = 2.6.1
cython-zstd = 0.2
funcsigs = 1.0.2


# Test Suite: NEO.UnitTest-Master ran at 2023/02/09 16:45:13.884299 UTC
#             28 failures, 4 errors, 873 total, status: FAIL

[neoppod-repository]
revision = d5afef8e24ae41660ad011320868e8d0b6b1c95b



# Test Suite: NEO.UnitTest-Master ran at 2023/02/09 16:45:13.884299 UTC
#             28 failures, 4 errors, 873 total, status: FAIL

[neoppod-repository]
revision = d5afef8e24ae41660ad011320868e8d0b6b1c95b

