File openstack-dashboard.spec of Package openstack-dashboard

#
# spec file for package openstack-dashboard
#
# Copyright (c) 2020 SUSE LLC
#
# 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/
#


%if 0%{?rhel} || 0%{?fedora}
%global rdo 1
%global http_dashboard_dir %{_datarootdir}/openstack-dashboard
%else
%global http_dashboard_dir /srv/www/openstack-dashboard
%endif
Name:           openstack-dashboard
Version:        18.7.0~dev30
Release:        0
Summary:        OpenStack Dashboard (Horizon)
License:        Apache-2.0
Group:          Development/Languages/Python
URL:            https://wiki.openstack.org/OpenStackDashboard
Source0:        horizon-master.tar.gz
# https://review.openstack.org/#/c/635159/
Patch0:         0001-Do-not-set-COMPRESS_ENABLED-explicitly.patch
BuildRequires:  fdupes
BuildRequires:  gettext
BuildRequires:  openstack-macros
BuildRequires:  python3-Django
BuildRequires:  python3-Pint
BuildRequires:  python3-XStatic
BuildRequires:  python3-XStatic-Angular
BuildRequires:  python3-XStatic-Angular-Bootstrap
BuildRequires:  python3-XStatic-Angular-FileUpload
BuildRequires:  python3-XStatic-Angular-Gettext
BuildRequires:  python3-XStatic-Angular-Schema-Form
BuildRequires:  python3-XStatic-Angular-lrdragndrop
BuildRequires:  python3-XStatic-Bootstrap-Datepicker
BuildRequires:  python3-XStatic-Bootstrap-SCSS
BuildRequires:  python3-XStatic-D3
BuildRequires:  python3-XStatic-Font-Awesome
BuildRequires:  python3-XStatic-Hogan
BuildRequires:  python3-XStatic-JQuery-Migrate
BuildRequires:  python3-XStatic-JQuery.TableSorter
BuildRequires:  python3-XStatic-JQuery.quicksearch
BuildRequires:  python3-XStatic-JSEncrypt
BuildRequires:  python3-XStatic-Jasmine
BuildRequires:  python3-XStatic-Rickshaw
BuildRequires:  python3-XStatic-Spin
BuildRequires:  python3-XStatic-bootswatch
BuildRequires:  python3-XStatic-jQuery
BuildRequires:  python3-XStatic-jquery-ui
BuildRequires:  python3-XStatic-mdi
BuildRequires:  python3-XStatic-objectpath
BuildRequires:  python3-XStatic-roboto-fontface
BuildRequires:  python3-XStatic-smart-table
BuildRequires:  python3-XStatic-term.js
BuildRequires:  python3-XStatic-tv4
BuildRequires:  python3-cinderclient
BuildRequires:  python3-devel
BuildRequires:  python3-django-compressor
BuildRequires:  python3-django-debreach
BuildRequires:  python3-django-pyscss
BuildRequires:  python3-glanceclient
BuildRequires:  python3-heatclient
BuildRequires:  python3-keystoneclient
BuildRequires:  python3-mock
BuildRequires:  python3-netaddr
BuildRequires:  python3-neutronclient
BuildRequires:  python3-novaclient
BuildRequires:  python3-oslo.concurrency
BuildRequires:  python3-oslo.policy
BuildRequires:  python3-osprofiler
BuildRequires:  python3-pbr
BuildRequires:  python3-pytest
BuildRequires:  python3-swiftclient
BuildRequires:  python3-testtools
Requires:       python3-horizon = %{version}-%{release}
Requires:       python3-openstack_auth = %{version}-%{release}
Provides:       openstack-horizon = %{version}-%{release}
BuildArch:      noarch
%if 0%{?suse_version}
BuildRequires:  apache2
Requires:       apache2
Requires:       apache2-mod_wsgi-python3
%endif
%if 0%{?rdo}
Requires:       httpd
Requires:       python3-mod_wsgi
%endif
# Apache2 example configuration:
%if 0%{?rdo}
Source2:        openstack-dashboard.conf.sample.rdo
%else
Source2:        openstack-dashboard.conf.sample.suse
%endif
# To generate a self-signed certificate to be used in demo setups:
%if 0%{?suse_version}
Requires(post):  apache2-utils
%endif
%if 0%{?rdo}
Requires(post):  httpd-tools
%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 python3-horizon
Summary:        OpenStack Dashboard (Horizon) - Python Module
Group:          Development/Languages/Python
Requires:       python3-Babel
Requires:       python3-Django
Requires:       python3-Pint
Requires:       python3-PyYAML
Requires:       python3-XStatic
Requires:       python3-XStatic-Angular
Requires:       python3-XStatic-Angular-Bootstrap
Requires:       python3-XStatic-Angular-FileUpload
Requires:       python3-XStatic-Angular-Gettext
Requires:       python3-XStatic-Angular-Schema-Form
Requires:       python3-XStatic-Angular-lrdragndrop
Requires:       python3-XStatic-Bootstrap-Datepicker
Requires:       python3-XStatic-Bootstrap-SCSS
Requires:       python3-XStatic-D3
Requires:       python3-XStatic-Font-Awesome
Requires:       python3-XStatic-Hogan
Requires:       python3-XStatic-JQuery-Migrate
Requires:       python3-XStatic-JQuery.TableSorter
Requires:       python3-XStatic-JQuery.quicksearch
Requires:       python3-XStatic-JSEncrypt
Requires:       python3-XStatic-Jasmine
Requires:       python3-XStatic-Rickshaw
Requires:       python3-XStatic-Spin
Requires:       python3-XStatic-bootswatch
Requires:       python3-XStatic-jQuery
Requires:       python3-XStatic-jquery-ui
Requires:       python3-XStatic-mdi
Requires:       python3-XStatic-objectpath
Requires:       python3-XStatic-roboto-fontface
Requires:       python3-XStatic-smart-table
Requires:       python3-XStatic-term.js
Requires:       python3-XStatic-tv4
Requires:       python3-cinderclient
Requires:       python3-django-babel
Requires:       python3-django-compressor
Requires:       python3-django-debreach
Requires:       python3-django-pyscss
Requires:       python3-futurist
Requires:       python3-glanceclient
Requires:       python3-heatclient
Requires:       python3-httplib2
Requires:       python3-iso8601
Requires:       python3-keystoneclient
Requires:       python3-netaddr
Requires:       python3-neutronclient
Requires:       python3-novaclient
Requires:       python3-oslo.concurrency
Requires:       python3-oslo.config
Requires:       python3-oslo.i18n
Requires:       python3-oslo.policy
Requires:       python3-oslo.serialization
Requires:       python3-oslo.utils
Requires:       python3-osprofiler
Requires:       python3-pbr
Requires:       python3-pyScss
Requires:       python3-pytz
Requires:       python3-semantic_version
Requires:       python3-six
Requires:       python3-swiftclient

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

%package -n python3-openstack_auth
Summary:        OpenStack Auth (Horizon) - Python Module
Group:          Development/Languages/Python

%description -n python3-openstack_auth
The Python module OpenStack Auth provides Authentication mechanism
for the OpenStack Dashboard (Horizon).

%prep
%autosetup -p1 -n horizon-18.7.0.dev30
%py_req_cleanup

# Fix manage.py shebang
sed -i 's#%{_bindir}/env python#%{_bindir}/python3#' manage.py

%build
# compile mo files before build
pushd horizon
python3 ../manage.py compilemessages
popd
pushd openstack_dashboard
python3 ../manage.py compilemessages
popd
%{py3_build}

%check
rm horizon/test/unit/hacking/test_checks.py
python3 manage.py test horizon --settings=horizon.test.settings
# TODO
# python3 manage.py test openstack_dashboard --settings=openstack_dashboard.test.settings --exclude-dir=openstack_dashboard/test/integration_tests

%install
%{py3_install}

# Move openstack_dashboard files
install -d -m 755 %{buildroot}%{http_dashboard_dir}
mv %{buildroot}%{python3_sitelib}/openstack_dashboard/ %{buildroot}%{http_dashboard_dir}
install -m 755 manage.py %{buildroot}%{http_dashboard_dir}/manage.py

# Create a local_settings.py
mv %{buildroot}%{http_dashboard_dir}/openstack_dashboard/local/local_settings.py{.example,}

# create root and static files
install -m 0755 -d %{buildroot}%{http_dashboard_dir}/static
install -m 0755 -d %{buildroot}%{http_dashboard_dir}/media
pushd %{buildroot}%{http_dashboard_dir}
PYTHONPATH=%{buildroot}%{python3_sitelib} python3 manage.py collectstatic --noinput
popd

# cleanup after manage.py run
rm -v %{buildroot}%{http_dashboard_dir}/openstack_dashboard/local/.secret_key_store
rm -v %{buildroot}%{http_dashboard_dir}/openstack_dashboard/local/*secret_key_store*

# Remove duplicate files
%if 0%{?suse_version}
%fdupes %{buildroot}%{python3_sitelib}
%fdupes %{buildroot}%{http_dashboard_dir}
%endif
rm -f %{buildroot}%{http_dashboard_dir}/openstack_dashboard/.eslintrc

install -D -m 644 %{SOURCE2} %{buildroot}%{apache_conf_dir}/openstack-dashboard.conf.sample

%files
%doc README.rst
%{http_dashboard_dir}
%attr(0750, %{apache_user}, %{apache_group}) %{http_dashboard_dir}/openstack_dashboard/local
%attr(0640, %{apache_user}, %{apache_group}) %{http_dashboard_dir}/openstack_dashboard/local/__init__.py*
%config(noreplace) %attr(0640, %{apache_user}, %{apache_group}) %{http_dashboard_dir}/openstack_dashboard/local/local_settings.py*
%attr(0770, root, %{apache_group}) %{http_dashboard_dir}/static/
%attr(0770, root, %{apache_group}) %{http_dashboard_dir}/media/
%{apache_conf_dir}/openstack-dashboard.conf.sample

%files -n python3-horizon
%license LICENSE
%{python3_sitelib}/horizon
%{python3_sitelib}/horizon-*.egg-info

%files -n python3-openstack_auth
%license LICENSE
%{python3_sitelib}/openstack_auth

%changelog