2011-06-09 19:06:30 +02:00
|
|
|
{ stdenv, fetchurl, pythonPackages, intltool, libvirt, libxml2Python, curl, novaclient }:
|
2011-03-29 18:15:08 +02:00
|
|
|
|
|
|
|
with stdenv.lib;
|
2011-02-21 22:53:42 +01:00
|
|
|
|
2011-06-09 19:06:30 +02:00
|
|
|
let version = "2011.2"; in
|
2011-02-21 22:53:42 +01:00
|
|
|
|
2011-03-29 18:15:08 +02:00
|
|
|
stdenv.mkDerivation rec {
|
2011-03-30 17:00:53 +02:00
|
|
|
name = "nova-${version}";
|
2011-02-21 22:53:42 +01:00
|
|
|
|
|
|
|
src = fetchurl {
|
2011-06-09 19:06:30 +02:00
|
|
|
url = "http://launchpad.net/nova/cactus/${version}/+download/nova-${version}.tar.gz";
|
|
|
|
sha256 = "1s2w0rm332y9x34ngjz8sys9sbldg857rx9d6r3nb1ik979fx8p7";
|
2011-02-21 22:53:42 +01:00
|
|
|
};
|
|
|
|
|
2011-04-01 17:53:37 +02:00
|
|
|
patches =
|
2011-06-09 19:06:30 +02:00
|
|
|
[ ./convert.patch ];
|
2011-04-01 17:53:37 +02:00
|
|
|
|
2011-03-30 14:51:16 +02:00
|
|
|
pythonPath = with pythonPackages;
|
|
|
|
[ setuptools eventlet greenlet gflags netaddr sqlalchemy carrot routes
|
2011-03-30 18:17:25 +02:00
|
|
|
paste_deploy m2crypto ipy boto_1_9 twisted sqlalchemy_migrate
|
2011-06-09 19:06:30 +02:00
|
|
|
distutils_extra simplejson readline glance cheetah lockfile httplib2
|
2011-03-30 19:04:27 +02:00
|
|
|
# !!! should libvirt be a build-time dependency? Note that
|
|
|
|
# libxml2Python is a dependency of libvirt.py.
|
2011-06-09 19:06:30 +02:00
|
|
|
libvirt libxml2Python
|
|
|
|
novaclient
|
2011-02-21 22:53:42 +01:00
|
|
|
];
|
|
|
|
|
2011-03-29 18:15:08 +02:00
|
|
|
buildInputs =
|
|
|
|
[ pythonPackages.python
|
|
|
|
pythonPackages.wrapPython
|
2011-03-30 19:04:27 +02:00
|
|
|
pythonPackages.mox
|
2011-03-30 14:51:16 +02:00
|
|
|
intltool
|
2011-03-29 18:15:08 +02:00
|
|
|
] ++ pythonPath;
|
|
|
|
|
2011-03-30 19:04:27 +02:00
|
|
|
PYTHON_EGG_CACHE = "`pwd`/.egg-cache";
|
|
|
|
|
2011-03-30 16:57:51 +02:00
|
|
|
preConfigure =
|
|
|
|
''
|
|
|
|
# Set the built-in state location to something sensible.
|
|
|
|
sed -i nova/flags.py \
|
|
|
|
-e "/DEFINE.*'state_path'/ s|../|/var/lib/nova|"
|
2011-03-31 15:21:07 +02:00
|
|
|
|
|
|
|
substituteInPlace nova/virt/images.py --replace /usr/bin/curl ${curl}/bin/curl
|
2011-04-07 11:58:46 +02:00
|
|
|
|
|
|
|
substituteInPlace nova/api/ec2/cloud.py \
|
|
|
|
--replace 'sh genrootca.sh' $out/libexec/nova/genrootca.sh
|
2011-03-30 16:57:51 +02:00
|
|
|
'';
|
2011-02-21 22:53:42 +01:00
|
|
|
|
|
|
|
buildPhase = "python setup.py build";
|
|
|
|
|
|
|
|
installPhase =
|
2011-03-30 14:51:16 +02:00
|
|
|
''
|
2011-02-21 22:53:42 +01:00
|
|
|
p=$(toPythonPath $out)
|
|
|
|
export PYTHONPATH=$p:$PYTHONPATH
|
|
|
|
mkdir -p $p
|
|
|
|
python setup.py install --prefix=$out
|
2011-03-29 18:15:08 +02:00
|
|
|
|
2011-03-30 14:51:16 +02:00
|
|
|
# Nova doesn't like to be called ".nova-foo-wrapped" because it
|
2011-04-06 17:08:36 +02:00
|
|
|
# computes some stuff from its own argv[0]. So put the wrapped
|
|
|
|
# programs in $out/libexec under their original names.
|
|
|
|
mkdir -p $out/libexec/nova
|
|
|
|
|
2011-03-30 14:51:16 +02:00
|
|
|
wrapProgram() {
|
|
|
|
local prog="$1"
|
2011-04-06 17:08:36 +02:00
|
|
|
local hidden=$out/libexec/nova/$(basename "$prog")
|
2011-03-30 14:51:16 +02:00
|
|
|
mv $prog $hidden
|
|
|
|
makeWrapper $hidden $prog "$@"
|
|
|
|
}
|
|
|
|
|
2011-03-29 18:15:08 +02:00
|
|
|
wrapPythonPrograms
|
2011-03-30 18:17:25 +02:00
|
|
|
|
2011-06-09 19:06:30 +02:00
|
|
|
cp -prvd etc $out/etc
|
2011-03-31 15:21:07 +02:00
|
|
|
|
|
|
|
# Nova makes some weird assumptions about where to find its own
|
|
|
|
# programs relative to the Python directory.
|
|
|
|
ln -sfn $out/bin $out/lib/${pythonPackages.python.libPrefix}/site-packages/bin
|
2011-04-07 11:58:46 +02:00
|
|
|
|
|
|
|
# Install the certificate generation script.
|
2011-06-09 19:06:30 +02:00
|
|
|
cp nova/CA/genrootca.sh $out/libexec/nova/
|
|
|
|
cp nova/CA/openssl.cnf.tmpl $out/libexec/nova/
|
2011-06-20 16:26:49 +02:00
|
|
|
|
|
|
|
# Allow nova-manage etc. to find the proper configuration file.
|
|
|
|
ln -s /etc/nova/nova.conf $out/libexec/nova/nova.conf
|
2011-02-21 22:53:42 +01:00
|
|
|
'';
|
|
|
|
|
2011-03-30 19:04:27 +02:00
|
|
|
doCheck = false; # !!! fix
|
|
|
|
|
|
|
|
checkPhase = "python setup.py test";
|
|
|
|
|
2011-02-21 22:53:42 +01:00
|
|
|
meta = {
|
|
|
|
homepage = http://nova.openstack.org/;
|
|
|
|
description = "OpenStack Compute (a.k.a. Nova), a cloud computing fabric controller";
|
|
|
|
};
|
|
|
|
}
|