Backport another fix from master to fix the offline updates feature.

- Resolves: #968936
This commit is contained in:
Richard Hughes 2013-06-13 13:14:31 +01:00 committed by Kalev Lember
parent 63f4ea2ab8
commit c1b32df01c
2 changed files with 58 additions and 2 deletions

View File

@ -69,3 +69,55 @@ index 3440be5..c09c8d2 100644
# How long the transaction is valid before it's destroyed, in seconds
#
commit cac9936e0950831905039c25f4b8e25ee4db3ce1
Author: Richard Hughes <richard@hughsie.com>
Date: Thu Jun 13 13:05:07 2013 +0100
yum: Use yb.downloadPkgs() to download updates
There were two bugs here:
- Using repo.getPackage() did not check the package checksum, only the size,
so it was possible to download a corrupt package and then not be able to
apply the updates
- By restricting to TS_UPDATE and TS_INSTALL we were ignoring any package that
was obsoleting another which could miss out packages.
Many thanks to Zdenek Pavlas for all the help in finding these issues.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=968936
diff --git a/backends/yum/yumBackend.py b/backends/yum/yumBackend.py
index 289f10f..49a0f7b 100755
--- a/backends/yum/yumBackend.py
+++ b/backends/yum/yumBackend.py
@@ -2365,22 +2365,16 @@ class PackageKitYumBackend(PackageKitBaseBackend, PackagekitPackage):
self.percentage(100)
return
+ # just download packages ready for the actual transaction
if TRANSACTION_FLAG_ONLY_DOWNLOAD in transaction_flags:
- package_list = []
for txmbr in self.yumbase.tsInfo:
- if txmbr.output_state in (TS_UPDATE, TS_INSTALL):
- self._show_package(txmbr.po, INFO_DOWNLOADING)
- repo = self.yumbase.repos.getRepo(txmbr.po.repoid)
+ if txmbr.output_state in TS_INSTALL_STATES:
try:
- path = repo.getPackage(txmbr.po)
- except yum.Errors.RepoError, e:
- self.error(ERROR_PACKAGE_DOWNLOAD_FAILED, "Cannot download file: %s" % _to_unicode(e), exit=False)
- return
- except IOError, e:
- self.error(ERROR_PACKAGE_DOWNLOAD_FAILED, "Cannot write to file: %s" % _to_unicode(e), exit=False)
- return
+ self._show_package(txmbr.po, INFO_DOWNLOADING)
+ self.yumbase.downloadPkgs([txmbr.po])
except Exception, e:
- raise PkError(ERROR_INTERNAL_ERROR, _format_str(traceback.format_exc()))
+ self.error(ERROR_PACKAGE_DOWNLOAD_FAILED, "Cannot download packages: %s" % _to_unicode(e), exit=False)
+ return
self.percentage(100)
return

View File

@ -6,7 +6,7 @@
Summary: Package management service
Name: PackageKit
Version: 0.8.9
Release: 4%{?dist}
Release: 5%{?dist}
License: GPLv2+ and LGPLv2+
URL: http://www.packagekit.org
Source0: http://www.packagekit.org/releases/%{name}-%{version}.tar.xz
@ -445,9 +445,13 @@ update-mime-database %{_datadir}/mime &> /dev/null || :
%{_libdir}/pkgconfig/packagekit-plugin.pc
%changelog
* Sat Jun 22 2013 Matthias Clasen <mclasen@redhat.com> - 0.8.9-4
* Sat Jun 22 2013 Matthias Clasen <mclasen@redhat.com> - 0.8.9-5
- Trim %%changelog
* Thu Jun 13 2013 Richard Hughes <rhughes@redhat.com> - 0.8.9-4
- Backport another fix from master to fix the offline updates feature.
- Resolves: #968936
* Thu Jun 06 2013 Richard Hughes <rhughes@redhat.com> - 0.8.9-3
- Backport 2 fixes from master to increase the maximum number of packages that
can be processed, and also to fix a race in the offline updates feature.