diff --git a/273.patch b/273.patch new file mode 100644 index 0000000..6c65149 --- /dev/null +++ b/273.patch @@ -0,0 +1,50 @@ +From d6507e52adcf851d8888b93f9905f0fad1052af2 Mon Sep 17 00:00:00 2001 +From: Robin Lee +Date: Sun, 16 Feb 2020 02:37:42 +0800 +Subject: [PATCH] Fix crashing of tests when '-Wp,-D_GLIBCXX_ASSERTIONS' is + given + +If 'vec' is a vector, calling 'vec[0]' will crash the program if +'vec' is empty and '-Wp,-D_GLIBCXX_ASSERTIONS' given in CXXFLAGS. + +Fixes https://github.com/gearman/gearmand/issues/272 +--- + libtest/cmdline.h | 4 ++-- + tests/hostile.cc | 2 +- + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/libtest/cmdline.h b/libtest/cmdline.h +index 692363f6..3503bada 100644 +--- a/libtest/cmdline.h ++++ b/libtest/cmdline.h +@@ -153,7 +153,7 @@ class Application { + + const char* stdout_c_str() const + { +- return &_stdout_buffer[0]; ++ return _stdout_buffer.size() ? &_stdout_buffer[0] : NULL; + } + + libtest::vchar_t stderr_result() const +@@ -163,7 +163,7 @@ class Application { + + const char* stderr_c_str() const + { +- return &_stderr_buffer[0]; ++ return _stderr_buffer.size() ? &_stderr_buffer[0] : NULL; + } + + size_t stderr_result_length() const +diff --git a/tests/hostile.cc b/tests/hostile.cc +index c4c0487d..c7686206 100644 +--- a/tests/hostile.cc ++++ b/tests/hostile.cc +@@ -136,7 +136,7 @@ extern "C" { + gearman_return_t rc; + void *value= gearman_client_do(&client, WORKER_FUNCTION_NAME, + NULL, +- &payload[0], ++ payload.size() ? &payload[0] : NULL, + payload.size() ? random() % payload.size() : 0, + NULL, &rc); + diff --git a/gearmand-1.1.12-ppc64le.patch b/gearmand-1.1.12-ppc64le.patch new file mode 100644 index 0000000..4a6780b --- /dev/null +++ b/gearmand-1.1.12-ppc64le.patch @@ -0,0 +1,21 @@ +diff -up gearmand-1.1.12/configure.ppc64le gearmand-1.1.12/configure +--- gearmand-1.1.12/configure.ppc64le 2014-09-09 17:12:22.368039057 +0200 ++++ gearmand-1.1.12/configure 2014-09-09 17:11:49.584039857 +0200 +@@ -16219,7 +16219,7 @@ $as_echo_n "checking for boostlib >= $bo + libsubdirs="lib" + ax_arch=`uname -m` + case $ax_arch in +- x86_64|ppc64|s390x|sparc64|aarch64) ++ x86_64|ppc64*|s390x|sparc64|aarch64) + libsubdirs="lib64 lib lib64" + ;; + esac +@@ -26051,7 +26051,7 @@ if ac_fn_c_try_compile "$LINENO"; then : + for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do + if test -n "$ac_prev"; then + case $ac_word in +- i?86 | x86_64 | ppc | ppc64) ++ i?86 | x86_64 | ppc | ppc64*) + if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then + ac_arch=$ac_word + else diff --git a/gearmand-1.1.19.1.tar.gz b/gearmand-1.1.19.1.tar.gz new file mode 100644 index 0000000..91c34e9 Binary files /dev/null and b/gearmand-1.1.19.1.tar.gz differ diff --git a/gearmand.init b/gearmand.init new file mode 100644 index 0000000..e2502aa --- /dev/null +++ b/gearmand.init @@ -0,0 +1,81 @@ +#!/bin/bash +# +# gearmand Startup script for the Gearman server +# +# chkconfig: - 85 15 +# description: Gearman is a distributed job system. +# processname: gearmand +# config: /etc/sysconfig/gearmand +# pidfile: /var/run/gearmand/gearmand.pid +# +### BEGIN INIT INFO +# Provides: gearmand +# Required-Start: $local_fs $network +# Required-Stop: $local_fs $network +# Default-Start: +# Default-Stop: +# Short-Description: start and stop the Gearman server +# Description: Gearman is a distributed job system. +### END INIT INFO + +# Source function library. +. /etc/rc.d/init.d/functions + +if [ -f /etc/sysconfig/gearmand ]; then + . /etc/sysconfig/gearmand +fi + +[ -z "${PIDFILE}" ] && pidfile="/var/run/gearmand/gearmand.pid" +[ -z "${LOCKFILE}" ] && lockfile="/var/lock/subsys/gearmand" + +gearmand=/usr/sbin/gearmand +prog=gearmand + +RETVAL=0 + +start() { + echo -n $"Starting $prog: " + daemon --pidfile=$pidfile --user=gearmand $gearmand -d $OPTIONS + RETVAL=$? + echo + [ $RETVAL = 0 ] && (touch $lockfile; pgrep -f $gearmand > $pidfile) + return $RETVAL +} + +stop() { + echo -n $"Stopping $prog: " + killproc -p $pidfile $gearmand + RETVAL=$? + echo + [ $RETVAL = 0 ] && rm -f $lockfile $pidfile +} + +# See how we were called. +case "$1" in + start) + start + ;; + stop) + stop + ;; + status) + status -p $pidfile $gearmand + RETVAL=$? + ;; + restart|reload) + stop + start + ;; + condrestart|try-restart) + if status -p $pidfile $gearmand >&/dev/null; then + stop + start + fi + ;; + *) + echo $"Usage: $prog {start|stop|restart|reload|condrestart|status|help}" + RETVAL=3 +esac + +exit $RETVAL + diff --git a/gearmand.service b/gearmand.service new file mode 100644 index 0000000..1be4a5c --- /dev/null +++ b/gearmand.service @@ -0,0 +1,12 @@ +[Unit] +Description=Gearmand distributed job system +After=syslog.target network.target + +[Service] +EnvironmentFile=/etc/sysconfig/gearmand +User=gearmand +Type=forking +ExecStart=/usr/sbin/gearmand -d --log-file none --syslog $OPTIONS + +[Install] +WantedBy=multi-user.target diff --git a/gearmand.spec b/gearmand.spec new file mode 100644 index 0000000..55d7572 --- /dev/null +++ b/gearmand.spec @@ -0,0 +1,111 @@ +Name: gearmand +Version: 1.1.19.1 +Release: 1 +Summary: A distributed job system +License: BSD +URL: http://www.gearman.org +Source0: https://github.com/gearman/%{name}/releases/download/%{version}/gearmand-%{version}.tar.gz +Source1: gearmand.init +Source2: gearmand.sysconfig +Source3: gearmand.service +Patch0: gearmand-1.1.12-ppc64le.patch +Patch1: https://github.com/gearman/gearmand/pull/273.patch +ExcludeArch: ppc +BuildRequires: gcc-c++ chrpath libuuid-devel boost-devel >= 1.37.0, boost-thread sqlite-devel +BuildRequires: tokyocabinet-devel libevent-devel libmemcached-devel, memcached hiredis-devel +BuildRequires: gperf mariadb-connector-c-devel openssl-devel libpq-devel zlib-devel systemd +%ifarch %{ix86} x86_64 ppc64 ppc64le aarch64 %{arm} +BuildRequires: gperftools-devel +%endif +Requires(pre): shadow-utils +Requires: procps +%{?systemd_requires} +%description +Gearman provides a generic framework to farm out work to other machines +or dispatch function calls to machines that are better suited to do the work. +It allows you to do work in parallel, to load balance processing, and to +call functions between languages. It can be used in a variety of applications, +from high-availability web sites to the transport for database replication. +In other words, it is the nervous system for how distributed processing +communicates. + +%package -n libgearman +Summary: Development libraries for gearman +Provides: libgearman-1.0 = %{version}-%{release} +Obsoletes: libgearman-1.0 < %{version}-%{release} +%description -n libgearman +Development libraries for %{name}. + +%package -n libgearman-devel +Summary: Development headers for libgearman +Requires: pkgconfig, libgearman = %{version}-%{release} libevent-devel +Provides: libgearman-1.0-devel = %{version}-%{release} +Obsoletes: libgearman-1.0-devel < %{version}-%{release} +%description -n libgearman-devel +Development headers for %{name}. + +%prep +%setup -q +%patch0 -p1 +%patch1 -p1 + +%build +%configure --disable-static --disable-silent-rules --enable-ssl +make %{_smp_mflags} + +%install +make install DESTDIR=%{buildroot} +rm -v %{buildroot}%{_libdir}/libgearman*.la +chrpath --delete %{buildroot}%{_bindir}/gearman +install -p -D -m 0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/sysconfig/gearmand +mkdir -p %{buildroot}%{_unitdir} +install -m 0644 %{SOURCE3} %{buildroot}%{_unitdir}/%{name}.service + +%check + +%pre +getent group gearmand >/dev/null || groupadd -r gearmand +getent passwd gearmand >/dev/null || \ + useradd -r -g gearmand -d / -s /sbin/nologin \ + -c "Gearmand job server" gearmand +exit 0 + +%post +%systemd_post gearmand.service + +%preun +%systemd_preun gearmand.service + +%postun +%systemd_postun_with_restart gearmand.service +%ldconfig_scriptlets -n libgearman + +%files +%license COPYING +%doc AUTHORS ChangeLog HACKING THANKS +%config(noreplace) %{_sysconfdir}/sysconfig/gearmand +%{_sbindir}/gearmand +%{_bindir}/gearman +%{_bindir}/gearadmin +%{_mandir}/man1/* +%{_mandir}/man8/* +%{_unitdir}/%{name}.service + +%files -n libgearman +%license COPYING +%{_libdir}/libgearman.so.8 +%{_libdir}/libgearman.so.8.0.0 + +%files -n libgearman-devel +%license COPYING +%doc AUTHORS ChangeLog HACKING THANKS +%dir %{_includedir}/libgearman +%{_includedir}/libgearman/ +%{_libdir}/pkgconfig/gearmand.pc +%{_libdir}/libgearman.so +%{_includedir}/libgearman-1.0/ +%{_mandir}/man3/* + +%changelog +* Tue Sep 7 2021 zhengyaohui - 1.1.19.1-1 +- package init diff --git a/gearmand.sysconfig b/gearmand.sysconfig new file mode 100644 index 0000000..bee2500 --- /dev/null +++ b/gearmand.sysconfig @@ -0,0 +1,3 @@ +### Settings for gearmand +# OPTIONS="" +