1 |
doktor5000 |
913541 |
# Fedora spec initially based on upstream spec file from OBS: |
2 |
|
|
# https://build.opensuse.org/package/view_file/devel:openQA/openQA/openQA.spec |
3 |
|
|
# License: GPLv2+ |
4 |
|
|
|
5 |
|
|
# openQA doesn't provide its own libs as they're not in the path, |
6 |
|
|
# so we need to exclude the auto-requires for them |
7 |
|
|
%global __requires_exclude perl\\(OpenQA |
8 |
|
|
|
9 |
|
|
%global github_owner os-autoinst |
10 |
|
|
%global github_name openQA |
11 |
|
|
%global github_version 4.2 |
12 |
|
|
%global github_commit 9953cb8cc89f4e9187f4209035ce2990dbf544cc |
13 |
|
|
# if set, will be a post-release snapshot build, otherwise a 'normal' build |
14 |
|
|
#global github_date 20150814 |
15 |
|
|
%global shortcommit %(c=%{github_commit}; echo ${c:0:7}) |
16 |
|
|
|
17 |
|
|
# can't use linebreaks here! |
18 |
|
|
%global openqa_services openqa-webui.service openqa-gru.service openqa-websockets.service openqa-scheduler.service |
19 |
|
|
%global openqa_worker_services openqa-worker.target openqa-worker@.service openqa-slirpvde.service openqa-vde_switch.service |
20 |
|
|
|
21 |
|
|
Name: openqa |
22 |
|
|
Version: %{github_version} |
23 |
doktor5000 |
922878 |
Release: %mkrel 4%{?github_date:.%{github_date}git%{shortcommit}} |
24 |
doktor5000 |
913541 |
Summary: The openQA web-frontend, scheduler and tools |
25 |
|
|
License: GPLv2+ |
26 |
doktor5000 |
913547 |
Group: Development/Tools |
27 |
doktor5000 |
913541 |
Url: http://os-autoinst.github.io/openQA/ |
28 |
|
|
Source0: https://github.com/%{github_owner}/%{github_name}/archive/%{github_commit}/%{github_name}-%{github_commit}.tar.gz |
29 |
|
|
# Backport: add my admin user creation script |
30 |
|
|
# https://github.com/os-autoinst/openQA/commit/3678b8599f5fc269b24b62eb2efecc0169a64264 |
31 |
|
|
Patch0: 0001-add-a-script-to-create-admin-user-and-API-key.patch |
32 |
|
|
# Backport: don't make sqlite db world-readable |
33 |
|
|
# https://github.com/os-autoinst/openQA/commit/ca5371222096d4fb347124a353a9d868acf40c76 |
34 |
|
|
Patch1: 0001-the-sqlite-database-should-be-only-readable-by-the-o.patch |
35 |
|
|
# Backport: improve branding (removes the SUSE navbar) |
36 |
|
|
# https://github.com/os-autoinst/openQA/commit/fbe15becd89f0dc278457fd8f25b87e43d60079c |
37 |
|
|
# https://github.com/os-autoinst/openQA/commit/ab76b525eb9d436ecc5f3395cd7de89a0e272e86 |
38 |
|
|
Patch2: 0001-replace-tabs-with-spaces.patch |
39 |
|
|
Patch3: 0002-Improve-web-UI-branding-mechanism-drop-topbar-in-pla.patch |
40 |
doktor5000 |
916624 |
Requires(pre): rpm-helper >= %{rpmhelper_required_version} |
41 |
|
|
Requires(post): rpm-helper >= %{rpmhelper_required_version} |
42 |
doktor5000 |
913547 |
Requires(post): sqlite3-tools |
43 |
|
|
BuildRequires: os-autoinst |
44 |
doktor5000 |
913541 |
Requires: openqa-common = %{version} |
45 |
|
|
Requires: perl(URI) |
46 |
doktor5000 |
913547 |
# (doktor5000) require a working version, see (mga#17345) |
47 |
|
|
BuildRequires: ruby-sass >= 3.4.20 |
48 |
doktor5000 |
913541 |
# needed for openid support |
49 |
|
|
Requires: perl(LWP::Protocol::https) |
50 |
doktor5000 |
922878 |
# (doktor5000) require apache directly to ease setup as upstream template configs assume apache |
51 |
|
|
Requires: httpd |
52 |
|
|
# (doktor5000) pull in additional required apache modules |
53 |
|
|
Requires: apache-mod_proxy |
54 |
|
|
Requires: apache-mod_proxy_html |
55 |
|
|
|
56 |
doktor5000 |
913541 |
# Recommends: logrotate |
57 |
|
|
# for postgresql |
58 |
|
|
# Recommends: perl(DateTime::Format::Pg) perl(DBD::Pg) |
59 |
doktor5000 |
913547 |
|
60 |
|
|
# (doktor5000) perl Requires are autodetected, explicit Requires are disregarded |
61 |
|
|
# FIXME: this macro is used for packages that are both BuildRequires and Requires |
62 |
doktor5000 |
913541 |
# runtime requirements that also the testsuite needs |
63 |
|
|
%define t_requires perl(DBD::SQLite) perl(DBIx::Class) perl(Config::IniFiles) perl(SQL::Translator) perl(Date::Format) perl(File::Copy::Recursive) perl(DateTime::Format::SQLite) perl(Net::OpenID::Consumer) perl(Mojolicious::Plugin::RenderFile) perl(Mojolicious::Plugin::AssetPack) perl(YAML) perl(aliased) perl(Config::Tiny) perl(DBIx::Class::DynamicDefault) perl(DBIx::Class::Schema::Config) perl(DBIx::Class::Storage::Statistics) perl(IO::Socket::INET6) perl(IO::Socket::SSL) perl(Data::Dump) perl(DBIx::Class::OptimisticLocking) perl(Mojolicious::Plugin::Bootstrap3) perl(Text::Markdown) perl(Net::DBus) perl(IPC::Run) |
64 |
|
|
BuildRequires: perl(Mojolicious) >= 5.60 |
65 |
doktor5000 |
913547 |
# (doktor5000) require minimum version, automatic requires generation detects this only as unversionned perl(Mojolicious::Lite) |
66 |
doktor5000 |
913541 |
Requires: perl(Mojolicious) >= 5.60 |
67 |
doktor5000 |
913547 |
# (doktor5000) require minimum version for critical bug fix |
68 |
|
|
# our perl module versioning differs from fedora |
69 |
|
|
# mga5 only has 0.82.700, might be important for backports |
70 |
|
|
BuildRequires: perl(DBIx::Class) >= 0.82.801 |
71 |
|
|
Requires: perl(DBIx::Class) >= 0.82.801 |
72 |
doktor5000 |
913541 |
# needed for test suite |
73 |
|
|
BuildRequires: git |
74 |
|
|
# needed for saving needles optimized |
75 |
|
|
Requires: optipng |
76 |
|
|
BuildRequires: %{t_requires} |
77 |
|
|
Requires: dbus |
78 |
|
|
%ifarch %x86 x86_64 |
79 |
|
|
# These two are only used for some tests, we can skip 'em for now |
80 |
doktor5000 |
913547 |
BuildRequires: phantomjs |
81 |
doktor5000 |
913541 |
%endif |
82 |
doktor5000 |
913547 |
BuildRequires: perl(Selenium::Remote::Driver) |
83 |
doktor5000 |
913541 |
BuildRequires: perl(Test::Compile) |
84 |
|
|
BuildRequires: perl(DBIx::Class::DeploymentHandler) |
85 |
|
|
Requires(post): perl(DBIx::Class::DeploymentHandler) |
86 |
doktor5000 |
913547 |
# (doktor5000) versionned Requires might be important for backports, we need is_literal_value function |
87 |
|
|
BuildRequires: perl(SQL::Abstract) >= 1.790.0 |
88 |
doktor5000 |
913541 |
BuildRequires: perl(SQL::SplitStatement) |
89 |
doktor5000 |
913547 |
# (doktor5000) not detected by automatic Requires generation |
90 |
doktor5000 |
913541 |
Requires(post): perl(SQL::SplitStatement) |
91 |
|
|
BuildRequires: systemd |
92 |
|
|
%{?systemd_requires} |
93 |
|
|
# if EV is installed, Mojolicious will use it; but then workers won't |
94 |
|
|
# work, because EV conflicts with interpreter threads. |
95 |
|
|
# https://github.com/os-autoinst/openQA/issues/450 |
96 |
|
|
# FIXME: this may actually need to be in -worker, I'm not sure if |
97 |
|
|
# it's the webUI or the worker where we need to make sure EV is not |
98 |
|
|
# present (or both). |
99 |
|
|
Conflicts: perl(EV) |
100 |
|
|
BuildArch: noarch |
101 |
|
|
# we need to have the same sha1 as expected |
102 |
doktor5000 |
913547 |
BuildRequires: perl-Mojolicious-Plugin-Bootstrap3 perl-Mojolicious-Plugin-AssetPack |
103 |
|
|
|
104 |
|
|
# (doktor5000) requires_eq might be expanded before BuildRequires have been resolved/satisfied, hence breaks spec parsing |
105 |
|
|
# see https://bugzilla.novell.com/show_bug.cgi?id=888467 for related information |
106 |
|
|
# and http://comments.gmane.org/gmane.linux.suse.opensuse.packaging/14693 |
107 |
|
|
|
108 |
|
|
# this is used to have the exact same versions as Requires wich where used as BuildRequires |
109 |
doktor5000 |
913541 |
%requires_eq perl-Mojolicious-Plugin-Bootstrap3 perl-Mojolicious-Plugin-AssetPack |
110 |
|
|
|
111 |
doktor5000 |
913547 |
# (doktor5000) recommend the workers subpackage - for a casual install of all openqa components on one server |
112 |
|
|
Recommends: %{name}-worker |
113 |
|
|
|
114 |
doktor5000 |
913541 |
%description |
115 |
|
|
The openQA framework consists of two parts, which are tracked in |
116 |
doktor5000 |
913547 |
separate git repositories. The OS-autoinst test engine and the front-end |
117 |
doktor5000 |
913541 |
with web-interface, test-scheduler and other high-level logic, which |
118 |
|
|
is part of this repo. |
119 |
|
|
|
120 |
|
|
%package common |
121 |
|
|
Summary: The openQA common tools for web-frontend and workers |
122 |
doktor5000 |
913547 |
Group: Development/Tools |
123 |
doktor5000 |
913541 |
Requires: %{t_requires} |
124 |
|
|
|
125 |
|
|
%description common |
126 |
|
|
This package contain shared resources for openQA web-frontend and |
127 |
|
|
openQA workers. |
128 |
|
|
|
129 |
|
|
%package worker |
130 |
|
|
Summary: The openQA worker |
131 |
doktor5000 |
913547 |
Group: Development/Tools |
132 |
doktor5000 |
913541 |
Requires: openqa-common = %{version}-%{release} |
133 |
|
|
Requires(post): coreutils |
134 |
|
|
Requires(post): os-autoinst >= 4 |
135 |
|
|
Requires: os-autoinst < 5 |
136 |
doktor5000 |
913547 |
# (doktor5000) needed in pre for the qemu user/group to exist, but we don't have a qemu user/group |
137 |
doktor5000 |
913541 |
Requires: qemu |
138 |
doktor5000 |
913547 |
# (doktor5000) not detected by automatic Requires generation |
139 |
doktor5000 |
913541 |
Requires: perl(SQL::SplitStatement) |
140 |
|
|
|
141 |
|
|
%description worker |
142 |
|
|
The openQA worker manages test engine (provided by os-autoinst package). |
143 |
|
|
|
144 |
|
|
%prep |
145 |
|
|
%autosetup -p1 -n %{github_name}-%{github_commit} |
146 |
|
|
# GNU patch doesn't apply file mode? This goes with Patch0 |
147 |
|
|
chmod 0755 script/create_admin |
148 |
|
|
# Fedora calls it httpd.service, SUSE calls it apache2.service... |
149 |
|
|
sed -i -e 's,apache2\.service,httpd\.service,g' systemd/*.service |
150 |
|
|
# ...Fedora keeps httpd config here, SUSE keeps it there. |
151 |
|
|
sed -i -e 's,"$(DESTDIR)"/etc/apache2/vhosts.d,"$(DESTDIR)"%{_sysconfdir}/httpd/conf.d,g' Makefile |
152 |
|
|
sed -i -e 's,/etc/apache2/vhosts.d,%{_sysconfdir}/httpd/conf.d,g' etc/apache2/vhosts.d/* |
153 |
|
|
# These are the Fedora-y standard TLS cert/key locations. |
154 |
|
|
sed -i -e 's,/etc/apache2/ssl.crt,%{_sysconfdir}/pki/tls/certs,g' etc/apache2/vhosts.d/* |
155 |
|
|
sed -i -e 's,/etc/apache2/ssl.key,%{_sysconfdir}/pki/tls/private,g' etc/apache2/vhosts.d/* |
156 |
|
|
|
157 |
|
|
%build |
158 |
doktor5000 |
913547 |
%make |
159 |
doktor5000 |
913541 |
|
160 |
|
|
%check |
161 |
|
|
# we don't really need the tidy test |
162 |
|
|
rm -f t/00-tidy.t |
163 |
doktor5000 |
916624 |
|
164 |
doktor5000 |
913547 |
%make test |
165 |
doktor5000 |
913541 |
|
166 |
|
|
%install |
167 |
|
|
%make_install |
168 |
|
|
mkdir -p %{buildroot}%{_datadir}/openqa/etc/openqa |
169 |
|
|
ln -s %{_sysconfdir}/openqa/openqa.ini %{buildroot}%{_datadir}/openqa/etc/openqa/openqa.ini |
170 |
|
|
ln -s %{_sysconfdir}/openqa/database.ini %{buildroot}%{_datadir}/openqa/etc/openqa/database.ini |
171 |
|
|
|
172 |
|
|
rm -rf /tmp/etc_openqa |
173 |
|
|
cp -a etc/openqa /tmp/etc_openqa |
174 |
|
|
export OPENQA_CONFIG=/tmp/etc_openqa |
175 |
|
|
export OPENQA_LOGFILE=/tmp/logfile |
176 |
|
|
rm -rf /tmp/db |
177 |
|
|
mkdir -p /tmp/db |
178 |
|
|
sed -i -e 's,/var/lib/openqa/db,/tmp/db,' /tmp/etc_openqa/database.ini |
179 |
|
|
# strange way to precompile assets :) |
180 |
|
|
./script/initdb --init_database |
181 |
|
|
./script/openqa version -m production |
182 |
|
|
cp -a public/packed %{buildroot}%{_datadir}/openqa/public/ |
183 |
|
|
|
184 |
|
|
cd %buildroot |
185 |
|
|
grep -rl /usr/bin/env . | while read file; do |
186 |
|
|
sed -e 's,/usr/bin/env perl,/usr/bin/perl,' -i $file |
187 |
|
|
done |
188 |
|
|
# Mojo cannot create a logfile if it doesn't exist: https://bugs.launchpad.net/mojo/+bug/1474224 |
189 |
|
|
# So we need to pre-create it, but we don't want it owned by the package, so |
190 |
|
|
# you don't lose logs on package uninstall. So we ghost it in the package |
191 |
|
|
# and create it in post. Here, we create it in the buildroot so it can be |
192 |
|
|
# ghosted. |
193 |
|
|
install -D -m 644 /dev/null %{buildroot}%{_localstatedir}/log/openqa |
194 |
|
|
# |
195 |
|
|
mkdir %{buildroot}%{_localstatedir}/lib/openqa/pool/1 |
196 |
|
|
# |
197 |
|
|
|
198 |
|
|
# We don't do AppArmor |
199 |
|
|
rm -rf %{buildroot}%{_sysconfdir}/apparmor.d |
200 |
|
|
|
201 |
|
|
%pre |
202 |
doktor5000 |
916624 |
%_pre_useradd geekotest /var/lib/openqa /sbin/nologin |
203 |
doktor5000 |
913541 |
|
204 |
|
|
%pre worker |
205 |
doktor5000 |
916624 |
# (doktor5000) fedora seems to use qemu group to control qemu access |
206 |
|
|
# we don't have a qemu group, check if permissions of normal system user suffice |
207 |
|
|
%_pre_useradd _openqa-worker /dev/null /sbin/nologin |
208 |
doktor5000 |
913541 |
|
209 |
|
|
%post |
210 |
|
|
# install empty log file (see above for reasoning) |
211 |
|
|
if [ ! -e /var/log/openqa ]; then |
212 |
|
|
install -D -m 644 -o geekotest /dev/null %{_localstatedir}/log/openqa || : |
213 |
|
|
fi |
214 |
|
|
|
215 |
|
|
# do database |
216 |
|
|
if [ $1 -eq 1 ]; then |
217 |
|
|
/usr/share/openqa/script/initdb --user geekotest --init_database || : |
218 |
|
|
|
219 |
|
|
echo "### copy and edit /etc/httpd/conf.d/openqa.conf.template!" |
220 |
|
|
fi |
221 |
|
|
|
222 |
|
|
%systemd_post %openqa_services |
223 |
|
|
|
224 |
|
|
%post worker |
225 |
|
|
%tmpfiles_create %{_tmpfilesdir}/openqa.conf |
226 |
|
|
%systemd_post %openqa_worker_services |
227 |
|
|
|
228 |
|
|
%preun |
229 |
|
|
%systemd_preun %openqa_services |
230 |
|
|
|
231 |
|
|
%preun worker |
232 |
|
|
%systemd_preun %openqa_worker_services |
233 |
|
|
|
234 |
|
|
%postun |
235 |
|
|
%systemd_postun_with_restart %openqa_services |
236 |
|
|
|
237 |
|
|
%postun worker |
238 |
|
|
%systemd_postun_with_restart %openqa_worker_services |
239 |
|
|
|
240 |
|
|
%files |
241 |
|
|
%doc README.asciidoc docs/* |
242 |
|
|
%dir %{_sysconfdir}/openqa |
243 |
|
|
%config(noreplace) %attr(-,geekotest,root) %{_sysconfdir}/openqa/openqa.ini |
244 |
|
|
%config(noreplace) %attr(-,geekotest,root) %{_sysconfdir}/openqa/database.ini |
245 |
|
|
%dir %{_datadir}/openqa |
246 |
|
|
%dir %{_datadir}/openqa/etc |
247 |
|
|
%dir %{_datadir}/openqa/etc/openqa |
248 |
|
|
%{_datadir}/openqa/etc/openqa/openqa.ini |
249 |
|
|
%{_datadir}/openqa/etc/openqa/database.ini |
250 |
|
|
%config %{_sysconfdir}/logrotate.d |
251 |
|
|
%config(noreplace) %{_sysconfdir}/dbus-1/system.d/org.opensuse.openqa.conf |
252 |
|
|
# apache vhost |
253 |
|
|
%dir %{_sysconfdir}/httpd |
254 |
|
|
%dir %{_sysconfdir}/httpd/conf.d |
255 |
|
|
%config %{_sysconfdir}/httpd/conf.d/openqa.conf.template |
256 |
|
|
%config %{_sysconfdir}/httpd/conf.d/openqa-common.inc |
257 |
|
|
%config %{_sysconfdir}/httpd/conf.d/openqa-ssl.conf.template |
258 |
|
|
# init |
259 |
|
|
%dir %{_unitdir} |
260 |
|
|
%{_unitdir}/openqa-webui.service |
261 |
|
|
%{_unitdir}/openqa-gru.service |
262 |
|
|
%{_unitdir}/openqa-scheduler.service |
263 |
|
|
%{_unitdir}/openqa-websockets.service |
264 |
|
|
# web libs |
265 |
|
|
%{_datadir}/openqa/templates |
266 |
|
|
%{_datadir}/openqa/public |
267 |
|
|
%{_datadir}/openqa/dbicdh |
268 |
|
|
%{_datadir}/openqa/script/backlog |
269 |
|
|
%{_datadir}/openqa/script/check_dependencies |
270 |
|
|
%{_datadir}/openqa/script/clean_needles |
271 |
|
|
%{_datadir}/openqa/script/client |
272 |
|
|
%{_datadir}/openqa/script/clone_job.pl |
273 |
|
|
%{_datadir}/openqa/script/create_admin |
274 |
|
|
%{_datadir}/openqa/script/dump_templates |
275 |
|
|
%{_datadir}/openqa/script/fetchneedles |
276 |
|
|
%{_datadir}/openqa/script/initdb |
277 |
|
|
%{_datadir}/openqa/script/load_templates |
278 |
|
|
%{_datadir}/openqa/script/openqa |
279 |
|
|
%{_datadir}/openqa/script/openqa-scheduler |
280 |
|
|
%{_datadir}/openqa/script/openqa-websockets |
281 |
|
|
%{_datadir}/openqa/script/tidy |
282 |
|
|
%{_datadir}/openqa/script/upgradedb |
283 |
|
|
%{_datadir}/openqa/script/migrate_images |
284 |
|
|
# TODO: define final user |
285 |
|
|
%defattr(-,geekotest,root) |
286 |
|
|
# attention: never package subdirectories owned by a user other |
287 |
|
|
# than root as that opens a security hole! |
288 |
|
|
%dir %{_localstatedir}/lib/openqa/db |
289 |
|
|
%dir %{_localstatedir}/lib/openqa/images |
290 |
|
|
%{_localstatedir}/lib/openqa/testresults |
291 |
|
|
%dir %{_localstatedir}/lib/openqa/share |
292 |
|
|
%dir %{_localstatedir}/lib/openqa/share/tests |
293 |
|
|
%dir %{_localstatedir}/lib/openqa/share/factory |
294 |
|
|
%ghost %attr(0640,geekotest,root) %{_localstatedir}/lib/openqa/db/db.sqlite |
295 |
|
|
%ghost %{_localstatedir}/log/openqa |
296 |
|
|
|
297 |
|
|
%files common |
298 |
|
|
%dir %{_datadir}/openqa |
299 |
|
|
%{_datadir}/openqa/lib |
300 |
|
|
%dir %{_localstatedir}/lib/openqa |
301 |
|
|
%{_localstatedir}/lib/openqa/factory |
302 |
|
|
%{_localstatedir}/lib/openqa/script |
303 |
|
|
%{_localstatedir}/lib/openqa/tests |
304 |
|
|
|
305 |
|
|
%files worker |
306 |
|
|
%config(noreplace) %attr(0400,_openqa-worker,root) %{_sysconfdir}/openqa/client.conf |
307 |
|
|
%config(noreplace) %{_sysconfdir}/openqa/workers.ini |
308 |
|
|
# init |
309 |
|
|
%dir %{_unitdir} |
310 |
|
|
%{_prefix}/lib/systemd/system-generators |
311 |
|
|
%{_unitdir}/openqa-worker.target |
312 |
|
|
%{_unitdir}/openqa-worker@.service |
313 |
|
|
%{_unitdir}/openqa-slirpvde.service |
314 |
|
|
%{_unitdir}/openqa-vde_switch.service |
315 |
|
|
%{_tmpfilesdir}/openqa.conf |
316 |
|
|
%ghost %dir %{_rundir}/openqa |
317 |
|
|
# worker libs |
318 |
|
|
%dir %{_datadir}/openqa |
319 |
|
|
%dir %{_datadir}/openqa/script |
320 |
|
|
%{_datadir}/openqa/script/worker |
321 |
|
|
%dir %{_localstatedir}/lib/openqa/pool |
322 |
|
|
%defattr(-,_openqa-worker,root) |
323 |
|
|
# own one pool - to create the others is task of the admin |
324 |
|
|
%dir %{_localstatedir}/lib/openqa/pool/1 |
325 |
|
|
|