apr-util: upgraded package to upstream

Upgraded dev-libs/apr-util to version 1.6.1-r3 on amd64, arm, arm64

BUG=chromium:1001245
TEST=preCQ

Change-Id: Ifbb18fdca03480cc3fbc441e5cf410096bd302a8
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/overlays/portage-stable/+/1832453
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Chris McDonald <cjmcdonald@chromium.org>
Tested-by: Chris McDonald <cjmcdonald@chromium.org>
diff --git a/dev-libs/apr-util/Manifest b/dev-libs/apr-util/Manifest
index 2e1ff8d..3759f95 100644
--- a/dev-libs/apr-util/Manifest
+++ b/dev-libs/apr-util/Manifest
@@ -1 +1 @@
-DIST apr-util-1.5.3.tar.bz2 695303 SHA256 78edb174f13e25ee15ded2b849b741a248b879a93a77a2d31c20f7e225be3968 SHA512 b03588fd10c8705ea72cb35e821a99ba160c5a480d91d766969672c72a4db5bc2ec01b13cbe0eccc1cd1eadd96e8198994296bc2f0232b3fce4e82271a382db6 WHIRLPOOL 4e3d131c2fcb5818db76c2d663caf7ab193a020011d21a1b03238075ba1ddb9778aa3df1e165cb13833efc446c81d13893a126d91e8da6cc55a5431e50f3b797
+DIST apr-util-1.6.1.tar.bz2 428595 BLAKE2B ab6eaf1594aaa1c7aae151319b630b83bdb8b68ec04f0e2b429b7c7789bdf274873270200ba43701359e2502d2be8624d8e42a56a5f399ec95a841e7c73ce706 SHA512 40eff8a37c0634f7fdddd6ca5e596b38de15fd10767a34c30bbe49c632816e8f3e1e230678034f578dd5816a94f246fb5dfdf48d644829af13bf28de3225205d
diff --git a/dev-libs/apr-util/apr-util-1.5.3-r1.ebuild b/dev-libs/apr-util/apr-util-1.5.3-r1.ebuild
deleted file mode 100644
index cf4b67f..0000000
--- a/dev-libs/apr-util/apr-util-1.5.3-r1.ebuild
+++ /dev/null
@@ -1,109 +0,0 @@
-# Copyright 1999-2014 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/dev-libs/apr-util/apr-util-1.5.3-r1.ebuild,v 1.1 2014/01/31 08:12:03 vapier Exp $
-
-EAPI="4"
-
-# Usually apr-util has the same PV as apr, but in case of security fixes, this may change.
-# APR_PV="${PV}"
-APR_PV="1.4.6"
-
-inherit autotools db-use eutils libtool multilib toolchain-funcs
-
-DESCRIPTION="Apache Portable Runtime Utility Library"
-HOMEPAGE="http://apr.apache.org/"
-SRC_URI="mirror://apache/apr/${P}.tar.bz2"
-
-LICENSE="Apache-2.0"
-SLOT="1"
-KEYWORDS="*"
-IUSE="berkdb doc freetds gdbm ldap mysql nss odbc openssl postgres sqlite static-libs"
-RESTRICT="test"
-
-RDEPEND="dev-libs/expat
-	>=dev-libs/apr-${APR_PV}:1
-	berkdb? ( >=sys-libs/db-4 )
-	freetds? ( dev-db/freetds )
-	gdbm? ( sys-libs/gdbm )
-	ldap? ( =net-nds/openldap-2* )
-	mysql? ( =virtual/mysql-5* )
-	nss? ( dev-libs/nss )
-	odbc? ( dev-db/unixODBC )
-	openssl? ( dev-libs/openssl )
-	postgres? ( dev-db/postgresql-base )
-	sqlite? ( dev-db/sqlite:3 )"
-DEPEND="${RDEPEND}
-	doc? ( app-doc/doxygen )"
-
-DOCS=(CHANGES NOTICE README)
-
-src_prepare() {
-	epatch "${FILESDIR}"/${P}-berkdb6.patch #476374
-	epatch "${FILESDIR}"/${PN}-1.5.3-sysroot.patch #385775
-	eautoreconf
-	elibtoolize
-}
-
-src_configure() {
-	local myconf=()
-
-	tc-is-static-only && myconf+=( --disable-util-dso )
-
-	if use berkdb; then
-		local db_version
-		db_version="$(db_findver sys-libs/db)" || die "Unable to find Berkeley DB version"
-		db_version="$(db_ver_to_slot "${db_version}")"
-		db_version="${db_version/\./}"
-		myconf+=(
-			--with-dbm=db${db_version}
-			# We use $T for the libdir because otherwise it'd simply be the normal
-			# system libdir.  That's pointless as the compiler will search it for
-			# us already.  This makes cross-compiling and such easier.
-			--with-berkeley-db="${SYSROOT}$(db_includedir 2>/dev/null):${T}"
-		)
-	else
-		myconf+=( --without-berkeley-db )
-	fi
-
-	econf \
-		--datadir="${EPREFIX}"/usr/share/apr-util-1 \
-		--with-apr="${SYSROOT}${EPREFIX}"/usr \
-		--with-expat="${EPREFIX}"/usr \
-		--without-sqlite2 \
-		$(use_with freetds) \
-		$(use_with gdbm) \
-		$(use_with ldap) \
-		$(use_with mysql) \
-		$(use_with nss) \
-		$(use_with odbc) \
-		$(use_with openssl) \
-		$(use_with postgres pgsql) \
-		$(use_with sqlite sqlite3) \
-		"${myconf[@]}"
-	# Use the current env build settings rather than whatever apr was built with.
-	sed -i -r \
-		-e "/^(apr_builddir|apr_builders|top_builddir)=/s:=:=${SYSROOT}:" \
-		-e "/^CC=/s:=.*:=$(tc-getCC):" \
-		-e '/^(C|CPP|CXX|LD)FLAGS=/d' \
-		-e '/^LTFLAGS/s:--silent::' \
-		build/rules.mk || die
-}
-
-src_compile() {
-	emake
-	use doc && emake dox
-}
-
-src_install() {
-	default
-
-	find "${ED}" -name "*.la" -delete
-	find "${ED}usr/$(get_libdir)/apr-util-${SLOT}" -name "*.a" -delete
-	use static-libs || find "${ED}" -name "*.a" -delete
-
-	use doc && dohtml -r docs/dox/html/*
-
-	# This file is only used on AIX systems, which Gentoo is not,
-	# and causes collisions between the SLOTs, so remove it.
-	rm -f "${ED}usr/$(get_libdir)/aprutil.exp"
-}
diff --git a/dev-libs/apr-util/apr-util-1.6.1-r3.ebuild b/dev-libs/apr-util/apr-util-1.6.1-r3.ebuild
new file mode 100644
index 0000000..e41dcdb
--- /dev/null
+++ b/dev-libs/apr-util/apr-util-1.6.1-r3.ebuild
@@ -0,0 +1,144 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+# Usually apr-util has the same PV as apr, but in case of security fixes, this may change.
+# APR_PV="${PV}"
+APR_PV="1.6.2"
+
+inherit autotools db-use libtool multilib toolchain-funcs
+
+DESCRIPTION="Apache Portable Runtime Utility Library"
+HOMEPAGE="https://apr.apache.org/"
+SRC_URI="mirror://apache/apr/${P}.tar.bz2"
+
+LICENSE="Apache-2.0"
+SLOT="1"
+KEYWORDS="*"
+IUSE="berkdb doc gdbm ldap libressl mysql nss odbc openssl postgres sqlite static-libs"
+#RESTRICT="test"
+
+RDEPEND="
+	dev-libs/expat
+	>=dev-libs/apr-${APR_PV}:1=
+	berkdb? ( >=sys-libs/db-4:= )
+	gdbm? ( sys-libs/gdbm:= )
+	ldap? ( =net-nds/openldap-2* )
+	mysql? ( || (
+		dev-db/mariadb-connector-c
+		dev-db/mysql-connector-c
+	) )
+	nss? ( dev-libs/nss )
+	odbc? ( dev-db/unixODBC )
+	openssl? (
+		!libressl? ( dev-libs/openssl:0= )
+		libressl? ( dev-libs/libressl )
+	)
+	postgres? ( dev-db/postgresql:= )
+	sqlite? ( dev-db/sqlite:3 )
+"
+DEPEND="
+	${RDEPEND}
+	>=sys-devel/libtool-2.4.2
+	doc? ( app-doc/doxygen )
+"
+
+DOCS=(CHANGES NOTICE README)
+
+PATCHES=(
+	"${FILESDIR}"/${PN}-1.5.3-sysroot.patch #385775
+	"${FILESDIR}"/${PN}-1.6.1-fix-gdbm-error-handling.patch
+)
+
+src_prepare() {
+	default
+
+	# Fix usage of libmysqlclient (bug #620230)
+	grep -lrF "libmysqlclient_r" "${S}" \
+		| xargs sed 's@libmysqlclient_r@libmysqlclient@g' -i \
+		|| die
+
+	mv configure.{in,ac} || die
+	eautoreconf
+	elibtoolize
+}
+
+src_configure() {
+	local myconf=(
+		--datadir="${EPREFIX}"/usr/share/apr-util-1
+		--with-apr="${SYSROOT}${EPREFIX}"/usr
+		--with-expat="${EPREFIX}"/usr
+		--without-sqlite2
+		$(use_with gdbm)
+		$(use_with ldap)
+		$(use_with mysql)
+		$(use_with nss)
+		$(use_with odbc)
+		$(use_with openssl)
+		$(use_with postgres pgsql)
+		$(use_with sqlite sqlite3)
+	)
+
+	tc-is-static-only && myconf+=( --disable-util-dso )
+
+	if use berkdb; then
+		local db_version
+		db_version="$(db_findver sys-libs/db)" || die "Unable to find Berkeley DB version"
+		db_version="$(db_ver_to_slot "${db_version}")"
+		db_version="${db_version/\./}"
+		myconf+=(
+			--with-dbm=db${db_version}
+			# We use $T for the libdir because otherwise it'd simply be the normal
+			# system libdir.  That's pointless as the compiler will search it for
+			# us already.  This makes cross-compiling and such easier.
+			--with-berkeley-db="${SYSROOT}$(db_includedir 2>/dev/null):${T}"
+		)
+	else
+		myconf+=( --without-berkeley-db )
+	fi
+
+	if use nss || use openssl ; then
+		myconf+=( --with-crypto ) # 518708
+	fi
+
+	econf "${myconf[@]}"
+	# Use the current env build settings rather than whatever apr was built with.
+	sed -i -r \
+		-e "/^(apr_builddir|apr_builders|top_builddir)=/s:=:=${SYSROOT}:" \
+		-e "/^CC=/s:=.*:=$(tc-getCC):" \
+		-e '/^(C|CPP|CXX|LD)FLAGS=/d' \
+		-e '/^LTFLAGS/s:--silent::' \
+		build/rules.mk || die
+}
+
+src_compile() {
+	emake
+	use doc && emake dox
+}
+
+src_test() {
+	# Building tests in parallel is broken
+	emake -j1 check
+}
+
+src_install() {
+	default
+
+	find "${ED}" -name "*.la" -delete || die
+	if [[ -d "${ED%/}/usr/$(get_libdir)/apr-util-${SLOT}" ]] ; then
+		find "${ED%/}/usr/$(get_libdir)/apr-util-${SLOT}" -name "*.a" -delete || die
+	fi
+	if ! use static-libs ; then
+		find "${ED}" -name "*.a" -not -name "*$(get_libname)" -delete || die
+	fi
+
+	if use doc ; then
+		docinto html
+		dodoc -r docs/dox/html/*
+	fi
+
+	# This file is only used on AIX systems, which Gentoo is not,
+	# and causes collisions between the SLOTs, so remove it.
+	rm "${ED%/}/usr/$(get_libdir)/aprutil.exp" || die
+}
diff --git a/dev-libs/apr-util/files/apr-util-1.3.12-bdb-5.2.patch b/dev-libs/apr-util/files/apr-util-1.3.12-bdb-5.2.patch
deleted file mode 100644
index 5687a8e..0000000
--- a/dev-libs/apr-util/files/apr-util-1.3.12-bdb-5.2.patch
+++ /dev/null
@@ -1,139 +0,0 @@
---- build/dbm.m4
-+++ build/dbm.m4
-@@ -579,6 +579,25 @@
-     apu_db_version=5
-   fi
- ])
-+dnl
-+dnl APU_CHECK_DB52: is DB5.2 present?
-+dnl
-+dnl if present: sets apu_db_header, apu_db_lib, and apu_db_version
-+dnl
-+AC_DEFUN([APU_CHECK_DB52], [
-+  places=$1
-+  if test -z "$places"; then
-+    places="std /usr/local/BerkeleyDB.5.2 /boot/home/config"
-+  fi
-+  APU_CHECK_BERKELEY_DB("5", "2", "-1",
-+    "$places",
-+    "db52/db.h db5/db.h db.h",
-+    "db-5.2 db5-5.2 db52 db5 db"
-+  )
-+  if test "$apu_have_db" = "1"; then
-+    apu_db_version=5
-+  fi
-+])
- 
- AC_DEFUN([APU_CHECK_DB], [
-   requested=$1
-@@ -681,6 +700,12 @@
-       AC_MSG_ERROR(Berkeley db5 not found)
-     fi
-     ;;
-+  db52)
-+    APU_CHECK_DB52("$check_places")
-+    if test "$apu_db_version" != "5"; then
-+      AC_MSG_ERROR(Berkeley db5 not found)
-+    fi
-+    ;;
-   default)
-     APU_CHECK_DB_ALL("$check_places")
-     ;;
-@@ -688,40 +713,43 @@
- ])
- 
- dnl
--dnl APU_CHECK_DB_ALL: Try all Berkeley DB versions, from 5.1 to 1.
-+dnl APU_CHECK_DB_ALL: Try all Berkeley DB versions, from 5.2 to 1.
- dnl
- AC_DEFUN([APU_CHECK_DB_ALL], [
-   all_places=$1
-  
--  APU_CHECK_DB51("$all_places")
-+  APU_CHECK_DB52("$all_places")
-   if test "$apu_db_version" != "5"; then
--    APU_CHECK_DB50("$all_places")
-+    APU_CHECK_DB51("$all_places")
-     if test "$apu_db_version" != "5"; then
--      APU_CHECK_DB48("$all_places")
--      if test "$apu_db_version" != "4"; then
--        APU_CHECK_DB47("$all_places")
-+      APU_CHECK_DB50("$all_places")
-+      if test "$apu_db_version" != "5"; then
-+        APU_CHECK_DB48("$all_places")
-         if test "$apu_db_version" != "4"; then
--          APU_CHECK_DB46("$all_places")
-+          APU_CHECK_DB47("$all_places")
-           if test "$apu_db_version" != "4"; then
--            APU_CHECK_DB45("$all_places")
-+            APU_CHECK_DB46("$all_places")
-             if test "$apu_db_version" != "4"; then
--              APU_CHECK_DB44("$all_places")
-+              APU_CHECK_DB45("$all_places")
-               if test "$apu_db_version" != "4"; then
--                APU_CHECK_DB43("$all_places")
-+                APU_CHECK_DB44("$all_places")
-                 if test "$apu_db_version" != "4"; then
--                  APU_CHECK_DB42("$all_places")
-+                  APU_CHECK_DB43("$all_places")
-                   if test "$apu_db_version" != "4"; then
--                    APU_CHECK_DB41("$all_places")
-+                    APU_CHECK_DB42("$all_places")
-                     if test "$apu_db_version" != "4"; then
--                      APU_CHECK_DB4("$all_places")
-+                      APU_CHECK_DB41("$all_places")
-                       if test "$apu_db_version" != "4"; then
--                        APU_CHECK_DB3("$all_places")
--                        if test "$apu_db_version" != "3"; then
--                          APU_CHECK_DB2("$all_places")
--                          if test "$apu_db_version" != "2"; then
--                            APU_CHECK_DB1("$all_places")
--                            if test "$apu_db_version" != "1"; then
--                              APU_CHECK_DB185("$all_places")
-+                        APU_CHECK_DB4("$all_places")
-+                        if test "$apu_db_version" != "4"; then
-+                          APU_CHECK_DB3("$all_places")
-+                          if test "$apu_db_version" != "3"; then
-+                            APU_CHECK_DB2("$all_places")
-+                            if test "$apu_db_version" != "2"; then
-+                              APU_CHECK_DB1("$all_places")
-+                              if test "$apu_db_version" != "1"; then
-+                                APU_CHECK_DB185("$all_places")
-+                              fi
-                             fi
-                           fi
-                         fi
-@@ -763,11 +791,11 @@
-   apu_db_version=0
- 
-   AC_ARG_WITH(dbm, [APR_HELP_STRING([--with-dbm=DBM], [choose the DBM type to use.
--      DBM={sdbm,gdbm,ndbm,db,db1,db185,db2,db3,db4,db41,db42,db43,db44,db45,db46,db47,db48,db50,db51}])],
-+      DBM={sdbm,gdbm,ndbm,db,db1,db185,db2,db3,db4,db41,db42,db43,db44,db45,db46,db47,db48,db50,db51,db52}])],
-   [
-     if test "$withval" = "yes"; then
-       AC_MSG_ERROR([--with-dbm needs to specify a DBM type to use.
--        One of: sdbm, gdbm, ndbm, db, db1, db185, db2, db3, db4, db41, db42, db43, db44, db45, db46, db47, db48, db50, db51])
-+        One of: sdbm, gdbm, ndbm, db, db1, db185, db2, db3, db4, db41, db42, db43, db44, db45, db46, db47, db48, db50, db51, db52])
-     fi
-     requested="$withval"
-   ], [
-@@ -978,6 +1006,10 @@
-       apu_use_db=1
-       apu_default_dbm=db5
-       ;;
-+    db52)
-+      apu_use_db=1
-+      apu_default_dbm=db5
-+      ;;
-     default)
-       dnl ### use more sophisticated DBMs for the default?
-       apu_default_dbm="sdbm (default)"
-@@ -985,7 +1017,7 @@
-       ;;
-     *)
-       AC_MSG_ERROR([--with-dbm=$look_for is an unknown DBM type.
--        Use one of: sdbm, gdbm, ndbm, db, db1, db185, db2, db3, db4, db41, db42, db43, db44, db45, db46, db47, db48, db50, db51])
-+        Use one of: sdbm, gdbm, ndbm, db, db1, db185, db2, db3, db4, db41, db42, db43, db44, db45, db46, db47, db48, db50, db51, db52])
-       ;;
-   esac
- 
diff --git a/dev-libs/apr-util/files/apr-util-1.5.3-berkdb6.patch b/dev-libs/apr-util/files/apr-util-1.5.3-berkdb6.patch
deleted file mode 100644
index a3f4a3c..0000000
--- a/dev-libs/apr-util/files/apr-util-1.5.3-berkdb6.patch
+++ /dev/null
@@ -1,69 +0,0 @@
-http://svn.apache.org/viewvc/apr/apr/trunk/build/dbm.m4?r1=1495889&r2=1544846&diff_format=h
-
---- apr/apr/trunk/build/dbm.m4	2013/06/23 20:27:54	1495889
-+++ apr/apr/trunk/build/dbm.m4	2013/11/23 17:57:39	1544846
-@@ -112,7 +112,7 @@
-         changequote([,])
-         unset $cache_id
-         AC_CHECK_HEADER([$bdb_header], [
--          if test "$1" = "3" -o "$1" = "4" -o "$1" = "5"; then
-+          if test "$1" = "3" -o "$1" = "4" -o "$1" = "5" -o "$1" = "6"; then
-             # We generate a separate cache variable for each prefix and libname
-             # we search under.  That way, we avoid caching information that
-             # changes if the user runs `configure' with a different set of
-@@ -455,13 +455,13 @@
- ])
- 
- dnl
--dnl APU_CHECK_DB_ALL: Try all Berkeley DB versions, from 5.X to 1.
-+dnl APU_CHECK_DB_ALL: Try all Berkeley DB versions, from 6.X to 1.
- dnl
- AC_DEFUN([APU_CHECK_DB_ALL], [
-   all_places=$1
- 
--  # Start version search at version 5.9
--  db_version=59
-+  # Start version search at version 6.9
-+  db_version=69
-   while [[ $db_version -ge 40 ]]
-   do
-     db_major=`echo $db_version | sed -e 's/.$//'`
-@@ -511,19 +511,34 @@
-   apu_db_version=0
- 
-   # Maximum supported version announced in help string.
--  # Although we search for all versions up to 5.9,
-+  # Although we search for all versions up to 6.9,
-   # we should only include existing versions in our
-   # help string.
--  db_max_version=53
--  db_min_version=41
-   dbm_list="sdbm, gdbm, ndbm, db, db1, db185, db2, db3, db4"
-+  db_max_version=48
-+  db_min_version=41
-+  db_version="$db_min_version"
-+  while [[ $db_version -le $db_max_version ]]
-+  do
-+    dbm_list="$dbm_list, db$db_version"
-+    db_version=`expr $db_version + 1`
-+  done
-+  db_max_version=53
-+  db_min_version=50
-+  db_version="$db_min_version"
-+  while [[ $db_version -le $db_max_version ]]
-+  do
-+    dbm_list="$dbm_list, db$db_version"
-+    db_version=`expr $db_version + 1`
-+  done
-+  db_max_version=60
-+  db_min_version=60
-   db_version="$db_min_version"
-   while [[ $db_version -le $db_max_version ]]
-   do
-     dbm_list="$dbm_list, db$db_version"
-     db_version=`expr $db_version + 1`
-   done
--  dbm_list="$dbm_list, db60"
- 
-   AC_ARG_WITH(dbm, [APR_HELP_STRING([--with-dbm=DBM], [choose the DBM type to use.
-       DBM={sdbm,gdbm,ndbm,db,db1,db185,db2,db3,db4,db4X,db5X,db6X} for some X=0,...,9])],
diff --git a/dev-libs/apr-util/files/apr-util-1.6.1-fix-gdbm-error-handling.patch b/dev-libs/apr-util/files/apr-util-1.6.1-fix-gdbm-error-handling.patch
new file mode 100644
index 0000000..92a4738
--- /dev/null
+++ b/dev-libs/apr-util/files/apr-util-1.6.1-fix-gdbm-error-handling.patch
@@ -0,0 +1,79 @@
+# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=889170
+# needs to be submitted upstream
+--- apr-util.orig/dbm/apr_dbm_gdbm.c
++++ apr-util/dbm/apr_dbm_gdbm.c
+@@ -36,13 +36,22 @@
+ static apr_status_t g2s(int gerr)
+ {
+     if (gerr == -1) {
+-        /* ### need to fix this */
+-        return APR_EGENERAL;
++        return APR_OS_START_USEERR + gdbm_errno;
+     }
+ 
+     return APR_SUCCESS;
+ }
+ 
++static apr_status_t gdat2s(datum d)
++{
++    if (d.dptr == NULL) {
++        return APR_OS_START_USEERR + gdbm_errno;
++    }
++
++    return APR_SUCCESS;
++}
++
++
+ static apr_status_t datum_cleanup(void *dptr)
+ {
+     if (dptr)
+@@ -55,19 +64,15 @@ static apr_status_t set_error(apr_dbm_t
+ {
+     apr_status_t rv = APR_SUCCESS;
+ 
+-    /* ### ignore whatever the DBM said (dbm_said); ask it explicitly */
+-
+-    if ((dbm->errcode = gdbm_errno) == GDBM_NO_ERROR) {
++    if (dbm_said == APR_SUCCESS) {
++        dbm->errcode = GDBM_NO_ERROR;
+         dbm->errmsg = NULL;
+     }
+     else {
++        dbm->errcode = dbm_said;
+         dbm->errmsg = gdbm_strerror(gdbm_errno);
+-        rv = APR_EGENERAL;        /* ### need something better */
+     }
+ 
+-    /* captured it. clear it now. */
+-    gdbm_errno = GDBM_NO_ERROR;
+-
+     return rv;
+ }
+ 
+@@ -144,7 +149,7 @@ static apr_status_t vt_gdbm_fetch(apr_db
+ 
+     /* 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,
+@@ -203,7 +208,7 @@ static apr_status_t vt_gdbm_firstkey(apr
+                                   apr_pool_cleanup_null);
+ 
+     /* 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)
+@@ -223,7 +228,7 @@ static apr_status_t vt_gdbm_nextkey(apr_
+                                   apr_pool_cleanup_null);
+ 
+     /* 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)
diff --git a/dev-libs/apr-util/metadata.xml b/dev-libs/apr-util/metadata.xml
index 5847a73..fbfc99a 100644
--- a/dev-libs/apr-util/metadata.xml
+++ b/dev-libs/apr-util/metadata.xml
@@ -1,11 +1,13 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
 <pkgmetadata>
-	<maintainer>
+	<maintainer type="person">
 		<email>polynomial-c@gentoo.org</email>
 		<name>Lars Wendler</name>
 	</maintainer>
 	<use>
+		<flag name="libressl">Use <pkg>dev-libs/libressl</pkg> instead of
+			<pkg>dev-libs/openssl</pkg> for 'openssl' USE flag</flag>
 		<flag name="nss">Install apr_crypto_nss module</flag>
 		<flag name="openssl">Install apr_crypto_openssl module</flag>
 	</use>
diff --git a/metadata/md5-cache/dev-libs/apr-util-1.5.3-r1 b/metadata/md5-cache/dev-libs/apr-util-1.5.3-r1
deleted file mode 100644
index b52b5c5..0000000
--- a/metadata/md5-cache/dev-libs/apr-util-1.5.3-r1
+++ /dev/null
@@ -1,14 +0,0 @@
-DEFINED_PHASES=compile configure install prepare
-DEPEND=dev-libs/expat >=dev-libs/apr-1.4.6:1 berkdb? ( >=sys-libs/db-4 ) freetds? ( dev-db/freetds ) gdbm? ( sys-libs/gdbm ) ldap? ( =net-nds/openldap-2* ) mysql? ( =virtual/mysql-5* ) nss? ( dev-libs/nss ) odbc? ( dev-db/unixODBC ) openssl? ( dev-libs/openssl ) postgres? ( dev-db/postgresql-base ) sqlite? ( dev-db/sqlite:3 ) doc? ( app-doc/doxygen ) >=app-portage/elt-patches-20170815 !<sys-devel/gettext-0.18.1.1-r3 || ( >=sys-devel/automake-1.16.1:1.16 >=sys-devel/automake-1.15.1:1.15 ) >=sys-devel/autoconf-2.69 >=sys-devel/libtool-2.4
-DESCRIPTION=Apache Portable Runtime Utility Library
-EAPI=4
-HOMEPAGE=http://apr.apache.org/
-IUSE=berkdb doc freetds gdbm ldap mysql nss odbc openssl postgres sqlite static-libs
-KEYWORDS=*
-LICENSE=Apache-2.0
-RDEPEND=dev-libs/expat >=dev-libs/apr-1.4.6:1 berkdb? ( >=sys-libs/db-4 ) freetds? ( dev-db/freetds ) gdbm? ( sys-libs/gdbm ) ldap? ( =net-nds/openldap-2* ) mysql? ( =virtual/mysql-5* ) nss? ( dev-libs/nss ) odbc? ( dev-db/unixODBC ) openssl? ( dev-libs/openssl ) postgres? ( dev-db/postgresql-base ) sqlite? ( dev-db/sqlite:3 )
-RESTRICT=test
-SLOT=1
-SRC_URI=mirror://apache/apr/apr-util-1.5.3.tar.bz2
-_eclasses_=autotools	d0e5375d47f4c809f406eb892e531513	db-use	8d7baa3efc7c38c7d5c5e7353c5460dc	estack	43ddf5aaffa7a8d0482df54d25a66a1f	eutils	06133990e861be0fe60c2b428fd025d9	libtool	f143db5a74ccd9ca28c1234deffede96	multilib	b2f01ad412baf81650c23fcf0975fa33	toolchain-funcs	1e35303c63cd707f6c3422b4493d5607	versionator	26ca8a8bd95d6a74122c08ba98a4ee72
-_md5_=f32ce3be249ba0711ed2b699991eaf68
diff --git a/metadata/md5-cache/dev-libs/apr-util-1.6.1-r3 b/metadata/md5-cache/dev-libs/apr-util-1.6.1-r3
new file mode 100644
index 0000000..63e0bae
--- /dev/null
+++ b/metadata/md5-cache/dev-libs/apr-util-1.6.1-r3
@@ -0,0 +1,14 @@
+BDEPEND=>=app-portage/elt-patches-20170815
+DEFINED_PHASES=compile configure install prepare test
+DEPEND=dev-libs/expat >=dev-libs/apr-1.6.2:1= berkdb? ( >=sys-libs/db-4:= ) gdbm? ( sys-libs/gdbm:= ) ldap? ( =net-nds/openldap-2* ) mysql? ( || ( dev-db/mariadb-connector-c dev-db/mysql-connector-c ) ) nss? ( dev-libs/nss ) odbc? ( dev-db/unixODBC ) openssl? ( !libressl? ( dev-libs/openssl:0= ) libressl? ( dev-libs/libressl ) ) postgres? ( dev-db/postgresql:= ) sqlite? ( dev-db/sqlite:3 ) >=sys-devel/libtool-2.4.2 doc? ( app-doc/doxygen ) !<sys-devel/gettext-0.18.1.1-r3 || ( >=sys-devel/automake-1.16.1:1.16 >=sys-devel/automake-1.15.1:1.15 ) >=sys-devel/autoconf-2.69 >=sys-devel/libtool-2.4
+DESCRIPTION=Apache Portable Runtime Utility Library
+EAPI=7
+HOMEPAGE=https://apr.apache.org/
+IUSE=berkdb doc gdbm ldap libressl mysql nss odbc openssl postgres sqlite static-libs
+KEYWORDS=*
+LICENSE=Apache-2.0
+RDEPEND=dev-libs/expat >=dev-libs/apr-1.6.2:1= berkdb? ( >=sys-libs/db-4:= ) gdbm? ( sys-libs/gdbm:= ) ldap? ( =net-nds/openldap-2* ) mysql? ( || ( dev-db/mariadb-connector-c dev-db/mysql-connector-c ) ) nss? ( dev-libs/nss ) odbc? ( dev-db/unixODBC ) openssl? ( !libressl? ( dev-libs/openssl:0= ) libressl? ( dev-libs/libressl ) ) postgres? ( dev-db/postgresql:= ) sqlite? ( dev-db/sqlite:3 )
+SLOT=1
+SRC_URI=mirror://apache/apr/apr-util-1.6.1.tar.bz2
+_eclasses_=autotools	d0e5375d47f4c809f406eb892e531513	db-use	501a5d0963e0d17f30260023f292ae8e	libtool	f143db5a74ccd9ca28c1234deffede96	multilib	b2f01ad412baf81650c23fcf0975fa33	toolchain-funcs	1e35303c63cd707f6c3422b4493d5607
+_md5_=78a4fdb39f1f7e1b34de75af54fef69d