kalev pushed to libhif (f22). "Switch to using dnf's yumdb, instead of yum's yumdb"

notifications at fedoraproject.org notifications at fedoraproject.org
Fri May 29 19:40:52 UTC 2015


From 86218515ad04720740b830fc6ff8d6468484cf3f Mon Sep 17 00:00:00 2001
From: Kalev Lember <kalevlember at gmail.com>
Date: Fri, 29 May 2015 21:04:06 +0200
Subject: Switch to using dnf's yumdb, instead of yum's yumdb


diff --git a/0001-Add-a-configure-option-to-choose-between-dnf-s-yumdb.patch b/0001-Add-a-configure-option-to-choose-between-dnf-s-yumdb.patch
new file mode 100644
index 0000000..28c10db
--- /dev/null
+++ b/0001-Add-a-configure-option-to-choose-between-dnf-s-yumdb.patch
@@ -0,0 +1,66 @@
+From a4237956dc61fe47e9a93cb3d00f71c5a246aded Mon Sep 17 00:00:00 2001
+From: Kalev Lember <kalevlember at gmail.com>
+Date: Wed, 27 May 2015 13:15:04 +0200
+Subject: [PATCH] Add a configure option to choose between dnf's yumdb and
+ yum's yumdb
+
+In F22, DNF is the default and has switched to using /var/lib/dnf/yumdb
+instead of /var/lib/yum/yumdb.
+
+This commit adds a configure option to choose which yumdb to use. In
+Fedora 22 and later where DNF is the default, we'll set it in downstream
+packaging to use dnf's yumdb, and in use --disable-dnf-yumdb in older
+Fedora releases to keep on using yum's yumdb.
+---
+ configure.ac    | 7 +++++++
+ libhif/hif-db.c | 8 +++++++-
+ 2 files changed, 14 insertions(+), 1 deletion(-)
+
+diff --git a/configure.ac b/configure.ac
+index aa9fe60..d6366f5 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -99,6 +99,13 @@ AC_TRY_COMPILE([#include <stdlib.h>
+ AC_DEFINE_UNQUOTED(BUILDOPT_HAWKEY_SACK_CREATE2, $BUILDOPT_HAWKEY_SACK_CREATE2, [Hawkey ABI change])
+ AC_PATH_PROG([XSLTPROC], [xsltproc])
+ 
++# whether to use /var/lib/dnf/yumdb or /var/lib/yum/yumdb
++AC_ARG_ENABLE(dnf-yumdb, AS_HELP_STRING([--enable-dnf-yumdb],[use dnf/yumdb instead of yum/yumdb @<:@default=yes@:>@]),
++              enable_dnf_yumdb=$enableval,enable_dnf_yumdb=yes)
++if test x$enable_dnf_yumdb = xyes; then
++  AC_DEFINE_UNQUOTED(BUILDOPT_USE_DNF_YUMDB,1,[Use dnf/yumdb instead of yum/yumdb])
++fi
++
+ AC_CONFIG_FILES([
+ Makefile
+ libhif/Makefile
+diff --git a/libhif/hif-db.c b/libhif/hif-db.c
+index 8a540c6..059c9b7 100644
+--- a/libhif/hif-db.c
++++ b/libhif/hif-db.c
+@@ -102,6 +102,11 @@ hif_db_get_dir_for_package (HifDb *db, HyPackage package)
+ 	const gchar *pkgid;
+ 	HifDbPrivate *priv = GET_PRIVATE (db);
+ 	const gchar *instroot;
++#ifdef BUILDOPT_USE_DNF_YUMDB
++	static const gchar *yumdb_dir = "/var/lib/dnf/yumdb";
++#else
++	static const gchar *yumdb_dir = "/var/lib/yum/yumdb";
++#endif
+ 
+ 	pkgid = hif_package_get_pkgid (package);
+ 	if (pkgid == NULL)
+@@ -111,8 +116,9 @@ hif_db_get_dir_for_package (HifDb *db, HyPackage package)
+ 	if (g_strcmp0 (instroot, "/") == 0)
+ 		instroot = "";
+ 
+-	return g_strdup_printf ("%s/var/lib/yum/yumdb/%c/%s-%s-%s-%s-%s",
++	return g_strdup_printf ("%s%s/%c/%s-%s-%s-%s-%s",
+ 				instroot,
++				yumdb_dir,
+ 				hy_package_get_name (package)[0],
+ 				pkgid,
+ 				hy_package_get_name (package),
+-- 
+2.4.1
+
diff --git a/libhif.spec b/libhif.spec
index aef80cb..65bd6d6 100644
--- a/libhif.spec
+++ b/libhif.spec
@@ -1,7 +1,7 @@
 Summary:   Simple package library built on top of hawkey and librepo
 Name:      libhif
 Version:   0.2.0
-Release:   3%{?dist}
+Release:   4%{?dist}
 License:   LGPLv2+
 URL:       https://github.com/hughsie/libhif
 Source0:   http://people.freedesktop.org/~hughsient/releases/libhif-%{version}.tar.xz
@@ -9,6 +9,8 @@ Source0:   http://people.freedesktop.org/~hughsient/releases/libhif-%{version}.t
 Patch0:    0001-transaction-Remove-obsoleted-packages-when-committin.patch
 # https://bugzilla.redhat.com/show_bug.cgi?id=1221158
 Patch1:    0001-context-Fix-rpmdb-file-monitor-with-installs.patch
+# https://github.com/hughsie/libhif/commit/27f2c79589f8fd2772889eece2a08f1198b2a022
+Patch2:    0001-Add-a-configure-option-to-choose-between-dnf-s-yumdb.patch
 
 BuildRequires: glib2-devel >= 2.16.1
 BuildRequires: libtool
@@ -38,12 +40,21 @@ GLib headers and libraries for libhif.
 %setup -q
 %patch0 -p1
 %patch1 -p1
+%patch2 -p1
+
+# for patch2
+autoreconf -fi
 
 %build
 # Support builds of both git snapshots and tarballs
 (if ! test -x configure; then NOCONFIGURE=1 ./autogen.sh; CONFIGFLAGS=--enable-gtk-doc; fi;
 %configure \
         --enable-gtk-doc \
+%if 0%{?fedora} >= 22
+        --enable-dnf-yumdb \
+%else
+        --disable-dnf-yumdb \
+%endif
         --disable-static \
         --disable-silent-rules
 )
@@ -73,6 +84,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libhif*.la
 %{_datadir}/gir-1.0/*.gir
 
 %changelog
+* Fri May 29 2015 Kalev Lember <kalevlember at gmail.com> 0.2.0-4
+- Switch to using dnf's yumdb, instead of yum's yumdb
+
 * Wed May 13 2015 Kalev Lember <kalevlember at gmail.com> 0.2.0-3
 - context: Fix rpmdb file monitor with / installs (#1221158)
 
-- 
cgit v0.10.2


	http://pkgs.fedoraproject.org/cgit/libhif.git/commit/?h=f22&id=86218515ad04720740b830fc6ff8d6468484cf3f


More information about the scm-commits mailing list