[buildout]
extensions =
  buildout-versions
  
extends =
  ../../component/gzip/buildout.cfg
  ../../component/dcron/buildout.cfg
  ../../component/logrotate/buildout.cfg
  ../../component/git/buildout.cfg
  ../../component/gnutls/buildout.cfg
  ../../component/libpng/buildout.cfg
  ../../component/libuuid/buildout.cfg
  ../../component/noVNC/buildout.cfg
  ../../component/openssl/buildout.cfg
  ../../component/dash/buildout.cfg
  ../../component/lxml-python/buildout.cfg
  ../../stack/nodejs.cfg
  ../../stack/shacache-client.cfg

develop =
  ${:parts-directory}/websockify

parts =
  template
  dash
  kvm
  eggs
  check-local-eggs
  check-local-eggs2
  nodejs
  http-proxy
  proxy-by-url
  npm-modules
  dcron
  logrotate

find-links +=
  http://www.nexedi.org/static/packages/source/slapos.buildout/

versions = versions

# Use only quite well working sites.
allow-hosts =
  *.nexedi.org
  *.python.org
  *.sourceforge.net
  alastairs-place.net
  dist.repoze.org
  effbot.org
  github.com
  peak.telecommunity.com
  psutil.googlecode.com
  www.dabeaz.com
  www.owlfish.com
  launchpad.net

# XXX: Workaround of SlapOS limitation
# Unzippig of eggs is required, as SlapOS do not yet provide nicely working
# development / fast switching environment for whole software
unzip = true

#XXX-Cedric : Currently, one can only access to KVM using noVNC.
#             Ideally one should be able to access KVM by using either NoVNC or VNC.
#             Problem is : no native crypto support in web browsers. So we have to disable ssl
#             In qemu builtin vnc server, and make it available only for localhost 
#             so that only novnc can listen to it.

#XXX-Cedric: Check status of https://github.com/kanaka/noVNC/issues/13 to see
#            When qemu has builtin support for websockets in vnc server to get rid of 
#            Websockify (socket <-> websocket proxy server) when it is ready.
#            May solve previous XXX depending on the implementation.

#XXX-Cedric: Check status of 
#            https://www.tiolive.com/nexedi/bug_module/20110819-11F4F70 for
#            Chrome >= 14 and Firefox >=7 can access to noVNC. (should be solved)

#XXX-Cedric : add list of keyboard layouts (azerty/us querty/...) parameter to qemu

[kvm]
recipe = hexagonit.recipe.cmmi
url = http://downloads.sourceforge.net/project/kvm/qemu-kvm/0.15.1/qemu-kvm-0.15.1.tar.gz
# XXX-Cedric : Upgrade to 1.0
# url = http://downloads.sourceforge.net/project/kvm/qemu-kvm/1.0/qemu-kvm-1.0.tar.gz
# md5sum = 00a825db46a70ba8ef9fc95da9cc7c1e
md5sum = 8800a7d6b3aa4a168ea7f78dc66c0320
configure-options =
  --disable-sdl
  --disable-xen
  --enable-vnc-tls
  --disable-vnc-sasl
  --disable-curses
  --disable-curl
  --enable-kvm
  --disable-docs
  --enable-vnc-png
  --disable-vnc-jpeg
  --extra-cflags="-I${gnutls:location}/include -I${libuuid:location}/include -I${zlib:location}/include -I${libpng:location}/include"
  --extra-ldflags="-Wl,-rpath -Wl,${glib:location}/lib -L${glib:location}/lib -Wl,-rpath -Wl,${gnutls:location}/lib -L${gnutls:location}/lib -Wl,-rpath -Wl,${gpg-error:location}/lib -L${gpg-error:location}/lib -L${gettext:location}/lib -Wl,-rpath -Wl,${gettext:location}/lib -Wl,-rpath -Wl,${libpng:location}/lib -L${libpng:location}/lib -L${libuuid:location}/lib -Wl,-rpath -Wl,${libuuid:location}/lib -L${zlib:location}/lib -Wl,-rpath -Wl,${zlib:location}/lib -lpng -lz -lgnutls"
  --disable-werror
environment =
  PATH=${pkgconfig:location}/bin:%(PATH)s
  PKG_CONFIG_PATH=${gnutls:location}/lib/pkgconfig:${glib:location}/lib/pkgconfig

[websockify]
# XXX-Cedric : use official egg from pypi when it is released
recipe = plone.recipe.command
stop-on-error = true
commit = 301f3ae580557da47fa5ea2050aa671ce9c5a1a0
repository = https://github.com/SlapOS/websockify.git
location = ${buildout:parts-directory}/${:_buildout_section_name_}
git-binary = ${git:location}/bin/git
command = export GIT_SSL_NO_VERIFY=true; (${:git-binary} clone --quiet ${:repository} ${:location} && cd ${:location} && ${:git-binary} reset --hard ${:commit}) || (rm -fr ${:location}; exit 1)
update-command =

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

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

[eggs]
recipe = z3c.recipe.scripts
dummy =
  ${websockify:location}
eggs =
  ${lxml-python:egg}
  websockify
  slapos.cookbook
  slapos.toolbox

[http-proxy]
# https://github.com/nodejitsu/node-http-proxy
recipe = slapos.recipe.build:download-unpacked
#XXX-Cedric : use upstream when merged
url = https://nodeload.github.com/desaintmartin/node-http-proxy/zipball/master
md5sum = 20204d0b29c2cef26e1c91e99eedca6b

[proxy-by-url]
# https://github.com/dominictarr/proxy-by-url
recipe = slapos.recipe.build:download-unpacked
#XXX-Cedric : use upstream when merged
url = https://nodeload.github.com/desaintmartin/proxy-by-url/zipball/master
md5sum = f6a7c4f8f01f3049086a1dbde2cd141c

[npm-modules]
recipe = plone.recipe.command
destination = ${buildout:parts-directory}/${:_buildout_section_name_}
location = ${buildout:parts-directory}/${:_buildout_section_name_}
command =
  rm -fr ${:destination} &&
  mkdir -p ${:destination} &&
  cd ${:destination} &&
  ${nodejs:location}/bin/node ${nodejs:location}/bin/npm install colors@0.6.0-1 &&
  ${nodejs:location}/bin/node ${nodejs:location}/bin/npm install socket.io@0.8.7 &&
  ${nodejs:location}/bin/node ${nodejs:location}/bin/npm install socket.io-client@0.8.7 &&
  ${nodejs:location}/bin/node ${nodejs:location}/bin/npm install optimist@0.3.1 &&
  ${nodejs:location}/bin/node ${nodejs:location}/bin/npm install pkginfo@0.2.3


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

[template-kvmplus]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-kvmplus.cfg
md5sum = 2e35c5b2ac9ee51d8f98fb1199f011c4
output = ${buildout:directory}/template-kvmplus.cfg
mode = 0644

[template-nbd]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-nbd.cfg
md5sum = 7691fadfc8d4392c58ac1bf0ebd5aaf2
output = ${buildout:directory}/template-nbd.cfg
mode = 0644

[template-frontend]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-frontend.cfg
md5sum = 123bf4e5bea9e86c03b62e9afb8ca04b
output = ${buildout:directory}/template-frontend.cfg
mode = 0644

[template]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg
md5sum = 68788763d23f70f24b9e575871c903a8
output = ${buildout:directory}/template.cfg
mode = 0644

[versions]
# Use SlapOS patched zc.buildout
zc.buildout = 1.6.0-dev-SlapOS-004

[networkcache]
# signature certificates of the following uploaders.
#   Romain Courteaud
#   Cedric de Saint Martin
signature-certificate-list =
  -----BEGIN CERTIFICATE-----
  MIIB4DCCAUkCADANBgkqhkiG9w0BAQsFADA5MQswCQYDVQQGEwJGUjEZMBcGA1UE
  CBMQRGVmYXVsdCBQcm92aW5jZTEPMA0GA1UEChMGTmV4ZWRpMB4XDTExMDkxNTA5
  MDAwMloXDTEyMDkxNTA5MDAwMlowOTELMAkGA1UEBhMCRlIxGTAXBgNVBAgTEERl
  ZmF1bHQgUHJvdmluY2UxDzANBgNVBAoTBk5leGVkaTCBnzANBgkqhkiG9w0BAQEF
  AAOBjQAwgYkCgYEApYZv6OstoqNzxG1KI6iE5U4Ts2Xx9lgLeUGAMyfJLyMmRLhw
  boKOyJ9Xke4dncoBAyNPokUR6iWOcnPHtMvNOsBFZ2f7VA28em3+E1JRYdeNUEtX
  Z0s3HjcouaNAnPfjFTXHYj4um1wOw2cURSPuU5dpzKBbV+/QCb5DLheynisCAwEA
  ATANBgkqhkiG9w0BAQsFAAOBgQBCZLbTVdrw3RZlVVMFezSHrhBYKAukTwZrNmJX
  mHqi2tN8tNo6FX+wmxUUAf3e8R2Ymbdbn2bfbPpcKQ2fG7PuKGvhwMG3BlF9paEC
  q7jdfWO18Zp/BG7tagz0jmmC4y/8akzHsV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