Commit 7be9ec30 by Alain Takoudjou

Update Release Candidate

2 parents 29a41407 8b64fd3a
Showing 69 changed files with 779 additions and 856 deletions
Changes
=======
1.0.62 (2018-04-10)
-------------------
* promise.plugin: new recipe for python promises plugin script generation
1.0.59 (2018-03-15)
-------------------
* librecipe.execute: fix convert process arguments to string formatting.
......
......@@ -34,9 +34,9 @@ md5sum = 2202b18f269ad606d70e1864857ed93c
[apache]
# inspired on http://old.aclark.net/team/aclark/blog/a-lamp-buildout-for-wordpress-and-other-php-apps/
recipe = slapos.recipe.cmmi
version = 2.4.29
version = 2.4.33
url = https://archive.apache.org/dist/httpd/httpd-${:version}.tar.bz2
md5sum = 0c599404ef6b69eee95bcd9fcd094407
md5sum = 6ef469d3f16fffeb688bc6e0346823e5
pre-configure =
cp -ar ${apr:location}/apr-${apr:version} srclib/apr/ &&
cp -ar ${apr-util:location}/apr-util-${apr-util:version} srclib/apr-util
......
diff -uNr Acquisition-2.13.8/src/Acquisition/_Acquisition.c Acquisition-2.13.8nxd001/src/Acquisition/_Acquisition.c
--- Acquisition-2.13.8/src/Acquisition/_Acquisition.c 2011-06-11 17:19:14.000000000 +0200
+++ Acquisition-2.13.8nxd001/src/Acquisition/_Acquisition.c 2013-10-31 16:24:55.665085888 +0100
@@ -448,6 +448,64 @@
diff -uNr Acquisition-2.13.12.orig/src/Acquisition/_Acquisition.c Acquisition-2.13.12/src/Acquisition/_Acquisition.c
--- Acquisition-2.13.12.orig/src/Acquisition/_Acquisition.c 2017-12-01 12:01:34.000000000 +0100
+++ Acquisition-2.13.12/src/Acquisition/_Acquisition.c 2018-04-09 17:10:15.394836944 +0200
@@ -449,6 +449,64 @@
}
static PyObject *
......@@ -66,7 +66,7 @@ diff -uNr Acquisition-2.13.8/src/Acquisition/_Acquisition.c Acquisition-2.13.8nx
Wrapper_acquire(Wrapper *self, PyObject *oname,
PyObject *filter, PyObject *extra, PyObject *orig,
int explicit, int containment);
@@ -545,8 +603,8 @@
@@ -589,8 +647,8 @@
Py_XDECREF(r); Py_XDECREF(v); Py_XDECREF(tb);
r=NULL;
}
......@@ -77,7 +77,7 @@ diff -uNr Acquisition-2.13.8/src/Acquisition/_Acquisition.c Acquisition-2.13.8nx
{
if (r==Acquired)
{
@@ -670,7 +728,7 @@
@@ -714,7 +772,7 @@
Py_XDECREF(r); Py_XDECREF(v); Py_XDECREF(tb);
r=NULL;
......@@ -86,7 +86,7 @@ diff -uNr Acquisition-2.13.8/src/Acquisition/_Acquisition.c Acquisition-2.13.8nx
if (r == Acquired) {
Py_DECREF(r);
}
@@ -707,7 +765,7 @@
@@ -751,7 +809,7 @@
Wrapper_getattro(Wrapper *self, PyObject *oname)
{
if (self->obj || self->container)
......@@ -95,18 +95,18 @@ diff -uNr Acquisition-2.13.8/src/Acquisition/_Acquisition.c Acquisition-2.13.8nx
/* Maybe we are getting initialized? */
return Py_FindAttr(OBJECT(self),oname);
@@ -724,7 +782,7 @@
return Py_FindAttr(OBJECT(self),oname);
@@ -776,7 +834,7 @@
result = Py_FindAttr(OBJECT(self),oname);
if (self->obj || self->container)
- return Wrapper_findattr(self, oname, NULL, NULL, NULL, 1, 0, 0, 0);
+ return Wrapper_findattr(self, oname, NULL, NULL, OBJECT(self), 1, 0, 0, 0);
else if (self->obj || self->container)
- result = Wrapper_findattr(self, oname, NULL, NULL, NULL, 1, 0, 0, 0);
+ result = Wrapper_findattr(self, oname, NULL, NULL, OBJECT(self), 1, 0, 0, 0);
/* Maybe we are getting initialized? */
return Py_FindAttr(OBJECT(self),oname);
diff -uNr Acquisition-2.13.8/src/Acquisition/test_dynamic_acquisition.py Acquisition-2.13.8nxd001/src/Acquisition/test_dynamic_acquisition.py
--- Acquisition-2.13.8/src/Acquisition/test_dynamic_acquisition.py 1970-01-01 01:00:00.000000000 +0100
+++ Acquisition-2.13.8nxd001/src/Acquisition/test_dynamic_acquisition.py 2013-10-31 16:24:55.665085888 +0100
else result = Py_FindAttr(OBJECT(self),oname);
diff -uNr Acquisition-2.13.12.orig/src/Acquisition/test_dynamic_acquisition.py Acquisition-2.13.12/src/Acquisition/test_dynamic_acquisition.py
--- Acquisition-2.13.12.orig/src/Acquisition/test_dynamic_acquisition.py 1970-01-01 01:00:00.000000000 +0100
+++ Acquisition-2.13.12/src/Acquisition/test_dynamic_acquisition.py 2018-04-09 17:07:34.863985305 +0200
@@ -0,0 +1,160 @@
+##############################################################################
+#
......@@ -268,10 +268,10 @@ diff -uNr Acquisition-2.13.8/src/Acquisition/test_dynamic_acquisition.py Acquisi
+ >>> assert not b.a.aq_inContextOf('somestring')
+'''
+
diff -uNr Acquisition-2.13.8/src/Acquisition/tests.py Acquisition-2.13.8nxd001/src/Acquisition/tests.py
--- Acquisition-2.13.8/src/Acquisition/tests.py 2011-06-11 17:09:38.000000000 +0200
+++ Acquisition-2.13.8nxd001/src/Acquisition/tests.py 2013-10-31 16:24:55.669085888 +0100
@@ -2552,6 +2552,7 @@
diff -uNr Acquisition-2.13.12.orig/src/Acquisition/tests.py Acquisition-2.13.12/src/Acquisition/tests.py
--- Acquisition-2.13.12.orig/src/Acquisition/tests.py 2017-12-01 12:01:34.000000000 +0100
+++ Acquisition-2.13.12/src/Acquisition/tests.py 2018-04-09 17:07:34.867985476 +0200
@@ -2588,6 +2588,7 @@
def test_suite():
return unittest.TestSuite((
DocTestSuite(),
......@@ -279,10 +279,10 @@ diff -uNr Acquisition-2.13.8/src/Acquisition/tests.py Acquisition-2.13.8nxd001/s
DocFileSuite('README.txt', package='Acquisition'),
unittest.makeSuite(TestParent),
unittest.makeSuite(TestAcquire),
diff -uNr Acquisition-2.13.8/src/Acquisition.egg-info/SOURCES.txt Acquisition-2.13.8nxd001/src/Acquisition.egg-info/SOURCES.txt
--- Acquisition-2.13.8/src/Acquisition.egg-info/SOURCES.txt 2011-06-11 17:21:18.000000000 +0200
+++ Acquisition-2.13.8nxd001/src/Acquisition.egg-info/SOURCES.txt 2013-10-31 16:24:55.669085888 +0100
@@ -15,6 +15,7 @@
diff -uNr Acquisition-2.13.12.orig/src/Acquisition.egg-info/SOURCES.txt Acquisition-2.13.12/src/Acquisition.egg-info/SOURCES.txt
--- Acquisition-2.13.12.orig/src/Acquisition.egg-info/SOURCES.txt 2017-12-01 12:08:29.000000000 +0100
+++ Acquisition-2.13.12/src/Acquisition.egg-info/SOURCES.txt 2018-04-09 17:07:34.867985476 +0200
@@ -10,6 +10,7 @@
src/Acquisition/_Acquisition.c
src/Acquisition/__init__.py
src/Acquisition/interfaces.py
......
From 8b31ccec54584a287cc61501948283d7d6ee7073 Mon Sep 17 00:00:00 2001
From: Julien Muchembled <jm@nexedi.com>
Date: Mon, 26 Mar 2018 20:39:07 +0200
Subject: [PATCH] Enable TCP_NODELAY for inet(6) sockets
See commit 3d886d426243655b9f5a2528636e42b5c7662c19.
---
src/ZEO/zrpc/client.py | 2 ++
src/ZEO/zrpc/server.py | 1 +
2 files changed, 3 insertions(+)
diff --git a/src/ZEO/zrpc/client.py b/src/ZEO/zrpc/client.py
index 32a7a877..669f5962 100644
--- a/src/ZEO/zrpc/client.py
+++ b/src/ZEO/zrpc/client.py
@@ -568,6 +568,8 @@ def __init__(self, domain, addr, mgr, client):
self.close()
return
self.sock.setblocking(0)
+ if domain in (socket.AF_INET, socket.AF_INET6):
+ self.sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
self.state = "opened"
def connect_procedure(self):
diff --git a/src/ZEO/zrpc/server.py b/src/ZEO/zrpc/server.py
index b83cc004..af91e3e4 100644
--- a/src/ZEO/zrpc/server.py
+++ b/src/ZEO/zrpc/server.py
@@ -66,6 +66,7 @@ def _open_socket(self):
socket.IPPROTO_IPV6, socket.IPV6_V6ONLY, True)
else:
self.create_socket(socket.AF_INET, socket.SOCK_STREAM)
+ self.socket.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
else:
self.create_socket(socket.AF_UNIX, socket.SOCK_STREAM)
self.set_reuse_addr()
--
2.14.1
......@@ -14,8 +14,8 @@ parts =
[gcc-common]
recipe = slapos.recipe.cmmi
url = http://ftp.gnu.org/gnu/gcc/gcc-5.4.0/gcc-5.4.0.tar.bz2
md5sum = 4c626ac2a83ef30dfb9260e6f59c2b30
url = http://ftp.gnu.org/gnu/gcc/gcc-5.5.0/gcc-5.5.0.tar.gz
md5sum = 781bc0195edeb0ceaace8428f63ae63d
# make install does not work when several core are used
make-targets = install -j1
......
......@@ -3,6 +3,7 @@
extends =
../findutils/buildout.cfg
../git/buildout.cfg
../pkgconfig/buildout.cfg
parts = gowork
......@@ -64,7 +65,15 @@ environment-extra =
# github.com/pkg/profile \
# golang.org/x/perf/cmd/benchstat
#
# it is possible to specify Go build flags used for compilation e.g. this way:
# For Cgo support pkg-config is made pre-available by gowork, and users
# should list paths where to search for pkg-config files, e.g. this way:
#
# [gowork]
# cpkgpath =
# ${sqlite3:location}/lib/pkgconfig
# ${zlib:location}/lib/pkgconfig
#
# It is also possible to specify Go build flags used for compilation e.g. this way:
#
# [gowork]
# buildflags = -race
......@@ -80,6 +89,9 @@ golang = ${golang19:location}
# no special build flags by default
buildflags =
# empty pkg-config path by default
cpkgpath =
# everything is done by dependent parts
recipe = plone.recipe.command
command = :
......@@ -93,7 +105,7 @@ recipe = slapos.recipe.template
url = ${:_profile_base_location_}/goenv.sh.in
output = ${gowork:directory}/env.sh
depends = ${gowork.mkdir:recipe}
md5sum = a9a265135931b3da53f4392870748264
md5sum = 7a067a3974c446c3eaa0e82818ba1adb
[gowork.mkdir]
# NOTE do not use slapos.cookbook:mkdirectory here - if anything in software (not instance)
......
......@@ -3,13 +3,16 @@
# ---- 8< ---- (buildout substitution here)
# PATH so that go & friends work out of the box
export PATH=${gowork:golang}/bin:${git:location}/bin:${buildout:bin-directory}:$PATH
export PATH=${gowork:golang}/bin:${git:location}/bin:${pkgconfig:location}/bin:${buildout:bin-directory}:$PATH
X=${gowork:directory}
export PKG_CONFIG_PATH=$(echo -n "${gowork:cpkgpath}" |tr '\n' ':'):$PKG_CONFIG_PATH
# ---- 8< ----
export GOPATH=$X:$GOPATH
export PATH=$X/bin:$PATH
export PS1="(`basename $X`) $PS1"
# strip trailing : from $GOPATH
# strip trailing : from $GOPATH, $PKG_CONFIG_PATH
GOPATH=$${GOPATH%:}
PKG_CONFIG_PATH=$${PKG_CONFIG_PATH%:}
......@@ -14,8 +14,8 @@ extends =
[groonga]
recipe = slapos.recipe.cmmi
url = http://packages.groonga.org/source/groonga/groonga-7.0.5.tar.gz
md5sum = d42dd98c5272ed2b9ab50ded54eb818b
url = http://packages.groonga.org/source/groonga/groonga-8.0.0.tar.gz
md5sum = f4641e68a5301e641399f2d112a494dd
# temporary patch to respect more tokens in natural language mode.
patches =
${:_profile_base_location_}/groonga.patch#9ed02fbe8400402d3eab47eee149978b
......
......@@ -14,6 +14,8 @@ configure-options =
--prefix=${:location}
--disable-static
--enable-rpath
patches =
${:_profile_base_location_}/fix-glibc2.26-ftbfs.patch#f1622be16964029fc66a70b8f9e1693c
[icu4c-slaposgcc]
# need for onlyoffice-core
......
--- source/i18n/digitlst.cpp 2018-03-29 10:59:45.706746334 +0900
+++ source/i18n/digitlst.cpp 2018-03-29 11:01:15.933534983 +0900
@@ -61,11 +61,7 @@
#endif
#if U_USE_STRTOD_L
-# if U_PLATFORM_USES_ONLY_WIN32_API || U_PLATFORM == U_PF_CYGWIN
-# include <locale.h>
-# else
-# include <xlocale.h>
-# endif
+# include <locale.h>
#endif
// ***************************************************************************
diff --git a/mrn_mysql_compat.h b/mrn_mysql_compat.h
index d2b227ff..337de968 100644
--- a/mrn_mysql_compat.h
+++ b/mrn_mysql_compat.h
@@ -362,6 +362,7 @@
#if defined(MRN_MARIADB_P) && \
((MYSQL_VERSION_ID >= 100207) || \
+ ((MYSQL_VERSION_ID >= 100126) && (MYSQL_VERSION_ID < 100200)) || \
((MYSQL_VERSION_ID >= 50557) && (MYSQL_VERSION_ID < 100000)))
# define mrn_create_partition_name(out, \
out_length, \
......@@ -28,8 +28,8 @@ parts =
[mariadb]
recipe = slapos.recipe.cmmi
url = https://downloads.mariadb.org/f/mariadb-${:version}/source/mariadb-${:version}.tar.gz/from/http%3A//fr.mirror.babylon.network/mariadb/?serve
version = 10.1.31
md5sum = 14ab0398c019eb531bc29f2c437ccb51
version = 10.1.32
md5sum = 389ce891cf00957748ba98b09f433c14
patch-options = -p0
patches =
${:_profile_base_location_}/mariadb_10.1.21_create_system_tables__no_test.patch#3c76aa9564a162f13aced7c0a3f783b3
......@@ -84,8 +84,8 @@ post-install =
# mroonga - a storage engine for MySQL. It provides fast fulltext search feature to all MySQL users.
# http://mroonga.github.com/
recipe = slapos.recipe.cmmi
url = http://packages.groonga.org/source/mroonga/mroonga-7.05.tar.gz
md5sum = d289667a60a6aa78d8bc276ab61b2996
url = http://packages.groonga.org/source/mroonga/mroonga-8.00.tar.gz
md5sum = 8b906705be5fc14785207ca6752b96e9
pre-configure = set -e
rm -rf fake_mariadb_source
mkdir -p fake_mariadb_source
......@@ -106,7 +106,6 @@ configure-options =
patch-options = -p1
patches =
${:_profile_base_location_}/mroonga_boolean.patch#c818568fe35ca6a4298f18e575d962a0
${:_profile_base_location_}/1a910088ec55c61434029d8e1cc3c6192ac508d7.diff#a8b8df4dd870a1a269dfd9dc6941467b
pre-build =
sed -i -e "s,${mariadb:location}/include,$(pwd)/fake_mariadb_source/include,g" Makefile */Makefile
environment =
......
# Do not extend any file that touch buildout:parts.
[mariadb]
version = 10.2.13
md5sum = 20c61bd4059ba287e54cfb2862bae81d
version = 10.2.14
md5sum = d98cce6f3c0e2971afa061fc67183b91
stable-patches =
configure-options +=
-DCMAKE_C_COMPILER=${gcc:location}/bin/gcc
......
......@@ -5,7 +5,7 @@ parts =
[noVNC]
recipe = hexagonit.recipe.download
ignore-existing = true
# version-0.6.1 release from 04 Jul 2016
url = https://github.com/kanaka/noVNC/archive/v0.6.1.tar.gz
md5sum = d153c6aa69a9178081768fecbace1932
# version-1.0.0 release on Feb 22, 2018
url = https://github.com/novnc/noVNC/archive/v1.0.0.tar.gz
md5sum = d63c2944abd12fecec6ec504e82f27c8
strip-top-level-dir = true
[buildout]
extends =
../binutils/buildout.cfg
../gcc/buildout.cfg
../libxml2/buildout.cfg
../zlib/buildout.cfg
......@@ -15,12 +16,12 @@ recipe = slapos.recipe.cmmi
location = ${buildout:parts-directory}/${:_buildout_section_name_}
# This url contains the hash provided by the DocumentServer core submodule hash.
# https://github.com/ONLYOFFICE/DocumentServer/
url = https://lab.nexedi.com/bk/onlyoffice_core/repository/archive.tar.bz2?ref=b051e75b179b3599c09937668fbbd2d7e2c50683
md5sum = b2713373d687dd1c7121c286fa156626
url = https://lab.nexedi.com/bk/onlyoffice_core/repository/archive.tar.bz2?ref=8a40eb47bd80a40ecde14c223525b21852d2fc9f
md5sum = 9cd1cd731202511e475971eee58ba7b6
configure-command = true
make-targets = lib bin
environment =
PATH=${gcc:location}/bin:${qt5-qmake:location}/bin:%(PATH)s
PATH=${binutils:location}/bin:${gcc:location}/bin:${qt5-qmake:location}/bin:%(PATH)s
CXXFLAGS=-I${libxml2:location}/include -I${zlib:location}/include -I${icu4c-slaposgcc:location}/include -I${boost-lib:location}/include -Wno-comment -Wno-deprecated-declarations -Wno-endif-labels -Wno-parentheses -Wno-reorder -Wno-sign-compare -Wno-switch -Wno-unknown-pragmas -Wno-unused
LDFLAGS=-L${gcc:location}/lib -Wl,-rpath=${gcc:location}/lib -L${gcc:location}/lib64 -Wl,-rpath=${gcc:location}/lib64 -L${libxml2:location}/lib -Wl,-rpath=${libxml2:location}/lib -L${zlib:location}/lib -Wl,-rpath=${zlib:location}/lib -L${icu4c-slaposgcc:location}/lib -Wl,-rpath=${icu4c-slaposgcc:location}/lib -L${boost-lib:location}/lib -Wl,-rpath=${boost-lib:location}/lib -Wl,-rpath=${:location}/lib
post-install =
......
......@@ -16,8 +16,8 @@ parts =
[openssl]
recipe = slapos.recipe.cmmi
url = https://www.openssl.org/source/openssl-1.0.2n.tar.gz
md5sum = 13bdc1b1d1ff39b6fd42a255e74676a4
url = https://www.openssl.org/source/openssl-1.0.2o.tar.gz
md5sum = 44279b8557c3247cbe324e2322ecd114
location = ${buildout:parts-directory}/${:_buildout_section_name_}
# 'prefix' option to override --openssldir/--prefix (which is useful
# when combined with INSTALL_PREFIX). Used by slapos.package.git/obs
......
......@@ -64,7 +64,6 @@ md5sum = 096c1c18b44c269808bd815d58c53c8f
[debian-amd64-jessie-netinst.iso]
<= debian-amd64-netinst-base
release = archive
version = 8.10.0
md5sum = 19dcfc381bd3e609c6056216d203f5bc
......
......@@ -5,8 +5,8 @@ parts =
[sqlite3]
recipe = slapos.recipe.cmmi
url = http://sqlite.org/2017/sqlite-autoconf-3190000.tar.gz
md5sum = 2426883b4dd3a9fd6aeb28a16b81a72b
url = https://sqlite.org/2018/sqlite-autoconf-3220000.tar.gz
md5sum = 96b5648d542e8afa6ab7ffb8db8ddc3d
configure-options =
--disable-static
--enable-readline
......
......@@ -22,7 +22,7 @@ dist = ${vm-debian:dists}
[vm-debian]
recipe = slapos.recipe.build:vm.install-debian
environment = vm-install-environment
dists = debian-jessie
dists = debian-stretch
size = 1Gi
late-command =
# rdnssd causes too much trouble with recent QEMU, because the latter acts as
......@@ -55,18 +55,22 @@ preseed.recommends = false
preseed.tasks =
[debian-squeeze]
<= debian-jessie
<= debian-stretch
x86_64.iso = debian-amd64-squeeze-netinst.iso
[debian-wheezy]
<= debian-jessie
<= debian-stretch
x86_64.iso = debian-amd64-wheezy-netinst.iso
[debian-jessie]
<= debian-stretch
x86_64.iso = debian-amd64-jessie-netinst.iso
[debian-stretch]
x86_64.iso = debian-amd64-netinst.iso
x86_64.kernel = install.amd/vmlinuz
x86_64.initrd = install.amd/initrd.gz
[debian-stretch]
<= debian-jessie
[debian-buster]
<= debian-stretch
x86_64.iso = debian-amd64-testing-netinst.iso
......@@ -28,7 +28,7 @@ from setuptools import setup, find_packages
import glob
import os
version = '1.0.60.dev0'
version = '1.0.62'
name = 'slapos.cookbook'
long_description = open("README.rst").read() + "\n" + \
open("CHANGES.rst").read() + "\n"
......@@ -99,7 +99,6 @@ setup(name=name,
'dropbear.add_authorized_key = slapos.recipe.dropbear:AddAuthorizedKey',
'dropbear.client = slapos.recipe.dropbear:Client',
'duplicity = slapos.recipe.duplicity:Recipe',
'egg_test = slapos.recipe.erp5_test:EggTestRecipe',
'equeue = slapos.recipe.equeue:Recipe',
'erp5.promise = slapos.recipe.erp5_promise:Recipe',
'erp5.test = slapos.recipe.erp5_test:Recipe',
......@@ -151,6 +150,7 @@ setup(name=name,
'postgres.export = slapos.recipe.postgres.backup:ExportRecipe',
'postgres.import = slapos.recipe.postgres.backup:ImportRecipe',
'proactive = slapos.recipe.proactive:Recipe',
'promise.plugin= slapos.recipe.promise_plugin:Recipe',
'publish = slapos.recipe.publish:Recipe',
'publish.serialised = slapos.recipe.publish:Serialised',
'publish-early = slapos.recipe.publish_early:Recipe',
......
......@@ -113,26 +113,3 @@ class CloudoooRecipe(GenericBaseRecipe):
return path_list
class EggTestRecipe(GenericBaseRecipe):
"""
Recipe used to create wrapper used to run test suite (python setup.py test)
off a list of Python eggs.
"""
def install(self):
test_list = self.options['test-list'].strip().replace('\n', ',')
common_dict = {}
if self.options.get('environment'):
environment_part = self.buildout.get(self.options['environment'])
if environment_part:
common_dict['environment'] = dict(environment_part)
if 'prepend-path' in self.options:
common_dict['prepend_path'] = self.options['prepend-path']
return self.createPythonScript(
self.options['run-test-suite'], __name__ + '.test.runTestSuite',
((self.options['run-test-suite-binary'],
"--source_code_path_list", test_list),
common_dict)
)
##############################################################################
#
# Copyright (c) 2018 Vifib SARL and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
import logging, os, sys
import zc.buildout.easy_install
from slapos.recipe.librecipe import GenericBaseRecipe
script_template = '''# This script is auto generated by slapgrid, do not edit!
import sys
sys.path[0:0] = [
%(path)s
]
extra_config_dict = {
%(config)s
}
# We want to cleanup all imported modules from slapos namespace, because
# they will conflict with slapos.core.
# In fact as slapos.grid is already imported, the promise cannot reimport
# his own slapos.grid from an updated sys.path. Then all module imports which
# are not in slapos.core will fail.
#
# call reload(slapos) only solve a part of problem because not all modules
# will be reloaded, and some new modules won't be added.
# The solution is to delete all cached 'slapos' modules as well as all cached
# 'pkg_resources' modules which is responsible of namespace declaration.
# They will be re-imported again using the updated sys.path
for module in sys.modules.keys():
if 'slapos' in module or 'pkg_resources' in module:
del sys.modules[module]
import slapos.grid.promise
%(content)s
'''
class Recipe(GenericBaseRecipe):
_WORKING_SET_CACHE_NAME = "slapos.cookbook_pplugin_ws_cache"
def __init__(self, buildout, name, options):
buildout_section = buildout['buildout']
options['eggs-directory'] = buildout_section['eggs-directory']
options['develop-eggs-directory'] = buildout_section['develop-eggs-directory']
super(Recipe, self).__init__(buildout, name, options)
def _get_cache_storage(self):
"""Return a mapping where to store generated working sets.
from https://github.com/buildout/buildout/blob/master/zc.recipe.egg_/src/zc/recipe/egg/egg.py#L170
"""
cache_storage = getattr(
self.buildout,
self._WORKING_SET_CACHE_NAME,
None
)
if cache_storage is None:
cache_storage = {}
setattr(
self.buildout,
self._WORKING_SET_CACHE_NAME,
cache_storage
)
return cache_storage
def install(self):
develop_eggs_dir = self.options['develop-eggs-directory']
eggs_dir = self.options['eggs-directory']
egg_list = [
egg.strip()
for egg in self.options['eggs'].split('\n')
if egg.strip()
]
cache_storage = self._get_cache_storage()
cache_key = (
tuple(egg_list),
eggs_dir,
develop_eggs_dir,
)
if cache_key not in cache_storage:
working_set = zc.buildout.easy_install.working_set(
egg_list,
[develop_eggs_dir, eggs_dir]
)
cache_storage[cache_key] = working_set
else:
working_set = cache_storage[cache_key]
content = self.options['content'].strip()
output = self.options['output']
mode = self.options.get('mode', '0600')
path_list_string = ""
for dist in working_set:
path_list_string += ' "%s",\n' % dist.location
content_string = '\n'.join([line.lstrip() for line in content.split('\n')])
config_string = ""
for key in self.options:
if key.startswith('config-'):
config_string += " '%s': '%s',\n" % (key[7:], self.options[key])
option_dict = dict(path=path_list_string.strip(),
content=content_string,
config=config_string.strip())
with open(output, 'w') as f:
f.write(script_template % option_dict)
os.chmod(output, int(mode, 8))
return (output,)
update = install
......@@ -4,8 +4,6 @@ import unittest
from mock import patch
from slapos.recipe import free_port
class SocketMock():
def __init__(self, *args, **kw):
self.args = args
......@@ -28,31 +26,16 @@ class FreePortTest(unittest.TestCase):
SocketMock.bind = SocketMock.close = SocketMock.nothing_happen
def new_recipe(self, **kw):
buildout = {
'buildout': {
'bin-directory': '',
'find-links': '',
'allow-hosts': '',
'develop-eggs-directory': '',
'eggs-directory': '',
'python': 'testpython',
'installed': '.installed.cfg',
},
'testpython': {
'executable': sys.executable,
},
'slap-connection': {
'computer-id': '',
'partition-id': '',
'server-url': '',
'software-release-url': '',
}
}
from slapos.recipe import free_port
from slapos.test.utils import makeRecipe
options = {
'ip': '127.0.0.1',
}
options.update(kw)
return free_port.Recipe(buildout=buildout, name='free_port', options=options)
return makeRecipe(
free_port.Recipe,
options=options,
name='free_port')
@useMock
def test_ifNoBusyPortThenMinPortIsAlwaysReturned(self):
......
......@@ -4,30 +4,15 @@ import unittest
from tempfile import mkdtemp
from shutil import rmtree
from slapos.recipe import generic_cloudooo
class TestGenericCloudooo(unittest.TestCase):
def new_recipe(self, options):
buildout = {
'buildout': {
'bin-directory': '',
'find-links': '',
'allow-hosts': '',
'develop-eggs-directory': '',
'eggs-directory': '',
'python': 'testpython',
},
'testpython': {
'executable': sys.executable,
},
'slap-connection': {
'computer-id': '',
'partition-id': '',
'server-url': '',
'software-release-url': '',
}
}
return generic_cloudooo.Recipe(buildout=buildout, name='generic_cloudooo', options=options)
from slapos.recipe import generic_cloudooo
from slapos.test.utils import makeRecipe
return makeRecipe(
generic_cloudooo.Recipe,
options=options,
name='generic_cloudooo')
def setUp(self):
self.test_dir = mkdtemp()
......
......@@ -5,37 +5,19 @@ import sys
import tempfile
import unittest
from slapos.recipe import pbs
class PBSTest(unittest.TestCase):
def new_recipe(self):
buildout = {
'buildout': {
'bin-directory': '',
'find-links': '',
'allow-hosts': '',
'develop-eggs-directory': '',
'eggs-directory': '',
'python': 'testpython',
},
'testpython': {
'executable': sys.executable,
},
'slap-connection': {
'computer-id': '',
'partition-id': '',
'server-url': '',
'software-release-url': '',
}
}
from slapos.recipe import pbs
from slapos.test.utils import makeRecipe
options = {
'rdiffbackup-binary': ''
}
return pbs.Recipe(buildout=buildout, name='pbs', options=options)
'rdiffbackup-binary': ''
}
return makeRecipe(
pbs.Recipe,
options=options,
name='pbs')
def test_push(self):
recipe = self.new_recipe()
......
......@@ -6,8 +6,6 @@ import tempfile
import unittest
from slapos.slap.slap import NotFoundError, ConnectionError
from slapos.recipe import re6stnet
class Re6stnetTest(unittest.TestCase):
......@@ -47,31 +45,21 @@ class Re6stnetTest(unittest.TestCase):
shutil.rmtree(path)
def new_recipe(self):
buildout = {
'buildout': {
'bin-directory': '',
'find-links': '',
'allow-hosts': '',
'develop-eggs-directory': '',
'eggs-directory': '',
'python': 'testpython',
},
'testpython': {
'executable': sys.executable,
},
'slap-connection': {
from slapos.recipe import re6stnet
from slapos.test.utils import makeRecipe
return makeRecipe(
re6stnet.Recipe,
options=self.options,
slap_connection={
'computer-id': 'comp-test',
'partition-id': 'slappart0',
'server-url': 'http://server.com',
'software-release-url': 'http://software.com',
'key-file': '/path/to/key',
'cert-file': '/path/to/cert'
}
}
options = self.options
},
name='re6stnet')
return re6stnet.Recipe(buildout=buildout, name='re6stnet', options=options)
def checkWrapper(self, path):
self.assertTrue(os.path.exists(path))
......
"""Test helpers
"""
import sys
import os.path
from ConfigParser import ConfigParser
import logging
def makeRecipe(recipe_class, options, name='test', slap_connection=None):
"""Instanciate a recipe of `recipe_class` with `options` with a buildout
mapping containing a python and an empty `slapos-connection` mapping, unless
provided as `slap_connection`.
If running tests in a buildout folder, the test recipe will reuse the
`eggs-directory` and `develop-eggs-directory` from this buildout so that the
test recipe does not need to install eggs again when using working set.
To prevent test accidentally writing to the buildout's eggs repositories, we
set `newest` to false and `offline` to true in this case.
"""
buildout = {
'buildout': {
'bin-directory': '',
'find-links': '',
'allow-hosts': '',
'develop-eggs-directory': '',
'eggs-directory': '',
'python': 'testpython',
},
'testpython': {
'executable': sys.executable,
},
'slap-connection': {
'computer-id': '',
'partition-id': '',
'server-url': '',
'software-release-url': '',
}
}
if slap_connection is not None:
buildout['slap-connection'] = slap_connection
# are we in buildout folder ?
# the usual layout is
# ${buildout:directory}/parts/slapos-repository/slapos/test/utils.py , so try
# to find a buildout relative to this file.
buildout_cfg = os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', 'buildout.cfg')
if os.path.exists(buildout_cfg):
parser = ConfigParser()
parser.readfp(open(buildout_cfg))
eggs_directory = parser.get('buildout', 'eggs-directory')
develop_eggs_directory = parser.get('buildout', 'develop-eggs-directory')
logging.getLogger(__name__).info(
'Using eggs-directory (%s) and develop-eggs-directory (%s) from buildout at %s',
eggs_directory,
develop_eggs_directory,
buildout_cfg)
buildout['buildout']['eggs-directory'] = eggs_directory
buildout['buildout']['develop-eggs-directory'] = develop_eggs_directory
buildout['buildout']['newest'] = False
buildout['buildout']['offline'] = True
return recipe_class(buildout=buildout, name=name, options=options)
......@@ -51,7 +51,7 @@ pycrypto = 2.6.1
pycurl = 7.43.0
slapos.recipe.download = 1.0
slapos.recipe.template = 4.3
slapos.toolbox = 0.74
slapos.toolbox = 0.76
smmap = 0.9.0
# Required by:
......
......@@ -55,7 +55,7 @@ md5sum = d98a01182f38868612948c87d5231428
[template-default-slave-virtualhost]
filename = templates/default-virtualhost.conf.in
md5sum = 5344bff68a3f7dead633a35771ad1a19
md5sum = 7f38084af107034bedefba971abe165c
[template-cached-slave-virtualhost]
filename = templates/cached-virtualhost.conf.in
......
......@@ -11,7 +11,7 @@ plone.recipe.command = 1.1
pycrypto = 2.6.1
rdiff-backup = 1.0.5+SlapOSPatched001
slapos.recipe.template = 4.3
slapos.toolbox = 0.74
slapos.toolbox = 0.76
smmap = 0.9.0
numpy = 1.11.2
pyasn1 = 0.2.3
......
......@@ -69,7 +69,7 @@ def main():
test_title = args.test_suite_title or args.test_suite
if args.master_url: