some more zope2 service improvements

This commit is contained in:
Rok Garbas 2013-10-04 00:24:18 +02:00
parent 4ff36cb137
commit 7b6e26b380

View File

@ -136,21 +136,17 @@ if _interactive:
''; '';
env = pkgs.buildEnv { env = pkgs.buildEnv {
name = "zope2-${name}-env"; name = "zope2-${name}-env";
paths = [ pyenv pkgs.gnumake ];
postBuild =
''
echo "#!$out/bin/python" > $out/bin/interpreter
cat ${interpreter} >> $out/bin/interpreter
'';
};
pyenv = pkgs.buildEnv {
name = "zope2-${name}-pyenv";
paths = [ paths = [
pkgs.python27 pkgs.python27
pkgs.python27Packages.recursivePthLoader pkgs.python27Packages.recursivePthLoader
pkgs.python27Packages."plone.recipe.zope2instance" pkgs.python27Packages."plone.recipe.zope2instance"
] ++ attrValues pkgs.python27.modules ] ++ attrValues pkgs.python27.modules
++ opts.packages; ++ opts.packages;
postBuild =
''
echo "#!$out/bin/python" > $out/bin/interpreter
cat ${interpreter} >> $out/bin/interpreter
'';
}; };
conf = pkgs.writeText "zope2-${name}-conf" conf = pkgs.writeText "zope2-${name}-conf"
''%define INSTANCEHOME ${env} ''%define INSTANCEHOME ${env}
@ -204,7 +200,7 @@ container-class Products.TemporaryFolder.TemporaryContainer
${opts.extra} ${opts.extra}
''; '';
ctl = pkgs.writeScript "zope2-${name}-ctl" ctlScript = pkgs.writeScript "zope2-${name}-ctl-script"
''#!${env}/bin/python ''#!${env}/bin/python
import sys import sys
@ -213,7 +209,14 @@ import plone.recipe.zope2instance.ctl
if __name__ == '__main__': if __name__ == '__main__':
sys.exit(plone.recipe.zope2instance.ctl.main( sys.exit(plone.recipe.zope2instance.ctl.main(
["-C", "${conf}"] ["-C", "${conf}"]
+ sys.argv[1:]))''; + sys.argv[1:]))
'';
ctl = pkgs.writeScript "zope2-${name}-ctl"
''#!${pkgs.bash}/bin/bash -e
export PYTHONHOME=${env}
exec ${ctlScript} "$@"
'';
in { in {
description = "zope2 ${name} instance"; description = "zope2 ${name} instance";
after = [ "network.target" ]; # with RelStorage also add "postgresql.service" after = [ "network.target" ]; # with RelStorage also add "postgresql.service"