File openstack-dashboard.spec of Package openstack-dashboard
#
# spec file for package openstack-dashboard
#
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
%define component horizon
Name: openstack-dashboard
Version: 2012.1+git.1346336140.35eada8
Release: 0
Summary: OpenStack Dashboard (Horizon)
License: Apache-2.0
Group: Development/Languages/Python
Url: http://wiki.openstack.org/OpenStackDashboard
Source: %{component}-%{version}.tar.gz
Source1: green.tar.gz
# Apache2 example configuration:
Source2: openstack-dashboard.conf.sample
Patch0: suse-patches.diff
Patch2: backports.patch
# PATCH-FIX-UPSTREAM: Backport of https://review.openstack.org/#/c/8799
Patch3: horizon-secure_SECRET_KEY.patch
# PATCH-FIX-OPENSUSE: Backport of several SSL-related fixes
Patch4: horizon-ssl.patch
# backport https://review.openstack.org/#/c/5204/7/horizon/tests/testsettings.py,unified
Patch5: horizon-minimumpwlen.patch
Patch7: vnc-iframe-size.patch
# PATCH-FIX-UPSTREAM horizon-keep-image-properties.patch bnc#777855 vuntz@suse.com -- Do not lose properties when editing an image, cherry-picked from Folsom
Patch9: horizon-keep-image-properties.patch
# PATCH-FIX-OPENSUSE: SUSE Cloud branding
Patch10: horizon-suse-branding.patch
# PATCH-FIX-UPSTREAM horizon-launch-from-volume-.patch bnc#780982 saschpe@susee.de -- Launch from volume with valid volume size
Patch11: horizon-launch-from-volume.patch
BuildRequires: apache2
BuildRequires: fdupes
BuildRequires: python-devel
BuildRequires: python-setuptools
Requires: apache2
Requires: apache2-mod_wsgi
# temporary requires - there will (most likely) be patterns with and without the config subpackage
Requires: openstack-dashboard-config = %{version}
Requires: python >= 2.6.8
Requires: python-cloudfiles
Requires: python-dateutil
Requires: python-django >= 1.4
Requires: python-glance
Requires: python-horizon = %{version}
Requires: python-keystoneclient
# For secure SECRET_KEY generation:
Requires: python-lockfile
Requires: python-novaclient
Recommends: openstack-novncproxy
# Can't hurt to also provide openstack-horizon:
Provides: openstack-%{component} = %{version}
BuildRoot: %{_tmppath}/%{name}-%{version}-build
# To generate a self-signed certificate to be used in demo setups:
Requires(post): apache2-utils
Requires(post): openssl
Requires(post): sysconfig
%if 0%{?suse_version} && 0%{?suse_version} <= 1110
%{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
%else
BuildArch: noarch
%endif
%description
The OpenStack dashboard provides administrators and users a graphical
interface to access, provision and automate cloud-based resources. The
extensible design makes it easy to plug in and expose third party
products and services, such as billing, monitoring and additional
management tools.
The dashboard is just one way to interact with OpenStack resources.
Developers can automate access or build tools to manage their resources
using the native OpenStack API or the EC2 compatibility API.
%package -n python-horizon
Summary: OpenStack Dashboard (Horizon) - Python module
Group: Development/Languages/Python
#TODO/FIXME: This shouldn't be needed:
#Requires: %%{name} = %%{version}
%description -n python-horizon
The Python module horizon is the core component of the OpenStack
dashboard.
%package config
Summary: OpenStack Dashboard (Horizon) - Default configuration
Group: Development/Languages/Python
Requires: %{name} = %{version}
%description config
A default configuration for the OpenStack dashboard. It is provides
best-practices and recommendations.
%package test
Summary: OpenStack Dashboard (Horizon) - Testsuite
Group: Development/Languages/Python
Requires: %{name} = %{version}
Requires: python-coverage
Requires: python-django-nose
Requires: python-django-nose-selenium
# Disabled: the selenium tests are not run by default, and pushing selenium to
# Factory would require too much time for now. We might need to patch the
# source to kill the selenium-related import later, though.
#Requires: python-selenium
%description test
The OpenStack dashboard testsuite. It is used to verify the
functionality of the OpenStack dashboard and its components.
%prep
%setup -q -n %{component}-%{version}
tar xf %{SOURCE1} ; cp -a green/* openstack_dashboard/static/dashboard/
%patch0 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch7
%patch9 -p1
%patch10 -p1
%patch11 -p1
# Fix non-executable script rpmlint warning:
sed -i "/\#\!\/bin\/bash/d" horizon/dashboards/settings/templates/settings/{ec2/ec2rc.sh,project/openrc.sh}.template
%build
python setup.py build
%install
install -d -m 755 %{buildroot}%{_localstatedir}/lib/openstack-dashboard
install -d -m 755 %{buildroot}%{_localstatedir}/lib/openstack-dashboard/openstack_dashboard
install -d -m 755 %{buildroot}%{_localstatedir}/lib/openstack-dashboard/horizon
# test subpackage
install -d -m 755 %{buildroot}%{_localstatedir}/lib/openstack-dashboard-test
cp -av .pylintrc * %{buildroot}%{_localstatedir}/lib/openstack-dashboard-test
find %{buildroot}%{_localstatedir}/lib/openstack-dashboard-test -name ".gitignore" | xargs rm -f
rm -rf %{buildroot}%{_localstatedir}/lib/openstack-dashboard-test/horizon
rm -rf %{buildroot}%{_localstatedir}/lib/openstack-dashboard-test/openstack_dashboard
ln -s %{python_sitelib}/horizon %{buildroot}%{_localstatedir}/lib/openstack-dashboard-test/horizon
ln -s %{python_sitelib}/openstack_dashboard %{buildroot}%{_localstatedir}/lib/openstack-dashboard-test/openstack_dashboard
python setup.py install --prefix=%{_prefix} --root=%{buildroot} --record-rpm=INSTALLED_FILES_ALL
cp -av manage.py %{buildroot}%{_localstatedir}/lib/openstack-dashboard/
pushd openstack_dashboard
cp -av local static wsgi %{buildroot}%{_localstatedir}/lib/openstack-dashboard/openstack_dashboard
cp -av templates %{buildroot}%{python_sitelib}/openstack_dashboard/
popd
pushd horizon
cp -av static locale %{buildroot}%{_localstatedir}/lib/openstack-dashboard/horizon
popd
mv %{buildroot}%{_localstatedir}/lib/openstack-dashboard/openstack_dashboard/local/local_settings.py.example %{buildroot}%{_localstatedir}/lib/openstack-dashboard/openstack_dashboard/local/local_settings.py
cat <<EOF >> %{buildroot}%{_localstatedir}/lib/openstack-dashboard/openstack_dashboard/local/local_settings.py
SESSION_ENGINE = 'django.contrib.sessions.backends.cached_db'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(LOCAL_PATH, 'dashboard_openstack.sqlite3'),
'TEST_NAME': os.path.join(LOCAL_PATH, 'test.sqlite3'),
},
}
# Use HttpOnly CSRF cookie:
CSRF_COOKIE_HTTPONLY = True
# SUSE Branding (currently only used in HTML <title> tags):
SITE_BRANDING = 'SUSE Cloud'
EOF
# Use secure SECRET_KEY generation for local_settings.py (bnc#755607):
sed -i -e "s|\# \(from horizon\.utils import secret_key\)|\1|" \
-e "s|\# \(SECRET_KEY = .*\)|\1|" %{buildroot}%{_localstatedir}/lib/openstack-dashboard/openstack_dashboard/local/local_settings.py
(cd %{buildroot}%{_localstatedir}/lib/openstack-dashboard/openstack_dashboard/static/ ; find -type f | xargs chmod a-x )
# remove local settings file from python module
# this belongs 1. in /var and 2. in the config sub package, see below
rm -rf %{buildroot}%{python_sitelib}/openstack_dashboard/local
# link local settings
ln -s %{_localstatedir}/lib/openstack-dashboard/openstack_dashboard/local %{buildroot}%{python_sitelib}/openstack_dashboard/local
# remove duplicate files
%if 0%{?suse_version}
%fdupes %{buildroot}%{python_sitelib}
%fdupes %{buildroot}%{_localstatedir}/lib/openstack-dashboard
%fdupes %{buildroot}%{_localstatedir}/lib/openstack-dashboard-test
%endif
#remove po files
find %{buildroot}%{_localstatedir}/lib/openstack-dashboard/horizon/locale -name "*.po" | xargs rm -f
# Apache2 SSL certificate stubs (generated in %%post)
install -d %{buildroot}%{_sysconfdir}/apache2/ssl.{crt,csr,key}
install -d %{buildroot}/srv/www/htdocs
touch %{buildroot}%{_sysconfdir}/apache2/ssl.key/openstack-dashboard-{ca,server}.key
touch %{buildroot}%{_sysconfdir}/apache2/ssl.csr/openstack-dashboard-server.csr
touch %{buildroot}%{_sysconfdir}/apache2/ssl.crt/openstack-dashboard-{ca,server}.crt
# Apache2 sample configuration
install -d %{buildroot}%{_sysconfdir}/apache2/conf.d
install -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/apache2/conf.d/openstack-dashboard.conf.sample
#TODO: Maybe move Apache2-related stuff + certs into sub-package?
%post
if [ ! -s %{_sysconfdir}/apache2/ssl.csr/openstack-dashboard-server.csr ] ; then
# Generate a self-signed certificate to be used in non-production Dashboard setups:
(umask 377 ; /usr/bin/gensslcert -C openstack-dashboard -n openstack-dashboard.example.com)
fi
%files
%defattr(-,root,root)
%dir %{_localstatedir}/lib/openstack-dashboard
%dir %{_localstatedir}/lib/openstack-dashboard/openstack_dashboard
%dir %{_localstatedir}/lib/openstack-dashboard/openstack_dashboard/wsgi
%dir %attr(0750, wwwrun, www) %{_localstatedir}/lib/openstack-dashboard/openstack_dashboard/local
%dir %{_localstatedir}/lib/openstack-dashboard/openstack_dashboard/static
%dir %{_localstatedir}/lib/openstack-dashboard/horizon
%dir %{_localstatedir}/lib/openstack-dashboard/horizon/static
%{_localstatedir}/lib/openstack-dashboard/manage.py
%{_localstatedir}/lib/openstack-dashboard/openstack_dashboard/static/*
%{_localstatedir}/lib/openstack-dashboard/horizon/static/*
%{_localstatedir}/lib/openstack-dashboard/openstack_dashboard/wsgi/django.wsgi
# lang files
%dir %{_localstatedir}/lib/openstack-dashboard/horizon/locale
%dir %{_localstatedir}/lib/openstack-dashboard/horizon/locale/*
%dir %{_localstatedir}/lib/openstack-dashboard/horizon/locale/*/LC_MESSAGES
%lang(es) %{_localstatedir}/lib/openstack-dashboard/horizon/locale/es/LC_MESSAGES/django.mo
%lang(fr) %{_localstatedir}/lib/openstack-dashboard/horizon/locale/fr/LC_MESSAGES/django.mo
%lang(ja) %{_localstatedir}/lib/openstack-dashboard/horizon/locale/ja/LC_MESSAGES/django.mo
%lang(pl) %{_localstatedir}/lib/openstack-dashboard/horizon/locale/pl/LC_MESSAGES/django.mo
%lang(pt) %{_localstatedir}/lib/openstack-dashboard/horizon/locale/pt/LC_MESSAGES/django.mo
#%%lang(zh-cn) %%{_localstatedir}/lib/openstack-dashboard/horizon/locale/zh_CN/LC_MESSAGES/django.mo
%lang(zh-tw) %{_localstatedir}/lib/openstack-dashboard/horizon/locale/zh_TW/LC_MESSAGES/django.mo
%ghost %{_sysconfdir}/apache2/ssl.key/openstack-dashboard-*.key
%ghost %{_sysconfdir}/apache2/ssl.csr/openstack-dashboard-server.csr
%ghost %{_sysconfdir}/apache2/ssl.crt/openstack-dashboard-*.crt
%{_sysconfdir}/apache2/conf.d/openstack-dashboard.conf.sample
%files config
%defattr(0750,root,root)
%dir %attr(0750, wwwrun, www) %{_localstatedir}/lib/openstack-dashboard/openstack_dashboard/local
%attr(0640, wwwrun, www) %{_localstatedir}/lib/openstack-dashboard/openstack_dashboard/local/__init__.py
%config(noreplace) %attr(0640, wwwrun, www) %{_localstatedir}/lib/openstack-dashboard/openstack_dashboard/local/local_settings.py
%files -n python-horizon
%defattr(-,root,root)
%{python_sitelib}/*
%files test
%defattr(-,root,root)
%{_localstatedir}/lib/openstack-dashboard-test/
%{_localstatedir}/lib/openstack-dashboard-test/.pylintrc
%changelog