[libhif] Do not download the mirrorlists when checking for updates

Richard Hughes rhughes at fedoraproject.org
Thu Jan 15 19:58:56 UTC 2015


commit ab9a4a9c15ddbb407a0e4971808653e19147f032
Author: Richard Hughes <richard at hughsie.com>
Date:   Thu Jan 15 19:58:49 2015 +0000

    Do not download the mirrorlists when checking for updates

 ...load-the-mirrorlists-when-checking-for-up.patch |   37 ++++++++++++++++++++
 libhif.spec                                        |   10 ++++-
 2 files changed, 45 insertions(+), 2 deletions(-)
---
diff --git a/0001-Do-not-download-the-mirrorlists-when-checking-for-up.patch b/0001-Do-not-download-the-mirrorlists-when-checking-for-up.patch
new file mode 100644
index 0000000..479bda0
--- /dev/null
+++ b/0001-Do-not-download-the-mirrorlists-when-checking-for-up.patch
@@ -0,0 +1,37 @@
+From 6e59114b3db23455972c0ae394b330605e568679 Mon Sep 17 00:00:00 2001
+From: Richard Hughes <richard at hughsie.com>
+Date: Thu, 15 Jan 2015 19:44:32 +0000
+Subject: [PATCH] Do not download the mirrorlists when checking for updates
+
+This works around a librepo bug[1] in that setting the LRO_MIRRORLIST means
+that LRO_LOCAL is no longer honored. The libhif 0.1.7 release changed the order
+to load the .repo file before doing the check, which resulted in the mirrorlist
+being set ahead before the repo check.
+
+As a workaround we can set LRO_MIRRORLIST to NULL before using LRO_LOCAL,
+although this probably needs to either be fixed or documented in librepo.
+
+You can trivially reproduce the bug by doing:
+$ unshare -n ./hif-cmd refresh
+
+[1] https://github.com/Tojaj/librepo/issues/41
+---
+ libhif/hif-source.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/libhif/hif-source.c b/libhif/hif-source.c
+index bf7a0a7..2d3a7d6 100644
+--- a/libhif/hif-source.c
++++ b/libhif/hif-source.c
+@@ -975,6 +975,8 @@ hif_source_check (HifSource *source,
+ 		return FALSE;
+ 	if (!lr_handle_setopt (priv->repo_handle, error, LRO_YUMDLIST, download_list))
+ 		return FALSE;
++	if (!lr_handle_setopt (priv->repo_handle, error, LRO_MIRRORLIST, NULL))
++		return FALSE;
+ 	lr_result_clear (priv->repo_result);
+ 	if (!lr_handle_perform (priv->repo_handle, priv->repo_result, &error_local)) {
+ 		g_set_error (error,
+-- 
+2.1.0
+
diff --git a/libhif.spec b/libhif.spec
index 56195b5..5a4bf4e 100644
--- a/libhif.spec
+++ b/libhif.spec
@@ -1,13 +1,14 @@
 Summary:   Simple package library built on top of hawkey and librepo
 Name:      libhif
 Version:   0.1.7
-Release:   2%{?dist}
+Release:   3%{?dist}
 License:   LGPLv2+
 URL:       https://github.com/hughsie/libhif
 Source0:   http://people.freedesktop.org/~hughsient/releases/libhif-%{version}.tar.xz
 
 # already upstream
 Patch1:    0001-Fix-unintentional-change.patch
+Patch2:    0001-Do-not-download-the-mirrorlists-when-checking-for-up.patch
 
 BuildRequires: glib2-devel >= 2.16.1
 BuildRequires: libtool
@@ -33,6 +34,7 @@ GLib headers and libraries for libhif.
 %prep
 %setup -q
 %patch1 -p1 -b .fix-gpg-import
+%patch2 -p1 -b .no-download-mirrorlists
 
 %build
 %configure \
@@ -65,7 +67,11 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libhif*.la
 %{_datadir}/gir-1.0/*.gir
 
 %changelog
-* Fri Dec 19 2014 Richard Hughes <richard at hughsie.com> 0.1.7-2
+* Thu Jan 15 2015 Richard Hughes <richard at hughsie.com> 0.1.7-3
+- Do not download the mirrorlists when checking for updates
+- Resolves: #1181501
+
+* Wed Jan 14 2015 Richard Hughes <richard at hughsie.com> 0.1.7-2
 - Fix auto-importing of GPG keys during installing
 - Resolves: #1182090 and #1182156
 


More information about the scm-commits mailing list