%global _hardened_build 1 # Git commit hash for tracking upstream changes %global commit 25085c5f090031fd7110613a77fd6f816681d801 %global shortcommit %(c=%{commit}; echo ${c:0:7}) %define beanstalkd_user beanstalkd %define beanstalkd_group %{beanstalkd_user} %define beanstalkd_home %{_localstatedir}/lib/beanstalkd %define beanstalkd_binlogdir %{beanstalkd_home}/binlog Name: beanstalkd Version: dev1.13 Release: 1.git%{shortcommit}%{?dist} Summary: A simple, fast work-queue service License: MIT URL: https://beanstalkd.github.io/ # Using git snapshot from master branch Source0: beanstalkd-%{shortcommit}.tar.gz Source1: beanstalkd.service Source2: beanstalkd.sysconfig BuildRequires: systemd gcc gcc-c++ Requires(pre): shadow-utils Requires(post): systemd Requires(preun): systemd Requires(postun): systemd %description beanstalkd is a simple, fast work-queue service. Its interface is generic, but was originally designed for reducing the latency of page views in high-volume web applications by running most time-consuming tasks asynchronously. %prep %autosetup -n beanstalkd-%{commit} %build # Fix signal handler function signature sed -i 's/handle_sigterm_pid1()/handle_sigterm_pid1(int sig)/' main.c # Remove -Werror from the Makefile to avoid build failures on warnings sed -i 's/-Werror//' Makefile make LDFLAGS="%{?__global_ldflags}" CFLAGS="%{optflags} -Wno-stringop-truncation" %{?_smp_mflags} %check make check %install make install PREFIX=%{buildroot}%{_prefix} %{__install} -p -D -m 0644 %{SOURCE1} %{buildroot}%{_unitdir}/beanstalkd.service %{__install} -p -D -m 0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/sysconfig/beanstalkd %{__install} -d -m 0755 %{buildroot}%{beanstalkd_home} %{__install} -d -m 0755 %{buildroot}%{beanstalkd_binlogdir} %{__install} -d -m 00755 %{buildroot}%{_mandir}/man1 %{__install} -p -m 0644 doc/beanstalkd.1 %{buildroot}%{_mandir}/man1/ %pre getent group %{beanstalkd_group} >/dev/null || groupadd -r %{beanstalkd_group} getent passwd %{beanstalkd_user} >/dev/null || \ useradd -r -g %{beanstalkd_user} -d %{beanstalkd_home} -s /sbin/nologin \ -c "beanstalkd user" %{beanstalkd_user} exit 0 %post # make the binlog dir after installation, this is so SELinux does not complain # about the init script creating the binlog directory # See RhBug 558310 if [ -d %{beanstalkd_home} ]; then %{__install} -d %{beanstalkd_binlogdir} -m 0755 \ -o %{beanstalkd_user} -g %{beanstalkd_group} \ %{beanstalkd_binlogdir} fi %systemd_post beanstalkd.service %preun %systemd_preun beanstalkd.service %postun %systemd_postun_with_restart beanstalkd.service %files %license LICENSE %{_unitdir}/beanstalkd.service %{_bindir}/beanstalkd %{_mandir}/man1/beanstalkd.1* %config(noreplace) %{_sysconfdir}/sysconfig/beanstalkd %attr(0755,%{beanstalkd_user},%{beanstalkd_group}) %dir %{beanstalkd_home} %ghost %attr(0755,%{beanstalkd_user},%{beanstalkd_group}) %dir %{beanstalkd_binlogdir} %changelog * Fri Sep 05 2025 COPR Builder - dev1.13-1.git%{shortcommit} - Automated build from GitHub master branch - Git commit: %{commit}