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

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

Parent Directory Parent Directory | Revision Log Revision Log


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

  ViewVC Help
Powered by ViewVC 1.1.30