/[packages]/cauldron/openqa/current/SPECS/openqa.spec
ViewVC logotype

Contents of /cauldron/openqa/current/SPECS/openqa.spec

Parent Directory Parent Directory | Revision Log Revision Log


Revision 913547 - (show annotations) (download)
Tue Dec 22 16:52:44 2015 UTC (8 years, 4 months ago) by doktor5000
File size: 13507 byte(s)
- adapt to Mageia
- added versionned BuildRequires on ruby-sass to ensure working version
- added comment on usage of %%requires_eq why it might break parsing the .spec
- fixed %%pre useradd for user _openqa-worker as we don't have a qemu group
- replace Requires on httpd by virtual "webserver" Requires
- replace Requires on sqlite by sqlite3-tools, as we have both sqlite versions
- add version and comment for explicit Requires on perl(Mojolicious)
- add comment on other explicit Requires on perl modules
- add comment on usage of %%t_requires for Requires and BuildRequires
- add comment on %%requires_eq usage
- enable tests
- removed bogus Requires(post) on coreutils (SILENT)
- fix Group (SILENT)

1 # 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 %if %{undefined tmpfiles_create}
22 %global tmpfiles_create() \
23 systemd-tmpfiles --create %{?*} >/dev/null 2>&1 || :
24 %{nil}
25 %endif
26
27 Name: openqa
28 Version: %{github_version}
29 Release: %mkrel 1%{?github_date:.%{github_date}git%{shortcommit}}
30 Summary: The openQA web-frontend, scheduler and tools
31 License: GPLv2+
32 Group: Development/Tools
33 Url: http://os-autoinst.github.io/openQA/
34 Source0: https://github.com/%{github_owner}/%{github_name}/archive/%{github_commit}/%{github_name}-%{github_commit}.tar.gz
35 # Backport: add my admin user creation script
36 # https://github.com/os-autoinst/openQA/commit/3678b8599f5fc269b24b62eb2efecc0169a64264
37 Patch0: 0001-add-a-script-to-create-admin-user-and-API-key.patch
38 # Backport: don't make sqlite db world-readable
39 # https://github.com/os-autoinst/openQA/commit/ca5371222096d4fb347124a353a9d868acf40c76
40 Patch1: 0001-the-sqlite-database-should-be-only-readable-by-the-o.patch
41 # Backport: improve branding (removes the SUSE navbar)
42 # https://github.com/os-autoinst/openQA/commit/fbe15becd89f0dc278457fd8f25b87e43d60079c
43 # https://github.com/os-autoinst/openQA/commit/ab76b525eb9d436ecc5f3395cd7de89a0e272e86
44 Patch2: 0001-replace-tabs-with-spaces.patch
45 Patch3: 0002-Improve-web-UI-branding-mechanism-drop-topbar-in-pla.patch
46 Requires(post): sqlite3-tools
47 BuildRequires: os-autoinst
48 Requires: openqa-common = %{version}
49 Requires: perl(URI)
50 # (doktor5000) require a working version, see (mga#17345)
51 BuildRequires: ruby-sass >= 3.4.20
52 # needed for openid support
53 Requires: perl(LWP::Protocol::https)
54 # (doktor5000) require virtual provides "webserver" instead of apache directly
55 Requires: webserver
56 # Recommends: logrotate
57 # for postgresql
58 # Recommends: perl(DateTime::Format::Pg) perl(DBD::Pg)
59
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 # 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) require minimum version, automatic requires generation detects this only as unversionned perl(Mojolicious::Lite)
66 Requires: perl(Mojolicious) >= 5.60
67 # (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 # 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 BuildRequires: phantomjs
81 %endif
82 BuildRequires: perl(Selenium::Remote::Driver)
83 BuildRequires: perl(Test::Compile)
84 BuildRequires: perl(DBIx::Class::DeploymentHandler)
85 Requires(post): perl(DBIx::Class::DeploymentHandler)
86 # (doktor5000) versionned Requires might be important for backports, we need is_literal_value function
87 BuildRequires: perl(SQL::Abstract) >= 1.790.0
88 BuildRequires: perl(SQL::SplitStatement)
89 # (doktor5000) not detected by automatic Requires generation
90 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 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 %requires_eq perl-Mojolicious-Plugin-Bootstrap3 perl-Mojolicious-Plugin-AssetPack
110
111 # (doktor5000) recommend the workers subpackage - for a casual install of all openqa components on one server
112 Recommends: %{name}-worker
113
114 %description
115 The openQA framework consists of two parts, which are tracked in
116 separate git repositories. The OS-autoinst test engine and the front-end
117 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 Group: Development/Tools
123 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 Group: Development/Tools
132 Requires: openqa-common = %{version}-%{release}
133 Requires(post): coreutils
134 Requires(post): os-autoinst >= 4
135 Requires: os-autoinst < 5
136 # (doktor5000) needed in pre for the qemu user/group to exist, but we don't have a qemu user/group
137 Requires: qemu
138 # (doktor5000) not detected by automatic Requires generation
139 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 %make
159
160 %check
161 # we don't really need the tidy test
162 rm -f t/00-tidy.t
163 #
164 #make test
165 %make test
166 #prove -r
167
168 %install
169 %make_install
170 mkdir -p %{buildroot}%{_datadir}/openqa/etc/openqa
171 ln -s %{_sysconfdir}/openqa/openqa.ini %{buildroot}%{_datadir}/openqa/etc/openqa/openqa.ini
172 ln -s %{_sysconfdir}/openqa/database.ini %{buildroot}%{_datadir}/openqa/etc/openqa/database.ini
173
174 rm -rf /tmp/etc_openqa
175 cp -a etc/openqa /tmp/etc_openqa
176 export OPENQA_CONFIG=/tmp/etc_openqa
177 export OPENQA_LOGFILE=/tmp/logfile
178 rm -rf /tmp/db
179 mkdir -p /tmp/db
180 sed -i -e 's,/var/lib/openqa/db,/tmp/db,' /tmp/etc_openqa/database.ini
181 # strange way to precompile assets :)
182 ./script/initdb --init_database
183 ./script/openqa version -m production
184 cp -a public/packed %{buildroot}%{_datadir}/openqa/public/
185
186 cd %buildroot
187 grep -rl /usr/bin/env . | while read file; do
188 sed -e 's,/usr/bin/env perl,/usr/bin/perl,' -i $file
189 done
190 # Mojo cannot create a logfile if it doesn't exist: https://bugs.launchpad.net/mojo/+bug/1474224
191 # So we need to pre-create it, but we don't want it owned by the package, so
192 # you don't lose logs on package uninstall. So we ghost it in the package
193 # and create it in post. Here, we create it in the buildroot so it can be
194 # ghosted.
195 install -D -m 644 /dev/null %{buildroot}%{_localstatedir}/log/openqa
196 #
197 mkdir %{buildroot}%{_localstatedir}/lib/openqa/pool/1
198 #
199
200 # We don't do AppArmor
201 rm -rf %{buildroot}%{_sysconfdir}/apparmor.d
202
203 %pre
204 getent group geekotest >/dev/null || groupadd -r geekotest
205 getent passwd geekotest >/dev/null || \
206 useradd -r -g geekotest -d /var/lib/openqa -s /sbin/nologin \
207 -c "openQA user" geekotest
208 exit 0
209
210 %pre worker
211 getent group _openqa-worker >/dev/null || groupadd -r _openqa-worker
212 getent passwd _openqa-worker >/dev/null || \
213 # (doktor5000) we don't have a qemu group, check if permissions of normal user suffice
214 useradd -r -g _openqa-worker -d /dev/null -s /sbin/nologin \
215 -c "openQA worker" _openqa-worker
216 exit 0
217
218 %post
219 # install empty log file (see above for reasoning)
220 if [ ! -e /var/log/openqa ]; then
221 install -D -m 644 -o geekotest /dev/null %{_localstatedir}/log/openqa || :
222 fi
223
224 # do database
225 if [ $1 -eq 1 ]; then
226 /usr/share/openqa/script/initdb --user geekotest --init_database || :
227
228 echo "### copy and edit /etc/httpd/conf.d/openqa.conf.template!"
229 fi
230
231 %systemd_post %openqa_services
232
233 %post worker
234 %tmpfiles_create %{_tmpfilesdir}/openqa.conf
235 %systemd_post %openqa_worker_services
236
237 %preun
238 %systemd_preun %openqa_services
239
240 %preun worker
241 %systemd_preun %openqa_worker_services
242
243 %postun
244 %systemd_postun_with_restart %openqa_services
245
246 %postun worker
247 %systemd_postun_with_restart %openqa_worker_services
248
249 %files
250 %doc README.asciidoc docs/*
251 %dir %{_sysconfdir}/openqa
252 %config(noreplace) %attr(-,geekotest,root) %{_sysconfdir}/openqa/openqa.ini
253 %config(noreplace) %attr(-,geekotest,root) %{_sysconfdir}/openqa/database.ini
254 %dir %{_datadir}/openqa
255 %dir %{_datadir}/openqa/etc
256 %dir %{_datadir}/openqa/etc/openqa
257 %{_datadir}/openqa/etc/openqa/openqa.ini
258 %{_datadir}/openqa/etc/openqa/database.ini
259 %config %{_sysconfdir}/logrotate.d
260 %config(noreplace) %{_sysconfdir}/dbus-1/system.d/org.opensuse.openqa.conf
261 # apache vhost
262 %dir %{_sysconfdir}/httpd
263 %dir %{_sysconfdir}/httpd/conf.d
264 %config %{_sysconfdir}/httpd/conf.d/openqa.conf.template
265 %config %{_sysconfdir}/httpd/conf.d/openqa-common.inc
266 %config %{_sysconfdir}/httpd/conf.d/openqa-ssl.conf.template
267 # init
268 %dir %{_unitdir}
269 %{_unitdir}/openqa-webui.service
270 %{_unitdir}/openqa-gru.service
271 %{_unitdir}/openqa-scheduler.service
272 %{_unitdir}/openqa-websockets.service
273 # web libs
274 %{_datadir}/openqa/templates
275 %{_datadir}/openqa/public
276 %{_datadir}/openqa/dbicdh
277 %{_datadir}/openqa/script/backlog
278 %{_datadir}/openqa/script/check_dependencies
279 %{_datadir}/openqa/script/clean_needles
280 %{_datadir}/openqa/script/client
281 %{_datadir}/openqa/script/clone_job.pl
282 %{_datadir}/openqa/script/create_admin
283 %{_datadir}/openqa/script/dump_templates
284 %{_datadir}/openqa/script/fetchneedles
285 %{_datadir}/openqa/script/initdb
286 %{_datadir}/openqa/script/load_templates
287 %{_datadir}/openqa/script/openqa
288 %{_datadir}/openqa/script/openqa-scheduler
289 %{_datadir}/openqa/script/openqa-websockets
290 %{_datadir}/openqa/script/tidy
291 %{_datadir}/openqa/script/upgradedb
292 %{_datadir}/openqa/script/migrate_images
293 # TODO: define final user
294 %defattr(-,geekotest,root)
295 # attention: never package subdirectories owned by a user other
296 # than root as that opens a security hole!
297 %dir %{_localstatedir}/lib/openqa/db
298 %dir %{_localstatedir}/lib/openqa/images
299 %{_localstatedir}/lib/openqa/testresults
300 %dir %{_localstatedir}/lib/openqa/share
301 %dir %{_localstatedir}/lib/openqa/share/tests
302 %dir %{_localstatedir}/lib/openqa/share/factory
303 %ghost %attr(0640,geekotest,root) %{_localstatedir}/lib/openqa/db/db.sqlite
304 %ghost %{_localstatedir}/log/openqa
305
306 %files common
307 %dir %{_datadir}/openqa
308 %{_datadir}/openqa/lib
309 %dir %{_localstatedir}/lib/openqa
310 %{_localstatedir}/lib/openqa/factory
311 %{_localstatedir}/lib/openqa/script
312 %{_localstatedir}/lib/openqa/tests
313
314 %files worker
315 %config(noreplace) %attr(0400,_openqa-worker,root) %{_sysconfdir}/openqa/client.conf
316 %config(noreplace) %{_sysconfdir}/openqa/workers.ini
317 # init
318 %dir %{_unitdir}
319 %{_prefix}/lib/systemd/system-generators
320 %{_unitdir}/openqa-worker.target
321 %{_unitdir}/openqa-worker@.service
322 %{_unitdir}/openqa-slirpvde.service
323 %{_unitdir}/openqa-vde_switch.service
324 %{_tmpfilesdir}/openqa.conf
325 %ghost %dir %{_rundir}/openqa
326 # worker libs
327 %dir %{_datadir}/openqa
328 %dir %{_datadir}/openqa/script
329 %{_datadir}/openqa/script/worker
330 %dir %{_localstatedir}/lib/openqa/pool
331 %defattr(-,_openqa-worker,root)
332 # own one pool - to create the others is task of the admin
333 %dir %{_localstatedir}/lib/openqa/pool/1
334

  ViewVC Help
Powered by ViewVC 1.1.30