File autotest-framework.spec of Package autotest-framework
Name: autotest-framework
Version: 0.16.2.git.1480378492.662f26a
Release: 1.0
Summary: Framework for fully automated testing
Group: Applications/System
License: GPL-3.0+
#BSD and LGPLv2+ and MIT
URL: http://autotest.github.com/
#BuildArch: noarch
Source0: https://github.com/autotest/autotest/archive/autotest-%{version}.tar.gz
%if 0%{?suse_version} == 1315
Source1: autotest-framework-rpmlintrc
%endif
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
%if 0%{?suse_version} >=1230
Requires: grubby
%endif
Requires: python >= 2.4
Requires: openssh
Requires: rsync
Requires: tar, gzip, bzip2, unzip
Requires(pre): pwdutils
BuildRequires: python >= 2.4
%description
Autotest is a framework for fully automated testing. It is designed primarily
to test the Linux kernel, though it is useful for many other functions such as
qualifying new hardware. It's an open-source project under the GPL and is used
and developed by a number of organizations, including Google, IBM, and many
others.
The autotest package provides the client harness capable of running autotest
jobs on a single system.
%package server
Summary: Server test harness and front-end for autotest
Group: Applications/System
Requires: %{name} = %{version}-%{release}
Requires: python-django >= 1.3
#Requires: conmux
Requires: mysql-community-server
Requires: gnuplot
Requires: apache2-prefork
Requires: apache2-mod_wsgi
Requires: python-mysql
Requires: python-numpy
Requires: python-atfork
Requires: python-M2Crypto
Requires: python-imaging
Requires: python-matplotlib
Requires: python-paramiko
Requires: python-simplejson
Requires: python-setuptools
Requires: python-httplib2
%if 0%{?suse_version} >=1230
Requires(post): policycoreutils-python
%endif
%if 0%{?suse_version} >=1230
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
BuildRequires: systemd
%else
# This is for /sbin/service
Requires(preun): initscripts
Requires(postun): initscripts
# This is for /sbin/chkconfig
Requires(post): aaa_base
Requires(preun): aaa_base
%endif
%description server
Autotest is a framework for fully automated testing. It is designed primarily
to test the Linux kernel, though it is useful for many other functions such as
qualifying new hardware. It's an open-source project under the GPL and is used
and developed by a number of organizations, including Google, IBM, and many
others.
The autotest-server package provides the server harness capable of running
autotest jobs on a single system.
%prep
%setup -q -n autotest-%{version}
sed -i -e "s|DocumentRoot /usr/local/autotest/apache/www|DocumentRoot %{_datadir}/autotest/www|" apache/apache-conf
sed -i -e "s|/usr/local/autotest|%{python_sitelib}/autotest|" global_config.ini
echo "%{version}" > RELEASE-VERSION
%build
python setup.py build
%install
rm -rf %{buildroot}
python setup.py install --root %{buildroot} --skip-build --prefix=%{_prefix}
# Fedora specific locations
install -d %{buildroot}%{_localstatedir}/log/autotest
install -d %{buildroot}%{_localstatedir}/run/autotest
install -d %{buildroot}%{python_sitelib}/autotest/server/tests
install -d %{buildroot}%{python_sitelib}/autotest/server/site_tests
cp -a logs/README README.logs
cp -a packages/README README.packages
cp -a results/README README.results
cp -a client/shared/README README.common_lib
%if 0%{?suse_version} >=1230
# Install systemd init script
install -d %{buildroot}%{_unitdir}
cp -a utils/autotestd.service %{buildroot}%{_unitdir}/
%else
# Install SysV initscript instead
install -d %{buildroot}%{_sysconfdir}/rc.d/
cp -a utils/autotest-rh.init %{buildroot}%{_sysconfdir}/rc.d/autotestd
%endif
rm -rf %{buildroot}%{python_sitelib}/autotest/frontend/client
mkdir %{buildroot}%{_sysconfdir}/profile.d/
cat > %{buildroot}%{_sysconfdir}/profile.d/autotest.sh <<EOF
# Add AUTOTEST_PATH VAR for all users
export AUTOTEST_PATH=%{python_sitelib}/autotest/
EOF
rm -rf %{buildroot}%{python_sitelib}/autotest/client/config/*
rm -rf %{buildroot}%{python_sitelib}/autotest/frontend/afe/doctests/*
rm -rf %{buildroot}%{python_sitelib}/autotest/utils/named_semaphore
rm -rf %{buildroot}%{python_sitelib}/autotest/client/deps
rm -rf %{buildroot}%{python_sitelib}/autotest/client/profilers/*
rm -vf %{buildroot}%{python_sitelib}/autotest/client/tools/setidle.c
rm -vf %{buildroot}%{python_sitelib}/autotest/server/unittest_suite.*
find %{buildroot}%{python_sitelib}/autotest/ -name "*_unittest.*" -exec rm '{}' \;
rm -vrf source/_templates/.empty source/_static/.empty build/.empty
for lib in $(find %{buildroot}%{python_sitelib}/autotest/ -name '*.py'); do
sed '1{/#!\/usr\/bin\/python\|env/d}' $lib > $lib.new &&
touch -r $lib $lib.new &&
mv $lib.new $lib
done
chmod +x %{buildroot}%{python_sitelib}/autotest/client/tools/*
chmod -x %{buildroot}%{python_sitelib}/autotest/client/tools/*.py
chmod -x %{buildroot}%{python_sitelib}/autotest/client/tools/perf.conf
rm -rf %{buildroot}%{python_sitelib}/autotest-*.egg-info
%clean
rm -rf %{buildroot}
%pre
getent group autotest >/dev/null || groupadd -r autotest
getent passwd autotest >/dev/null || \
useradd -r -g autotest -s /bin/bash \
-c "User account for the autotest harness" autotest
exit 0
%post
if [ "$1" -eq 1 ] ; then
su -c "ssh-keygen -q -t rsa -N ''" - autotest || exit 0
fi
%post server
if [ $1 -eq 1 ] ; then
# Initial installation
%if 0%{?suse_version} >=1230
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
semanage fcontext -a -t bin_t '%{python_sitelib}/autotest/tko(/.*cgi)?'
restorecon %{python_sitelib}/autotest/tko/*
%else
/sbin/chkconfig --add autotestd >/dev/null 2>&1 || :
%endif
fi
%preun server
if [ $1 -eq 0 ] ; then
# Package removal, not upgrade
%if 0%{?suse_version} >=1230
/bin/systemctl --no-reload disable autotestd.service > /dev/null 2>&1 || :
/bin/systemctl stop autotestd.service > /dev/null 2>&1 || :
%else
/sbin/service autotestd stop >/dev/null 2>&1
/sbin/chkconfig --del autotestd >/dev/null 2>&1 || :
%endif
fi
%postun server
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
if [ $1 -ge 1 ] ; then
# Package upgrade, not uninstall
%if 0%{?suse_version} >=1230
/bin/systemctl try-restart autotestd.service >/dev/null 2>&1 || :
%else
/sbin/service autotestd condrestart >/dev/null 2>&1 || :
%endif
fi
%files
%defattr(-,root,root,-)
%doc DCO LGPL_LICENSE LICENSE CODING_STYLE README.rst documentation/* README.common_lib README.results client/samples/
%dir %{python_sitelib}/autotest
%dir %{_sysconfdir}/autotest
%config(noreplace) %{_sysconfdir}/autotest/global_config.ini
%config(noreplace) %{_sysconfdir}/autotest/shadow_config.ini
%config(noreplace) %attr(0644, root, root) %{_sysconfdir}/profile.d/autotest.sh
%{python_sitelib}/autotest/client/
%{python_sitelib}/autotest/__init__.py*
%{python_sitelib}/autotest/common.py*
%{_bindir}/autotest-local
%{_bindir}/autotest-local-streamhandler
%{_bindir}/autotest-daemon
%{_bindir}/autotest-daemon-monitor
%files server
%defattr(-,root,root,-)
%doc README.logs README.packages server/samples/
%dir %{_datadir}/autotest/
%{python_sitelib}/autotest/cli/
%{python_sitelib}/autotest/database_legacy/
%{python_sitelib}/autotest/installation_support/
%{python_sitelib}/autotest/frontend/
%{python_sitelib}/autotest/mirror/
%{python_sitelib}/autotest/scheduler/
%{python_sitelib}/autotest/server/
%{python_sitelib}/autotest/shared/
%{python_sitelib}/autotest/utils/
%{python_sitelib}/autotest/tko/
%{_datadir}/autotest/mirror/
%{_datadir}/autotest/utils/
%{_datadir}/autotest/tko/
%attr(-, root, autotest) %{_localstatedir}/log/autotest/
%ghost %attr(-, root, autotest) %{_localstatedir}/run/autotest/
%{_bindir}/autotest-remote
%{_bindir}/autotest-db-delete-job
%{_bindir}/autotest-manage-rpc-server
%{_bindir}/autotest-rpc-change-protection-level
%{_bindir}/autotest-rpc-client
%{_bindir}/autotest-rpc-migrate-host
%{_bindir}/autotest-rpc-query-keyvals
%{_bindir}/autotest-rpc-query-results
%{_bindir}/autotest-tko-parse
%{_bindir}/autotest-scheduler
%{_bindir}/autotest-scheduler-watcher
%{_bindir}/autotest-upgrade-db
%{_bindir}/autotest-database-turnkey
%{_bindir}/autotest-firewalld-add-service
%{_bindir}/autotest-install-packages-deps
%if 0%{?suse_version} >=1230
%{_unitdir}/autotestd.service
%else
%attr(0755, root, root) %{_sysconfdir}/rc.d/autotestd
%endif
%changelog
* Wed Feb 19 2014 Antoine Ginies <aginies@suse.com> 0.15.0
- based on fedora SPEC