[buildout]
parts =
  phantomjs-wrapper
  slapos-test-runner

eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
offline = true

[slap-configuration]
recipe = slapos.cookbook:slapconfiguration
computer = $${slap-connection:computer-id}
partition = $${slap-connection:partition-id}
url = $${slap-connection:server-url}
key = $${slap-connection:key-file}
cert = $${slap-connection:cert-file}

[create-directory]
recipe = slapos.cookbook:mkdirectory
bin = $${buildout:directory}/bin
etc = $${buildout:directory}/etc
services = $${:etc}/run
srv = $${buildout:directory}/srv

[download-source]
recipe = slapos.recipe.build:gitclone
git-executable = ${git:location}/bin/git

[kedifa]
<= download-source
repository = ${kedifa-repository:location}

[caucase]
<= download-source
repository = ${caucase-repository:location}

[slapos.libnetworkcache]
<= download-source
repository = ${slapos.libnetworkcache-repository:location}

[erp5.util]
<= download-source
repository = ${erp5.util-repository:location}

[slapos.cookbook]
<= download-source
repository = ${slapos.cookbook-repository:location}

[slapos.core]
<= download-source
repository = ${slapos.core-repository:location}

[slapos.recipe.build]
<= download-source
repository = ${slapos.recipe.build-repository:location}

[slapos.recipe.cmmi]
<= download-source
repository = ${slapos.recipe.cmmi-repository:location}

[slapos.recipe.template]
<= download-source
repository = ${slapos.recipe.template-repository:location}

[slapos.toolbox]
<= download-source
repository = ${slapos.toolbox-repository:location}

[slapos.rebootstrap]
<= download-source
repository = ${slapos.rebootstrap-repository:location}

[rubygemsrecipe]
<= download-source
repository = ${rubygemsrecipe-repository:location}


[slapos-test-runner]
recipe = slapos.cookbook:wrapper
wrapper-path = $${create-directory:bin}/runTestSuite
command-line =
  ${buildout:bin-directory}/runTestSuite
  --python_interpreter=${buildout:bin-directory}/${eggs:interpreter}
  --source_code_path_list=$${kedifa:location},$${caucase:location},$${erp5.util:location},$${slapos.cookbook:location},$${slapos.core:location},$${slapos.recipe.build:location},$${slapos.recipe.cmmi:location},$${slapos.recipe.template:location},$${slapos.toolbox:location},$${slapos.libnetworkcache:location},$${slapos.rebootstrap:location},$${rubygemsrecipe:location}

# Notes about environment:
# * slapos.cookbook:wrapper does not seem to allow "extending" PATH. Tests
#   needs ping, which is a setuid binary that cannot be installed via slapos
#   way of building software without root access, so we keep "standard"
#   /usr/bin and /bin in $PATH
# * SLAPOS_TEST_environment is safe to be used by tests, but there is no
#   guarantee about free ports on IPV4 and IPV6
# * LOCAL_IPV4 is backward compatible, to be migrated, SLAPOS_TEST_IPV4
environment =
  PATH=${coreutils:location}/bin:${curl:location}/bin:${openssl:location}/bin:${git:location}/bin:${libxslt:location}/bin:${socat:location}/bin:${lmsensors:location}/bin:${rsync:location}/bin/:${buildout:bin-directory}:/usr/bin/:/bin/
  LOCAL_IPV4=$${slap-configuration:ipv4-random}
  SLAPOS_TEST_IPV4=$${slap-configuration:ipv4-random}
  SLAPOS_TEST_IPV6=$${slap-configuration:ipv6-random}


[phantomjs-wrapper]
recipe = slapos.cookbook:wrapper
command-line = ${phantomjs:location}/phantomjs-slapos
wrapper-path = $${create-directory:bin}/phantomjs