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

  ViewVC Help
Powered by ViewVC 1.1.30