[buildout]
develop =
  ${:parts-directory}/bef_erp5-recipe
  ${:parts-directory}/z2loganalyser

extends =
  ../../component/mysql-tritonn-5.0/buildout.cfg
  ../../component/gzip/buildout.cfg
  ../../component/maatkit/buildout.cfg
  ../erp5/software.cfg

parts +=
  sanef.repository
  mysql-tritonn-5.0
  products-upgrade
  bt5-repository
  checkrecipe
  checkz2loganalyser
  maatkit

[eggs]
# Just so buildout executes [bef_erp5-recipe] before [eggs], as
# - [eggs] references [bef_erp5-recipe]
# - [instance-recipe] needs [bef_erp5-recipe] to be finished
# - we cannot rely on anything else being executed before [eggs]
bef_dummy =
  ${bef_erp5-recipe:location}
  ${z2loganalyser:location}

# XXX: Workaround for hack;
# slapos.core is added, as even if it is defined as dependency in bef_erp5-recipe
# it is not being fetched, maybe because of using this crazy hack.
# Note: Possibly everything from setup.py shall be done in same way.
eggs +=
  slapos.core
  z2loganalyser

extra-paths +=
  ${products-erp5:location}

[template]
url = ${:_profile_base_location_}/instance.cfg
md5sum = 73b41ac7f8a03aaebc53657d25d6c46c

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

[checkrecipe]
<= eggcheck
egg = slapos.cookbook

[checkz2loganalyser]
<= eggcheck
egg = z2loganalyser

[instance-recipe]
egg = slapos.cookbook
module = bef_erp5

[z2loganalyser]
recipe = plone.recipe.command
svn_param =--trust-server-cert --no-auth-cache --non-interactive --quiet -r 45666
svn = ${subversion:location}/bin/svn
location = ${buildout:parts-directory}/${:_buildout_section_name_}
stop-on-error = true
update-command = ${:command}
command =
  ${:svn} checkout ${:svn_param} https://svn.erp5.org/repos/public/erp5/trunk/utils/z2loganalyser/ ${:location} || exit 1

[sanef.repository]
<= erp5
repository = https://saneftestbot:kucahS5oav6jahch@git.erp5.org/repos/sanef.git

[bt5-repository]
recipe = plone.recipe.command
stop-on-error = true
command =
  ${buildout:executable} ${erp5:location}/product/ERP5/bin/genbt5list ${erp5:location}/product/ERP5/bootstrap ${erp5:location}/bt5 ${sanef.repository:location}/bt5
update-command = ${:command}
  
[products-upgrade]
# Recipe infrae.subversion is using svn command under the hood, but there is
# no way to pass --trust-server-cert --non-interactive, so in 2.12 falvour
# it is better to evaluate usage of provided subversion command
recipe = plone.recipe.command
svn_param =--trust-server-cert --no-auth-cache --non-interactive --quiet
location = ${buildout:parts-directory}/${:_buildout_section_name_}
stop-on-error = true
update-command = ${:command}
product_list = ERP5PropertySheetLegacy
command =
  for product in ERP5PropertySheetLegacy ; do ${subversion:location}/bin/svn checkout ${:svn_param} https://svn.erp5.org/repos/public/erp5/trunk/obsolete/products/$product ${:location}/$product || exit 1 ; done

[products-erp5]
recipe = plone.recipe.command
stop-on-error = true
location = ${buildout:parts-directory}/${:_buildout_section_name_}
update-command = ${:command}
command =
  mkdir -p ${:location}/Products &&
  for product in ${erp5:location}/product/* ; do ln -fs $product ${:location}/Products ; done &&
  for product in ${sanef.repository}/product/* ; do ln -fs $product ${:location}/Products ; done &&
  echo "__import__('pkg_resources').declare_namespace(__name__)" > "${:location}/Products/__init__.py"

[products]
# XXX: Lack of eggification workaround
# list of products, possible to extend, it is passed in reversed way
# to allow overriding during extending profile
list = ${products-deps:location} ${products-upgrade:location}

[bef_erp5-recipe]
recipe = plone.recipe.command
stop-on-error = true
location = ${buildout:parts-directory}/${:_buildout_section_name_}
# Note: GIT_SSL_NO_VERIFY is used as SlapOS OpenSSL configuration does not
# contain master certificates to verify.
command = GIT_SSL_NO_VERIFY=1 ${git:location}/bin/git clone --quiet https://saneftestbot:kucahS5oav6jahch@git.erp5.org/repos/slapos/sanef.git ${:location}
update-command = cd ${:location} && GIT_SSL_NO_VERIFY=1 ${git:location}/bin/git pull --quiet