[Yum-devel] [PATCH 2/2] When installing for obsoletes, see if newer pkg is in trans. (BZ 516577)
James Antill
james at and.org
Mon Aug 17 20:43:25 UTC 2009
Otherwise we install two different versions, if the newer pkg doesn't
also do the obsoletes (stupid, stupid, packaging).
---
yum/__init__.py | 9 +++++++++
yum/transactioninfo.py | 11 +++++++++++
2 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/yum/__init__.py b/yum/__init__.py
index 0df32a3..adc43d9 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -2990,6 +2990,15 @@ class YumBase(depsolve.Depsolve):
# It's a minor UI problem for RHEL, but might as well dtrt.
obs_pkgs = [self.getPackageObject(tup) for tup in obs_tups]
for obsoleting_pkg in packagesNewestByNameArch(obs_pkgs):
+ newer = self.tsInfo.findNewer(obsoleting_pkg)
+ if newer:
+ # This is to work around pkgA-1 obs pkgB, but pkgA-2
+ # doesn't. So we don't want to install two versions.
+ tx = newer[0]
+ txmbr = self.tsInfo.addObsoleting(tx.po, installed_pkg)
+ self.tsInfo.addObsoleted(installed_pkg, tx.po)
+ tx_return.append(txmbr)
+ continue
tx_return.extend(self.install(po=obsoleting_pkg))
for available_pkg in availpkgs:
for obsoleted in self.up.obsoleting_dict.get(available_pkg.pkgtup, []):
diff --git a/yum/transactioninfo.py b/yum/transactioninfo.py
index 84dbb4b..85e035d 100644
--- a/yum/transactioninfo.py
+++ b/yum/transactioninfo.py
@@ -155,6 +155,17 @@ class TransactionData:
return result
+ def findNewer(self, po, states=('i', 'u')):
+ """ Return any packages in the transaction that are newer than the
+ given package. Can also filter to states, default is
+ install/update. """
+
+ ret = []
+ for txmbr in self.matchNaevr(name=po.name):
+ if txmbr in states and txmbr.po.verGT(po):
+ ret.append(txmbr)
+ return ret
+
def _isLocalPackage(self, txmember):
# Is this the right criteria?
# FIXME: This is kinda weird, we really want all local pkgs to be in a
--
1.6.2.5
More information about the Yum-devel
mailing list