# 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: 12%{?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 # script for (re-)generating packed web assets when AssetPack or Bootstrap3 # change: see package review for discussion of this Source1: generate-packed-assets # 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 # Backport: log to stderr (so systemd journal) by default # https://github.com/os-autoinst/openQA/pull/541 Patch3: 0001-log-to-stderr-so-journal-by-default.patch # Backport: fix some issues with UID and GID switch in initdb script # https://github.com/os-autoinst/openQA/pull/546 Patch4: 0001-initdb-when-user-set-setgid-and-don-t-guess-db-owner.patch # Backport: setgid in upgradedb as well as initdb # https://github.com/os-autoinst/openQA/pull/548 Patch5: 0001-setgid-as-well-in-upgradedb-like-in-initdb.patch Obsoletes: openqa < 4.3-7 Requires(post): sqlite # This is for the %triggerin script (asset generation calls 'sass' command) Requires: rubygem(sass) # This is for tests, currently disabled #BuildRequires: os-autoinst Requires: openqa-common = %{version}-%{release} Requires: perl(URI) # 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 Requires(post): systemd Requires(preun): systemd Requires(postun): systemd BuildArch: noarch Requires: perl-Mojolicious-Plugin-Bootstrap3 Requires: 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) Requires(post): systemd Requires(preun): systemd Requires(postun): systemd %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 # this does nothing, but it's harmless, so just in case it turns up... make %{?_smp_mflags} %install %make_install install -m 0755 %{SOURCE1} %{buildroot}%{_datadir}/openqa/script/generate-packed-assets 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 cd %{buildroot} grep -rl /usr/bin/env . | while read file; do sed -e 's,/usr/bin/env perl,/usr/bin/perl,' -i $file done mkdir %{buildroot}%{_localstatedir}/lib/openqa/pool/1 # We don't do AppArmor rm -rf %{buildroot}%{_sysconfdir}/apparmor.d %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 %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 || : %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 || : %post # do database if [ $1 -eq 1 ]; then %{_datadir}/openqa/script/initdb --user geekotest --init_database || : 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} %post httpd if [ $1 -eq 1 ]; then echo "### copy and edit /etc/httpd/conf.d/openqa.conf.template!" fi %preun %systemd_preun %{openqa_services} if [ $1 -eq 0 ]; then rm -rf %{_datadir}/openqa/public/packed fi %preun worker %systemd_preun %{openqa_worker_services} %postun %systemd_postun_with_restart %{openqa_services} %postun worker %systemd_postun_with_restart %{openqa_worker_services} # when these packages change, the 'packed' assets will be invalidated # and need regeneration. we do not let openQA itself regenerate them # for security reasons (reducing write privs as far as possible) %triggerin -- perl-Mojolicious-Plugin-Bootstrap3 perl-Mojolicious-Plugin-AssetPack %{_datadir}/openqa/script/generate-packed-assets %files %doc README.asciidoc docs/* %dir %{_sysconfdir}/openqa %config(noreplace) %{_sysconfdir}/openqa/openqa.ini %config(noreplace) %attr(-,root,geekotest) %{_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 %{_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 %dir %{_datadir}/openqa/script %{_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 %{_datadir}/openqa/script/generate-packed-assets %dir %{_localstatedir}/lib/openqa/share %dir %{_localstatedir}/lib/openqa/share/factory %defattr(-,geekotest,root) # the database script does creation with 'geekotest' privileges %dir %{_localstatedir}/lib/openqa/db # the server may create files in these locations %dir %{_localstatedir}/lib/openqa/images %dir %{_localstatedir}/lib/openqa/share/tests %{_localstatedir}/lib/openqa/testresults # when sqlite is used this file must be server-writable and *not* # readable by anyone but server or root, hence expected permissions %ghost %attr(0640,geekotest,root) %{_localstatedir}/lib/openqa/db/db.sqlite %files common %license COPYING %dir %{_datadir}/openqa %ghost %dir %{_datadir}/openqa/packed %{_datadir}/openqa/lib %dir %{_localstatedir}/lib/openqa # these are compatibility symlinks into the shared data; they go in # -common because both server and workers need them but they're not in # the shared location %{_localstatedir}/lib/openqa/factory %{_localstatedir}/lib/openqa/tests # this is a compat symlink to a directory whose contents are split # between server and worker %{_localstatedir}/lib/openqa/script %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/systemd-openqa-generator %{_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 # Note: remote workers are required to mount /var/lib/openqa/share # shared with the server. %files httpd %license COPYING # apache vhost %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 12 2016 Adam Williamson - 4.3-12 - quiet the trigger script down a bit - clean up sass cache in the trigger script - more customizable trigger script for upstream submission - setgid in upgradedb as well as initdb * Fri Feb 12 2016 Adam Williamson - 4.3-11 - fix initdb UID / GID issues - use triggers for packed asset (re-)generation (Zbigniew) - server should own script dir as well as worker - drop ownership / ghosting of specific asset dirs * Wed Feb 10 2016 Adam Williamson - 4.3-10 - log to journal by default (upstream PR #541) * Mon Feb 08 2016 Adam Williamson - 4.3-9 - drop the log file ghost stuff, it's for AppArmor, not needed for Fedora - comment on the requirement for remote workers to mount shared data - explain the location of the compat symlinks in -common - fix ownership of database.ini (thanks Zbigniew) * Sun Feb 07 2016 Adam Williamson - 4.3-8 - more package review improvements: - * drop the old commented perl(EV) conflict which isn't needed now - * don't use systemd_requires macro - * explain that %build is a lie (but make it parallel nothing) - * move %check to the logical place - * don't fail scriptlets on user creation failure - * move post-install info message to httpd subpackage - * openqa.ini does not need to be owned by geekotest - * don't own directories we shouldn't * 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)