@ -1,125 +1,137 @@
%define debug_package %{nil}
## START: Set by rpmautospec
%define community_general_version 4.4.0
## (rpmautospec version 0.6.5)
%define ansible_posix_version 1.3.0
## RPMAUTOSPEC: autorelease, autochangelog
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
release_number = 2;
base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}"));
print(release_number + base_release_number - 1);
}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}}
## END: Set by rpmautospec
%bcond_without check
%global goipath github.com/redhatinsights/rhc-worker-playbook
Version: 0.2.2
%global tag v%{version}
%gometa -f
%global common_description %{expand:
A worker for yggdrasil that receives Ansible playbooks and executes them against
the local host.}
%global golicenses LICENSE
%global godocs CONTRIBUTING.md README.md
Name: rhc-worker-playbook
Name: rhc-worker-playbook
Version: 0.1.8
Release: %autorelease
Release: 4%{?dist}
Summary: Ansible playbook yggdrasil worker
Summary: Python worker for Red Hat connector that launches Ansible Runner
License: GPLv2+
License: GPL-2.0-or-later
URL: https://github.com/redhatinsights/rhc-worker-playbook
URL: %{gourl}
Source: rhc-worker-playbook-0.1.8.tar.gz
Source: %{url}/releases/download/%{tag}/rhc-worker-playbook-%{version}.tar.xz
Source1: https://github.com/ansible-collections/community.general/archive/%{community_general_version}/ansible-collection-community-general-%{community_general_version}.tar.gz
Source2: https://github.com/ansible-collections/ansible.posix/archive/%{ansible_posix_version}/ansible-collection-ansible-posix-%{ansible_posix_version}.tar.gz
BuildRequires: ansible-core
BuildRequires: golang >= 1.18
#
BuildRequires: jq
# patches_ignore=DROP-IN-RPM
BuildRequires: meson
# patches_base=8ddc5ccfc97290a021b4c4de673b92fedc38cbfb
BuildRequires: pkgconfig(dbus-1)
Patch0001: 0001-fix-Execute-playbook-asynchronously.patch
BuildRequires: pkgconfig(systemd)
Patch0002: 0002-Do-not-busy-wait-when-playbook-is-running.patch
BuildRequires: pkgconfig(yggdrasil)
Patch0003: 0003-Use-thread.join-timeout-to-avoid-busy-waiting-and-si.patch
%{?__python3:Requires: %{__python3}}
Requires: insights-client
Requires: python3dist(requests)
Requires: python3dist(pyyaml)
Requires: ansible-core
BuildRequires: rhc
BuildRequires: pkgconfig
BuildRequires: python3-devel
BuildRequires: python3dist(pip)
BuildRequires: python3dist(pip)
BuildRequires: python3dist(wheel)
BuildRequires: systemd-rpm-macros
BuildRequires: python3dist(setuptools)
BuildRequires: python3-rpm-macros
BuildRequires: openssl-devel
BuildRequires: c-ares-devel
%if %{with check}
BuildRequires: zlib-devel
BuildRequires: insights-client
BuildRequires: python3dist(cython)
%endif
BuildRequires: gcc
BuildRequires: gcc-c++
Requires: ansible-core
ExclusiveArch: x86_64 s390x ppc64 ppc64le
%description %common_description
%description
%global setup_flags -Dvendor=True
Python-based worker for Red Hat connect, used to launch Ansible playbooks via Ansible Runner.
%gopkg
%prep
%prep
%setup -q -a1 -a2 -n %{name}-%{version}
%goprep %{?rhel:-k}
%patch0001 -p1
%if %{undefined rhel}
%patch0002 -p1
%generate_buildrequires
%patch0003 -p1
%go_generate_buildrequires
%endif
pushd community.general-%{community_general_version}
rm -vr .github .azure-pipelines
rm -rvf tests/ hacking/
find -type f ! -executable -name '*.py' -print -exec sed -i -e '1{\@^#!.*@d}' '{}' +
find -type f -name '.gitignore' -print -delete
popd
pushd ansible.posix-%{ansible_posix_version}
rm -vr tests/{integration,utils} .github changelogs/fragments/.keep {test-,}requirements.txt shippable.yml
rm -vr .azure-pipelines
rm -rvf tests/
find -type f ! -executable -name '*.py' -print -exec sed -i -e '1{\@^#!.*@d}' '{}' +
find -type f -name '.gitignore' -print -delete
popd
%build
%build
export GRPC_PYTHON_BUILD_WITH_CYTHON=True
%undefine _auto_set_build_flags
export GRPC_PYTHON_BUILD_SYSTEM_OPENSSL=True
export %gomodulesmode
export GRPC_PYTHON_BUILD_SYSTEM_ZLIB=True
%{?gobuilddir:export GOPATH="%{gobuilddir}:${GOPATH:+${GOPATH}:}%{?gopath}"}
export GRPC_PYTHON_BUILD_SYSTEM_CARES=True
%meson %setup_flags "-Dgobuildflags=[%(echo %{expand:%gocompilerflags} | sed -e s/"^"/"'"/ -e s/" "/"', '"/g -e s/"$"/"'"/), '-tags', '"rpm_crashtraceback\ ${BUILDTAGS:-}"', '-a', '-v', '-x']" -Dgoldflags='%{?currentgoldflags} -B 0x%(head -c20 /dev/urandom|od -An -tx1|tr -d " \n") -compressdwarf=false -linkmode=external -extldflags "%{build_ldflags} %{?__golang_extldflags}"'
export GRPC_PYTHON_DISABLE_LIBC_COMPATIBILITY=True
%meson_build
# TODO(gchamoul): Remove workaround
# once https://bugzilla.redhat.com/show_bug.cgi?id=2056959 is fixed
#%define rhc_config_dir $(pkg-config rhc --variable workerconfdir)
%define rhc_config_dir /etc/rhc/workers
%define _lto_cflags %{nil}
%set_build_flags
%{__make} PREFIX=%{_prefix} LIBDIR=%{_libdir} CONFIG_DIR=%{rhc_config_dir} PYTHON_PKGDIR=%{python3_sitelib} installed-lib-dir
%{make_build} build
# Building the Ansible Collections
pushd community.general-%{community_general_version}
tar -cf %{_tmppath}/community-general-%{community_general_version}.tar.gz .
popd
pushd ansible.posix-%{ansible_posix_version}
tar -cf %{_tmppath}/ansible-posix-%{ansible_posix_version}.tar.gz .
popd
%install
%install
%{make_install} PREFIX=%{_prefix} LIBDIR=%{_libdir} CONFIG_DIR=%{rhc_config_dir} PYTHON_PKGDIR=%{python3_sitelib}
%meson_install
%py3_shebang_fix \
%{buildroot}%{_datadir}/rhc-worker-playbook/ansible/collections/ansible_collections/ansible/posix/.azure-pipelines/scripts/*.py \
%{buildroot}%{_datadir}/rhc-worker-playbook/ansible/collections/ansible_collections/ansible/posix/tests/utils/shippable/*.py \
%{buildroot}%{_datadir}/rhc-worker-playbook/ansible/collections/ansible_collections/community/general/.azure-pipelines/scripts/*.py \
%{buildroot}%{_datadir}/rhc-worker-playbook/ansible/collections/ansible_collections/community/general/tests/*/extra/*.py \
%{buildroot}%{_datadir}/rhc-worker-playbook/ansible/collections/ansible_collections/community/general/tests/integration/targets/django_manage/files/base_test/1045-single-app-project/single_app_project/*.py \
%{buildroot}%{_datadir}/rhc-worker-playbook/ansible/collections/ansible_collections/community/general/tests/integration/targets/django_manage/files/base_test/simple_project/p1/*.py \
%{nil}
%{__install} --directory %{buildroot}%{_localstatedir}/lib/%{name}
%if %{with check}
%check
%meson_test
%endif
%post
%systemd_post com.redhat.Yggdrasil1.Worker1.rhc_worker_playbook.service
%preun
%systemd_preun com.redhat.Yggdrasil1.Worker1.rhc_worker_playbook.service
%postun
%systemd_postun_with_restart com.redhat.Yggdrasil1.Worker1.rhc_worker_playbook.service
%files
%license LICENSE
%if %{defined rhel}
%license vendor/modules.txt
%endif
%doc CONTRIBUTING.md README.md
%{_libexecdir}/*
%config(noreplace) %{_sysconfdir}/%{name}/%{name}.toml
%{_unitdir}/*
%{_datadir}/dbus-1/{interfaces,system-services,system.d}/*
%{_datadir}/%{name}
%{_libdir}/%{name}
%dir %attr(700, root, yggdrasil-worker) %{_localstatedir}/lib/%{name}
# Installing the Ansible Collections
%changelog
mkdir -p %{buildroot}%{_datadir}/rhc-worker-playbook/ansible/collections/ansible_collections/community/general
## START: Generated by rpmautospec
mkdir -p %{buildroot}%{_datadir}/rhc-worker-playbook/ansible/collections/ansible_collections/ansible/posix
* Tue Oct 29 2024 Troy Dawson <tdawson@redhat.com> - 0.2.2-2
- Bump release for October 2024 mass rebuild:
pushd %{buildroot}%{_datadir}/rhc-worker-playbook/ansible/collections/ansible_collections/community/general
* Fri Oct 25 2024 MSVSphere Packaging Team <packager@msvsphere-os.ru> - 0.2.2-1
tar -xf %{_tmppath}/community-general-%{community_general_version}.tar.gz
- Rebuilt for MSVSphere 10
popd
pushd %{buildroot}%{_datadir}/rhc-worker-playbook/ansible/collections/ansible_collections/ansible/posix
* Thu Oct 03 2024 Link Dupont <link@sub-pop.net> - 0.2.2-1
tar -xf %{_tmppath}/ansible-posix-%{ansible_posix_version}.tar.gz
- Update to 0.2.2
popd
# Creating the logs directory for ansible-runner
* Thu May 30 2024 Jiri Hnidek <jhnidek@redhat.com> 0.1.8-8
mkdir -p %{buildroot}%{_localstatedir}/log/rhc-worker-playbook/ansible/
- Use SPDX format of GPLv2+ license in .spec file
* Fri Dec 08 2023 Pino Toscano <ptoscano@redhat.com> 0.1.8-7
- Avoid writing Python bytecode (RHEL-14277)
%files
* Wed Mar 22 2023 Link Dupont <link@redhat.com> 0.1.8-6
%{_libexecdir}/rhc/rhc-worker-playbook.worker
- Enable stripping of debug symbols into a debuginfo package.
%{python3_sitelib}/rhc_worker_playbook/
%{python3_sitelib}/rhc_worker_playbook*.egg-info/
%{_libdir}/rhc-worker-playbook/
%{_datadir}/rhc-worker-playbook/ansible/collections/ansible_collections/
%{_localstatedir}/log/rhc-worker-playbook/ansible/
%config(noreplace) %{_sysconfdir}/rhc/workers/rhc-worker-playbook.toml
%doc
* Fri Mar 03 2023 Link Dupont <link@redhat.com> 0.1.8-5
- Drop ExclusiveArch, but exclude i686 (RHBZ#2178692)
%changelog
* Thu Oct 20 2022 Gael Chamoulaud <gchamoul@redhat.com> 0.1.8-4
* Thu Oct 20 2022 Gael Chamoulaud <gchamoul@redhat.com> 0.1.8-4
- Use thread.join(timeout) to avoid busy waiting and simplify interval event posting logic (rhbz#2115848)
- Use thread.join(timeout) to avoid busy waiting and simplify interval event posting logic (rhbz#2115848)
@ -161,3 +173,5 @@ mkdir -p %{buildroot}%{_localstatedir}/log/rhc-worker-playbook/ansible/
- Enhancements to playbook validation
- Enhancements to playbook validation
- Fixes for regular execution status updates
- Fixes for regular execution status updates
- Configuration fixes
- Configuration fixes
## END: Generated by rpmautospec