-
Notifications
You must be signed in to change notification settings - Fork 1
/
example-ui.spec
123 lines (97 loc) · 3.34 KB
/
example-ui.spec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
%{!?sources_gpg: %{!?dlrn:%global sources_gpg 1} }
# %global sources_gpg_sign <get the Cryptographic Signatures of current release from https://releases.openstack.org/#cryptographic-signatures>
%global sources_gpg_sign 0x2426b928085a020d8a90d0d879ab7008d0896c8a
%{!?upstream_version: %global upstream_version %{version}%{?milestone}}
%global pypi_name example-dashboard
%global mod_name example_dashboard
%global with_doc 1
# tests are disabled by default
%bcond_with tests
Name: openstack-example-ui
Version: XXX
Release: XXX
Summary: The UI component for the OpenStack example service
License: ASL 2.0
URL: https://github.com/openstack/%{pypi_name}
Source0: https://tarballs.openstack.org/%{pypi_name}/%{pypi_name}-%{upstream_version}.tar.gz
# Required for tarball sources verification
%if 0%{?sources_gpg} == 1
Source101: https://tarballs.openstack.org/%{pypi_name}/%{pypi_name}-%{upstream_version}.tar.gz.asc
Source102: https://releases.openstack.org/_static/%{sources_gpg_sign}.txt
%endif
BuildArch: noarch
# Required for tarball sources verification
%if 0%{?sources_gpg} == 1
BuildRequires: /usr/bin/gpgv2
BuildRequires: openstack-macros
%endif
BuildRequires: python2-devel
BuildRequires: python-setuptools
BuildRequires: python-pbr
BuildRequires: git-core
# Required to compile translation files
BuildRequires: python-django
# openstack-dashboard is probably required for running tests
# if your project uses own tests, remove this, otherwise uncomment.
# BuildRequires: openstack-dashboard
BuildRequires: gettext
Requires: openstack-dashboard
Requires: python-pbr
%description
openstack-example-ui is a dashboard for example service
%if 0%{?with_doc}
%package doc
Summary: Documentation for example dashboard
BuildRequires: python-sphinx
BuildRequires: python-oslo-sphinx
%description doc
Documentation files for example dashboard
%endif
%prep
# Required for tarball sources verification
%if 0%{?sources_gpg} == 1
%{gpgverify} --keyring=%{SOURCE102} --signature=%{SOURCE101} --data=%{SOURCE0}
%endif
%autosetup -n %{pypi_name}-%{upstream_version} -S git
# Let RPM handle the dependencies
rm -rf {test-,}requirements.txt tools/{pip,test}-requires
%build
# build
%py2_build
# Generate i18n files
pushd build/lib/%{mod_name}
django-admin compilemessages
popd
%if 0%{?with_doc}
# Build html documentation
%{__python2} setup.py build_sphinx
# remove the sphinx-build leftovers
rm -rf html/.{doctrees,buildinfo}
%endif
%install
%py2_install
# Move config to horizon
mkdir -p %{buildroot}%{_datadir}/openstack-dashboard/openstack_dashboard/local/enabled/
# replace XXX_example for a expression that match files for each specific dashboard
install -p -D -m 640 %{mod_name}/enabled/_XXX_example* %{buildroot}%{_datadir}/openstack-dashboard/openstack_dashboard/local/enabled/
# Remove .po and .pot (they are not required)
rm -f %{buildroot}%{python2_sitelib}/%{mod_name}/locale/*/LC_*/django*.po
rm -f %{buildroot}%{python2_sitelib}/%{mod_name}/locale/*pot
# Find language files
%find_lang django --all-name
%check
%if %{?with_tests}
%{__python2} setup.py test
%endif
%files -f django.lang
%doc README.rst
%license LICENSE
%{python2_sitelib}/%{mod_name}
%{python2_sitelib}/*.egg-info
%{_datadir}/openstack-dashboard/openstack_dashboard/local/enabled/_XXX_example*
%if 0%{?with_doc}
%files doc
%doc html
%license LICENSE
%endif
%changelog