File buildbot.spec of Package buildbot
%define pythons python3
%{?single_pythons_311plus}
# Missing dependencies for tests
%bcond_with check
# Missing dependencies for documentation
%bcond_with docs
# Offer support for various latent worker types
%bcond_without ec2
%bcond_without container
%bcond_without libvirt
%if 0%{?rhel} && 0%{?rhel} < 9
# Required client packages don't exist in RHEL or EPEL
%bcond_with openstack
%else
%bcond_without openstack
%endif
Name: buildbot
Version: 4.3.0
Release: 7%{?dist}
Summary: Build/test automation system
License: GPL-2.0-only
URL: https://buildbot.net
Source0: https://files.pythonhosted.org/packages/source/b/buildbot/buildbot-%{version}.tar.gz
Source1: https://files.pythonhosted.org/packages/source/b/buildbot_worker/buildbot_worker-%{version}.tar.gz
Source2: https://files.pythonhosted.org/packages/source/b/buildbot_www/buildbot_www-%{version}.tar.gz
Source3: https://files.pythonhosted.org/packages/source/b/buildbot_waterfall_view/buildbot_waterfall_view-%{version}.tar.gz
Source4: https://files.pythonhosted.org/packages/source/b/buildbot_grid_view/buildbot_grid_view-%{version}.tar.gz
Source5: https://files.pythonhosted.org/packages/source/b/buildbot_console_view/buildbot_console_view-%{version}.tar.gz
Source6: https://files.pythonhosted.org/packages/source/b/buildbot_badges/buildbot_badges-%{version}.tar.gz
Source7: https://files.pythonhosted.org/packages/source/b/buildbot_wsgi_dashboards/buildbot_wsgi_dashboards-%{version}.tar.gz
# Build-time only component for buildbot
Source8: https://files.pythonhosted.org/packages/source/b/buildbot_pkg/buildbot_pkg-%{version}.tar.gz
# Service template units for buildbot instances
Source10: buildbot-master@.service
Source11: buildbot-worker@.service
# openSUSE-specific systemd drop-ins (separate users, paths)
Source12: buildbot-master.conf
Source13: buildbot-worker.conf
BuildArch: noarch
BuildRequires: %{python_module devel}
BuildRequires: python-rpm-macros
BuildRequires: fdupes
BuildRequires: %{python_module pip}
BuildRequires: %{python_module wheel}
BuildRequires: %{python_module setuptools}
# For making the build work from source
BuildRequires: %{python_module Twisted >= 17.9}
BuildRequires: %{python_module Jinja2 >= 2.1}
BuildRequires: %{python_module zope.interface >= 4.1.1}
BuildRequires: %{python_module SQLAlchemy}
BuildRequires: %{python_module python-dateutil >= 1.5}
BuildRequires: %{python_module txaio >= 2.2.2}
BuildRequires: %{python_module autobahn >= 0.16}
BuildRequires: %{python_module PyJWT}
BuildRequires: %{python_module PyYAML}
BuildRequires: %{python_module treq}
BuildRequires: %{python_module boto3}
BuildRequires: %{python_module lz4}
%if %{with check}
BuildRequires: bzr
BuildRequires: cvs
BuildRequires: git
BuildRequires: mercurial
BuildRequires: subversion
BuildRequires: darcs
%endif
%if %{with docs}
BuildRequires: make
BuildRequires: %{python_module Sphinx >= 1.4}
BuildRequires: %{python_module sphinxcontrib-blockdiag}
BuildRequires: %{python_module sphinxcontrib-spelling}
BuildRequires: %{python_module pyenchant}
BuildRequires: %{python_module docutils >= 0.8}
BuildRequires: %{python_module sphinx-jinja}
BuildRequires: %{python_module towncrier}
%endif
# For systemd units
BuildRequires: systemd-rpm-macros
# Turns former package into a metapackage for installing everything
Requires: %{name}-master = %{version}-%{release}
%if %{with ec2}
Recommends: %{name}-master-ec2 = %{version}-%{release}
%endif
%if %{with container}
Recommends: %{name}-master-container = %{version}-%{release}
%endif
%if %{with libvirt}
Recommends: %{name}-master-libvirt = %{version}-%{release}
%endif
%if %{with openstack}
Recommends: %{name}-master-openstack = %{version}-%{release}
%endif
Requires: %{name}-worker = %{version}-%{release}
Requires: %{name}-www = %{version}-%{release}
%if %{with docs}
Requires: %{name}-doc = %{version}-%{release}
%else
Obsoletes: %{name}-doc < %{version}-%{release}
%endif
%description
The BuildBot is a system to automate the compile/test cycle required by
most software projects to validate code changes. By automatically
rebuilding and testing the tree each time something has changed, build
problems are pinpointed quickly, before other developers are
inconvenienced by the failure.
%files
# Empty because metapackage
# ---------------------------------------------------------------------
%package -n %{name}-master
Summary: Build/test automation system master
Recommends: %{name}-www = %{version}-%{release}
Requires(pre): shadow
Requires(post): systemd
Requires: python311-Twisted >= 17.9
Requires: python311-Jinja2 >= 2.1
Requires: python311-zope.interface >= 4.1.1
Requires: python311-SQLAlchemy
Requires: python311-python-dateutil >= 1.5
Requires: python311-txaio >= 2.2.2
Requires: python311-autobahn >= 0.16
Requires: python311-PyJWT
Requires: python311-PyYAML
Requires: python311-treq
Requires: python311-setuptools
%if ! %{with docs}
Obsoletes: %{name}-doc < %{version}-%{release}
%endif
%description -n %{name}-master
The BuildBot is a system to automate the compile/test cycle required by
most software projects to validate code changes. By automatically
rebuilding and testing the tree each time something has changed, build
problems are pinpointed quickly, before other developers are
inconvenienced by the failure.
This package contains only the buildmaster implementation.
The buildbot-worker package contains the buildworker.
%pre -n %{name}-master
getent group buildbot-master >/dev/null || groupadd -r buildbot-master
getent passwd buildbot-master >/dev/null || useradd -r -g buildbot-master -d %{_sharedstatedir}/buildbot/master -s /sbin/nologin -c "Buildbot master" buildbot-master
%service_add_pre buildbot-master@.service
%post -n %{name}-master
%service_add_post buildbot-master@.service
for master in $(systemctl list-units 'buildbot-master@*.service' --all --plain --no-legend | cut -d '@' -f 2 | cut -d '.' -f 1); do
systemctl stop buildbot-master@"$master".service
su - buildbot-master -s /bin/bash -c "buildbot upgrade-master /var/lib/buildbot/master/$master"
systemctl start buildbot-master@"$master".service
done
%preun -n %{name}-master
%service_del_preun buildbot-master@.service
%postun -n %{name}-master
%service_del_postun buildbot-master@.service
%files -n %{name}-master
%doc CREDITS NEWS UPGRADING
%license COPYING
%{_bindir}/buildbot
%{_mandir}/man1/buildbot.1*
%{_prefix}/lib/python3.*/site-packages/buildbot/
%{_prefix}/lib/python3.*/site-packages/buildbot-*dist-info/
%dir %{_sharedstatedir}/buildbot
%dir %attr(-, buildbot-master, buildbot-master) %{_sharedstatedir}/buildbot/master
%{_unitdir}/buildbot-master@.service
%dir %{_unitdir}/buildbot-master@.service.d
%{_unitdir}/buildbot-master@.service.d/buildbot-master.conf
# ---------------------------------------------------------------------
%{_sysusersdir}/buildbot.conf
%if %{with ec2}
%package master-ec2
Summary: Build/test automation system master -- AWS EC2 support
Requires: %{name}-master = %{version}-%{release}
Requires: python%{python3_version}dist(boto3)
%description master-ec2
The BuildBot is a system to automate the compile/test cycle required by
most software projects to validate code changes. By automatically
rebuilding and testing the tree each time something has changed, build
problems are pinpointed quickly, before other developers are
inconvenienced by the failure.
This is a metapackage to install the master with AWS EC2 dynamic
worker support.
%files master-ec2
# Empty because metapackage
%endif
# ---------------------------------------------------------------------
%if %{with container}
%package master-container
Summary: Build/test automation system master -- Container support
Requires: %{name}-master = %{version}-%{release}
Requires: python%{python3_version}dist(docker)
%description master-container
The BuildBot is a system to automate the compile/test cycle required by
most software projects to validate code changes. By automatically
rebuilding and testing the tree each time something has changed, build
problems are pinpointed quickly, before other developers are
inconvenienced by the failure.
This is a metapackage to install the master with container worker support.
%files master-container
# Empty because metapackage
%endif
# ---------------------------------------------------------------------
%if %{with libvirt}
%package master-libvirt
Summary: Build/test automation system master -- libvirt support
Requires: %{name}-master = %{version}-%{release}
Requires: python%{python3_version}dist(libvirt-python)
%description master-libvirt
The BuildBot is a system to automate the compile/test cycle required by
most software projects to validate code changes. By automatically
rebuilding and testing the tree each time something has changed, build
problems are pinpointed quickly, before other developers are
inconvenienced by the failure.
This is a metapackage to install the master with libvirt-driven dynamic
VM worker support.
%files master-libvirt
# Empty because metapackage
%endif
# ---------------------------------------------------------------------
%if %{with openstack}
%package master-openstack
Summary: Build/test automation system master -- OpenStack support
Requires: %{name}-master = %{version}-%{release}
Requires: python%{python3_version}dist(keystoneauth1)
Requires: python%{python3_version}dist(python-novaclient)
%description master-openstack
The BuildBot is a system to automate the compile/test cycle required by
most software projects to validate code changes. By automatically
rebuilding and testing the tree each time something has changed, build
problems are pinpointed quickly, before other developers are
inconvenienced by the failure.
This is a metapackage to install the master with OpenStack dynamic
worker support.
%files master-openstack
# Empty because metapackage
%endif
# ---------------------------------------------------------------------
%package -n %{name}-worker
Summary: Build/test automation system worker
Requires(pre): shadow
Requires(post): systemd
Requires: python311-Twisted >= 17.9
Requires: python311-autobahn >= 0.16
Requires: python311-txaio >= 2.2.2
%if ! %{with docs}
Obsoletes: %{name}-doc < %{version}-%{release}
%endif
%description -n %{name}-worker
This package contains only the buildworker implementation.
The buildbot-master package contains the buildmaster.
%pre -n %{name}-worker
getent group buildbot-worker >/dev/null || groupadd -r buildbot-worker
getent passwd buildbot-worker >/dev/null || useradd -r -g buildbot-worker -d %{_sharedstatedir}/buildbot/worker -s /sbin/nologin -c "Buildbot worker" buildbot-worker
%service_add_pre buildbot-worker@.service
%post -n %{name}-worker
%service_add_post buildbot-worker@.service
for worker in $(systemctl list-units 'buildbot-worker@*.service' --all --plain --no-legend | cut -d '@' -f 2 | cut -d '.' -f 1); do
systemctl restart buildbot-worker@"$worker".service
done
%preun -n %{name}-worker
%service_del_preun buildbot-worker@.service
%postun -n %{name}-worker
%service_del_postun buildbot-worker@.service
%files -n %{name}-worker
%doc NEWS UPGRADING
%license COPYING
%{_bindir}/buildbot-worker
%{_mandir}/man1/buildbot-worker.1*
%{_prefix}/lib/python3.*/site-packages/buildbot_worker/
%{_prefix}/lib/python3.*/site-packages/buildbot_worker-*dist-info/
%dir %{_sharedstatedir}/buildbot
%dir %attr(-, buildbot-worker, buildbot-worker) %{_sharedstatedir}/buildbot/worker
%{_unitdir}/buildbot-worker@.service
%dir %{_unitdir}/buildbot-worker@.service.d
%{_unitdir}/buildbot-worker@.service.d/buildbot-worker.conf
%{_sysusersdir}/buildbot-worker.conf
# ---------------------------------------------------------------------
%package -n %{name}-www
Summary: Build/test automation system web frontend
Requires: %{name}-master = %{version}-%{release}
%description -n %{name}-www
Provides web frontend for buildbot.
%files -n %{name}-www
%license COPYING
%{_prefix}/lib/python3.*/site-packages/buildbot_www/
%{_prefix}/lib/python3.*/site-packages/buildbot_www-*.dist-info/
%{_prefix}/lib/python3.*/site-packages/buildbot_waterfall_view/
%{_prefix}/lib/python3.*/site-packages/buildbot_waterfall_view-*dist-info/
%{_prefix}/lib/python3.*/site-packages/buildbot_grid_view/
%{_prefix}/lib/python3.*/site-packages/buildbot_grid_view-*dist-info/
%{_prefix}/lib/python3.*/site-packages/buildbot_console_view/
%{_prefix}/lib/python3.*/site-packages/buildbot_console_view-*dist-info/
%{_prefix}/lib/python3.*/site-packages/buildbot_badges/
%{_prefix}/lib/python3.*/site-packages/buildbot_badges-*dist-info/
%{_prefix}/lib/python3.*/site-packages/buildbot_wsgi_dashboards/
%{_prefix}/lib/python3.*/site-packages/buildbot_wsgi_dashboards-*dist-info/
# ---------------------------------------------------------------------
%if %{with docs}
%package -n %{name}-doc
Summary: Buildbot documentation
%description -n %{name}-doc
%{summary}.
%files -n %{name}-doc
%{_pkgdocdir}/
%endif
# ---------------------------------------------------------------------
%prep
%setup -q -b0 -b1 -b2 -b3 -b4 -b5 -b6 -b7 -b8
cd ..
cd buildbot_worker-%{version}
# Create sysusers.d config files
cat >buildbot.sysusers.conf <<EOF
u buildbot-master - 'Service account for the Buildbot master' %{_sharedstatedir}/buildbot/master -
EOF
cat >buildbot-worker.sysusers.conf <<EOF
u buildbot-worker - 'Service account for the Buildbot worker' %{_sharedstatedir}/buildbot/worker -
EOF
# Generate build requires works in Fedora but not in openSUSE
# dependencies are explicitly stated in BuildRequires
# %generate_buildrequires
# %pyproject_buildrequires
%build
%pyproject_wheel
%if %{with docs}
#TODO create API documentation
pushd docs
make docs.tgz VERSION="%{version}" SPHINXBUILD=sphinx-build-3
popd
%endif
pushd ../%{name}_worker-%{version}
%pyproject_wheel
popd
# For buildbot_pkg build-time module to set version correctly
export BUILDBOT_VERSION=%{version}
# So that other modules can use buildbot-pkg import
export PYTHONPATH=%{_builddir}/%{name}-%{version}/build/lib:%{_builddir}/%{name}_pkg-%{version}/build/lib
bbweb_components=(pkg www waterfall_view grid_view console_view badges wsgi_dashboards)
for bbweb_component in ${bbweb_components[@]}; do
pushd ../%{name}_${bbweb_component}-%{version}
sed -e "s/^ setup_requires=.*$//" -i setup.py
%pyproject_wheel
popd
done
%install
%pyproject_install
# For buildbot_pkg build-time module to set version correctly
export BUILDBOT_VERSION=%{version}
# So that other modules can use buildbot-pkg import
export PYTHONPATH=%{_builddir}/%{name}-%{version}/build/lib:%{_builddir}/%{name}_pkg-%{version}/build/lib
bbweb_components=(www waterfall_view grid_view console_view badges wsgi_dashboards)
for bbweb_component in ${bbweb_components[@]}; do
pushd ../%{name}_${bbweb_component}-%{version}
%pyproject_install
popd
done
install -Dpm0644 -t %{buildroot}%{_mandir}/man1 docs/buildbot.1
%if %{with docs}
mkdir -p %{buildroot}%{_pkgdocdir}
tar xf docs/docs.tgz --strip-components=1 -C %{buildroot}%{_pkgdocdir}
%endif
# install worker files
pushd ../%{name}_worker-%{version}
%pyproject_install
install -Dpm0644 -t %{buildroot}%{_mandir}/man1 docs/buildbot-worker.1
install -m0644 -D buildbot.sysusers.conf %{buildroot}%{_sysusersdir}/buildbot.conf
install -m0644 -D buildbot-worker.sysusers.conf %{buildroot}%{_sysusersdir}/buildbot-worker.conf
popd
# Purge windows-only files
rm -vf %{buildroot}%{_bindir}/*windows*
# Install systemd units and openSUSE drop-ins
mkdir -p %{buildroot}%{_unitdir}
cp -a %{S:10} %{S:11} %{buildroot}%{_unitdir}
mkdir -p %{buildroot}%{_unitdir}/buildbot-master@.service.d
install -m0644 %{S:12} %{buildroot}%{_unitdir}/buildbot-master@.service.d/buildbot-master.conf
mkdir -p %{buildroot}%{_unitdir}/buildbot-worker@.service.d
install -m0644 %{S:13} %{buildroot}%{_unitdir}/buildbot-worker@.service.d/buildbot-worker.conf
mkdir -p %{buildroot}%{_sharedstatedir}/buildbot/{master,worker}
%python3_fix_shebang
%fdupes %{buildroot}
%if %{with check}
%check
trial buildbot.test
%endif
%changelog