Package init

This commit is contained in:
dogsheng 2019-12-25 15:41:44 +08:00
parent 80022bef40
commit 4a9f8fe00b
9 changed files with 650 additions and 0 deletions

View File

@ -0,0 +1,133 @@
From 1a476fb1cc53aa7beedf3d6e90573a81a421c506 Mon Sep 17 00:00:00 2001
From: Stefan Fritsch <sf@apache.org>
Date: Sun, 25 Feb 2018 16:41:11 +0000
Subject: [PATCH 06/15] Fix error handling in gdbm
Only check for gdbm_errno if the return value of the called gdbm_*
function says so. This fixes apr-util with gdbm 1.14, which does not
seem to always reset gdbm_errno.
Also make the gdbm driver return error codes starting with
APR_OS_START_USEERR instead of always returning APR_EGENERAL. This is
what the berkleydb driver already does.
Also ensure that dsize is 0 if dptr == NULL.
(backport of r1825311 in apr trunk)
git-svn-id: https://svn.apache.org/repos/asf/apr/apr-util/branches/1.6.x@1825312 13f79535-47bb-0310-9956-ffa450edef68
---
CHANGES | 5 ++++-
dbm/apr_dbm_gdbm.c | 48 ++++++++++++++++++++++++++++------------------
2 files changed, 33 insertions(+), 20 deletions(-)
diff --git a/dbm/apr_dbm_gdbm.c b/dbm/apr_dbm_gdbm.c
index 749447a0..4d563491 100644
--- a/dbm/apr_dbm_gdbm.c
+++ b/dbm/apr_dbm_gdbm.c
@@ -36,8 +36,20 @@
static apr_status_t g2s(int gerr)
{
if (gerr == -1) {
- /* ### need to fix this */
- return APR_EGENERAL;
+ if (gdbm_errno == GDBM_NO_ERROR)
+ return APR_SUCCESS;
+ return APR_OS_START_USEERR + gdbm_errno;
+ }
+
+ return APR_SUCCESS;
+}
+
+static apr_status_t gdat2s(datum d)
+{
+ if (d.dptr == NULL) {
+ if (gdbm_errno == GDBM_NO_ERROR || gdbm_errno == GDBM_ITEM_NOT_FOUND)
+ return APR_SUCCESS;
+ return APR_OS_START_USEERR + gdbm_errno;
}
return APR_SUCCESS;
@@ -53,22 +65,14 @@ static apr_status_t datum_cleanup(void *dptr)
static apr_status_t set_error(apr_dbm_t *dbm, apr_status_t dbm_said)
{
- apr_status_t rv = APR_SUCCESS;
-
- /* ### ignore whatever the DBM said (dbm_said); ask it explicitly */
+ dbm->errcode = dbm_said;
- if ((dbm->errcode = gdbm_errno) == GDBM_NO_ERROR) {
+ if (dbm_said == APR_SUCCESS)
dbm->errmsg = NULL;
- }
- else {
- dbm->errmsg = gdbm_strerror(gdbm_errno);
- rv = APR_EGENERAL; /* ### need something better */
- }
-
- /* captured it. clear it now. */
- gdbm_errno = GDBM_NO_ERROR;
+ else
+ dbm->errmsg = gdbm_strerror(dbm_said - APR_OS_START_USEERR);
- return rv;
+ return dbm_said;
}
/* --------------------------------------------------------------------------
@@ -107,7 +111,7 @@ static apr_status_t vt_gdbm_open(apr_dbm_t **pdb, const char *pathname,
NULL);
if (file == NULL)
- return APR_EGENERAL; /* ### need a better error */
+ return APR_OS_START_USEERR + gdbm_errno;
/* we have an open database... return it */
*pdb = apr_pcalloc(pool, sizeof(**pdb));
@@ -141,10 +145,12 @@ static apr_status_t vt_gdbm_fetch(apr_dbm_t *dbm, apr_datum_t key,
if (pvalue->dptr)
apr_pool_cleanup_register(dbm->pool, pvalue->dptr, datum_cleanup,
apr_pool_cleanup_null);
+ else
+ pvalue->dsize = 0;
/* store the error info into DBM, and return a status code. Also, note
that *pvalue should have been cleared on error. */
- return set_error(dbm, APR_SUCCESS);
+ return set_error(dbm, gdat2s(rd));
}
static apr_status_t vt_gdbm_store(apr_dbm_t *dbm, apr_datum_t key,
@@ -201,9 +207,11 @@ static apr_status_t vt_gdbm_firstkey(apr_dbm_t *dbm, apr_datum_t *pkey)
if (pkey->dptr)
apr_pool_cleanup_register(dbm->pool, pkey->dptr, datum_cleanup,
apr_pool_cleanup_null);
+ else
+ pkey->dsize = 0;
/* store any error info into DBM, and return a status code. */
- return set_error(dbm, APR_SUCCESS);
+ return set_error(dbm, gdat2s(rd));
}
static apr_status_t vt_gdbm_nextkey(apr_dbm_t *dbm, apr_datum_t *pkey)
@@ -221,9 +229,11 @@ static apr_status_t vt_gdbm_nextkey(apr_dbm_t *dbm, apr_datum_t *pkey)
if (pkey->dptr)
apr_pool_cleanup_register(dbm->pool, pkey->dptr, datum_cleanup,
apr_pool_cleanup_null);
+ else
+ pkey->dsize = 0;
/* store any error info into DBM, and return a status code. */
- return set_error(dbm, APR_SUCCESS);
+ return set_error(dbm, gdat2s(rd));
}
static void vt_gdbm_freedatum(apr_dbm_t *dbm, apr_datum_t data)
--
2.19.1

View File

@ -0,0 +1,46 @@
From aecf1eb280326484a58b21c68a18373f7c17872e Mon Sep 17 00:00:00 2001
From: Ruediger Pluem <rpluem@apache.org>
Date: Mon, 5 Feb 2018 09:44:16 +0000
Subject: [PATCH 05/15] Merge r1822315 from trunk:
* We cannot access list any longer after we called apr_allocator_free as it points to memory we just freed.
Reviewed by: rpluem
git-svn-id: https://svn.apache.org/repos/asf/apr/apr-util/branches/1.6.x@1823146 13f79535-47bb-0310-9956-ffa450edef68
---
buckets/apr_buckets_alloc.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/buckets/apr_buckets_alloc.c b/buckets/apr_buckets_alloc.c
index e5838dd0..2d6f214e 100644
--- a/buckets/apr_buckets_alloc.c
+++ b/buckets/apr_buckets_alloc.c
@@ -45,12 +45,21 @@ struct apr_bucket_alloc_t {
static apr_status_t alloc_cleanup(void *data)
{
apr_bucket_alloc_t *list = data;
+#if APR_POOL_DEBUG
+ apr_allocator_t *allocator = NULL;
+#endif
+
+#if APR_POOL_DEBUG
+ if (list->pool && list->allocator != apr_pool_allocator_get(list->pool)) {
+ allocator = list->allocator;
+ }
+#endif
apr_allocator_free(list->allocator, list->blocks);
#if APR_POOL_DEBUG
- if (list->pool && list->allocator != apr_pool_allocator_get(list->pool)) {
- apr_allocator_destroy(list->allocator);
+ if (allocator) {
+ apr_allocator_destroy(allocator);
}
#endif
--
2.19.1

View File

@ -0,0 +1,142 @@
From a3a77fb2cb515be72de6eb36d51da40998a2d8a3 Mon Sep 17 00:00:00 2001
From: Yann Ylavic <ylavic@apache.org>
Date: Wed, 27 Jun 2018 23:18:10 +0000
Subject: [PATCH 08/15] Merge r1834022, r1834023, r1834024 from trunk:
apr_reslist: test for ttl = 0
The current reslist implementation handles ttl=0 as no TTL when acquiring
resources (expected and documented), but as zero TTL when releasing (immediate
expiry, so resources above smax are never recycled).
This test validates the upcoming fix (r1834023).
apr_reslist: fix release of resource with zero/no TTL.
Ignore expiry when ttl=0 in apr_reslist_maintain(), like apr_reslist_acquire().
While ttl=0 is supposed to mean no TTL/expiry, apr_reslist_maintain() hence
apr_reslist_release() were destroying all resources above smax in this case.
Corresponding test already committed in r1834022.
apr_reslist: follow up to r1834023: avoid unnecessary apr_time_now() calls.
When ttl=0 is configured, we never need to check for expiry.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr-util/branches/1.6.x@1834558 13f79535-47bb-0310-9956-ffa450edef68
---
misc/apr_reslist.c | 16 +++++++++++-----
test/testreslist.c | 39 +++++++++++++++++++++++++++++++++++++++
2 files changed, 50 insertions(+), 5 deletions(-)
diff --git a/misc/apr_reslist.c b/misc/apr_reslist.c
index 0c43e074..12ae96a1 100644
--- a/misc/apr_reslist.c
+++ b/misc/apr_reslist.c
@@ -81,7 +81,9 @@ static apr_res_t *pop_resource(apr_reslist_t *reslist)
static void push_resource(apr_reslist_t *reslist, apr_res_t *resource)
{
APR_RING_INSERT_HEAD(&reslist->avail_list, resource, apr_res_t, link);
- resource->freed = apr_time_now();
+ if (reslist->ttl) {
+ resource->freed = apr_time_now();
+ }
reslist->nidle++;
}
@@ -210,8 +212,10 @@ APU_DECLARE(apr_status_t) apr_reslist_maintain(apr_reslist_t *reslist)
created_one++;
}
- /* We don't need to see if we're over the max if we were under it before */
- if (created_one) {
+ /* We don't need to see if we're over the max if we were under it before,
+ * nor need we check for expiry if no ttl is configure.
+ */
+ if (created_one || !reslist->ttl) {
#if APR_HAS_THREADS
apr_thread_mutex_unlock(reslist->listlock);
#endif
@@ -328,14 +332,16 @@ APU_DECLARE(apr_status_t) apr_reslist_acquire(apr_reslist_t *reslist,
{
apr_status_t rv;
apr_res_t *res;
- apr_time_t now;
+ apr_time_t now = 0;
#if APR_HAS_THREADS
apr_thread_mutex_lock(reslist->listlock);
#endif
/* If there are idle resources on the available list, use
* them right away. */
- now = apr_time_now();
+ if (reslist->ttl) {
+ now = apr_time_now();
+ }
while (reslist->nidle > 0) {
/* Pop off the first resource */
res = pop_resource(reslist);
diff --git a/test/testreslist.c b/test/testreslist.c
index 36333a15..78c908d2 100644
--- a/test/testreslist.c
+++ b/test/testreslist.c
@@ -258,6 +258,44 @@ static void test_reslist(abts_case *tc, void *data)
ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
}
+static void test_reslist_no_ttl(abts_case *tc, void *data)
+{
+ apr_status_t rv;
+ apr_reslist_t *rl;
+ my_parameters_t *params;
+ my_resource_t *res;
+
+ /* Parameters (sleep not used) */
+ params = apr_pcalloc(p, sizeof(*params));
+
+ rv = apr_reslist_create(&rl,
+ /*no min*/0, /*no smax*/0, /*max*/1, /*no ttl*/0,
+ my_constructor, my_destructor, params, p);
+ ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
+
+ /* Acquire/contruct one resource */
+ rv = apr_reslist_acquire(rl, (void **)&res);
+ ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
+ ABTS_INT_EQUAL(tc, 0, res->id);
+
+ /* Release it before next check */
+ rv = apr_reslist_release(rl, res);
+ ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
+
+ /* Re-acquire/release: the resource should be the same */
+ rv = apr_reslist_acquire(rl, (void **)&res);
+ ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
+ ABTS_INT_EQUAL(tc, 0, res->id);
+
+ /* Release it before cleanup */
+ rv = apr_reslist_release(rl, res);
+ ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
+
+ rv = apr_reslist_destroy(rl);
+ ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
+ ABTS_INT_EQUAL(tc, params->d_count, 1);
+}
+
#endif /* APR_HAS_THREADS */
abts_suite *testreslist(abts_suite *suite)
@@ -266,6 +304,7 @@ abts_suite *testreslist(abts_suite *suite)
#if APR_HAS_THREADS
abts_run_test(suite, test_reslist, NULL);
+ abts_run_test(suite, test_reslist_no_ttl, NULL);
#endif
return suite;
--
2.19.1

View File

@ -0,0 +1,30 @@
From 966ad88931e413f1f6a29035af67fe06b7e7fdc3 Mon Sep 17 00:00:00 2001
From: Rainer Jung <rjung@apache.org>
Date: Sat, 25 Aug 2018 13:38:26 +0000
Subject: [PATCH 10/15] Remove dereference of null pointer.
Backport of r1836231 from trunk.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr-util/branches/1.6.x@1839051 13f79535-47bb-0310-9956-ffa450edef68
---
hooks/apr_hooks.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/hooks/apr_hooks.c b/hooks/apr_hooks.c
index 4cedb3a5..af3dc958 100644
--- a/hooks/apr_hooks.c
+++ b/hooks/apr_hooks.c
@@ -180,7 +180,8 @@ static TSort *tsort(TSort *pData,int nItems)
break;
}
}
- pTail->pNext=NULL; /* unfudge the tail */
+ if(pTail)
+ pTail->pNext=NULL; /* unfudge the tail */
return pHead;
}
--
2.19.1

View File

@ -0,0 +1,128 @@
This is an upstream patch from: https://bz.apache.org/bugzilla/show_bug.cgi?id=61517
diff -ur a/build/dbd.m4 b/build/dbd.m4
--- a/build/dbd.m4 2017-05-03 19:18:52.000000000 -0400
+++ b/build/dbd.m4 2017-09-13 16:58:07.369546391 -0400
@@ -163,10 +163,15 @@
old_cppflags="$CPPFLAGS"
old_ldflags="$LDFLAGS"
+ my_library="mysqlclient"
+
AC_ARG_WITH([mysql], APR_HELP_STRING([--with-mysql=DIR], [enable MySQL DBD driver]),
[
if test "$withval" = "yes"; then
AC_PATH_PROG([MYSQL_CONFIG],[mysql_config])
+ if test "x$MYSQL_CONFIG" = "x"; then
+ AC_PATH_PROG([MYSQL_CONFIG],[mariadb_config])
+ fi
if test "x$MYSQL_CONFIG" != 'x'; then
mysql_CPPFLAGS="`$MYSQL_CONFIG --include`"
mysql_LDFLAGS="`$MYSQL_CONFIG --libs_r | sed -e 's/-l[[^ ]]\+//g'`"
@@ -174,32 +179,40 @@
APR_ADDTO(CPPFLAGS, [$mysql_CPPFLAGS])
APR_ADDTO(LIBS, [$mysql_LIBS])
+
+ if $MYSQL_CONFIG --libs_r | grep -q mariadb; then
+ my_library="mariadb"
+ fi
fi
- AC_CHECK_HEADERS([mysql.h my_global.h my_sys.h],
- AC_CHECK_LIB(mysqlclient, mysql_init, [apu_have_mysql=1]),
- [apu_have_mysql=0; break],
- [#include <my_global.h>])
- if test "$apu_have_mysql" = "0"; then
- AC_CHECK_HEADERS([mysql/mysql.h mysql/my_global.h mysql/my_sys.h],
- AC_CHECK_LIB(mysqlclient, mysql_init, [apu_have_mysql=1]),
- [apu_have_mysql=0; break],
- [#include <mysql/my_global.h>])
+ AC_CHECK_HEADERS([mysql.h errmsg.h], [apu_have_mysql=1], [apu_have_mysql=0; break])
+ if test "$apr_have_mysql" = "0"; then
+ AC_CHECK_HEADERS([mysql/mysql.h mysql/errmsg.h], [apu_have_mysql=1], [apu_have_mysql=0; break])
fi
- if test "$apu_have_mysql" != "0" && test "x$MYSQL_CONFIG" != 'x'; then
- APR_ADDTO(APRUTIL_PRIV_INCLUDES, [$mysql_CPPFLAGS])
+ if test "$apr_have_mysql" = "1"; then
+ AC_CHECK_HEADERS([my_global.h my_sys.h mysql/my_global.h mysql/my_sys.h])
+ AC_CHECK_LIB($my_library, mysql_init,, [apu_have_mysql=0])
+ fi
+ if test "$apu_have_mysql" = "1" && test "x$MYSQL_CONFIG" != 'x'; then
+ APR_ADDTO(APRUTIL_PRIV_INCLUDES, [$mysql_CPPFLAGS])
fi
elif test "$withval" = "no"; then
:
else
AC_PATH_PROG([MYSQL_CONFIG],[mysql_config],,[$withval/bin])
+ if test "x$MYSQL_CONFIG" = "x"; then
+ AC_PATH_PROG([MYSQL_CONFIG],[mariadb_config],,[$withval/bin])
+ fi
if test "x$MYSQL_CONFIG" != 'x'; then
- mysql_CPPFLAGS="`$MYSQL_CONFIG --include`"
- mysql_LDFLAGS="`$MYSQL_CONFIG --libs_r | sed -e 's/-l[[^ ]]\+//g'`"
- mysql_LIBS="`$MYSQL_CONFIG --libs_r`"
+ mysql_CPPFLAGS="`$MYSQL_CONFIG --include`"
+ mysql_LDFLAGS="`$MYSQL_CONFIG --libs_r | sed -e 's/-l[[^ ]]\+//g'`"
+ mysql_LIBS="`$MYSQL_CONFIG --libs_r`"
+ if $MYSQL_CONFIG --libs_r | grep -q mariadb; then
+ my_library="mariadb"
+ fi
else
- mysql_CPPFLAGS="-I$withval/include"
- mysql_LDFLAGS="-L$withval/lib "
+ mysql_CPPFLAGS="-I$withval/include"
+ mysql_LDFLAGS="-L$withval/lib "
fi
APR_ADDTO(CPPFLAGS, [$mysql_CPPFLAGS])
@@ -207,18 +220,15 @@
APR_ADDTO(LIBS, [$mysql_LIBS])
AC_MSG_NOTICE(checking for mysql in $withval)
- AC_CHECK_HEADERS([mysql.h my_global.h my_sys.h],
- AC_CHECK_LIB(mysqlclient, mysql_init, [apu_have_mysql=1]),
- [apu_have_mysql=0; break],
- [#include <my_global.h>])
-
- if test "$apu_have_mysql" != "1"; then
- AC_CHECK_HEADERS([mysql/mysql.h mysql/my_global.h mysql/my_sys.h],
- AC_CHECK_LIB(mysqlclient, mysql_init, [apu_have_mysql=1]),
- [apu_have_mysql=0; break],
- [#include <mysql/my_global.h>])
+ AC_CHECK_HEADERS([mysql.h errmsg.h], [apu_have_mysql=1], [apu_have_mysql=0; break])
+ if test "$apr_have_mysql" = "0"; then
+ AC_CHECK_HEADERS([mysql/mysql.h mysql/errmsg.h], [apu_have_mysql=1], [apu_have_mysql=0; break])
+ fi
+ if test "$apr_have_mysql" = "1"; then
+ AC_CHECK_HEADERS([my_global.h my_sys.h mysql/my_global.h mysql/my_sys.h])
+ AC_CHECK_LIB($my_library, mysql_init,, [apu_have_mysql=0])
fi
- if test "$apu_have_mysql" != "0"; then
+ if test "$apu_have_mysql" = "1"; then
APR_ADDTO(APRUTIL_PRIV_INCLUDES, [$mysql_CPPFLAGS])
fi
fi
@@ -229,7 +239,7 @@
dnl Since we have already done the AC_CHECK_LIB tests, if we have it,
dnl we know the library is there.
if test "$apu_have_mysql" = "1"; then
- APR_ADDTO(LDADD_dbd_mysql, [$mysql_LDFLAGS -lmysqlclient $mysql_LIBS])
+ APR_ADDTO(LDADD_dbd_mysql, [$mysql_LDFLAGS -l$my_library $mysql_LIBS])
fi
AC_SUBST(LDADD_dbd_mysql)
diff -ur a/dbd/apr_dbd_mysql.c b/dbd/apr_dbd_mysql.c
--- a/dbd/apr_dbd_mysql.c 2017-05-03 19:18:52.000000000 -0400
+++ b/dbd/apr_dbd_mysql.c 2017-09-13 19:15:20.894368809 -0400
@@ -1262,7 +1262,9 @@
static void dbd_mysql_init(apr_pool_t *pool)
{
+#if MYSQL_VERSION_ID < 100000
my_init();
+#endif
mysql_thread_init();
/* FIXME: this is a guess; find out what it really does */

View File

@ -0,0 +1,25 @@
--- apr-util-1.2.7/Makefile.in.pkgconf
+++ apr-util-1.2.7/Makefile.in
@@ -51,7 +51,7 @@
# Create apu-config script suitable for the install tree
apu-config.out: $(APU_CONFIG)
- sed 's,^\(location=\).*$$,\1installed,' < $(APU_CONFIG) > $@
+ sed 's,^\(location=\).*$$,\1installed,;s,^\(APR_.*_DIR\)=.*,\1="$${libdir}/build",' < $(APU_CONFIG) > $@
install: $(TARGETS) install-modules
$(APR_MKDIR) $(DESTDIR)$(includedir) $(DESTDIR)$(libdir)/pkgconfig \
--- apr-util-1.2.7/apu-config.in.pkgconf
+++ apr-util-1.2.7/apu-config.in
@@ -24,9 +24,10 @@
prefix="@prefix@"
exec_prefix="@exec_prefix@"
bindir="@bindir@"
-libdir="@libdir@"
includedir="@includedir@"
+libdir=`pkg-config --variable=libdir apr-util-@APRUTIL_MAJOR_VERSION@`
+
LIBS="@APRUTIL_EXPORT_LIBS@"
INCLUDES="@APRUTIL_INCLUDES@"
LDFLAGS="@APRUTIL_LDFLAGS@"

View File

@ -0,0 +1,10 @@
--- apr-util-1.4.1/apr-util.pc.in~ 2008-05-23 16:27:37.000000000 -0500
+++ apr-util-1.4.1/apr-util.pc.in 2013-02-07 08:55:09.717312176 -0600
@@ -9,5 +9,6 @@
Version: @APRUTIL_DOTTED_VERSION@
# assume that apr-util requires libapr of same major version
Requires: apr-@APRUTIL_MAJOR_VERSION@
-Libs: -L${libdir} -l@APRUTIL_LIBNAME@ @LDADD_ldap@ @APRUTIL_EXPORT_LIBS@
+Libs: -L${libdir} -l@APRUTIL_LIBNAME@ @LDADD_ldap@
+Libs.private: @APRUTIL_EXPORT_LIBS@
Cflags: -I${includedir}

BIN
apr-util-1.6.1.tar.bz2 Normal file

Binary file not shown.

136
apr-util.spec Normal file
View File

@ -0,0 +1,136 @@
%define apuver 1
Name: apr-util
Version: 1.6.1
Release: 10
Summary: apr-util provides a number of helpful abstractions on top of APR.
License: ASL 2.0
URL: http://apr.apache.org
Source0: http://www.apache.org/dist/apr/%{name}-%{version}.tar.bz2
Patch0: apr-util-1.2.7-pkgconf.patch
Patch1: apr-util-1.4.1-private.patch
Patch6000: Updated-patch-to-compile-apr-util-against-mariadb-10.patch
Patch6001: Merge-r1822315-from-trunk.patch
Patch6002: Fix-error-handling-in-gdbm.patch
Patch6003: Merge-r1834022-r1834023-r1834024-from-trunk.patch
Patch6004: Remove-dereference-of-null-pointer.patch
BuildRequires: gcc autoconf apr-devel >= 1.6.0 libdb-devel expat-devel libuuid-devel
BuildRequires: mariadb-connector-c-devel sqlite-devel >= 3.1.0 openldap-devel openssl-devel
Requires: apr-util%{?_isa} = %{version}-%{release}
Recommends: apr-util-openssl%{_isa} = %{version}-%{release}
Recommends: apr-util-bdb%{_isa} = %{version}-%{release}
Obsoletes: apr-util-bdb < %{version}-%{release} apr-util-mysql < %{version}-%{release}
Obsoletes: apr-util-sqlite < %{version}-%{release} apr-util-ldap < %{version}-%{release}
Obsoletes: apr-util-openssl < %{version}-%{release}
Provides: apr-util-bdb = %{version}-%{release} apr-util-mysql = %{version}-%{release}
Provides: apr-util-sqlite = %{version}-%{release} apr-util-ldap = %{version}-%{release}
Provides: apr-util-openssl = %{version}-%{release}
%description
The mission of the Apache Portable Runtime (APR) project is to create and maintain software
libraries that provide a predictable and consistent interface to underlying platform-specific
implementations. The primary goal is to provide an API to which software developers may
code and be assured of predictable if not identical behaviour regardless of the platform on
which their software is built, relieving them of the need to code special-case conditions to
work around or take advantage of platform-specific deficiencies or features.
%package devel
Summary: The development kit of apr-util.
Requires: expat-devel%{?_isa} apr-util%{?_isa} = %{version}-%{release}
Requires: libdb-devel%{?_isa} openldap-devel%{?_isa} apr-devel%{?_isa} pkgconfig
%description devel
The development kit of apr-util.
%package pgsql
Summary: The PostgreSQL DBD driver of apr-util.
BuildRequires: libpq-devel
Requires: apr-util%{?_isa} = %{version}-%{release}
%description pgsql
The PostgreSQL DBD driver of apr-util.
%package odbc
Summary: The ODBC DBD driver of apr-util.
BuildRequires: unixODBC-devel
Requires: apr-util%{?_isa} = %{version}-%{release}
%description odbc
The ODBC DBD driver of apr-util.
%prep
%autosetup -n %{name}-%{version} -p1
%build
autoheader && autoconf
export ac_cv_ldap_set_rebind_proc_style=three
%configure --with-apr=%{_prefix} --includedir=%{_includedir}/apr-%{apuver} \
--with-ldap=ldap_r --without-gdbm --with-sqlite3 --with-pgsql --with-mysql --with-odbc \
--with-dbm=db5 --with-berkeley-db --without-sqlite2 --with-crypto --with-openssl
%make_build
%install
rm -rf %{buildroot}
%make_install
install -D -m 0644 build/find_apu.m4 %{buildroot}/%{_datadir}/aclocal/find_apu.m4
rm -f %{buildroot}%{_libdir}/aprutil.exp
rm -f %{buildroot}%{_libdir}/libapr*.a
sed -i '/^old_library/s,libapr.*\.a,,' %{buildroot}%{_libdir}/libapr*.la
sed -ri '/^dependency_libs/{s,-l(pq|sqlite[0-9]|rt|dl|uuid) ,,g}' \
%{buildroot}%{_libdir}/libapr*.la
rm -f %{buildroot}%{_libdir}/%{name}-%{apuver}/*.*a
%check
export MALLOC_CHECK_=2 MALLOC_PERTURB_=$(($RANDOM % 255 + 1))
export LD_LIBRARY_PATH=%{buildroot}/%{_libdir}/%{name}-%{apuver}
make test
%ldconfig_scriptlets
%pre
%preun
%post
%postun
%files
%doc CHANGES NOTICE
%license LICENSE
%{_libdir}/libaprutil-%{apuver}.so.*
%dir %{_libdir}/%{name}-%{apuver}
%{_libdir}/%{name}-%{apuver}/apr_dbm_db*
%{_libdir}/%{name}-%{apuver}/apr_dbd_mysql*
%{_libdir}/%{name}-%{apuver}/apr_dbd_sqlite*
%{_libdir}/%{name}-%{apuver}/apr_ldap*
%{_libdir}/%{name}-%{apuver}/apr_crypto_openssl*
%files devel
%{_bindir}/apu-%{apuver}-config
%{_libdir}/libaprutil-%{apuver}.*a
%{_libdir}/libaprutil-%{apuver}.so
%{_includedir}/apr-%{apuver}/*.h
%{_libdir}/pkgconfig/*.pc
%{_datadir}/aclocal/*.m4
%files pgsql
%{_libdir}/%{name}-%{apuver}/apr_dbd_pgsql*
%files odbc
%{_libdir}/%{name}-%{apuver}/apr_dbd_odbc*
%changelog
* Tue Oct 22 2019 openEuler Buildteam <buildteam@openeuler.org> - 1.6.1-10
- optimize spec file.
* Sat Sep 28 2019 openEuler Buildteam <buildteam@openeuler.org> - 1.6.1-9
- Package rebuild.
* Thu Sep 05 2019 openEuler Buildteam <buildteam@openeuler.org> - 1.6.1-8
- Package init.