File openstack-dashboard.spec of Package openstack-dashboard

#
# spec file for package openstack-dashboard
#
# Copyright (c) 2019 SUSE LINUX 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 https://bugs.opensuse.org/
#


%define component horizon

%define version_unconverted 14.0.5.dev7

Name:           openstack-dashboard
Version:        14.0.5~dev7
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-rocky.tar.gz
# Apache2 example configuration:
Source2:        openstack-dashboard.conf.sample
Source99:       rpmlintrc
# https://review.openstack.org/#/c/607064/
BuildRequires:  apache2
BuildRequires:  fdupes
BuildRequires:  openstack-suse-macros
BuildRequires:  python-Django1
BuildRequires:  python-devel
BuildRequires:  python-pbr >= 0.6
# Now BuildRequires to be able to import the local_settings.py for collectstatic
BuildRequires:  python-XStatic
BuildRequires:  python-XStatic-Angular
BuildRequires:  python-XStatic-Angular-Bootstrap
BuildRequires:  python-XStatic-Angular-FileUpload
BuildRequires:  python-XStatic-Angular-Gettext
BuildRequires:  python-XStatic-Angular-Schema-Form
BuildRequires:  python-XStatic-Angular-lrdragndrop
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-Rickshaw
BuildRequires:  python-XStatic-Spin
BuildRequires:  python-XStatic-bootswatch
BuildRequires:  python-XStatic-jQuery
BuildRequires:  python-XStatic-jquery-ui
BuildRequires:  python-XStatic-mdi
BuildRequires:  python-XStatic-objectpath
BuildRequires:  python-XStatic-roboto-fontface
BuildRequires:  python-XStatic-smart-table
BuildRequires:  python-XStatic-term.js
BuildRequires:  python-XStatic-tv4
BuildRequires:  python-cinderclient
BuildRequires:  python-django-pyscss
BuildRequires:  python-django_compressor
BuildRequires:  python-glanceclient
BuildRequires:  python-heatclient
BuildRequires:  python-keystoneclient
BuildRequires:  python-neutronclient
BuildRequires:  python-novaclient
BuildRequires:  python-oslo.concurrency
BuildRequires:  python-oslo.policy
BuildRequires:  python-swiftclient
BuildRequires:  python-troveclient
Requires:       apache2
Requires:       apache2-mod_wsgi
Requires:       python >= 2.6.8
Requires:       python-csscompressor
Requires:       python-horizon = %{version}
Requires:       python-openstack_auth = %{version}
Recommends:     openstack-novncproxy
# Can't hurt to also provide openstack-horizon:
Provides:       openstack-%{component} = %{version}
# Provide removed packages
Provides:       openstack-dashboard-branding-upstream = %{version}
Provides:       python-horizon-branding-upstream = %{version}
Obsoletes:      openstack-dashboard-branding-upstream <= %{version}
Obsoletes:      python-horizon-branding-upstream <= %{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
Provides:       openstack-dashboard-config = %{version}
Obsoletes:      openstack-dashboard-config < %{version}
# django_openstack_auth was merged into openstack/horizon in Queens release
Obsoletes:      python-django_openstack_auth
%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-Babel >= 2.3.4
Requires:       python-Django1 >= 1.11
Requires:       python-Pint >= 0.5
Requires:       python-PyYAML >= 3.12
Requires:       python-XStatic >= 1.0.0
Requires:       python-XStatic-Angular >= 1.5.8.0
Requires:       python-XStatic-Angular-Bootstrap >= 2.2.0.0
Requires:       python-XStatic-Angular-FileUpload >= 12.0.4.0
Requires:       python-XStatic-Angular-Gettext >= 2.3.8.0
Requires:       python-XStatic-Angular-Schema-Form >= 0.8.13.0
Requires:       python-XStatic-Angular-lrdragndrop >= 1.0.2.2
Requires:       python-XStatic-Bootstrap-Datepicker >= 1.3.1.0
Requires:       python-XStatic-Bootstrap-SCSS >= 3.3.7.1
Requires:       python-XStatic-D3 >= 3.5.17.0
Requires:       python-XStatic-Font-Awesome >= 4.7.0.0
Requires:       python-XStatic-Hogan >= 2.0.0.2
Requires:       python-XStatic-JQuery-Migrate >= 1.2.1.1
Requires:       python-XStatic-JQuery.TableSorter >= 2.14.5.1
Requires:       python-XStatic-JQuery.quicksearch >= 2.0.3.1
Requires:       python-XStatic-JSEncrypt >= 2.3.1.1
Requires:       python-XStatic-Jasmine >= 2.4.1.1
Requires:       python-XStatic-Rickshaw >= 1.5.0.0
Requires:       python-XStatic-Spin >= 1.2.5.2
Requires:       python-XStatic-bootswatch >= 3.3.7.0
Requires:       python-XStatic-jQuery >= 1.8.2.1
Requires:       python-XStatic-jquery-ui >= 1.10.4.1
Requires:       python-XStatic-mdi >= 1.4.57.0
Requires:       python-XStatic-objectpath >= 1.2.1.0
Requires:       python-XStatic-roboto-fontface >= 0.5.0.0
Requires:       python-XStatic-smart-table >= 1.4.13.2
Requires:       python-XStatic-term.js >= 0.0.7.0
Requires:       python-XStatic-tv4 >= 1.2.7.0
Requires:       python-ceilometerclient >= 2.5.0
Requires:       python-cinderclient >= 3.3.0
Requires:       python-django-babel >= 0.6.2
Requires:       python-django-pyscss >= 2.0.2
Requires:       python-django_compressor >= 1.4
Requires:       python-futurist >= 1.2.0
Requires:       python-glanceclient >= 2.8.0
Requires:       python-heatclient >= 1.10.0
Requires:       python-httplib2 >= 0.7.5
Requires:       python-iso8601 >= 0.1.11
Requires:       python-keystoneauth1 >= 3.4.0
Requires:       python-keystoneclient >= 3.15.0
Requires:       python-netaddr >= 0.7.18
Requires:       python-neutronclient >= 6.7.0
Requires:       python-novaclient >= 9.1.0
Requires:       python-oslo.concurrency >= 3.26.0
Requires:       python-oslo.config >= 5.2.0
Requires:       python-oslo.i18n >= 3.15.3
Requires:       python-oslo.policy >= 1.30.0
Requires:       python-oslo.serialization >= 2.18.0
Requires:       python-oslo.utils >= 3.33.0
Requires:       python-osprofiler >= 2.3.0
Requires:       python-pbr >= 2.0.0
Requires:       python-pyScss >= 1.3.4
Requires:       python-pytz >= 2013.6
Requires:       python-semantic_version >= 2.3.1
Requires:       python-six >= 1.10.0
Requires:       python-swiftclient >= 3.2.0

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

%package -n python-openstack_auth
Summary:        OpenStack Django authentication
Group:          Development/Languages/Python

%description -n python-openstack_auth
The Python module for OpenStack Django authentication.

%package test
Summary:        OpenStack Dashboard (Horizon) - Testsuite
Group:          Development/Languages/Python
Requires:       %{name} = %{version}
Requires:       python-django-nose >= 1.4.4
Requires:       python-mock >= 2.0.0
Requires:       python-mox3 >= 0.20.0
Requires:       python-netaddr >= 0.7.18
Requires:       python-nose >= 1.3.7
Requires:       python-nose-exclude
Requires:       python-nosehtmloutput >= 0.0.3
Requires:       python-nosexcover >= 1.0.10
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 >= 2.2.0

%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}
%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 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
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
rm -f %{buildroot}/srv/www/openstack-dashboard/openstack_dashboard/.eslintrc

# generate language file and split
%find_lang django
%find_lang djangojs
grep -h "\/openstack_dashboard\/locale\/" djangojs.lang django.lang > dashboard.lang
grep -h "\/horizon\/locale\/" djangojs.lang 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

%files -f dashboard.lang
%defattr(-,root,root)
%doc README.rst
%license 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/local/local_settings.d
/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/templates/
/srv/www/openstack-dashboard/openstack_dashboard/templatetags/
/srv/www/openstack-dashboard/openstack_dashboard/utils/
/srv/www/openstack-dashboard/openstack_dashboard/django_pyscss_fix/
/srv/www/openstack-dashboard/openstack_dashboard/test/
%exclude /srv/www/openstack-dashboard/openstack_dashboard/test/unit
%exclude /srv/www/openstack-dashboard/openstack_dashboard/test/integration_tests
/srv/www/openstack-dashboard/openstack_dashboard/usage/
/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*
/srv/www/openstack-dashboard/openstack_dashboard/contrib/
/srv/www/openstack-dashboard/openstack_dashboard/themes/

%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)
%dir %{python_sitelib}/horizon
%dir %{python_sitelib}/horizon/locale
%dir %{python_sitelib}/horizon/locale/*
%dir %{python_sitelib}/horizon/locale/*/LC_MESSAGES
# NOTE(aplanas) add the test directory as a workaround to bsc#1076810
%dir %{python_sitelib}/horizon/test
%{python_sitelib}/horizon/browsers
%{python_sitelib}/horizon/conf
%{python_sitelib}/horizon/contrib
%{python_sitelib}/horizon/forms
%{python_sitelib}/horizon/management
%{python_sitelib}/horizon/middleware
%{python_sitelib}/horizon/utils
%{python_sitelib}/horizon/static
%{python_sitelib}/horizon/tabs
%{python_sitelib}/horizon/tables
%{python_sitelib}/horizon/templates
%{python_sitelib}/horizon/templatetags
%{python_sitelib}/horizon/workflows
%{python_sitelib}/horizon/*.py*
%{python_sitelib}/horizon/test/*.py*
%{python_sitelib}/horizon/test/jasmine
%exclude %{python_sitelib}/horizon/conf/*/static
%exclude %{python_sitelib}/horizon/conf/*/templates
%exclude %{python_sitelib}/horizon/hacking
%exclude %{python_sitelib}/horizon/test/customization
%exclude %{python_sitelib}/horizon/test/messages
%exclude %{python_sitelib}/horizon/test/dummy_auth
%exclude %{python_sitelib}/horizon/test/tests
%exclude %{python_sitelib}/horizon/test/templates
%exclude %{python_sitelib}/horizon/test/test_dashboards
%{python_sitelib}/horizon-*.egg-info

%files -n python-openstack_auth
%defattr(-,root,root)
%{python_sitelib}/openstack_auth

%files test
%defattr(-,root,root)
%{_localstatedir}/lib/%{name}-test/
%dir %{python_sitelib}/horizon/test
%{python_sitelib}/horizon/test/unit
%{python_sitelib}/horizon/test/selenium
%{python_sitelib}/horizon/karma.conf.js
/srv/www/openstack-dashboard/openstack_dashboard/karma.conf.js

%changelog