[buildout]

extends =
# Exact version of Zope
  ztk-versions.cfg
  zope-versions.cfg
  buildout.hash.cfg
  ../../component/cups/buildout.cfg
  ../../component/dbus/buildout.cfg
  ../../component/file/buildout.cfg
  ../../component/fonts/buildout.cfg
  ../../component/gcc/buildout.cfg
  ../../component/ghostscript/buildout.cfg
  ../../component/git/buildout.cfg
  ../../component/graphviz/buildout.cfg
  ../../component/gzip/buildout.cfg
  ../../component/haproxy/buildout.cfg
  ../../component/hookbox/buildout.cfg
  ../../component/findutils/buildout.cfg
  ../../component/librsvg/buildout.cfg
  ../../component/imagemagick/buildout.cfg
  ../../component/inkscape/buildout.cfg
  ../../component/kumo/buildout.cfg
  ../../component/libdmtx/buildout.cfg
  ../../component/libffi/buildout.cfg
  ../../component/libpng/buildout.cfg
  ../../component/matplotlib/buildout.cfg
  ../../component/mesa/buildout.cfg
  ../../component/numpy/buildout.cfg
  ../../component/statsmodels/buildout.cfg
  ../../component/h5py/buildout.cfg
  ../../component/ocropy/buildout.cfg
  ../../component/pandas/buildout.cfg
  ../../component/percona-toolkit/buildout.cfg
  ../../component/patch/buildout.cfg
  ../../component/pillow/buildout.cfg
  ../../component/pycrypto-python/buildout.cfg
  ../../component/pysvn-python/buildout.cfg
  ../../component/python-ldap-python/buildout.cfg
  ../../component/rdiff-backup/buildout.cfg
  ../../component/scikit-learn/buildout.cfg
  ../../component/scikit-image/buildout.cfg
  ../../component/PyWavelets/buildout.cfg
  ../../component/stunnel/buildout.cfg
  ../../component/subversion/buildout.cfg
  ../../component/tesseract/buildout.cfg
  ../../component/w3-validator/buildout.cfg
  ../../component/w3m/buildout.cfg
  ../../component/xorg/buildout.cfg
  ../../component/poppler/buildout.cfg
  ../../component/zabbix/buildout.cfg
  ../../component/sed/buildout.cfg
  ../../component/coreutils/buildout.cfg
  ../../component/grep/buildout.cfg
  ../../component/dash/buildout.cfg
  ../../component/bash/buildout.cfg
  ../../component/wget/buildout.cfg
  ../../component/aspell/buildout.cfg
  ../../component/jsl/buildout.cfg
  ../../component/6tunnel/buildout.cfg
  ../../component/findutils/buildout.cfg
  ../../component/userhosts/buildout.cfg
  ../../component/postfix/buildout.cfg
  ../../component/zbarlight/buildout.cfg
  ../monitor/buildout.cfg
  ../../software/caucase/software.cfg
  ../../software/jupyter/software.cfg
  ../../software/neoppod/software-common.cfg
# keep neoppod extends last

parts +=
  erp5-util-develop
  slapos-cookbook
  rdiff-backup
  aspell
  aspell-en-dictionary
  apache
  apache-antiloris
  file
  findutils
  graphviz
  haproxy
  jsl
  stunnel
  w3m
  poppler
  libpng
  ghostscript
  mroonga-mariadb
  imagemagick
  inkscape
  libdmtx
  dmtx-utils
  kumo
  w3-validator
  tesseract
  tesseract-eng-traineddata
  tesseract-osd-traineddata
  scipy
  ocropy
  hookbox
  percona-toolkit
  zabbix-agent
  dash
  bash
  wget
  userhosts
  postfix

# Buildoutish
  eggs
  eggs-all-scripts
  testrunner
  test_suite_runner

# basic Xorg
  libXdmcp
  libXext
  libXau
  libSM
  libXrender

# fonts
  liberation-fonts
  ipaex-fonts
  ipa-fonts
  ocrb-fonts
  android-fonts


# get git repositories
  erp5
  genbt5list

# some additional utils
  zodbanalyze

# Create instance template
  template

# jupyter
  jupyter
  jupyter-notebook-initialized-scripts
  instance-jupyter-notebook

# override python2.7 to add SlapOS libstdc++ in RPATH.
[python2.7]
extra-ldflags = -Wl,-rpath=${gcc:location}/lib -Wl,-rpath=${gcc:location}/lib64

# override instance-jupyter-notebook not to render into default template.cfg
[instance-jupyter-notebook]
rendered = ${buildout:directory}/template-jupyter.cfg

[instance-caucase]
rendered = ${buildout:directory}/instance-caucase.cfg

[download-base]
<= download-base-neo
url = ${:_profile_base_location_}/${:filename}

[check-recipe]
recipe = plone.recipe.command
stop-on-error = true
update-command = ${:command}
command = grep parts ${buildout:develop-eggs-directory}/slapos.cookbook.egg-link

[mariadb-start-clone-from-backup]
<= download-base
mode = 755

[mariadb-resiliency-after-import-script]
<= download-base
mode = 755

[mariadb-slow-query-report-script]
<= download-base
mode = 755

[template-mariadb]
<= download-base
link-binary =
  ${coreutils:location}/bin/basename
  ${coreutils:location}/bin/cat
  ${coreutils:location}/bin/cp
  ${coreutils:location}/bin/ls
  ${coreutils:location}/bin/tr
  ${coreutils:location}/bin/uname
  ${gettext:location}/lib/gettext/hostname
  ${grep:location}/bin/grep
  ${sed:location}/bin/sed
  ${mariadb:location}/bin/mysqlbinlog

[template-kumofs]
<= download-base

[template-zope-conf]
<= download-base

[site-zcml]
<= download-base

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

[template-mariadb-initial-setup]
<= download-base

[template-postfix]
< = download-base

[template-postfix-master-cf]
< = download-base

[template-postfix-main-cf]
< = download-base

[template-postfix-aliases]
< = download-base

[template-run-zelenium]
< = download-base
url = ${:_profile_base_location_}/template/run-zelenium-test.py.in

[template]
recipe = slapos.recipe.template:jinja2
# XXX: "template.cfg" is hardcoded in instanciation recipe
rendered = ${buildout:directory}/template.cfg
template = ${:_profile_base_location_}/${:filename}
mode = 640
context =
    key mariadb_link_binary template-mariadb:link-binary
    key zope_link_binary template-zope:link-binary
    key apache_location apache:location
    key aspell_location aspell:location
    key bin_directory buildout:bin-directory
    key buildout_bin_directory buildout:bin-directory
    key cairo_location cairo:location
    key caucase_template instance-caucase:rendered
    key coreutils_location coreutils:location
    key cups_location cups:location
    key curl_location curl:location
    key cyrus_sasl_location cyrus-sasl:location
    key dash_location dash:location
    key bash_location bash:location
    key dbus_glib_location dbus-glib:location
    key dbus_location dbus:location
    key dcron_location dcron:location
    key default_cloudooo_url erp5-defaults:cloudooo-connection-url
    key erp5_location erp5:location
    key file_location file:location
    key findutils_location findutils:location
    key fontconfig_location fontconfig:location
    key fonts_location fonts:location
    key freetype_location freetype:location
    key glib_location glib:location
    key glu_location glu:location
    key gzip_location gzip:location
    key haproxy_location haproxy:location
    key imagemagick_location imagemagick:location
    key instance_common_cfg instance-common:rendered
    key jsl_location jsl:location
    key jupyter_enable_default erp5-defaults:jupyter-enable-default
    key kumo_location kumo:location
    key libICE_location libICE:location
    key libSM_location libSM:location
    key libX11_location libX11:location
    key libXau_location libXau:location
    key libXdmcp_location libXdmcp:location
    key libXext_location libXext:location
    key libXrender_location libXrender:location
    key libexpat_location libexpat:location
    key libffi_location libffi:location
    key librsvg_location librsvg:location
    key libxcb_location libxcb:location
    key local_bt5_repository local-bt5-repository:list
    key logrotate_location logrotate:location
    key mariadb_location mariadb:location
    key mariadb_resiliency_after_import_script mariadb-resiliency-after-import-script:target
    key mariadb_slow_query_report_script mariadb-slow-query-report-script:target
    key mariadb_start_clone_from_backup mariadb-start-clone-from-backup:target
    key matplotlibrc_location matplotlibrc:location
    key mesa_location mesa:location
    key parts_directory buildout:parts-directory
    key openssl_location openssl:location
    key percona_toolkit_location percona-toolkit:location
    key pixman_location pixman:location
    key poppler_location poppler:location
    key postfix_location postfix:location
    key root_common root-common:target
    key site_zcml site-zcml:target
    key sixtunnel_location 6tunnel:location
    key template_run_zelenium template-run-zelenium:target
    key egg_interpreter eggs:interpreter
    key stunnel_location stunnel:location
    key template_apache_conf template-apache-backend-conf:target
    key template_balancer template-balancer:target
    key template_erp5 template-erp5:target
    key template_haproxy_cfg template-haproxy-cfg:target
    key template_jupyter_cfg instance-jupyter-notebook:rendered
    key template_kumofs template-kumofs:target
    key template_mariadb template-mariadb:target
    key template_mariadb_initial_setup template-mariadb-initial-setup:target
    key template_monitor monitor2-template:rendered
    key template_my_cnf template-my-cnf:target
    key template_postfix template-postfix:target
    key template_postfix_aliases template-postfix-aliases:target
    key template_postfix_main_cf template-postfix-main-cf:target
    key template_postfix_master_cf template-postfix-master-cf:target
    key template_zeo template-zeo:target
    key template_zope template-zope:target
    key template_zope_conf template-zope-conf:target
    key userhosts_location userhosts:location
    key unixodbc_location unixodbc:location
    key wget_location wget:location
    key xdamage_location xdamage:location
    key xfixes_location xfixes:location
    key zlib_location zlib:location
    key extra_path_list eggs:extra-paths

[template-erp5]
<= download-base

[template-zeo]
<= download-base

[template-zope]
<= download-base
link-binary =
  ${aspell:location}/bin/aspell
  ${dmtx-utils:location}/bin/dmtxwrite
  ${git:location}/bin/git
  ${graphviz:location}/bin/dot
  ${grep:location}/bin/grep
  ${imagemagick:location}/bin/convert
  ${imagemagick:location}/bin/identify
  ${jsl:location}/bin/jsl
  ${librsvg:location}/bin/rsvg-convert
  ${mariadb:location}/bin/mysql
  ${mariadb:location}/bin/mysqldump
  ${openssl:location}/bin/openssl
  ${poppler:location}/bin/pdfinfo
  ${poppler:location}/bin/pdftohtml
  ${poppler:location}/bin/pdftotext
  ${sed:location}/bin/sed
  ${tesseract:location}/bin/tesseract
  ${w3m:location}/bin/w3m

[template-balancer]
<= download-base

[template-haproxy-cfg]
<= download-base

[bt5-repository]
# Format:
#   <url or path> [...]
#
# Use absolute paths for local repositories, and URLs for non-local otherwise.
#
list = ${local-bt5-repository:list}

[local-bt5-repository]
# Same as bt5-repository, but only local repository.
# Used to generate bt5lists.
list = ${erp5:location}/bt5 ${erp5:location}/product/ERP5/bootstrap

[genbt5list]
recipe = plone.recipe.command
stop-on-error = true
genbt5list = ${erp5:location}/product/ERP5/bin/genbt5list
command =
  echo '${local-bt5-repository:list}' |xargs ${buildout:executable} ${:genbt5list}
update-command = ${:command}

[erp5_repository_list]
repository_id_list = erp5

# ERP5 defaults, which can be overridden in inheriting recipes (e.g. wendelin)
[erp5-defaults]
cloudooo-connection-url = https://cloudooo.erp5.net/
# Jupyter is by default disabled in ERP5
jupyter-enable-default = false

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

[testrunner]
# XXX: Workaround for fact ERP5Type is not an distribution and does not
#      expose entry point for test runner
recipe = zc.recipe.egg
eggs = ${eggs:eggs}
extra-paths = ${eggs:extra-paths}
entry-points =
  runUnitTest=runUnitTest:main
scripts = runUnitTest
initialization =
  import glob, imp, os, sys
  import App # prevent Testing from importing Zope2.App instead of App
  import Products
  Products.__path__[:0] = filter(None,
    os.getenv('INSERT_PRODUCTS_PATH', '').split(os.pathsep))
  os.environ['SOFTWARE_HOME'] = os.path.abspath(imp.find_module('Zope2')[1])
  os.environ['ZOPE_SCRIPTS'] = ''
  parts_directory = '''${buildout:parts-directory}'''
  repository_id_list = \
    '''${erp5_repository_list:repository_id_list}'''.split()[::-1]
  os.environ['erp5_tests_bt5_path'] = ','.join(sum((
    [bt5_path, os.path.join(bt5_path, '*')]
    for bt5_path in (os.path.join(parts_directory, x, 'bt5')
                     for x in repository_id_list)), []))
  extra_path_list = '''${:extra-paths}'''.split()
  sys.path[:0] = sum((
    glob.glob(os.path.join(x, 'tests'))
    for x in extra_path_list), [])
  sys.path[:0] = sum((
    glob.glob(os.path.join(x, 'Products', '*', 'tests'))
    for x in extra_path_list), [])
  sys.path[:0] = sum((
    glob.glob(os.path.join(x, 'Products', '*', 'tests'))
    for x in os.getenv('INSERT_PRODUCTS_PATH', '').split(os.pathsep)), [])
  os.environ['PATH'] = '${jsl:location}/bin:%s' % os.environ['PATH']
  os.environ['CGI_PATH'] = '${w3-validator:location}/httpd/cgi-bin'

[test_suite_runner]
# XXX: Workaround for fact ERP5Type is not an distribution and does not
#      expose entry point for test runner
recipe = zc.recipe.egg
eggs = ${eggs:eggs}
extra-paths = ${eggs:extra-paths}
entry-points =
  runTestSuite=Products.ERP5Type.tests.runTestSuite:main
scripts = runTestSuite
initialization =
  import os
  import sys
  import Products
  [Products.__path__.insert(0, p) for p in reversed(os.environ.get('INSERT_PRODUCTS_PATH', '').split(':')) if p]
  import Zope2
  os.environ['SOFTWARE_HOME'] = os.path.abspath(os.path.dirname(os.path.dirname(Zope2.__file__)))
  os.environ['ZOPE_SCRIPTS'] = ''
  repository_id_list = list(reversed('''${erp5_repository_list:repository_id_list}'''.split()))
  sys.path[0:0] = ['/'.join(['''${buildout:parts-directory}''', x]) for x in repository_id_list]

[eggs]
<= neoppod
eggs = ${neoppod:eggs}
  ${numpy:egg}
  ${matplotlib:egg}
  ${lxml-python:egg}
  ${ocropy:egg}
  ${pandas:egg}
  ${pillow-python:egg}
  ${python-ldap-python:egg}
  ${pysvn-python:egg}
  ${pycrypto-python:egg}
  ${scipy:egg}
  ${scikit-learn:egg}
  ${scikit-image:egg}
  sympy
  ${h5py:egg}
  openpyxl
  ${statsmodels:egg}
  ${zbarlight:egg}
  lock_file
  astor
  APacheDEX
  PyStemmer
  PyXML
  Pympler
  SOAPpy
  chardet
  collective.recipe.template
  coverage
  erp5diff
  interval
  ipdb
  Jinja2
  jsonschema
  mechanize
  objgraph
  paramiko
  ply
  pyflakes
  pypdf2
  python-magic
  python-memcached
  pytz
  requests
  threadframe
  timerserver
  urlnorm
  uuid
  xml_marshaller
  xupdate_processor
  feedparser
  validictory
  erp5.util
  huBarcode
  qrcode
  spyne
  httplib2
  suds
  pprofile
  pycountry
  xfw
  jsonschema
  selenium
  pytesseract
  decorator
  networkx
# Needed for checking ZODB Components source code
  pylint
  pytracemalloc

# Zope
  Zope2
# Zope acquisition patch
  Acquisition
# for runzeo
  ZEO

# Other Zope 2 packages
  Products.PluggableAuthService
  Products.PluginRegistry

# CMF 2.2
  Products.CMFActionIcons
  Products.CMFCalendar
  Products.CMFCore
  Products.CMFDefault
  Products.CMFTopic
  Products.CMFUid
  Products.DCWorkflow
  Products.GenericSetup
  five.localsitemanager

# Other products
  Products.DCWorkflowGraph
  Products.MimetypesRegistry
  Products.ExternalEditor
  Products.TIDStorage
  Products.LongRequestLogger

# BBB: Temporarily keep zope.app.testing awaiting we use newer version of CMF
#      (for tests like testCookieCrumbler).
  zope.app.testing

# Currently forked in our repository
#    Products.PortalTransforms
# Dependency for our fork of PortalTransforms
  StructuredText

# Needed for parsing .po files from our Localizer subset
  polib

# Needed for Google OAuth
  google-api-python-client

# Need for Facebook OAuth
  facebook-sdk

# Used by ERP5 Jupyter backend
  ipykernel

# Used by DiffTool
  xmltodict
  deepdiff
  unidiff
  jsonpickle

# parameterizing the version of the generated python interpreter name by the
# python section version causes dependency between this egg section and the
# installation of python, which we don't want on an instance
interpreter = ${buildout:python}
scripts =
  apachedex
  repozo
  runzope
  runzeo
  tidstoraged
  tidstorage_repozo
  web_checker_utility = erp5.util.webchecker:web_checker_utility

extra-paths =
  ${erp5:location}

# patches for eggs
patch-binary = ${patch:location}/bin/patch
Acquisition-patches = ${:_profile_base_location_}/../../component/egg-patch/Acquisition/aq_dynamic.patch#1d9a56e9af4371f5b6951ebf217a15d7
Acquisition-patch-options = -p1
Products.DCWorkflow-patches = ${:_profile_base_location_}/../../component/egg-patch/Products.DCWorkflow/workflow_method.patch#975b49e96bae33ac8563454fe5fa9899
Products.DCWorkflow-patch-options = -p1
python-magic-patches = ${:_profile_base_location_}/../../component/egg-patch/python_magic/magic.patch#de0839bffac17801e39b60873a6c2068
python-magic-patch-options = -p1

[eggs-all-scripts]
recipe = zc.recipe.egg
eggs =
  munnel
patch-binary = ${eggs:patch-binary}

[zodbanalyze]
recipe = zc.recipe.egg
eggs = erp5.util
entry-points =
  zodbanalyze=erp5.util.zodbanalyze:main
scripts = zodbanalyze

# develop erp5.util from parts/erp5/
[erp5-util-develop]
recipe = zc.recipe.egg:develop
setup = ${erp5:location}

[slapos-deps-eggs]
recipe = zc.recipe.egg
eggs +=
  slapos.toolbox[zodbpack]
scripts +=
  is-local-tcp-port-opened
  is-process-older-than-dependency-set
  check-slow-queries-digest-result
  check-apachedex-result
  runApacheDex
  zodbpack

[versions]
# See ../../software/neoppod/software-common.cfg for versions common with NEO:
#  neoppod, mysqlclient, slapos.recipe.template & [slapos-deps-eggs]

# patched eggs
Acquisition = 2.13.12+SlapOSPatched001
Products.DCWorkflow = 2.2.4+SlapOSPatched001
ocropy = 1.0+SlapOSPatched001
pysvn = 1.7.10+SlapOSPatched002
python-ldap = 2.4.32+SlapOSPatched001
python-magic = 0.4.12+SlapOSPatched001

# use newer version than specified in ZTK
PasteDeploy = 1.5.2
argparse = 1.4.0
zope.dottedname = 4.1.0

# test_UserManagerInterfaces in testERP5Security fails with 1.10.0.
Products.PluggableAuthService = 1.9.0

# we are still using this old stable version.
rdiff-backup = 1.0.5+SlapOSPatched001

# modified version that works fine for buildout installation
SOAPpy = 0.12.0nxd001

# CMF 2.3 is not yet supported.
Products.CMFCalendar = 2.2.3
Products.CMFCore = 2.2.10
Products.CMFDefault = 2.2.4
Products.CMFTopic = 2.2.1
Products.CMFUid = 2.2.1

# newer version requires zope.traversing>=4.0.0a2.
zope.app.appsetup = 3.16.0

# newer version requires zope.i18n>=4.0.0a3
zope.app.publication = 3.14.0

# newer version requires zope.testbrowser>=4
zope.app.testing = 3.8.1

# Pinned versions
APacheDEX = 1.6.2
Pillow = 5.2.0
Products.CMFActionIcons = 2.1.3
Products.DCWorkflowGraph = 0.4.1
# Products.ExternalEditor 2.0.0's dtml is not based on Zope2 OFS's one.
Products.ExternalEditor = 1.1.1
Products.GenericSetup = 1.8.6
Products.LongRequestLogger = 2.1.0
# Products.MimetypesRegistry 2.1 requires AccessControl>=3.0.0Acquisition.
Products.MimetypesRegistry = 2.0.10
Products.PluginRegistry = 1.4
Products.TIDStorage = 5.4.9
pyPdf = 1.13
PyPDF2 = 1.26.0
PyStemmer = 1.3.0
PyXML = 0.8.5
Pympler = 0.4.3
StructuredText = 2.11.1
WSGIUtils = 0.7
ZODB3 = 3.11.0
# astroid 1.4.1 breaks testDynamicClassGeneration
astroid = 1.3.8
chardet = 2.3.0
csp-eventlet = 0.7.0
erp5diff = 0.8.1.7
eventlet = 0.20.1
five.formlib = 1.0.4
five.localsitemanager = 2.0.5
google-api-python-client = 1.6.1
greenlet = 0.4.12
http-parser = 0.8.3
httplib2 = 0.10.3
huBarcode = 1.0.0
interval = 1.0.0
ipdb = 0.10.2
logilab-common = 1.3.0
munnel = 0.3
nt-svcutils = 2.13.0
oauth2client = 4.0.0
objgraph = 3.1.0
ply = 3.10
polib = 1.0.8
pprofile = 1.10.0
pyasn1 = 0.2.3
pyasn1-modules = 0.0.8
pycountry = 17.1.8
pycrypto = 2.6.1
pycurl = 7.43.0
pyflakes = 1.5.0
# pylint 1.5.1 breaks testDynamicClassGeneration
pylint = 1.4.4
python-memcached = 1.58
pytracemalloc = 1.2
qrcode = 5.3
restkit = 4.2.2
rsa = 3.4.2
rtjp-eventlet = 0.3.2
socketpool = 0.5.3
spyne = 2.12.14
suds = 0.4
facebook-sdk = 2.0.0
threadframe = 0.2
timerserver = 2.0.4
urlnorm = 1.1.4
uuid = 1.30
validictory = 1.1.0
xfw = 0.10
xupdate-processor = 0.4
selenium = 3.8.0
scikit-image = 0.14.0
PyWavelets = 0.5.2
networkx = 2.1
pytesseract = 0.2.2
zbarlight = 2.0
cloudpickle = 0.5.3
dask = 0.18.1
toolz = 0.9.0

# Required by:
# Products.CMFCore==2.2.10
Products.ZSQLMethods = 2.13.5

# Required by:
# eventlet==0.20.1
enum-compat = 0.0.2

# Required by:
# SOAPpy===0.12.0nxd001
fpconst = 0.7.2

# Required by:
# objgraph==3.1.0
graphviz = 0.5.2

# Required by:
# Pillow==4.0.0
olefile = 0.44

# Required by:
# munnel==0.3
python-libmilter = 1.0.3

# Required by:
# zope.app.testing==3.8.1
zope.app.debug = 3.4.1

# Required by:
# zope.app.testing==3.8.1
zope.app.dependable = 3.5.1

# Required by:
# Products.CMFCalendar==2.2.3
# five.formlib==1.0.4
zope.app.form = 4.0.2

Cython = 0.26.1
et-xmlfile = 1.0.1
h5py = 2.7.1
mpmath = 0.19
openpyxl = 2.4.8
sympy = 1.1.1

# Required by:
# openpyxl==2.4.8
jdcal = 1.3

xmltodict = 0.11.0
deepdiff = 3.3.0
unidiff = 0.5.5

# Required by:
# deepdiff = 3.3.0
jsonpickle = 0.9.6
decorator = 4.3.0