-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathorthos2.spec
200 lines (168 loc) · 6.31 KB
/
orthos2.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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
# 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/
Name: orthos2
Version: 1.4
Release: 0
Summary: Machine administration
Url: https://github.com/openSUSE/orthos2
Group: Productivity/Networking/Boot/Servers
%{?systemd_ordering}
License: GPL-2.0-or-later
Source: orthos2-%{version}.tar.gz
%if 0%{?suse_version}
Source1: orthos2.rpmlintrc
%endif
BuildArch: noarch
BuildRequires: fdupes
BuildRequires: systemd-rpm-macros
# For /etc/nginx{,/conf.d} creation
BuildRequires: nginx
BuildRequires: python3-setuptools
BuildRequires: python3-devel
# Required for python3-asgiref
BuildRequires: %{python_module typing_extensions if %python-base < 3.8}
Requires(post): sudo
%if 0%{?suse_version}
BuildRequires: python-rpm-macros
%endif
# Finds python dependencies based on egg info generated by setup.py
# Theoretically distro independent and should work this way, but has
# quite some pitfalls. Only works after SLE 15 SP2, due to build service
# restrictions (be careful, there they messed it up and
# python_enable_dependency_generator macro is defined, but does not do
# anything. This check still also needs to explicitly check for SLE 15 SP2...
%if 0%{?sle_version} <= 150300
%undefine python_enable_dependency_generator
%undefine python_disable_dependency_generator
%endif
%{?python_enable_dependency_generator}
%if ! (%{defined python_enable_dependency_generator} || %{defined python_disable_dependency_generator})
Requires: python3-Django >= 4.2
Requires: python3-django-extensions
Requires: python3-django-auth-ldap
Requires: python3-djangorestframework
Requires: python3-netaddr
Requires: python3-paramiko
Requires: python3-psycopg2
Requires: python3-ldap
Requires: python3-validators
Requires: python3-terminado
Requires: python3-tornado
%endif
# Needed to install /etc/logrotate.d/orthos2
Requires: python3-Django >= 4.2
Requires: logrotate
Requires: nginx
Requires: ansible
Requires: uwsgi
Requires: uwsgi-python3
Requires: /sbin/service
Provides: orthos2-%{version}-%{release}
%description
Orthos is the machine administration tool of the development network at SUSE. It is used for following tasks:
getting the state of the machine
overview about the hardware
overview about the installed software (installations)
reservation of the machines
generating the DHCP configuration (via Cobbler)
reboot the machines remotely
managing remote (serial) consoles
%package docs
Summary: HTML documentation for orthos2
BuildRequires: python3-django >= 3.2
BuildRequires: python3-django-auth-ldap
BuildRequires: python3-django-extensions
BuildRequires: python3-paramiko
BuildRequires: python3-djangorestframework
BuildRequires: python3-validators
BuildRequires: python3-netaddr
BuildRequires: python3-ldap
BuildRequires: python3-sphinx_rtd_theme
BuildRequires: python3-Sphinx
%define orthos_web_docs /srv/www/orthos2/docs
%description docs
HTML documentation that can be put into a web servers htdocs directory for publishing.
%prep
%autosetup
%build
%py3_build
cd docs
make html
%install
%py3_install
# docs
mkdir -p %{buildroot}%{orthos_web_docs}
# client is built via separate spec file to reduce build dependencies
rm %{buildroot}/usr/bin/orthos2
cp -r docs/_build/html/* %{buildroot}%{orthos_web_docs}
%fdupes %{buildroot}/%{orthos_web_docs}
#systemd
ln -sr %{buildroot}%{python3_sitelib}/orthos2 %{buildroot}/usr/lib/orthos2/orthos2
cp -r ansible %{buildroot}/usr/lib/orthos2/ansible
%pre
getent group orthos >/dev/null || groupadd -r orthos
getent passwd orthos >/dev/null || \
useradd -r -g orthos -d /var/lib/orthos2 -s /bin/bash \
-c "Useful comment about the purpose of this account" orthos
%service_add_pre orthos2.service orthos2_taskmanager.service orthos2.socket orthos2_debug.service
%post
%tmpfiles_create %{_tmpfilesdir}/%{name}.conf
%service_add_post orthos2.service orthos2_taskmanager.service orthos2.socket orthos2_debug.service
orthos-admin migrate
orthos-admin collectstatic --noinput
%preun
%service_del_preun orthos2.service orthos2_taskmanager.service orthos2.socket orthos2_debug.service
%postun
%service_del_postun orthos2.service orthos2_taskmanager.service orthos2.socket orthos2_debug.service
%files
%{python3_sitelib}/orthos2-*
%{_unitdir}/orthos2_taskmanager.service
%{_unitdir}/orthos2.service
%{_unitdir}/orthos2_debug.service
%{_unitdir}/orthos2.socket
%{_tmpfilesdir}/orthos2.conf
%dir %{python3_sitelib}/orthos2/
%{python3_sitelib}/orthos2/*
%dir %{_sysconfdir}/orthos2
%config %{_sysconfdir}/orthos2/orthos2.ini
%config %{_sysconfdir}/orthos2/settings
%config %{_sysconfdir}/logrotate.d/orthos2
%config(noreplace) %{_sysconfdir}/nginx/conf.d/orthos2_nginx.conf
%dir /usr/lib/orthos2
%dir /usr/lib/orthos2/scripts
%dir /usr/share/orthos2
%dir /usr/share/orthos2/fixtures
/usr/share/orthos2/fixtures/*
/usr/lib/orthos2/*
%attr(755,orthos,orthos) %{_bindir}/orthos-admin
%attr(755,orthos,orthos) %dir /srv/www/orthos2
%ghost %dir /run/%{name}
%ghost %dir /run/%{name}/ansible
%ghost %dir /run/%{name}/ansible_lastrun
%ghost %dir /run/%{name}/ansible_archive
%attr(755,orthos,orthos) %dir /var/log/orthos2
%attr(775,orthos,orthos) %dir /var/lib/orthos2
%attr(775,orthos,orthos) %dir /var/lib/orthos2/archiv
%attr(775,orthos,orthos) %dir /var/lib/orthos2/orthos-vm-images
%attr(775,orthos,orthos) %dir /var/lib/orthos2/database
%attr(700,orthos,orthos) %dir /var/lib/orthos2/.ssh
# defattr(fileattr, user, group, dirattr)
# Add whole ansible directory with correct attr for dirs and files
# Always keep this at the end with defattr
%defattr(664, orthos, orthos, 775)
/usr/lib/orthos2/ansible
%files docs
%dir %{orthos_web_docs}
%{orthos_web_docs}/*
%changelog
* Tue Sep 15 00:26:20 UTC 2020 - Thomas Renninger <trenn@suse.de>
- First submissions