See if we can get trove to package itself.

Change-Id: I653fcee0725896d588115db354cd69ca4ab2b342
This commit is contained in:
Joshua Harlow 2013-08-02 17:12:33 -07:00
parent 3bd140827f
commit 0a5989ec80
7 changed files with 284 additions and 4 deletions

View File

@ -28,6 +28,9 @@ from anvil import utils
LOG = logging.getLogger(__name__)
# TODO(harlowja): get rid of static lists in code files for these names
# which we should be able to take in via configuration or other automatic
# process
OPENSTACK_PACKAGES = set([
"cinder",
"glance",
@ -35,15 +38,18 @@ OPENSTACK_PACKAGES = set([
"keystone",
"nova",
"oslo.config",
"quantum",
"swift",
"python-cinderclient",
"python-glanceclient",
"python-keystoneclient",
"python-novaclient",
"python-neutronclient",
"python-novaclient",
"python-swiftclient",
"python-troveclient",
"quantum",
"swift",
"trove",
])
SKIP_PACKAGE_NAMES = []
class InstallHelper(object):
@ -208,6 +214,7 @@ class DependencyHandler(object):
cmdline = cmdline + extra_pips + ["-r"] + requires_files
cmdline.extend(["--ignore-package"])
cmdline.extend(OPENSTACK_PACKAGES)
cmdline.extend(SKIP_PACKAGE_NAMES)
cmdline.extend(self.python_names)
output = sh.execute(cmdline, check_exit_code=False)

View File

@ -62,6 +62,8 @@ class YumInstallHelper(base.InstallHelper):
class YumDependencyHandler(base.DependencyHandler):
OPENSTACK_EPOCH = 2
SPEC_TEMPLATE_DIR = "packaging/specs"
# TODO(harlowja): get rid of these static lists/mappings from code and move
# them to configuration (or elsewhere).
API_NAMES = {
"nova": "Compute",
"glance": "Image",
@ -69,7 +71,7 @@ class YumDependencyHandler(base.DependencyHandler):
"cinder": "Volume",
"quantum": "Networking",
}
SERVER_NAMES = ["nova", "glance", "keystone", "quantum", "cinder"]
SERVER_NAMES = ["nova", "glance", "keystone", "quantum", "cinder", "trove"]
TRANSLATION_NAMES = {
'horizon': "python-django-horizon",
}

View File

@ -0,0 +1,7 @@
# Settings for component trove-client
---
# Where we download this from...
get_from: "git://github.com/openstack/python-troveclient.git?branch=master"
...

View File

@ -0,0 +1,7 @@
# Settings for component trove
---
# Where we download this from...
get_from: "git://github.com/openstack/trove.git?branch=master"
...

View File

@ -313,6 +313,20 @@ components:
test: anvil.components.base_testing:PythonTestingComponent
coverage: anvil.components.base_testing:PythonTestingComponent
uninstall: anvil.components.base_install:PkgUninstallComponent
trove:
action_classes:
install: anvil.components.base_install:PythonInstallComponent
running: anvil.components.base_runtime:EmptyRuntime
test: anvil.components.base_testing:PythonTestingComponent
coverage: anvil.components.base_testing:PythonTestingComponent
uninstall: anvil.components.base_install:PkgUninstallComponent
trove-client:
action_classes:
install: anvil.components.base_install:PythonInstallComponent
running: anvil.components.base_runtime:EmptyRuntime
test: anvil.components.base_testing:PythonTestingComponent
coverage: anvil.components.base_testing:PythonTestingComponent
uninstall: anvil.components.base_install:PkgUninstallComponent
openvswitch:
action_classes:
install: anvil.components.base_install:PkgInstallComponent

View File

@ -0,0 +1,57 @@
---
components:
# Order matters here!
- general
- db
- rabbit-mq
- oslo-config
- keystone
# Client used by many components
- keystone-client
- glance
- cinder
# Clients used by nova (+ others)
- glance-client
- cinder-client
- neutron-client
- nova
- nova-client
- trove
- trove-client
options:
nova:
db-sync: true
do-network-init: true
mq-type: "rabbit"
enable-cells: false
enable-spice: false
local-conductor: false
glance:
db-sync: true
load-images: true
keystone:
db-sync: true
do-init: true
enable-pki: false
cinder:
db-sync: true
subsystems:
glance:
- api
- registry
keystone:
- all
nova:
- api
- cert
- compute
- conductor
- network
- scheduler
cinder:
- api
- scheduler
- volume
supports:
- rhel
...

View File

@ -0,0 +1,186 @@
#encoding UTF-8
# Based on spec by:
# * Andrey Brindeyev <abrindeyev@griddynamics.com>
# * Alessio Ababilov <aababilov@griddynamics.com>
%global python_name trove
%global daemon_prefix openstack-trove
%global os_version $version
%if ! (0%{?fedora} > 12 || 0%{?rhel} > 5)
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
%endif
Name: openstack-trove
Epoch: $epoch
Version: %{os_version}$version_suffix
Release: $release%{?dist}
Url: http://www.openstack.org
Summary: Database as a Service
License: Apache 2.0
Vendor: Openstack Foundation
Group: Applications/System
Source0: %{python_name}-%{os_version}.tar.gz
Source1: openstack-trove-server.init
Source2: openstack-trove-api.init
#for $idx, $fn in enumerate($patches)
Patch$idx: $fn
#end for
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}
BuildArch: noarch
BuildRequires: python-devel
BuildRequires: python-setuptools
%if ! 0%{?usr_only}
Requires(post): chkconfig
Requires(postun): initscripts
Requires(preun): chkconfig
Requires(pre): shadow-utils
%endif
Requires: python-trove = %{epoch}:%{version}-%{release}
%description
Trove is Database as a Service for OpenStack.
This package contains the Trove daemon.
%if 0%{?with_doc}
%package doc
Summary: Documentation for %{name}
Group: Documentation
Requires: %{name} = %{epoch}:%{version}-%{release}
%description doc
Trove is Database as a Service for OpenStack.
This package contains documentation for Trove.
%endif
%package -n python-trove
Summary: Trove Python libraries
Group: Development/Languages/Python
#for $i in $requires
Requires: ${i}
#end for
%description -n python-trove
Trove is Database as a Service for OpenStack.
This package contains the Trove Python library.
%prep
%setup -q -n %{python_name}-%{os_version}
#for $idx, $fn in enumerate($patches)
%patch$idx -p1
#end for
#raw
%build
python setup.py build
%install
%__rm -rf %{buildroot}
%if 0%{?with_doc}
export PYTHONPATH="$PWD:$PYTHONPATH"
pushd doc
sphinx-build -b html source build/html
popd
# Fix hidden-file-or-dir warnings
rm -fr doc/build/html/.doctrees doc/build/html/.buildinfo
%endif
python setup.py install --prefix=%{_prefix} --root=%{buildroot}
%if ! 0%{?usr_only}
# Install config files
install -d -m 755 %{buildroot}%{_sysconfdir}/trove
install -p -D -m 640 etc/trove/api-paste.ini %{buildroot}%{_sysconfdir}/trove/
install -p -D -m 640 etc/trove/trove.conf.sample %{buildroot}%{_sysconfdir}/trove/
install -p -D -m 640 etc/trove/trove-guestagent.conf.sample %{buildroot}%{_sysconfdir}/trove/
install -p -D -m 640 etc/trove/trove-taskmanager.conf.sample %{buildroot}%{_sysconfdir}/trove/
install -d -m 755 %{buildroot}%{_sharedstatedir}/trove
install -d -m 755 %{buildroot}%{_localstatedir}/log/trove
install -d -m 755 %{buildroot}%{_localstatedir}/run/trove
# Initscripts
install -p -D -m 755 %{SOURCE1} %{buildroot}%{_initrddir}/%{daemon_prefix}-api
install -p -D -m 755 %{SOURCE1} %{buildroot}%{_initrddir}/%{daemon_prefix}-server
%endif
%__rm -rf %{buildroot}%{py_sitelib}/{doc,tools}
%clean
%__rm -rf %{buildroot}
%if ! 0%{?usr_only}
%pre
getent group trove >/dev/null || groupadd -r trove
getent passwd trove >/dev/null || \
useradd -r -g trove -d %{_sharedstatedir}/trove -s /sbin/nologin \
-c "OpenStack Trove Daemons" trove
exit 0
%preun
if [ $1 = 0 ] ; then
/sbin/service %{daemon_prefix}-api stop &>/dev/null
/sbin/chkconfig --del %{daemon_prefix}-api
/sbin/service %{daemon_prefix}-server stop &>/dev/null
/sbin/chkconfig --del %{daemon_prefix}-server
exit 0
fi
%postun
if [ $1 -ge 1 ] ; then
# Package upgrade, not uninstall
/sbin/service %{daemon_prefix}-api condrestart &>/dev/null
/sbin/service %{daemon_prefix}-server condrestart &>/dev/null
exit 0
fi
%endif
%files
%defattr(-,root,root,-)
%doc README* LICENSE* ChangeLog AUTHORS
%{_usr}/bin/*
%if ! 0%{?usr_only}
%config(noreplace) %{_sysconfdir}/trove
%dir %attr(0755, trove, nobody) %{_sharedstatedir}/trove
%dir %attr(0755, trove, nobody) %{_localstatedir}/log/trove
%dir %attr(0755, trove, nobody) %{_localstatedir}/run/trove
%{_initrddir}/*
%endif
%if 0%{?with_doc}
%files doc
%defattr(-,root,root,-)
%doc doc
%endif
%files -n python-trove
%defattr(-,root,root,-)
%doc LICENSE
%{python_sitelib}/*
%changelog
#endraw