[buildout]
extends =
  ../../component/apache/buildout.cfg
  ../../component/bash/buildout.cfg
  ../../component/dcron/buildout.cfg
  ../../component/dropbear/buildout.cfg
  ../../component/gzip/buildout.cfg
  ../../component/logrotate/buildout.cfg
  ../../stack/slapos.cfg

parts =
  instance-profile
  slapos-cookbook
  eggs

# Add hosting location of testing version of slapos.core
find-links +=
  http://www.nexedi.org/static/packages/source/slapos.core-testing/

[environment]
recipe = collective.recipe.environment


[instance-profile]
# 3 advantages of using jinja2 for ALL templates:
# 1/ Explicit scope (pythonic style, we explicitely list what we want to be in the scope)
# 2/ No troubles between $ and $$ (more simple)
# 3/ We can explicitely define the path of executables (i.e
#    in software, define httpd-executable = ${apache:location}/bin/httpd
#    and in instance, just use httpd-executable without bother where it is actually
#    (location can change inside of the component, from bin to sbin for example).
recipe = slapos.recipe.template:jinja2
template = ${:_profile_base_location_}/instance.cfg.jinja2
rendered = ${buildout:directory}/instance.cfg
#md5sum = 4861be4a581686feef9f9edea865d7ee
mode = 0644
context =
    key bin_directory buildout:bin-directory
    key develop_eggs_directory buildout:develop-eggs-directory
    key eggs_directory buildout:eggs-directory
    key path environment:PATH
    raw httpd_executable ${apache:location}/bin/httpd
    raw bash_executable ${bash:location}/bin/bash
    raw dcron_executable ${dcron:location}/sbin/crond
    raw dropbear_executable ${dropbear:location}/sbin/dropbear
    raw dropbearkey_executable ${dropbear:location}/bin/dropbearkey
    raw gzip_executable ${gzip:location}/bin/gzip
    raw gunzip_executable ${gzip:location}/bin/gunzip
    raw logrotate_executable ${logrotate:location}/usr/sbin/logrotate
    raw slapos_configuration_file_template_path ${slapos-configuration-file-template:target}
    raw httpd_configuration_file_template_path ${httpd-configuration-file-template:target}

[slapos-configuration-file-template]
# Download the template of slapos.cfg
recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/template/slapos.cfg.in
#md5sum = 
target = ${buildout:directory}/slapos.cfg.in
mode = 0644


[httpd-configuration-file-template]
# Download the template of httpd.conf
recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/template/httpd.conf.in
mode = 0644
#md5sum = 
#target = ${

[eggs]
recipe = zc.recipe.egg
eggs =
  collective.recipe.template

# Add slapos.libnetworkcache to path of slapos.core.
[slapos-cookbook]
eggs =
  ${lxml-python:egg}
  slapos.cookbook
  cliff
  hexagonit.recipe.download
  inotifyx
  netaddr
  netifaces
  requests
  slapos.core
  supervisor
  xml_marshaller
  pytz
  slapos.libnetworkcache