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

  ViewVC Help
Powered by ViewVC 1.1.30