Accepting request 130819 from network:utilities

- Update to version 1.4.14 
* Avoid race condition in test during pid creation by blind retrying
* Fixed issue with invalid binary protocol touch command expiration time
- If the test suite fails, package must fail build.
- Use byteswapping macros from endian.h and not some ad-hoc/slow
 function.
- Add systemd units.

OBS-URL: https://build.opensuse.org/request/show/130819
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/memcached?expand=0&rev=20
This commit is contained in:
Ismail Dönmez 2012-08-15 09:20:01 +00:00 committed by Git OBS Bridge
commit 264bda0b17
9 changed files with 485 additions and 23 deletions

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:335ccd7904dea31b1884438f70ad650df6e38e9e368e975226435e447884ec69
size 270674

3
memcached-1.4.14.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f2e2ad8ee8d256f2c3748d7f741dcddfd0ab6bdece6fa1c18484e83f311156ef
size 321262

370
memcached-autofoo.patch Normal file
View File

@ -0,0 +1,370 @@
--- configure.ac.orig
+++ configure.ac
@@ -1,59 +1,15 @@
-AC_PREREQ(2.52)
+AC_PREREQ([2.60])
m4_include([version.m4])
m4_include([m4/c99-backport.m4])
-AC_INIT(memcached, VERSION_NUMBER, memcached@googlegroups.com)
-AC_CANONICAL_SYSTEM
+AC_INIT([memcached],[VERSION_NUMBER],[memcached@googlegroups.com])
+AC_CANONICAL_TARGET
AC_CONFIG_SRCDIR(memcached.c)
-AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
-AM_CONFIG_HEADER(config.h)
-
-AC_PROG_CC
-
-dnl **********************************************************************
-dnl DETECT_ICC ([ACTION-IF-YES], [ACTION-IF-NO])
-dnl
-dnl check if this is the Intel ICC compiler, and if so run the ACTION-IF-YES
-dnl sets the $ICC variable to "yes" or "no"
-dnl **********************************************************************
-AC_DEFUN([DETECT_ICC],
-[
- ICC="no"
- AC_MSG_CHECKING([for icc in use])
- if test "$GCC" = "yes"; then
- dnl check if this is icc acting as gcc in disguise
- AC_EGREP_CPP([^__INTEL_COMPILER], [__INTEL_COMPILER],
- AC_MSG_RESULT([no])
- [$2],
- AC_MSG_RESULT([yes])
- [$1]
- ICC="yes")
- else
- AC_MSG_RESULT([no])
- [$2]
- fi
-])
-
-DETECT_ICC([], [])
-
-dnl **********************************************************************
-dnl DETECT_SUNCC ([ACTION-IF-YES], [ACTION-IF-NO])
-dnl
-dnl check if this is the Sun Studio compiler, and if so run the ACTION-IF-YES
-dnl sets the $SUNCC variable to "yes" or "no"
-dnl **********************************************************************
-AC_DEFUN([DETECT_SUNCC],
-[
- AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
- AS_IF(test "x$SUNCC" = "xyes", [$1], [$2])
-
-])
-
-DETECT_SUNCC([CFLAGS="-mt $CFLAGS"], [])
-
-if test "$ICC" = "no"; then
- AC_PROG_CC_C99
-fi
+AM_INIT_AUTOMAKE([foreign -Wall -Wno-portability tar-pax no-dist-gzip dist-xz subdir-objects])
+AC_CONFIG_HEADERS([config.h])
+AC_PROG_CC_STDC
+AC_USE_SYSTEM_EXTENSIONS
+AC_SYS_LARGEFILE
AM_PROG_CC_C_O
AC_PROG_INSTALL
@@ -76,14 +32,11 @@ AC_DEFUN([AC_C_DETECT_SASL_CB_GETCONF],
[
AC_CACHE_CHECK([for SASL_CB_GETCONF],
[ac_cv_c_sasl_cb_getconf],
- [AC_TRY_COMPILE(
- [
+ [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <sasl/sasl.h>
- ], [
+ ]], [[
unsigned long val = SASL_CB_GETCONF;
- ],
- [ ac_cv_c_sasl_cb_getconf=yes ],
- [ ac_cv_c_sasl_cb_getconf=no ])
+ ]])],[ ac_cv_c_sasl_cb_getconf=yes ],[ ac_cv_c_sasl_cb_getconf=no ])
])
AS_IF([test "$ac_cv_c_sasl_cb_getconf" = "yes"],
[AC_DEFINE([HAVE_SASL_CB_GETCONF], 1,
@@ -170,23 +123,6 @@ fi
AC_SUBST(PROFILER_FLAGS)
-AC_ARG_ENABLE(64bit,
- [AS_HELP_STRING([--enable-64bit],[build 64bit version])])
-if test "x$enable_64bit" = "xyes"
-then
- org_cflags=$CFLAGS
- CFLAGS=-m64
- AC_RUN_IFELSE(
- [AC_LANG_PROGRAM([], [dnl
-return sizeof(void*) == 8 ? 0 : 1;
- ])
- ],[
- CFLAGS="-m64 $org_cflags"
- ],[
- AC_MSG_ERROR([Don't know how to build a 64-bit object.])
- ])
-fi
-
# Issue 213: Search for clock_gettime to help people linking
# with a static version of libevent
AC_SEARCH_LIBS(clock_gettime, rt)
@@ -195,91 +131,7 @@ AC_SEARCH_LIBS(clock_gettime, rt)
AC_SEARCH_LIBS(socket, socket)
AC_SEARCH_LIBS(gethostbyname, nsl)
-trylibeventdir=""
-AC_ARG_WITH(libevent,
- [ --with-libevent=PATH Specify path to libevent installation ],
- [
- if test "x$withval" != "xno" ; then
- trylibeventdir=$withval
- fi
- ]
-)
-
-dnl ------------------------------------------------------
-dnl libevent detection. swiped from Tor. modified a bit.
-
-LIBEVENT_URL=http://www.monkey.org/~provos/libevent/
-
-AC_CACHE_CHECK([for libevent directory], ac_cv_libevent_dir, [
- saved_LIBS="$LIBS"
- saved_LDFLAGS="$LDFLAGS"
- saved_CPPFLAGS="$CPPFLAGS"
- le_found=no
- for ledir in $trylibeventdir "" $prefix /usr/local ; do
- LDFLAGS="$saved_LDFLAGS"
- LIBS="-levent $saved_LIBS"
-
- # Skip the directory if it isn't there.
- if test ! -z "$ledir" -a ! -d "$ledir" ; then
- continue;
- fi
- if test ! -z "$ledir" ; then
- if test -d "$ledir/lib" ; then
- LDFLAGS="-L$ledir/lib $LDFLAGS"
- else
- LDFLAGS="-L$ledir $LDFLAGS"
- fi
- if test -d "$ledir/include" ; then
- CPPFLAGS="-I$ledir/include $CPPFLAGS"
- else
- CPPFLAGS="-I$ledir $CPPFLAGS"
- fi
- fi
- # Can I compile and link it?
- AC_TRY_LINK([#include <sys/time.h>
-#include <sys/types.h>
-#include <event.h>], [ event_init(); ],
- [ libevent_linked=yes ], [ libevent_linked=no ])
- if test $libevent_linked = yes; then
- if test ! -z "$ledir" ; then
- ac_cv_libevent_dir=$ledir
- _myos=`echo $target_os | cut -f 1 -d .`
- AS_IF(test "$SUNCC" = "yes" -o "x$_myos" = "xsolaris2",
- [saved_LDFLAGS="$saved_LDFLAGS -Wl,-R$ledir/lib"],
- [AS_IF(test "$GCC" = "yes",
- [saved_LDFLAGS="$saved_LDFLAGS -Wl,-rpath,$ledir/lib"])])
- else
- ac_cv_libevent_dir="(system)"
- fi
- le_found=yes
- break
- fi
- done
- LIBS="$saved_LIBS"
- LDFLAGS="$saved_LDFLAGS"
- CPPFLAGS="$saved_CPPFLAGS"
- if test $le_found = no ; then
- AC_MSG_ERROR([libevent is required. You can get it from $LIBEVENT_URL
-
- If it's already installed, specify its path using --with-libevent=/dir/
-])
- fi
-])
-LIBS="-levent $LIBS"
-if test $ac_cv_libevent_dir != "(system)"; then
- if test -d "$ac_cv_libevent_dir/lib" ; then
- LDFLAGS="-L$ac_cv_libevent_dir/lib $LDFLAGS"
- le_libdir="$ac_cv_libevent_dir/lib"
- else
- LDFLAGS="-L$ac_cv_libevent_dir $LDFLAGS"
- le_libdir="$ac_cv_libevent_dir"
- fi
- if test -d "$ac_cv_libevent_dir/include" ; then
- CPPFLAGS="-I$ac_cv_libevent_dir/include $CPPFLAGS"
- else
- CPPFLAGS="-I$ac_cv_libevent_dir $CPPFLAGS"
- fi
-fi
+PKG_CHECK_MODULES([LIBEVENT], [libevent])
dnl ----------------------------------------------------------------------------
@@ -308,14 +160,14 @@ dnl ************************************
AC_DEFUN([AC_HAVE_SASL_CALLBACK_FT],
[AC_CACHE_CHECK(for sasl_callback_ft, ac_cv_has_sasl_callback_ft,
[
- AC_TRY_COMPILE([
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#ifdef HAVE_SASL_SASL_H
#include <sasl/sasl.h>
#include <sasl/saslplug.h>
#endif
- ],[
+ ]], [[
sasl_callback_ft a_callback;
- ],[
+ ]])],[
ac_cv_has_sasl_callback_ft=yes
],[
ac_cv_has_sasl_callback_ft=no
@@ -337,18 +189,15 @@ AC_DEFUN([AC_C_DETECT_UINT64_SUPPORT],
[
AC_CACHE_CHECK([for print macros for integers (C99 section 7.8.1)],
[ac_cv_c_uint64_support],
- [AC_TRY_COMPILE(
- [
+ [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#ifdef HAVE_INTTYPES_H
#include <inttypes.h>
#endif
#include <stdio.h>
- ], [
+ ]], [[
uint64_t val = 0;
fprintf(stderr, "%" PRIu64 "\n", val);
- ],
- [ ac_cv_c_uint64_support=yes ],
- [ ac_cv_c_uint64_support=no ])
+ ]])],[ ac_cv_c_uint64_support=yes ],[ ac_cv_c_uint64_support=no ])
])
])
@@ -367,12 +216,12 @@ dnl Check if the type socklen_t is defin
AC_DEFUN([AC_C_SOCKLEN_T],
[AC_CACHE_CHECK(for socklen_t, ac_cv_c_socklen_t,
[
- AC_TRY_COMPILE([
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <sys/types.h>
#include <sys/socket.h>
- ],[
+ ]], [[
socklen_t foo;
- ],[
+ ]])],[
ac_cv_c_socklen_t=yes
],[
ac_cv_c_socklen_t=no
@@ -411,35 +260,6 @@ fi
AC_C_ENDIAN
-AC_DEFUN([AC_C_HTONLL],
-[
- AC_MSG_CHECKING([for htonll])
- have_htoll="no"
- AC_TRY_LINK([
-#include <sys/types.h>
-#include <netinet/in.h>
-#ifdef HAVE_INTTYPES_H
-#include <inttypes.h> */
-#endif
- ], [
- return htonll(0);
- ], [
- have_htoll="yes"
- AC_DEFINE([HAVE_HTONLL], [1], [Have ntohll])
- ], [
- have_htoll="no"
- ])
-
- AC_MSG_RESULT([$have_htoll])
-])
-
-AC_C_HTONLL
-
-dnl Check whether the user's system supports pthread
-AC_SEARCH_LIBS(pthread_create, pthread)
-if test "x$ac_cv_search_pthread_create" = "xno"; then
- AC_MSG_ERROR([Can't enable threads without the POSIX thread library.])
-fi
AC_CHECK_FUNCS(mlockall)
AC_CHECK_FUNCS(getpagesizes)
@@ -486,13 +306,13 @@ dnl These were added in 4.1.2, but 32bit
dnl lacks testable defines.
have_gcc_atomics=no
AC_MSG_CHECKING(for GCC atomics)
-AC_TRY_LINK([],[
+AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
unsigned short a;
unsigned short b;
b = __sync_add_and_fetch(&a, 1);
b = __sync_sub_and_fetch(&a, 2);
- ],[have_gcc_atomics=yes
- AC_DEFINE(HAVE_GCC_ATOMICS, 1, [GCC Atomics available])])
+ ]])],[have_gcc_atomics=yes
+ AC_DEFINE(HAVE_GCC_ATOMICS, 1, [GCC Atomics available])],[])
AC_MSG_RESULT($have_gcc_atomics)
dnl Check for the requirements for running memcached with less privileges
@@ -529,29 +349,5 @@ AM_CONDITIONAL([BUILD_SPECIFICATIONS],
[test "x$enable_docs" != "xno" -a "x$XML2RFC" != "xno" -a "x$XSLTPROC" != "xno"])
-dnl Let the compiler be a bit more picky. Please note that you cannot
-dnl specify these flags to the compiler before AC_CHECK_FUNCS, because
-dnl the test program will generate a compilation warning and hence fail
-dnl to detect the function ;-)
-if test "$ICC" = "yes"
-then
- dnl ICC trying to be gcc.
- CFLAGS="$CFLAGS -diag-disable 187 -Wall -Werror"
- AC_DEFINE([_GNU_SOURCE],[1],[find sigignore on Linux])
-elif test "$GCC" = "yes"
-then
- GCC_VERSION=`$CC -dumpversion`
- CFLAGS="$CFLAGS -Wall -Werror -pedantic -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls"
- case $GCC_VERSION in
- 4.4.*)
- CFLAGS="$CFLAGS -fno-strict-aliasing"
- ;;
- esac
- AC_DEFINE([_GNU_SOURCE],[1],[find sigignore on Linux])
-elif test "$SUNCC" = "yes"
-then
- CFLAGS="$CFLAGS -errfmt=error -errwarn -errshort=tags"
-fi
-
AC_CONFIG_FILES(Makefile doc/Makefile)
AC_OUTPUT
--- Makefile.am.orig
+++ Makefile.am
@@ -1,3 +1,6 @@
+AM_CFLAGS = -pthread -Wall -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls
+AM_CPPFLAGS = -include $(top_builddir)/config.h
+
bin_PROGRAMS = memcached
pkginclude_HEADERS = protocol_binary.h
noinst_PROGRAMS = memcached-debug sizes testapp timedrun
@@ -32,11 +35,12 @@ memcached_SOURCES += sasl_defs.c
endif
memcached_debug_SOURCES = $(memcached_SOURCES)
-memcached_CPPFLAGS = -DNDEBUG
-memcached_debug_LDADD = @PROFILER_LDFLAGS@
-memcached_debug_CFLAGS = @PROFILER_FLAGS@
+memcached_CPPFLAGS = $(AM_CPPFLAGS) -DNDEBUG
+memcached_debug_LDADD = @PROFILER_LDFLAGS@ $(LIBEVENT_LIBS)
+memcached_debug_CFLAGS = @PROFILER_FLAGS@ $(AM_CFLAGS)
+memcached_debug_CPPFLAGS = $(AM_CPPFLAGS)
-memcached_LDADD =
+memcached_LDADD = $(LIBEVENT_LIBS)
memcached_DEPENDENCIES =
memcached_debug_DEPENDENCIES =
CLEANFILES=

View File

@ -0,0 +1,56 @@
--- util.c.orig
+++ util.c
@@ -115,30 +115,3 @@ void vperror(const char *fmt, ...) {
perror(buf);
}
-#ifndef HAVE_HTONLL
-static uint64_t mc_swap64(uint64_t in) {
-#ifdef ENDIAN_LITTLE
- /* Little endian, flip the bytes around until someone makes a faster/better
- * way to do this. */
- int64_t rv = 0;
- int i = 0;
- for(i = 0; i<8; i++) {
- rv = (rv << 8) | (in & 0xff);
- in >>= 8;
- }
- return rv;
-#else
- /* big-endian machines don't need byte swapping */
- return in;
-#endif
-}
-
-uint64_t ntohll(uint64_t val) {
- return mc_swap64(val);
-}
-
-uint64_t htonll(uint64_t val) {
- return mc_swap64(val);
-}
-#endif
-
--- util.h.orig
+++ util.h
@@ -7,15 +7,16 @@
*
* returns true if conversion succeeded.
*/
+
+#include <endian.h>
+
bool safe_strtoull(const char *str, uint64_t *out);
bool safe_strtoll(const char *str, int64_t *out);
bool safe_strtoul(const char *str, uint32_t *out);
bool safe_strtol(const char *str, int32_t *out);
-#ifndef HAVE_HTONLL
-extern uint64_t htonll(uint64_t);
-extern uint64_t ntohll(uint64_t);
-#endif
+#define htonll(x) htobe64(x)
+#define ntohll(x) be64toh(x)
#ifdef __GCC
# define __gcc_attribute__ __attribute__

View File

@ -1,3 +1,17 @@
-------------------------------------------------------------------
Tue Aug 14 02:50:12 UTC 2012 - crrodriguez@opensuse.org
- Update to version 1.4.14
* Avoid race condition in test during pid creation by blind retrying
* Fixed issue with invalid binary protocol touch command expiration time
- If the test suite fails, package must fail build.
- Use byteswapping macros from endian.h and not some ad-hoc/slow
function.
- Add systemd units.
-------------------------------------------------------------------
Tue Apr 3 00:54:39 UTC 2012 - tabraham@novell.com

View File

@ -179,7 +179,7 @@ case "$1" in
echo -n "Starting memcached "
## Start daemon with startproc(8). If this fails
## the return value is set appropriately by startproc.
startproc -u $MEMCACHED_USER -g $MEMCACHED_GROUP $MEMCACHED_BIN $MEMCACHED_PARAMS
startproc -u $MEMCACHED_USER -g $MEMCACHED_GROUP $MEMCACHED_BIN -d $MEMCACHED_PARAMS
# Remember status and be verbose
rc_status -v

12
memcached.service Normal file
View File

@ -0,0 +1,12 @@
[Unit]
Description=memcached daemon
After=network.target
[Service]
User= memcached
Group= memcached
EnvironmentFile=/etc/sysconfig/memcached
ExecStart=/usr/sbin/memcached $MEMCACHED_PARAMS
[Install]
WantedBy=multi-user.target

View File

@ -15,17 +15,13 @@
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
# norootforbuild
Name: memcached
Version: 1.4.13
Version: 1.4.14
Release: 0
%define pkg_name memcached
%define pkg_version %{version}
#
License: BSD-3-Clause
Group: Productivity/Networking/Other
#
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version} > 1100
@ -33,20 +29,28 @@ BuildRequires: libevent-devel
%else
BuildRequires: libevent
%endif
BuildRequires: automake
BuildRequires: cyrus-sasl-devel
BuildRequires: pkgconfig
BuildRequires: systemd
PreReq: %insserv_prereq %fillup_prereq /usr/sbin/groupadd /usr/sbin/useradd
Conflicts: memcached-unstable
%define home_dir /var/lib/%{pkg_name}
#
Url: http://memcached.org/
# http://memcached.googlecode.com/files/memcached-1.4.5.tar.gz
Source: %{pkg_name}-%{pkg_version}.tar.bz2
Source: http://memcached.googlecode.com/files/%{name}-%{version}.tar.gz
Source1: %{pkg_name}.init
Source2: %{pkg_name}.sysconfig
Source3: memcached-rpmlintrc
Source4: memcached.service
#
Patch0: memcached-1.4.5.dif
Patch1: memcached-autofoo.patch
Patch2: memcached-use-endian_h.patch
#
Summary: A high-performance, distributed memory object caching system
License: BSD-3-Clause
Group: Productivity/Networking/Other
%{?systemd_requires}
%description
Memcached is a high-performance, distributed memory object caching
@ -62,46 +66,51 @@ resource utilization, and faster access to the databases on a memcache
miss.
%prep
%setup -n %{pkg_name}-%{pkg_version}
%setup -q -n %{pkg_name}-%{pkg_version}
%patch0
%patch1
%patch2
%build
export CFLAGS="%{optflags} -g"
%configure --bindir=%{_sbindir}
sed -i 's/-Werror/ /' Makefile
%{__make}
autoreconf -fiv
%configure --enable-sasl --disable-coverage --bindir=%{_sbindir}
make %{?_smp_mflags}
%check
%{__make} test || true
%{__make} test
%install
%makeinstall
%make_install
%{__install} -D -m 0755 scripts/memcached-tool %{buildroot}%{_sbindir}/memcached-tool
%{__install} -Dd -m 0755 %{buildroot}%{home_dir}
%{__install} -D -m 0755 %{S:1} %{buildroot}%{_sysconfdir}/init.d/%{pkg_name}
%{__ln_s} -f ../..%{_sysconfdir}/init.d/%{pkg_name} %{buildroot}%{_sbindir}/rc%{pkg_name}
%{__install} -D -m 0644 %{S:2} %{buildroot}/var/adm/fillup-templates/sysconfig.%{pkg_name}
%{__install} -D -m 0644 %{S:4} %{buildroot}%{_unitdir}/%{pkg_name}.service
%clean
%{__rm} -rf %{buildroot};
%pre
/usr/sbin/groupadd -r %{pkg_name} &>/dev/null || :
/usr/sbin/useradd -o -g %{pkg_name} -s /bin/false -r -c "user for %{pkg_name}" -d %{home_dir} %{pkg_name} &>/dev/null || :
%service_add_pre %{pkg_name}.service
%post
%fillup_and_insserv %{pkg_name}
%service_add_post %{pkg_name}.service
%preun
%stop_on_removal %{pkg_name}
%service_del_preun %{pkg_name}.service
%postun
%restart_on_update %{pkg_name}
%{insserv_cleanup}
%service_del_postun %{pkg_name}.service
%files
%defattr(-,root,root)
%doc AUTHORS ChangeLog COPYING NEWS README doc/*.txt
%doc AUTHORS ChangeLog COPYING NEWS doc/*.txt
%{_sbindir}/%{pkg_name}
# %{_sbindir}/%{pkg_name}-debug
%{_sbindir}/memcached-tool
@ -111,5 +120,6 @@ sed -i 's/-Werror/ /' Makefile
%{_includedir}/%{pkg_name}
/var/adm/fillup-templates/sysconfig.%{pkg_name}
%dir %attr(755,root,root) %{home_dir}
%{_unitdir}/%{pkg_name}.service
%changelog

View File

@ -8,7 +8,7 @@
#
# see man 1 memcached for more
#
MEMCACHED_PARAMS="-d -l 127.0.0.1"
MEMCACHED_PARAMS="-l 127.0.0.1"
## Path: Network/WWW/Memcached
## Description: username memcached should run as