diff --git a/SOURCES/beanstalkd-1.10-mkdtemp.patch b/SOURCES/beanstalkd-1.10-mkdtemp.patch new file mode 100644 index 0000000..a52b47c --- /dev/null +++ b/SOURCES/beanstalkd-1.10-mkdtemp.patch @@ -0,0 +1,21 @@ +diff -ur beanstalkd-1.10.org/ct/ct.c beanstalkd-1.10/ct/ct.c +--- beanstalkd-1.10.org/ct/ct.c 2014-08-04 21:39:54.000000000 -0600 ++++ beanstalkd-1.10/ct/ct.c 2016-01-08 11:44:55.012786874 -0700 +@@ -182,7 +183,7 @@ + { + t->fd = tmpfd(); + strcpy(t->dir, TmpDirPat); +- mktemp(t->dir); ++ mkdtemp(t->dir); + t->pid = fork(); + if (t->pid < 0) { + die(1, errno, "fork"); +@@ -285,7 +286,7 @@ + int outfd = tmpfd(); + int durfd = tmpfd(); + strcpy(b->dir, TmpDirPat); +- mktemp(b->dir); ++ mkdtemp(b->dir); + int pid = fork(); + if (pid < 0) { + die(1, errno, "fork"); diff --git a/SOURCES/beanstalkd-1.10-warnings.patch b/SOURCES/beanstalkd-1.10-warnings.patch new file mode 100644 index 0000000..404070b --- /dev/null +++ b/SOURCES/beanstalkd-1.10-warnings.patch @@ -0,0 +1,35 @@ +diff -ur beanstalkd-1.10.org/ct/ct.c beanstalkd-1.10/ct/ct.c +--- beanstalkd-1.10.org/ct/ct.c 2014-08-04 21:39:54.000000000 -0600 ++++ beanstalkd-1.10/ct/ct.c 2016-01-08 11:40:40.867677319 -0700 +@@ -13,7 +13,9 @@ + #include + #include + #include ++#include + #include ++#include + #include "internal.h" + #include "ct.h" + +@@ -23,9 +24,9 @@ + static int64 bstart, bdur; + static int btiming; // bool + static int64 bbytes; +-static const int64 Second = 1000 * 1000 * 1000; +-static const int64 BenchTime = Second; +-static const int MaxN = 1000 * 1000 * 1000; ++const int64 Second = 1000 * 1000 * 1000; ++const int64 BenchTime = 1000 * 1000 * 1000; ++const int MaxN = 1000 * 1000 * 1000; + + + +@@ -416,7 +417,7 @@ + runbenchn(b, n); + } + if (b->status == 0) { +- printf("%8d\t%10lld ns/op", n, b->dur/n); ++ printf("%8d\t%10"PRId64" ns/op", n, b->dur/n); + if (b->bytes > 0) { + double mbs = 0; + if (b->dur > 0) { diff --git a/SOURCES/beanstalkd.service b/SOURCES/beanstalkd.service new file mode 100644 index 0000000..3dbe5ed --- /dev/null +++ b/SOURCES/beanstalkd.service @@ -0,0 +1,13 @@ +[Unit] +Description=Beanstalkd Fast Workqueue Service +After=network.target + +[Service] +User=beanstalkd +Type=simple +EnvironmentFile=-/etc/sysconfig/beanstalkd +ExecStart=/usr/bin/beanstalkd $ADDR $PORT $USER $MAX_JOB_SIZE $BINLOG_DIR $BINLOG_SIZE $BINLOG_FSYNC_PERIOD +Restart=always + +[Install] +WantedBy=multi-user.target diff --git a/SOURCES/beanstalkd.sysconfig b/SOURCES/beanstalkd.sysconfig new file mode 100644 index 0000000..e0bb152 --- /dev/null +++ b/SOURCES/beanstalkd.sysconfig @@ -0,0 +1,29 @@ +# System configuration for the beanstalkd daemon + +# +# beanstalkd commandline options +# + +ADDR=-l 0.0.0.0 +PORT=-p 11300 +USER=-u beanstalkd + +# Job size is left to the default. Uncomment and set it +# to a value to have it take affect. +#MAX_JOB_SIZE=-z 65535 + +# Using the binlog is off by default. +# +# The direcory to house the binlog. +#BINLOG_DIR=-b /var/lib/beanstalkd/binlog +# +# fsync the binlog at most once every N milliseconds. +# setting this to 0 means 'always fsync'. If this is unset, +# and the binlog is used, then no explicit fsync is ever +# performed. That is, the -F option is used. +#BINLOG_FSYNC_PERIOD=-f some-value +# +# The size of each binlog file. This is rounded +# up to the nearest 512 byte boundary. +#BINLOG_SIZE=-s 10485760 + diff --git a/SPECS/beanstalkd.spec b/SPECS/beanstalkd.spec new file mode 100644 index 0000000..0984efd --- /dev/null +++ b/SPECS/beanstalkd.spec @@ -0,0 +1,198 @@ +%global _hardened_build 1 + +%define beanstalkd_user beanstalkd +%define beanstalkd_group %{beanstalkd_user} +%define beanstalkd_home %{_localstatedir}/lib/beanstalkd +%define beanstalkd_binlogdir %{beanstalkd_home}/binlog + +Name: beanstalkd +Version: 1.10 +Release: 10%{?dist} +Summary: A simple, fast work-queue service + +License: MIT +URL: http://kr.github.io/%{name}/ +Source0: https://github.com/kr/%{name}/archive/v%{version}.tar.gz +Source1: %{name}.service +Source2: %{name}.sysconfig + +Patch1: beanstalkd-1.10-warnings.patch +Patch2: beanstalkd-1.10-mkdtemp.patch + +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 -p1 + + +%build +make LDFLAGS="%{?__global_ldflags}" CFLAGS="%{optflags}" %{?_smp_mflags} + + +%check +make check + + +%install +make install PREFIX=%{buildroot}%{_prefix} +%{__install} -p -D -m 0644 %{SOURCE1} %{buildroot}%{_unitdir}/%{name}.service +%{__install} -p -D -m 0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/sysconfig/%{name} +%{__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/%{name}.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_user} \ + %{beanstalkd_binlogdir} +fi +%systemd_post %{name}.service + + +%preun +%systemd_preun %{name}.service + + +%postun +%systemd_postun_with_restart %{name}.service + + +%files +%doc README doc/protocol.txt +%license LICENSE +%{_unitdir}/%{name}.service +%{_bindir}/%{name} +%{_mandir}/man1/%{name}.1* +%config(noreplace) %{_sysconfdir}/sysconfig/%{name} +%attr(0755,%{beanstalkd_user},%{beanstalkd_group}) %dir %{beanstalkd_home} +%ghost %attr(0755,%{beanstalkd_user},%{beanstalkd_group}) %dir %{beanstalkd_binlogdir} + + +%changelog +* Thu Jan 31 2019 Fedora Release Engineering - 1.10-10 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Mon Jul 16 2018 Nathanael Noblet - 1.10-9 +- Added missing BR gcc + +* Thu Jul 12 2018 Fedora Release Engineering - 1.10-8 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + +* Wed Feb 07 2018 Fedora Release Engineering - 1.10-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Sat Dec 16 2017 Neal Gompa - 1.10-6 +- Small spec improvements +- Drop legacy EL5-era stuff +- Use the correct systemd macro in post-install scriptlet + +* Wed Aug 02 2017 Fedora Release Engineering - 1.10-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild + +* Wed Jul 26 2017 Fedora Release Engineering - 1.10-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Fri Feb 10 2017 Fedora Release Engineering - 1.10-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild + +* Wed Feb 03 2016 Fedora Release Engineering - 1.10-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + +* Sat Dec 12 2015 Nathanael Noblet - 1.10-1 +- New upstream release + +* Wed Jun 17 2015 Fedora Release Engineering - 1.9-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + +* Fri Aug 15 2014 Fedora Release Engineering - 1.9-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild + +* Sat Jun 07 2014 Fedora Release Engineering - 1.9-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild + +* Sun Sep 08 2013 Jeremy Hinegardner - 1.9-1 +- update scriptlets with systemd macros (#850044) - from Václav Pavlín +- add hardened build (#954331) +- update to latests upstream + +* Sat Aug 03 2013 Fedora Release Engineering - 1.4.6-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild + +* Wed Feb 13 2013 Fedora Release Engineering - 1.4.6-8 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + +* Wed Jul 18 2012 Fedora Release Engineering - 1.4.6-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Sun Feb 19 2012 Jeremy Hinegardner - 1.4.6-6 +- Add systemd config Bug #754490 +- fix user/group creation to be in line with packaging standards +- fix Source URL + +* Thu Jan 12 2012 Fedora Release Engineering - 1.4.6-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild + +* Sun Feb 27 2011 Jeremy Hinegardner - 1.4.6-4 +- fix f15 build issues with patch from upstream + +* Mon Feb 07 2011 Fedora Release Engineering - 1.4.6-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Sat Jun 05 2010 Jeremy Hinegardner - 1.4.6-1 +- update to upstream 1.4.6 + +* Mon Feb 22 2010 Jeremy Hinegardner - 1.4.3-2 +- fix binlogdir location initialization for bug #55831 + +* Sun Feb 21 2010 Jeremy Hinegardner - 1.4.3-1 +- update to upstream 1.4.3 +- change default binlogdir in sysconfig file +- cleanup rpmlint warnings + +* Sat Oct 17 2009 Jeremy Hinegardner - 1.4.2-1 +- update to upstream 1.4.2 + +* Sun Oct 11 2009 Jeremy Hinegardner - 1.4-0 +- update to upstream 1.4 + +* Fri Jul 24 2009 Fedora Release Engineering - 1.3-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Sat Apr 11 2009 Jeremy Hinegardner - 1.3-1 +- update to upstream 1.3 + +* Mon Feb 23 2009 Fedora Release Engineering - 1.2-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild + +* Tue Feb 17 2009 Jeremy Hinegardner - 1.2-1 +- update to upstream 1.2 +- remove man page source as it was incorporated upstream + +* Sat Nov 22 2008 Jeremy Hinegardner - 1.1-1 +- initial spec creation