File openstack-dashboard.spec of Package openstack-dashboard

#
# spec file for package openstack-dashboard
#
# Copyright (c) 2014 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

%define version_unconverted 2014.2.4.dev17

Name:           openstack-dashboard
Version:        2014.2.4.juno
Release:        0
Summary:        OpenStack Dashboard (Horizon)
License:        Apache-2.0
Group:          Development/Languages/Python
Url:            http://wiki.openstack.org/OpenStackDashboard
Source:         http://tarballs.openstack.org/horizon/horizon-stable-juno.tar.gz
# Apache2 example configuration:
Source2:        openstack-dashboard.conf.sample
Patch2:         0001-Reorder-template-loader.patch
Patch3:         0001_honor_keystone_policy_file_when_creating_client.patch
Patch4:         0001_remove_admin_role_name_admin_hardcode.patch
Patch5:         0001_enhance_policy_rules_to_workflow_actions.patch
Patch6:         0002_enhance_policy_rules_to_workflow_actions_identity_project.patch
Patch7:         0001_add_admin_policy_in_router_dashboard.patch
Patch8:         0001-Adds-deactivated-status-for-glance-image.patch
Patch9:         0001_reset_flavors_for_other_than_boot_from_image_source_type.patch
Patch10:        0002_reset_flavors_for_other_than_boot_from_image_source_type.patch
BuildRequires:  apache2
BuildRequires:  fdupes
BuildRequires:  openstack-suse-macros
BuildRequires:  python-devel
BuildRequires:  python-pbr >= 0.5
BuildRequires:  python-Django >= 1.4.2
# Now BuildRequires to be able to import the local_settings.py for collectstatic
BuildRequires:  python-XStatic
BuildRequires:  python-XStatic-Angular
BuildRequires:  python-XStatic-Angular-Cookies
BuildRequires:  python-XStatic-Angular-Mock
BuildRequires:  python-XStatic-Bootstrap-Datepicker
BuildRequires:  python-XStatic-Bootstrap-SCSS
BuildRequires:  python-XStatic-D3
BuildRequires:  python-XStatic-Font-Awesome
BuildRequires:  python-XStatic-Hogan
BuildRequires:  python-XStatic-JQuery-Migrate
BuildRequires:  python-XStatic-JQuery.TableSorter
BuildRequires:  python-XStatic-JQuery.quicksearch
BuildRequires:  python-XStatic-JSEncrypt
BuildRequires:  python-XStatic-Jasmine
BuildRequires:  python-XStatic-QUnit
BuildRequires:  python-XStatic-Rickshaw
BuildRequires:  python-XStatic-Spin
BuildRequires:  python-XStatic-jQuery
BuildRequires:  python-XStatic-jquery-ui
BuildRequires:  python-cinderclient
BuildRequires:  python-glanceclient
BuildRequires:  python-heatclient
BuildRequires:  python-neutronclient
BuildRequires:  python-novaclient
BuildRequires:  python-saharaclient
BuildRequires:  python-swiftclient
BuildRequires:  python-troveclient
BuildRequires:  python-keystoneclient
BuildRequires:  python-lockfile
BuildRequires:  python-django_openstack_auth
BuildRequires:  python-django_compressor
BuildRequires:  python-django-pyscss
Requires:       apache2
Requires:       apache2-mod_wsgi
Requires:       python >= 2.6.8
Requires:       python-horizon = %{version}
Recommends:     openstack-novncproxy
Provides:       %{name} = 2014.2
# Can't hurt to also provide openstack-horizon:
Provides:       openstack-%{component} = %{version}
# Provide removed packages
Provides:       openstack-dashboard-branding-upstream = 2015.1
Provides:       python-horizon-branding-upstream = 2015.1
Obsoletes:      openstack-dashboard-branding-upstream <= 2015.1
Obsoletes:      python-horizon-branding-upstream <= 2015.1
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
Provides:       openstack-dashboard-config = %{version}
Obsoletes:      openstack-dashboard-config < %{version}
%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
Requires:       python-Django >= 1.4.2
Requires:       python-XStatic >= 1.0.0
Requires:       python-XStatic-Angular >= 1.2.1.1
Requires:       python-XStatic-Angular-Cookies >= 1.2.1.1
Requires:       python-XStatic-Angular-Mock >= 1.2.1.1
Requires:       python-XStatic-Bootstrap-Datepicker >= 1.3.1.0
Requires:       python-XStatic-Bootstrap-SCSS >= 3
Requires:       python-XStatic-D3 >= 3.1.6.2
Requires:       python-XStatic-Font-Awesome >= 4.1.0
Requires:       python-XStatic-Hogan >= 2.0.0.2
Requires:       python-XStatic-JQuery-Migrate >= 1.2.1.1
Requires:       python-XStatic-JQuery.TableSorter >= 2.0.5b.0
Requires:       python-XStatic-JQuery.quicksearch >= 2.0.3.1
Requires:       python-XStatic-JSEncrypt >= 2.0.0.2
Requires:       python-XStatic-Jasmine >= 1.3.1.1
Requires:       python-XStatic-QUnit >= 1.14.0.2
Requires:       python-XStatic-Rickshaw >= 1.5.0
Requires:       python-XStatic-Spin >= 1.2.5.2
Requires:       python-XStatic-jQuery >= 1.7.2
Requires:       python-XStatic-jquery-ui >= 1.10.1
Requires:       python-ceilometerclient >= 1.0.6
Requires:       python-cinderclient >= 1.1.0
Requires:       python-django-pyscss >= 1.0.3
Requires:       python-django_compressor >= 1.4
Requires:       python-django_openstack_auth >= 1.1.7
Requires:       python-eventlet >= 0.15.1
Requires:       python-glanceclient >= 0.14.0
Requires:       python-heatclient >= 0.2.9
Requires:       python-httplib2 >= 0.7.5
Requires:       python-iso8601 >= 0.1.9
Requires:       python-keystoneclient >= 0.10.0
Requires:       python-kombu >= 2.5.0
Requires:       python-lockfile >= 0.8
Requires:       python-netaddr >= 0.7.12
Requires:       python-neutronclient >= 2.3.6
Requires:       python-novaclient >= 2.18.0
Requires:       python-pbr >= 0.6
Requires:       python-pyScss >= 1.2.1
Requires:       python-pytz
Requires:       python-saharaclient >= 0.7.3
Requires:       python-six >= 1.7.0
Requires:       python-swiftclient >= 2.2.0
Requires:       python-troveclient >= 1.0.4

%description -n python-horizon
The Python module horizon is the core component of the OpenStack
dashboard.

%package test
Summary:        OpenStack Dashboard (Horizon) - Testsuite
Group:          Development/Languages/Python
Requires:       %{name} = %{version}
Requires:       python-django-nose
Requires:       python-mox >= 0.5.3
Requires:       python-netaddr >= 0.7.12
Requires:       python-nose
Requires:       python-nose-exclude
Requires:       python-nosehtmloutput >= 0.0.3
Requires:       python-nosexcover
Requires:       python-openstack.nose_plugin >= 0.7
# python-selenium is not available by default, but we can try to drag it in
Recommends:     python-selenium
Requires:       python-testtools >= 0.9.34

%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_unconverted}
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%openstack_cleanup_prep

%build
python setup.py build

%install
python setup.py install --prefix=%{_prefix} --root=%{buildroot}

# compile mo files from po files
if [ -e /usr/bin/django-admin ]; then
    ADMINCMD=/usr/bin/django-admin
else
    ADMINCMD=/usr/bin/django-admin.py
fi
(cd %{buildroot}%{python_sitelib}/horizon && $ADMINCMD compilemessages)
(cd %{buildroot}%{python_sitelib}/openstack_dashboard && $ADMINCMD compilemessages)

# Remove po files
find %{buildroot}%{python_sitelib}/horizon/locale %{buildroot}%{python_sitelib}/openstack_dashboard/locale -name "*.po" -delete -print

# Move openstack_dashboard files
install -d -m 755 %{buildroot}/srv/www/openstack-dashboard
mv %{buildroot}%{python_sitelib}/openstack_dashboard/ %{buildroot}/srv/www/openstack-dashboard/
cp -a manage.py %{buildroot}/srv/www/openstack-dashboard/

# Create a local_settings.py
mv %{buildroot}/srv/www/openstack-dashboard/openstack_dashboard/local/local_settings.py{.example,}

# create root and collect static files
install -m 0755 -d %{buildroot}/srv/www/openstack-dashboard/static
install -m 0755 -d %{buildroot}/srv/www/openstack-dashboard/media
(cd %{buildroot}/srv/www/openstack-dashboard/ && PYTHONPATH=%{buildroot}%{python_sitelib} python manage.py collectstatic --noinput )
# cleanup after manage.py run
rm %{buildroot}/srv/www/openstack-dashboard/openstack_dashboard/local/local_settings.pyc
rm %{buildroot}/srv/www/openstack-dashboard/openstack_dashboard/local/.secret_key_store

# Remove duplicate files
%if 0%{?suse_version}
%fdupes %{buildroot}%{python_sitelib}
%fdupes %{buildroot}/srv/www/openstack-dashboard
%endif

# generate language file and split
%find_lang django
cat django.lang
grep "\/openstack_dashboard\/locale\/" django.lang > dashboard.lang
grep "\/horizon\/locale\/" django.lang > horizon.lang

# Apache2 SSL certificate stubs (generated in %%post):
%openstack_apache_ssl_cert_install
# Apache2 sample configuration:
install -d %{buildroot}%{_sysconfdir}/apache2/conf.d
install -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/apache2/conf.d/openstack-dashboard.conf.sample

### test subpackage
%openstack_test_package_install

%post
%openstack_apache_ssl_cert_post


%files -f dashboard.lang
%defattr(-,root,root)
%doc README.rst LICENSE
%dir /srv/www/openstack-dashboard
/srv/www/openstack-dashboard/manage.py
%dir /srv/www/openstack-dashboard/openstack_dashboard
%dir %attr(0750, wwwrun, www) /srv/www/openstack-dashboard/openstack_dashboard/local
%attr(0640, wwwrun, www) /srv/www/openstack-dashboard/openstack_dashboard/local/__init__.py*
%config(noreplace) %attr(0640, wwwrun, www) /srv/www/openstack-dashboard/openstack_dashboard/local/local_settings.py
%attr(0770, root, www) /srv/www/openstack-dashboard/static/
%attr(0770, root, www) /srv/www/openstack-dashboard/media/
/srv/www/openstack-dashboard/openstack_dashboard/api/
/srv/www/openstack-dashboard/openstack_dashboard/local/enabled/
/srv/www/openstack-dashboard/openstack_dashboard/static/
/srv/www/openstack-dashboard/openstack_dashboard/dashboards/
/srv/www/openstack-dashboard/openstack_dashboard/management/
/srv/www/openstack-dashboard/openstack_dashboard/openstack/
/srv/www/openstack-dashboard/openstack_dashboard/templatetags/
/srv/www/openstack-dashboard/openstack_dashboard/templates/
/srv/www/openstack-dashboard/openstack_dashboard/utils/
/srv/www/openstack-dashboard/openstack_dashboard/test/
%exclude /srv/www/openstack-dashboard/openstack_dashboard/test/tests
/srv/www/openstack-dashboard/openstack_dashboard/usage/
/srv/www/openstack-dashboard/openstack_dashboard/django_pyscss_fix
/srv/www/openstack-dashboard/openstack_dashboard/enabled/
/srv/www/openstack-dashboard/openstack_dashboard/wsgi/
/srv/www/openstack-dashboard/openstack_dashboard/conf/
/srv/www/openstack-dashboard/openstack_dashboard/*.py*


%dir /srv/www/openstack-dashboard/openstack_dashboard/locale
%dir /srv/www/openstack-dashboard/openstack_dashboard/locale/*
%dir /srv/www/openstack-dashboard/openstack_dashboard/locale/*/LC_MESSAGES


%openstack_apache_ssl_cert_files
%{_sysconfdir}/apache2/conf.d/openstack-dashboard.conf.sample


%files -n python-horizon -f horizon.lang
%defattr(-,root,root)
%{python_sitelib}/horizon/
%exclude %{python_sitelib}/horizon/conf/*/static
%exclude %{python_sitelib}/horizon/conf/*/templates
%exclude %{python_sitelib}/horizon/test/tests
%exclude %{python_sitelib}/horizon/locale
%{python_sitelib}/horizon-*.egg-info

%files test
%defattr(-,root,root)
%{_localstatedir}/lib/%{name}-test/
%{python_sitelib}/horizon/test/tests

%changelog
openSUSE Build Service is sponsored by