[buildout]
bef_erp5_recipe_location = ${:parts-directory}/bef_erp5-recipe
develop =
  ${:bef_erp5_recipe_location}
extends =
  ../../component/mysql-tritonn-5.0/buildout.cfg
  ../erp5/software.cfg

parts +=
  mysql-tritonn-5.0
  products-bef
  products-upgrade

[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}

# 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

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

[template]
url = ${:_profile_base_location_}/instance.cfg
md5sum = 8ed5e0c3dcbde0f88e18dba0d364fabf

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

[bef-svn-template]
# 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 --username saneftestbot --password kucahS5oav6jahch
svn = ${subversion:location}/bin/svn
location = ${buildout:parts-directory}/${:_buildout_section_name_}
stop-on-error = true
update-command = ${:command}

[bt5-bef]
<= bef-svn-template
command =
  ${:svn} checkout ${:svn_param} https://svn.erp5.org/repos/sanef/trunk/bt5 ${:location} || exit 1

[products-bef]
<= bef-svn-template
product_list = SANEF
command =
  for product in SANEF ; do ${:svn} checkout ${:svn_param} https://svn.erp5.org/repos/sanef/trunk/products/$product ${:location}/$product || exit 1 ; done

[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 &&
  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} ${products-bef: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