openstack-horizon/openstack-dashboard.spec
2022-02-21 02:43:47 +00:00

362 lines
15 KiB
RPMSpec

%{!?upstream_version: %global upstream_version %{version}%{?milestone}}
Name: openstack-dashboard
Version: 16.2.2
Release: 5
Summary: OpenStack Dashboard (Horizon)
License: Apache-2.0 and BSD
URL: http://horizon.openstack.org/
Source0: https://tarballs.openstack.org/horizon/horizon-%{upstream_version}.tar.gz
Source1: openstack-dashboard-httpd-2.4.conf
Source2: openstack-dashboard-systemd.conf
Source3: openstack-dashboard-logrotate.conf
BuildArch: noarch
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-pbr
BuildRequires: git-core
BuildRequires: gettext
# for checks:
BuildRequires: python3-nose
BuildRequires: python3-osprofiler
BuildRequires: python3-iso8601
BuildRequires: python3-pycodestyle
BuildRequires: python3-mock
BuildRequires: python3-netaddr
BuildRequires: python3-anyjson
Requires: python3-horizon
Requires: python3-openstack_auth
Provides: openstack-horizon
%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.
%package -n python3-openstack_auth
Summary: OpenStack Auth (Horizon) - Python Module
Provides: python-openstack_auth
%description -n python3-openstack_auth
The Python module OpenStack Auth provides Authentication mechanism
for the OpenStack Dashboard (Horizon).
%package -n python3-horizon
Summary: Openstack web user interface reference implementation
BuildRequires: python3-django-debreach
BuildRequires: python3-django-compressor
BuildRequires: python3-django-pyscss
BuildRequires: python3-XStatic
BuildRequires: python3-XStatic-Angular
BuildRequires: python3-XStatic-Angular-Bootstrap
BuildRequires: python3-XStatic-Angular-Schema-Form
BuildRequires: python3-XStatic-D3
BuildRequires: python3-XStatic-Font-Awesome
BuildRequires: python3-XStatic-JSEncrypt
BuildRequires: python3-XStatic-Jasmine
BuildRequires: python3-XStatic-Bootstrap-SCSS
BuildRequires: python3-XStatic-termjs
BuildRequires: python3-XStatic-smart-table
BuildRequires: python3-XStatic-Angular-FileUpload
BuildRequires: python3-XStatic-Angular-Gettext
BuildRequires: python3-XStatic-bootswatch
BuildRequires: python3-XStatic-roboto-fontface
BuildRequires: python3-XStatic-mdi
BuildRequires: python3-XStatic-objectpath
BuildRequires: python3-XStatic-tv4
# bootstrap-scss requires at least python-scss
BuildRequires: python3-scss
BuildRequires: fontawesome-fonts-web
BuildRequires: python3-oslo-concurrency
BuildRequires: python3-oslo-config
BuildRequires: python3-oslo-i18n
BuildRequires: python3-oslo-serialization
BuildRequires: python3-oslo-utils
BuildRequires: python3-oslo-policy
BuildRequires: python3-babel
BuildRequires: python3-pytz
BuildRequires: systemd
BuildRequires: python3-django-appconf
BuildRequires: python3-semantic_version
BuildRequires: python3-XStatic-jQuery
BuildRequires: python3-XStatic-Hogan
BuildRequires: python3-XStatic-JQuery-Migrate
BuildRequires: python3-XStatic-JQuery-TableSorter
BuildRequires: python3-XStatic-JQuery-quicksearch
BuildRequires: python3-XStatic-Rickshaw
BuildRequires: python3-XStatic-Spin
BuildRequires: python3-XStatic-jquery-ui
BuildRequires: python3-XStatic-Bootstrap-Datepicker
BuildRequires: python3-XStatic-Angular-lrdragndrop
BuildRequires: python3-pint
BuildRequires: python3-memcached
BuildRequires: python3-glanceclient
BuildRequires: python3-keystoneclient
BuildRequires: python3-novaclient
BuildRequires: python3-neutronclient
BuildRequires: python3-cinderclient
BuildRequires: python3-swiftclient
BuildRequires: python3-pytest
Requires: python3-iso8601
Requires: python3-glanceclient
Requires: python3-keystoneclient
Requires: python3-keystoneauth1
Requires: python3-novaclient
Requires: python3-neutronclient
Requires: python3-cinderclient
Requires: python3-swiftclient
Requires: python3-netaddr
Requires: python3-osprofiler
Requires: python3-django-pyscss
Requires: python3-XStatic
Requires: python3-XStatic-Angular
Requires: python3-XStatic-Angular-Bootstrap
Requires: python3-XStatic-Angular-Schema-Form
Requires: python3-XStatic-D3
Requires: python3-XStatic-Font-Awesome
Requires: python3-XStatic-JSEncrypt
Requires: python3-XStatic-Jasmine
Requires: python3-XStatic-Bootstrap-SCSS
Requires: python3-XStatic-termjs
Requires: python3-XStatic-smart-table
Requires: python3-XStatic-Angular-Gettext
Requires: python3-XStatic-Angular-FileUpload
Requires: python3-XStatic-bootswatch
Requires: python3-XStatic-roboto-fontface
Requires: python3-XStatic-mdi
Requires: python3-XStatic-objectpath
Requires: python3-XStatic-tv4
Requires: python3-django-debreach
Requires: python3-scss
Requires: fontawesome-fonts-web
Requires: python3-oslo-concurrency
Requires: python3-oslo-config
Requires: python3-oslo-i18n
Requires: python3-oslo-serialization
Requires: python3-oslo-utils
Requires: python3-oslo-upgradecheck
Requires: python3-requests
Requires: python3-oslo-policy
Requires: python3-babel
Requires: python3-futurist
Requires: openssl
Requires: logrotate
Requires: python3-mod_wsgi
Requires: python3-django-appconf
Requires: python3-pymongo
Requires: python3-semantic_version
Requires: python3-XStatic-jQuery
Requires: python3-XStatic-Hogan
Requires: python3-XStatic-JQuery-Migrate
Requires: python3-XStatic-JQuery-TableSorter
Requires: python3-XStatic-JQuery-quicksearch
Requires: python3-XStatic-Rickshaw
Requires: python3-XStatic-Spin
Requires: python3-XStatic-jquery-ui
Requires: python3-XStatic-Bootstrap-Datepicker
Requires: python3-XStatic-Angular-lrdragndrop
Requires: python3-yaml
Requires: python3-memcached
Requires: python3-debtcollector
Requires: python3-pint
Provides: python-horizon
%description -n python3-horizon
Openstack Dashboard is a web user interface for Openstack. The package
provides a reference implementation using the Django Horizon project,
mostly consisting of JavaScript and CSS to tie it altogether as a standalone
site.
This package contains the python library.
%prep
%autosetup -n horizon-%{upstream_version} -S git
sed -i 's/Django<2.1,/Django/' requirements.txt
# customize default settings
# WAS [PATCH] disable debug, move web root
sed -i "/^DEBUG =.*/c\DEBUG = False" openstack_dashboard/local/local_settings.py.example
sed -i "/^WEBROOT =.*/c\WEBROOT = '/dashboard/'" openstack_dashboard/local/local_settings.py.example
sed -i "/^.*ALLOWED_HOSTS =.*/c\ALLOWED_HOSTS = ['horizon.example.com', 'localhost']" openstack_dashboard/local/local_settings.py.example
sed -i "/^.*LOCAL_PATH =.*/c\LOCAL_PATH = '/tmp'" openstack_dashboard/local/local_settings.py.example
sed -i "/^.*POLICY_FILES_PATH =.*/c\POLICY_FILES_PATH = '/etc/openstack-dashboard'" openstack_dashboard/local/local_settings.py.example
sed -i "/^BIN_DIR = .*/c\BIN_DIR = '/usr/bin'" openstack_dashboard/settings.py
sed -i "/^COMPRESS_PARSER = .*/a COMPRESS_OFFLINE = True" openstack_dashboard/settings.py
# set COMPRESS_OFFLINE=True
sed -i 's:COMPRESS_OFFLINE.=.False:COMPRESS_OFFLINE = True:' openstack_dashboard/settings.py
# Fix manage.py shebang
sed -i 's/\/usr\/bin\/env python/\/usr\/bin\/env python3/' manage.py
%build
# compile message strings
cd horizon && django-admin compilemessages && cd ..
cd openstack_dashboard && django-admin compilemessages && cd ..
# Dist tarball is missing .mo files so they're not listed in distributed egg metadata.
# Removing egg-info and letting PBR regenerate it was working around that issue
# but PBR cannot regenerate complete SOURCES.txt so some other files wont't get installed.
# Further reading why not remove upstream egg metadata:
# https://github.com/emonty/python-oslo-messaging/commit/f632684eb2d582253601e8da7ffdb8e55396e924
# https://fedorahosted.org/fpc/ticket/488
echo >> horizon.egg-info/SOURCES.txt
ls */locale/*/LC_MESSAGES/django*mo >> horizon.egg-info/SOURCES.txt
%{py3_build}
# compress css, js etc.
cp openstack_dashboard/local/local_settings.py.example openstack_dashboard/local/local_settings.py
# get it ready for compressing later in puppet-horizon
%{__python3} manage.py collectstatic --noinput --clear
%{__python3} manage.py compress --force
# undo hack
cp openstack_dashboard/local/local_settings.py.example openstack_dashboard/local/local_settings.py
%install
%{py3_install}
# drop httpd-conf snippet
install -m 0644 -D -p %{SOURCE1} %{buildroot}%{_sysconfdir}/httpd/conf.d/openstack-dashboard.conf
install -d -m 755 %{buildroot}%{_datadir}/openstack-dashboard
install -d -m 755 %{buildroot}%{_sharedstatedir}/openstack-dashboard
install -d -m 755 %{buildroot}%{_sysconfdir}/openstack-dashboard
# create directory for systemd snippet
mkdir -p %{buildroot}%{_unitdir}/httpd.service.d/
cp %{SOURCE2} %{buildroot}%{_unitdir}/httpd.service.d/openstack-dashboard.conf
# Copy everything to /usr/share
mv %{buildroot}%{python3_sitelib}/openstack_dashboard \
%{buildroot}%{_datadir}/openstack-dashboard
cp manage.py %{buildroot}%{_datadir}/openstack-dashboard
rm -rf %{buildroot}%{python3_sitelib}/openstack_dashboard
# remove unnecessary .po files
find %{buildroot} -name django.po -exec rm '{}' \;
find %{buildroot} -name djangojs.po -exec rm '{}' \;
# Move config to /etc, symlink it back to /usr/share
mv %{buildroot}%{_datadir}/openstack-dashboard/openstack_dashboard/local/local_settings.py.example %{buildroot}%{_sysconfdir}/openstack-dashboard/local_settings
ln -s ../../../../..%{_sysconfdir}/openstack-dashboard/local_settings %{buildroot}%{_datadir}/openstack-dashboard/openstack_dashboard/local/local_settings.py
mv %{buildroot}%{_datadir}/openstack-dashboard/openstack_dashboard/conf/*.json %{buildroot}%{_sysconfdir}/openstack-dashboard
mv %{buildroot}%{_datadir}/openstack-dashboard/openstack_dashboard/conf/nova_policy.d %{buildroot}%{_sysconfdir}/openstack-dashboard
rm -rf %{buildroot}%{_datadir}/openstack-dashboard/openstack_dashboard/wsgi
%find_lang django --all-name
grep "\/usr\/share\/openstack-dashboard" django.lang > dashboard.lang
grep "\/site-packages\/horizon" django.lang > horizon.lang
# copy static files to %{_datadir}/openstack-dashboard/static
mkdir -p %{buildroot}%{_datadir}/openstack-dashboard/static
cp -a openstack_dashboard/static/* %{buildroot}%{_datadir}/openstack-dashboard/static
cp -a horizon/static/* %{buildroot}%{_datadir}/openstack-dashboard/static
cp -a static/* %{buildroot}%{_datadir}/openstack-dashboard/static
# create /var/run/openstack-dashboard/ and own it
mkdir -p %{buildroot}%{_sharedstatedir}/openstack-dashboard
# create /var/log/horizon and own it
mkdir -p %{buildroot}%{_var}/log/horizon
# place logrotate config:
mkdir -p %{buildroot}%{_sysconfdir}/logrotate.d
cp -a %{SOURCE3} %{buildroot}%{_sysconfdir}/logrotate.d/openstack-dashboard
%check
# NOTE(jpena): we do not want to run hacking tests in check
rm horizon/test/unit/hacking/test_checks.py
%{__python3} manage.py test horizon --settings=horizon.test.settings
%post -n openstack-dashboard
# ugly hack to set a unique SECRET_KEY
sed -i "/^from horizon.utils import secret_key$/d" /etc/openstack-dashboard/local_settings
sed -i "/^SECRET_KEY.*$/{N;s/^.*$/SECRET_KEY='`openssl rand -hex 10`'/}" /etc/openstack-dashboard/local_settings
# reload systemd unit files
systemctl daemon-reload >/dev/null 2>&1 || :
%postun
# update systemd unit files
systemctl daemon-reload >/dev/null 2>&1 || :
%files -f dashboard.lang
%license LICENSE
%dir %{_datadir}/openstack-dashboard/
%{_datadir}/openstack-dashboard/*.py*
%{_datadir}/openstack-dashboard/static
%{_datadir}/openstack-dashboard/openstack_dashboard/*.py*
%{_datadir}/openstack-dashboard/openstack_dashboard/api
%{_datadir}/openstack-dashboard/openstack_dashboard/contrib
%dir %{_datadir}/openstack-dashboard/openstack_dashboard/dashboards/
%{_datadir}/openstack-dashboard/openstack_dashboard/dashboards/admin
%{_datadir}/openstack-dashboard/openstack_dashboard/dashboards/identity
%{_datadir}/openstack-dashboard/openstack_dashboard/dashboards/project
%{_datadir}/openstack-dashboard/openstack_dashboard/dashboards/settings
%{_datadir}/openstack-dashboard/openstack_dashboard/dashboards/__init__.py*
%{_datadir}/openstack-dashboard/openstack_dashboard/django_pyscss_fix
%{_datadir}/openstack-dashboard/openstack_dashboard/enabled
%{_datadir}/openstack-dashboard/openstack_dashboard/karma.conf.js
%{_datadir}/openstack-dashboard/openstack_dashboard/local
%{_datadir}/openstack-dashboard/openstack_dashboard/management
%{_datadir}/openstack-dashboard/openstack_dashboard/static
%{_datadir}/openstack-dashboard/openstack_dashboard/templates
%{_datadir}/openstack-dashboard/openstack_dashboard/templatetags
%{_datadir}/openstack-dashboard/openstack_dashboard/themes
%{_datadir}/openstack-dashboard/openstack_dashboard/test
%{_datadir}/openstack-dashboard/openstack_dashboard/usage
%{_datadir}/openstack-dashboard/openstack_dashboard/utils
%dir %{_datadir}/openstack-dashboard/openstack_dashboard
%dir %{_datadir}/openstack-dashboard/openstack_dashboard/locale
%dir %{_datadir}/openstack-dashboard/openstack_dashboard/locale/??
%dir %{_datadir}/openstack-dashboard/openstack_dashboard/locale/??_??
%dir %{_datadir}/openstack-dashboard/openstack_dashboard/locale/??/LC_MESSAGES
%dir %{_datadir}/openstack-dashboard/openstack_dashboard/locale/??_??/LC_MESSAGES
%{_datadir}/openstack-dashboard/openstack_dashboard/.eslintrc
%{_datadir}/openstack-dashboard/openstack_dashboard/__pycache__
%{_datadir}/openstack-dashboard/openstack_dashboard/dashboards/__pycache__
%dir %attr(0750, root, apache) %{_sysconfdir}/openstack-dashboard
%dir %attr(0750, apache, apache) %{_sharedstatedir}/openstack-dashboard
%dir %attr(0750, apache, apache) %{_var}/log/horizon
%config(noreplace) %{_sysconfdir}/httpd/conf.d/openstack-dashboard.conf
%config(noreplace) %attr(0640, root, apache) %{_sysconfdir}/openstack-dashboard/local_settings
%config(noreplace) %attr(0640, root, apache) %{_sysconfdir}/openstack-dashboard/cinder_policy.json
%config(noreplace) %attr(0640, root, apache) %{_sysconfdir}/openstack-dashboard/keystone_policy.json
%config(noreplace) %attr(0640, root, apache) %{_sysconfdir}/openstack-dashboard/nova_policy.json
%config(noreplace) %attr(0640, root, apache) %{_sysconfdir}/openstack-dashboard/glance_policy.json
%config(noreplace) %attr(0640, root, apache) %{_sysconfdir}/openstack-dashboard/neutron_policy.json
%config(noreplace) %attr(0640, root, apache) %{_sysconfdir}/openstack-dashboard/nova_policy.d/api-extensions.yaml
%config(noreplace) %attr(0644, root, root) %{_sysconfdir}/logrotate.d/openstack-dashboard
%attr(755,root,root) %dir %{_unitdir}/httpd.service.d
%config(noreplace) %{_unitdir}/httpd.service.d/openstack-dashboard.conf
%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
* Mon Feb 21 2022 wangxiyuan <wangxiyuan1007@gmail.com> - 16.2.2-5
- Fix systemd unit error
* Tue Nov 23 2021 huangtianhua <huangtianhua@huawei.com> - 16.2.2-4
- Removes Django<2.1 constrains
* Fri Nov 19 2021 huangtianhua <huangtianhua@huawei.com> - 16.2.2-3
- Adds python3-pint as requires
* Fri Nov 19 2021 lijiawei <ljw1101.vip@gmail.com> - 16.2.2-2
- Fix the file path
* Fri Nov 05 2021 lijiawei <ljw1101.vip@gmail.com> - 16.2.2-1
- Support OpenStack Train release