[yum-commits] Branch 'yum-3_2_X' - 2 commits - yum/__init__.py yum/sqlitesack.py
James Antill
james at osuosl.org
Fri Apr 17 18:17:04 UTC 2009
yum/__init__.py | 50 ++++++++++++++++++++++++++++++++------------------
yum/sqlitesack.py | 2 ++
2 files changed, 34 insertions(+), 18 deletions(-)
New commits:
commit 9fbb21beef647848564f1801d07819cd7dc1ca5c
Author: James Antill <james at and.org>
Date: Thu Apr 16 16:38:23 2009 -0400
Fix downgrade to work on same arch. pkgs (still not as good as upgrade)
diff --git a/yum/__init__.py b/yum/__init__.py
index 90a9737..e33ab06 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -44,7 +44,7 @@ import Errors
import rpmsack
import rpmUtils.updates
import rpmUtils.arch
-from rpmUtils.arch import getCanonArch, archDifference
+from rpmUtils.arch import getCanonArch, archDifference, canCoinstall
import rpmUtils.transaction
import comps
import config
@@ -3235,15 +3235,15 @@ class YumBase(depsolve.Depsolve):
return []
raise Errors.DowngradeError, _('No package(s) available to downgrade')
- warned_names = set()
+ warned_nas = set()
# Skip kernel etc.
tapkgs = []
for pkg in apkgs:
if self.allowedMultipleInstalls(pkg):
- if pkg.name not in warned_names:
+ if (pkg.name, pkg.arch) not in warned_nas:
msg = _("Package %s is allowed multiple installs, skipping") % pkg
self.verbose_logger.log(logginglevels.INFO_2, msg)
- warned_names.add(pkg.name)
+ warned_nas.add((pkg.name, pkg.arch))
continue
tapkgs.append(pkg)
apkgs = tapkgs
@@ -3254,38 +3254,52 @@ class YumBase(depsolve.Depsolve):
apkg_names.add(pkg.name)
ipkgs = self.rpmdb.searchNames(list(apkg_names))
- latest_installed = {}
+ latest_installed_na = {}
+ latest_installed_n = {}
for pkg in ipkgs:
- latest_installed[pkg.name] = pkg
+ latest_installed_n[pkg.name] = pkg
+ latest_installed_na[(pkg.name, pkg.arch)] = pkg
# Find "latest downgrade", ie. latest available pkg before
# installed version.
downgrade_apkgs = {}
for pkg in sorted(apkgs):
- if pkg.name not in latest_installed:
- if pkg.name not in warned_names and not doing_group_pkgs:
+ na = (pkg.name, pkg.arch)
+
+ # Here we allow downgrades from .i386 => .noarch, or .i586 => .i386
+ # but not .i386 => .x86_64 (similar to update).
+ key = na
+ latest_installed = latest_installed_na
+ if pkg.name in latest_installed_n and na not in latest_installed_na:
+ if not canCoinstall(pkg.arch,latest_installed_n[pkg.name].arch):
+ key = pkg.name
+ latest_installed = latest_installed_n
+
+ if key not in latest_installed:
+ if na not in warned_nas and not doing_group_pkgs:
msg = _('No Match for available package: %s') % pkg
self.logger.critical(msg)
- warned_names.add(pkg.name)
+ warned_nas.add(na)
continue
- if pkg.verGE(latest_installed[pkg.name]):
- if pkg.name not in warned_names:
+ if pkg.verGE(latest_installed[key]):
+ if na not in warned_nas:
msg = _('Only Upgrade available on package: %s') % pkg
self.logger.critical(msg)
- warned_names.add(pkg.name)
+ warned_nas.add(na)
continue
- warned_names.add(pkg.name)
- if (pkg.name in downgrade_apkgs and
- pkg.verLE(downgrade_apkgs[pkg.name])):
+ warned_nas.add(na)
+ if (na in downgrade_apkgs and
+ pkg.verLE(downgrade_apkgs[na])):
continue # Skip older than "latest downgrade"
- downgrade_apkgs[pkg.name] = pkg
+ downgrade_apkgs[na] = pkg
tx_return = []
for po in ipkgs:
- if po.name not in downgrade_apkgs:
+ na = (po.name, po.arch)
+ if na not in downgrade_apkgs:
continue
itxmbr = self.tsInfo.addErase(po)
- atxmbr = self.tsInfo.addInstall(downgrade_apkgs[po.name])
+ atxmbr = self.tsInfo.addInstall(downgrade_apkgs[na])
if not atxmbr: # Fail?
self.tsInfo.remove(itxmbr.pkgtup)
continue
commit 29b4babd76ee79002f37d87a4b4c2df88b78c5fb
Author: James Antill <james at and.org>
Date: Thu Apr 16 16:30:31 2009 -0400
Fix returnPackages() with a repoid, and pre-loaded data
diff --git a/yum/sqlitesack.py b/yum/sqlitesack.py
index df24fe1..7d87e0b 100644
--- a/yum/sqlitesack.py
+++ b/yum/sqlitesack.py
@@ -1215,6 +1215,8 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack):
returnList = []
for po in pkgobjlist:
+ if repoid is not None and repoid != po.repoid:
+ continue
if self._pkgExcluded(po):
continue
returnList.append(po)
More information about the Yum-commits
mailing list