[buildout]

# Local development - to be remove
develop =
  ${:parts-directory}/slapos.cookbook-repository

parts = 
  template
  application
  template_wu
  template_result
  template_input
  template-redis
  slapos-cookbook
  instance-egg
  condor
  redis
  template-condor
  description-file
  executable
  bonjourgrid-instance
  bonjourgrid
  slapos.cookbook-repository
  check-recipe  

extends =
  ../../stack/boinc/buildout.cfg
  ../../component/condor/buildout.cfg
  ../../component/redis/buildout.cfg
  ../../component/git/buildout.cfg
  ../../stack/slapos.cfg

#Generate All instances templates
[template]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg
output = ${buildout:directory}/template.cfg
mode = 0644
md5sum = 2f23572c39bfcedcdebdb5963aeefc38

################################
### BonjourGrid description ####
################################
[bonjourgrid-instance]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-bonjourgrid.cfg
output = ${buildout:directory}/template-bonjourgrid.cfg
mode = 0644
md5sum = 877878217bd87e3b3e4f69d7bdbb5524 

[bonjourgrid]
recipe = hexagonit.recipe.download
ignore-existing = true
url = ${:_profile_base_location_}/bonjourgrid.src/bonjourgrid.slapos.tar.gz
md5sum = 5b4594b8451d83eedfa5224dbdcbb872

#################################
### Redis-Server description ####
#################################
[template-redis]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/../redis-server/instance-redis.cfg
output = ${buildout:directory}/template-redis.cfg
mode = 0644
md5sum = 8b223d1fe0ffd40c7151766730da7fcb

#################################
### BOINC Server description ####
#################################

#Download Boinc Application Binary and configure project
[application]
recipe = hexagonit.recipe.download
ignore-existing = true
url = ${boinc:location}/libexec/examples/upper_case
download-only = true
filename = upper_case
#Application configuration
app-name = upper_case
version = 1.00

[template-base]
recipe = slapos.recipe.build:download
download-only = true
mode = 0644

[template_result]
<= template-base
url = ${:_profile_base_location_}/templates/template_result
filename = template_result
location = ${buildout:parts-directory}/${:_buildout_section_name_}
md5sum = a3f0e9fd559cadcb2f297b952f8face8

[template_wu]
<= template-base
url = ${:_profile_base_location_}/templates/template_wu
filename = template_wu
location = ${buildout:parts-directory}/${:_buildout_section_name_}
md5sum = 66d7ec85ce15e65d2858c11b75fb9574

[template_input]
<= template-base
url = ${:_profile_base_location_}/input/input_file
filename = input_file
location = ${buildout:parts-directory}/${:_buildout_section_name_}
md5sum = 6f8db599de986fab7a21625b7916589c

[boinc-application]
app-list = {"${application:app-name}":{"${application:version}":{"use_default":true, "wu-number":2, "input-file":"${template_input:location}/${template_input:filename}", "binary":"${application:location}/${application:filename}"}}}

[boinc-default]
template-result = ${template_result:location}/${template_result:filename}
template-wu = ${template_wu:location}/${template_wu:filename}
platform = x86_64-pc-linux-gnu
extension = 

##########################
###Condor description ####
##########################

[template-condor]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/../condor/instance-condor.cfg
output = ${buildout:directory}/template-condor.cfg
md5sum = 42985a425369e4f93211cfaad21d8eb8
mode = 0644

[description-file]
recipe = slapos.recipe.build:download
mode = 0644
url = ${:_profile_base_location_}/condor_job/submit
filename = submit
location = ${buildout:parts-directory}/${:_buildout_section_name_}
md5sum = 8180d88348b89b55216f8dd4475a9eea

[executable]
recipe = slapos.recipe.build:download
mode = 0774
url = ${:_profile_base_location_}/condor_job/simple
filename = simple
location = ${buildout:parts-directory}/${:_buildout_section_name_}
md5sum = c512f495cdd112bceb04feab7c909a10

[condor-application]
list = {"condor_test":{"description-file":"${description-file:location}/${description-file:filename}", "executable":"${executable:location}/${executable:filename}", "executable-name":"${executable:filename}", "files":{}}}


######################################################"
# Local development
[slapos.cookbook-repository]
recipe = plone.recipe.command
stop-on-error = true
branch = grid-computing
revision =
location = ${buildout:parts-directory}/${:_buildout_section_name_}
command = "${git:location}/bin/git" clone --branch "${:branch}" --quiet https://lab.nexedi.com/nexedi/slapos.git "${:location}" && if [ -n "${:revision}" ]; then cd "${:location}" && "${git:location}/bin/git" reset --quiet --hard "${:revision}" ; fi
update-command = cd "${:location}" && "${git:location}/bin/git" fetch --quiet && if [ -n "${:revision}" ]; then "${git:location}/bin/git" reset --hard "${:revision}"; else "${git:location}/bin/git" reset --quiet --hard @{upstream} ; fi

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