# Fedora spec initially based on upstream spec file from OBS: # https://build.opensuse.org/package/view_file/devel:openQA/openQA/openQA.spec # License: GPLv2+ # openQA has a bunch of private modules (most namespaced but a couple # not), we do not want automatic provides or requires for these # ref https://fedoraproject.org/wiki/Packaging:AutoProvidesAndRequiresFiltering#Perl # but per https://fedorahosted.org/fpc/ticket/591 , these have been # improved, and contrary to the wiki it is safe to set them first and # then call perl_default_filter, the values will be properly merged. # I tried to sell upstream on naming these properly and installing # them to the perl vendor dir, but they wouldn't bite: # https://github.com/os-autoinst/os-autoinst/issues/387 # Despite the apparently-CPAN-like name, DBIx::Class::Timestamps is # installed to openQA's private directory and should be excluded. # perl(Perl::Critic) requirements come from HashKeyQuotes.pm, which is # used only for tests, so we don't want a runtime requirement. %global __provides_exclude_from %{_datadir}/openqa/lib %global __requires_exclude perl\\((OpenQA|DBIx::Class::Timestamps|MojoDebugHandle|db_helpers|db_profiler|Perl::Critic) %{?perl_default_filter} %global github_owner os-autoinst %global github_name openQA %global github_version 4.3 %global github_commit 11f0541f05d7bbc663ae90d6dedefde8d6f03ff4 # if set, will be a post-release snapshot build, otherwise a 'normal' build #global github_date 20150814 %global shortcommit %(c=%{github_commit}; echo ${c:0:7}) # can't use linebreaks here! %global openqa_services openqa-webui.service openqa-gru.service openqa-websockets.service openqa-scheduler.service %global openqa_worker_services openqa-worker.target openqa-worker@.service openqa-slirpvde.service openqa-vde_switch.service %if %{undefined tmpfiles_create} %global tmpfiles_create() \ systemd-tmpfiles --create %{?*} >/dev/null 2>&1 || : %{nil} %endif Name: openqa Version: %{github_version} Release: 7%{?github_date:.%{github_date}git%{shortcommit}}%{?dist} Summary: OS-level automated testing framework License: GPLv2+ Url: http://os-autoinst.github.io/openQA/ Source0: https://github.com/%{github_owner}/%{github_name}/archive/%{github_commit}/%{github_name}-%{github_commit}.tar.gz # Backport: don't slow things down by using dbus for thumbnails # https://github.com/os-autoinst/openQA/commit/5cdcdb062d54f84efb2047a5ab22df511da4aa09 Patch0: 0001-Don-t-rely-on-IPC-for-thumbnails.patch # Backport: stop Gru task barfing on malformed JSON # https://github.com/os-autoinst/openQA/commit/2b26bd4af4917e5753454e9a01be832fc0da7c7c Patch1: 0001-JobModules-details-catch-malformed-JSON-files-517.patch # Backport: fix ISO downloading when ISOURL is specified but not ISO # https://github.com/os-autoinst/openQA/pull/520 Patch2: 0001-job_schedule_iso-fix-when-ISOURL-is-set-but-not-ISO.patch Obsoletes: openqa < 4.3-7 Requires(post): sqlite # This is for tests, currently disabled #BuildRequires: os-autoinst Requires: openqa-common = %{version}-%{release} Requires: perl(URI) BuildRequires: rubygem(sass) # needed for openid support Requires: perl(LWP::Protocol::https) Recommends: logrotate # for postgresql Recommends: perl(DateTime::Format::Pg) perl(DBD::Pg) # runtime requirements that also the testsuite needs %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(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) BuildRequires: perl(Mojolicious) >= 5.60 Requires: perl(Mojolicious) >= 5.60 # critical bug fix BuildRequires: perl(DBIx::Class) >= 0.082801 Requires: perl(DBIx::Class) >= 0.082801 # needed for test suite BuildRequires: git # needed for saving needles optimized Requires: optipng BuildRequires: %{t_requires} Requires: dbus %ifarch %x86 x86_64 # These two are only used for some tests, we can skip 'em for now #BuildRequires: phantomjs %endif #BuildRequires: perl(Selenium::Remote::Driver) BuildRequires: perl(Test::Compile) BuildRequires: perl(Perl::Critic) BuildRequires: perl(DBIx::Class::DeploymentHandler) Requires(post): perl(DBIx::Class::DeploymentHandler) BuildRequires: perl(SQL::SplitStatement) Requires(post): perl(SQL::SplitStatement) Requires(post): coreutils BuildRequires: systemd %{?systemd_requires} # if EV is installed, Mojolicious will use it; but then workers won't # work, because EV conflicts with interpreter threads. # https://github.com/os-autoinst/openQA/issues/450 # FIXME: this may actually need to be in -worker, I'm not sure if # it's the webUI or the worker where we need to make sure EV is not # present (or both). #Conflicts: perl(EV) BuildArch: noarch # we need to have the same sha1 as expected %requires_eq perl-Mojolicious-Plugin-Bootstrap3 perl-Mojolicious-Plugin-AssetPack %description openQA is a framework for operating system-level automated testing. It consists of three parts. This package contains the web interface, API, and scheduler. The worker component, which supervises test execution, is available in the openqa-worker package. The test engine, os-autoinst, is available in the os-autoinst package. %package common Summary: Common components for openQA server and workers Requires: %{t_requires} %description common This package contains shared resources for the openQA server and openQA workers. %package worker Summary: The openQA worker Requires: openqa-common = %{version}-%{release} Requires(post): coreutils Requires: os-autoinst >= 4 Requires: os-autoinst < 5 Requires: qemu Requires: perl(SQL::SplitStatement) %description worker The openQA worker manages the os-autoinst test engine. A system with openqa-worker installed can run an arbitrary number of openQA workers (as many as its hardware can support), each of which will run a single openQA test job at a time, as long as appropriate jobs for the worker are available from the server it is configured to work for. %package httpd Summary: openQA httpd (Apache) integration Requires: httpd Requires: httpd-filesystem # prior to 4.3-7, these files were part of the core package; this is # here so people who had those versions installed don't lose their # bits on update Obsoletes: openqa < 4.3-7 %description httpd This package contains httpd (Apache) configuration for the openQA automated testing framework. openQA runs as a self-contained http server which is expected to be reverse-proxied by a public-facing http server (rather than being accessed directly). The config snippets in this package help you configure openQA to be reverse proxied by httpd. %prep %autosetup -p1 -n %{github_name}-%{github_commit} # Fedora calls it httpd.service, SUSE calls it apache2.service... sed -i -e 's,apache2\.service,httpd\.service,g' systemd/*.service # ...Fedora keeps httpd config here, SUSE keeps it there. sed -i -e 's,"$(DESTDIR)"/etc/apache2/vhosts.d,"$(DESTDIR)"%{_sysconfdir}/httpd/conf.d,g' Makefile sed -i -e 's,/etc/apache2/vhosts.d,%{_sysconfdir}/httpd/conf.d,g' etc/apache2/vhosts.d/* # These are the Fedora-y standard TLS cert/key locations. sed -i -e 's,/etc/apache2/ssl.crt,%{_sysconfdir}/pki/tls/certs,g' etc/apache2/vhosts.d/* sed -i -e 's,/etc/apache2/ssl.key,%{_sysconfdir}/pki/tls/private,g' etc/apache2/vhosts.d/* %build make %check # mojo 4.88 introduced change that broke our secrets # implementation # https://github.com/kraih/mojo/issues/607 # # we don't really need the tidy test rm -f t/00-tidy.t # # tests are currently disabled on Fedora due to missing dependencies # #make test #prove -r %install %make_install mkdir -p %{buildroot}%{_datadir}/openqa/etc/openqa ln -s %{_sysconfdir}/openqa/openqa.ini %{buildroot}%{_datadir}/openqa/etc/openqa/openqa.ini ln -s %{_sysconfdir}/openqa/database.ini %{buildroot}%{_datadir}/openqa/etc/openqa/database.ini rm -rf /tmp/etc_openqa cp -a etc/openqa /tmp/etc_openqa export OPENQA_CONFIG=/tmp/etc_openqa export OPENQA_LOGFILE=/tmp/logfile rm -rf /tmp/db mkdir -p /tmp/db sed -i -e 's,/var/lib/openqa/db,/tmp/db,' /tmp/etc_openqa/database.ini # strange way to precompile assets :) ./script/initdb --init_database ./script/openqa version -m production cp -a public/packed %{buildroot}%{_datadir}/openqa/public/ cd %{buildroot} grep -rl /usr/bin/env . | while read file; do sed -e 's,/usr/bin/env perl,/usr/bin/perl,' -i $file done # Mojo cannot create a logfile if it doesn't exist. # So we need to pre-create it, but we don't want it owned by the package, so # you don't lose logs on package uninstall. So we ghost it in the package # and create it in post. Here, we create it in the buildroot so it can be # ghosted. install -D -m 644 /dev/null %{buildroot}%{_localstatedir}/log/openqa # mkdir %{buildroot}%{_localstatedir}/lib/openqa/pool/1 # # We don't do AppArmor rm -rf %{buildroot}%{_sysconfdir}/apparmor.d %pre getent group geekotest >/dev/null || groupadd -r geekotest getent passwd geekotest >/dev/null || \ useradd -r -g geekotest -d /var/lib/openqa -s /sbin/nologin \ -c "openQA user" geekotest exit 0 %pre worker getent group _openqa-worker >/dev/null || groupadd -r _openqa-worker getent passwd _openqa-worker >/dev/null || \ useradd -r -g _openqa-worker -G qemu -d /dev/null -s /sbin/nologin \ -c "openQA worker" _openqa-worker exit 0 %post # install empty log file (see above for reasoning) if [ ! -e %{_localstatedir}/log/openqa ]; then install -D -m 644 -o geekotest /dev/null %{_localstatedir}/log/openqa || : fi # do database if [ $1 -eq 1 ]; then %{_datadir}/openqa/script/initdb --user geekotest --init_database || : echo "### copy and edit /etc/httpd/conf.d/openqa.conf.template!" else %{_datadir}/openqa/script/upgradedb --user geekotest --upgrade_database || : fi %systemd_post %{openqa_services} %post worker %tmpfiles_create %{_tmpfilesdir}/openqa.conf %systemd_post %{openqa_worker_services} %preun %systemd_preun %{openqa_services} %preun worker %systemd_preun %{openqa_worker_services} %postun %systemd_postun_with_restart %{openqa_services} %postun worker %systemd_postun_with_restart %{openqa_worker_services} %files %doc README.asciidoc docs/* %dir %{_sysconfdir}/openqa %config(noreplace) %attr(-,geekotest,root) %{_sysconfdir}/openqa/openqa.ini %config(noreplace) %attr(-,geekotest,root) %{_sysconfdir}/openqa/database.ini %dir %{_datadir}/openqa %dir %{_datadir}/openqa/etc %dir %{_datadir}/openqa/etc/openqa %{_datadir}/openqa/etc/openqa/openqa.ini %{_datadir}/openqa/etc/openqa/database.ini %config %{_sysconfdir}/logrotate.d %config(noreplace) %{_sysconfdir}/dbus-1/system.d/org.opensuse.openqa.conf # init %dir %{_unitdir} %{_unitdir}/openqa-webui.service %{_unitdir}/openqa-gru.service %{_unitdir}/openqa-scheduler.service %{_unitdir}/openqa-websockets.service # web libs %{_datadir}/openqa/templates %{_datadir}/openqa/public %{_datadir}/openqa/dbicdh %{_datadir}/openqa/script/backlog %{_datadir}/openqa/script/check_dependencies %{_datadir}/openqa/script/clean_needles %{_datadir}/openqa/script/client %{_datadir}/openqa/script/clone_job.pl %{_datadir}/openqa/script/create_admin %{_datadir}/openqa/script/dump_templates %{_datadir}/openqa/script/fetchneedles %{_datadir}/openqa/script/initdb %{_datadir}/openqa/script/load_templates %{_datadir}/openqa/script/openqa %{_datadir}/openqa/script/openqa-scheduler %{_datadir}/openqa/script/openqa-websockets %{_datadir}/openqa/script/tidy %{_datadir}/openqa/script/upgradedb %{_datadir}/openqa/script/migrate_images %{_datadir}/openqa/script/modify_needle # TODO: define final user %defattr(-,geekotest,root) # attention: never package subdirectories owned by a user other # than root as that opens a security hole! %dir %{_localstatedir}/lib/openqa/db %dir %{_localstatedir}/lib/openqa/images %{_localstatedir}/lib/openqa/testresults %dir %{_localstatedir}/lib/openqa/share %dir %{_localstatedir}/lib/openqa/share/tests %dir %{_localstatedir}/lib/openqa/share/factory %ghost %attr(0640,geekotest,root) %{_localstatedir}/lib/openqa/db/db.sqlite %ghost %{_localstatedir}/log/openqa %files common %license COPYING %dir %{_datadir}/openqa %{_datadir}/openqa/lib %dir %{_localstatedir}/lib/openqa %{_localstatedir}/lib/openqa/factory %{_localstatedir}/lib/openqa/script %{_localstatedir}/lib/openqa/tests %files worker %config(noreplace) %attr(0400,_openqa-worker,root) %{_sysconfdir}/openqa/client.conf %config(noreplace) %{_sysconfdir}/openqa/workers.ini # init %dir %{_unitdir} %{_prefix}/lib/systemd/system-generators %{_unitdir}/openqa-worker.target %{_unitdir}/openqa-worker@.service %{_unitdir}/openqa-slirpvde.service %{_unitdir}/openqa-vde_switch.service %{_tmpfilesdir}/openqa.conf %ghost %dir %{_rundir}/openqa # worker libs %dir %{_datadir}/openqa %dir %{_datadir}/openqa/script %{_datadir}/openqa/script/worker %dir %{_localstatedir}/lib/openqa/pool %defattr(-,_openqa-worker,root) # own one pool - to create the others is task of the admin %dir %{_localstatedir}/lib/openqa/pool/1 %files httpd %license COPYING # apache vhost %dir %{_sysconfdir}/httpd %dir %{_sysconfdir}/httpd/conf.d %config %{_sysconfdir}/httpd/conf.d/openqa.conf.template %config %{_sysconfdir}/httpd/conf.d/openqa-common.inc %config %{_sysconfdir}/httpd/conf.d/openqa-ssl.conf.template %changelog * Fri Feb 05 2016 Adam Williamson - 4.3-7 - package review improvements: - * no need for worker to Requires(post) os-autoinst - * explain why tests are currently disabled - * fix a few macro invocations to use curly braces - * use directory macros where appropriate in scriptlets - * split apache configuration into a subpackage * Thu Jan 28 2016 Adam Williamson - 4.3-6 - update ISOURL patch to latest revision * Thu Jan 28 2016 Adam Williamson - 4.3-5 - patch: fix ISO downloading when ISOURL is specified but not ISO * Wed Jan 27 2016 Adam Williamson - 4.3-4 - patch: stop gru task barfing on malformed JSON (upstream PR #518) * Fri Jan 15 2016 Adam Williamson - 4.3-3 - filter perl(Perl::Critic) auto-requires, only needed for tests * Fri Jan 15 2016 Adam Williamson - 4.3-2 - fix __requires_exclude (stray | made it too greedy) * Fri Jan 15 2016 Adam Williamson - 4.3-1 - new release 4.3, drop patches merged upstream - tweak auto-provides / requires filtering - backport fix for slowdown caused by using dbus for thumbnails - update database on package update - include license in -common * Tue Jan 05 2016 Adam Williamson - 4.2-12 - one more backport (of a PR I just wrote) for HDD cleanup * Mon Jan 04 2016 Adam Williamson - 4.2-11 - backport cleanup of generated HDD snapshots * Wed Dec 16 2015 Adam Williamson - 4.2-10 - backport tmpdir creation fix (prevents large uploads failing) * Wed Dec 02 2015 Adam Williamson - 4.2-9 - backport branding fix (removes SUSE navbar) * Tue Nov 17 2015 Adam Williamson - 4.2-8 - make create_admin executable * Sat Oct 24 2015 Adam Williamson - 4.2-7 - conflict with perl(EV) - see openQA GH #450 * Thu Oct 22 2015 Adam Williamson - 4.2-6 - backport sqlite security fix and admin user creation script * Sat Oct 17 2015 Adam Williamson - 4.2-5 - correct worker username in a couple of places, adjust perms * Sat Oct 17 2015 Adam Williamson - 4.2-4 - another dep fix: sqlite * Sat Oct 17 2015 Adam Williamson - 4.2-3 - correct some dependencies, exclude internal auto-generated reqs * Fri Oct 16 2015 Adam Williamson - 4.2-2 - fix apache config filenames in sed commands * Thu Oct 15 2015 Adam Williamson - 4.2-1 - update to 4.2 upstream, tweak spec a bit more * Fri Aug 14 2015 Adam Williamson - 4-1.20150814gitc66ff87 - initial package (based on openSUSE spec)