|
|
d2a170 |
commit afac6a760b97b7dd71c06c00a4716d3212f6884c
|
|
|
d2a170 |
Author: Masahiro Matsuya <mmatsuya@redhat.com>
|
|
|
d2a170 |
Date: Wed Apr 20 10:16:10 2016 +0200
|
|
|
d2a170 |
|
|
|
d2a170 |
Cope with older installonly packages from deps. BZ 1306142
|
|
|
d2a170 |
|
|
|
d2a170 |
We have been doing this with explicitly installed packages but not for
|
|
|
d2a170 |
their dependencies, so let's do it after depsolving again to cover those
|
|
|
d2a170 |
too.
|
|
|
d2a170 |
|
|
|
d2a170 |
diff --git a/test/operationstests.py b/test/operationstests.py
|
|
|
d2a170 |
index 5a50439..bd999e6 100644
|
|
|
d2a170 |
--- a/test/operationstests.py
|
|
|
d2a170 |
+++ b/test/operationstests.py
|
|
|
d2a170 |
@@ -1,3 +1,4 @@
|
|
|
d2a170 |
+import rpm
|
|
|
d2a170 |
from testbase import *
|
|
|
d2a170 |
import simpleobsoletestests
|
|
|
d2a170 |
|
|
|
d2a170 |
@@ -142,6 +143,17 @@ class KernelTests(OperationsTests):
|
|
|
d2a170 |
res, msg = self.runOperation(['install','kernel-2.6.23.8'], p.inst, p.avail)
|
|
|
d2a170 |
self.assertResult(p.inst)
|
|
|
d2a170 |
|
|
|
d2a170 |
+ def testRequireOlderKernel(self):
|
|
|
d2a170 |
+ p = self.pkgs
|
|
|
d2a170 |
+
|
|
|
d2a170 |
+ foo = FakePackage('foo', '1.0', '1', arch='i686')
|
|
|
d2a170 |
+ foo.addRequires('kernel', 'EQ', (None, '2.6.23.5', '1'))
|
|
|
d2a170 |
+ navail = [foo, FakePackage('kernel', '2.6.23.5', '1',arch='i686')]
|
|
|
d2a170 |
+
|
|
|
d2a170 |
+ res, msg = self.runOperation(['install', 'foo'], p.inst, navail)
|
|
|
d2a170 |
+ self.assertResult(p.inst + navail)
|
|
|
d2a170 |
+ self.assertEquals(self.tsInfo.probFilterFlags, [rpm.RPMPROB_FILTER_OLDPACKAGE])
|
|
|
d2a170 |
+
|
|
|
d2a170 |
class MultiLibTests(OperationsTests):
|
|
|
d2a170 |
|
|
|
d2a170 |
@staticmethod
|
|
|
d2a170 |
diff --git a/yum/__init__.py b/yum/__init__.py
|
|
|
d2a170 |
index acaa973..c896fff 100644
|
|
|
d2a170 |
--- a/yum/__init__.py
|
|
|
d2a170 |
+++ b/yum/__init__.py
|
|
|
d2a170 |
@@ -1356,6 +1356,17 @@ much more problems).
|
|
|
d2a170 |
|
|
|
d2a170 |
if rescode == 2:
|
|
|
d2a170 |
self.save_ts(auto=True)
|
|
|
d2a170 |
+
|
|
|
d2a170 |
+ # Make sure we don't fail in rpm if we're installing a package that is
|
|
|
d2a170 |
+ # allowed multiple installs but has a newer version already installed.
|
|
|
d2a170 |
+ # Note that we already have a similar check in install(), but here we
|
|
|
d2a170 |
+ # do it to cover anything that was pulled in as a dependency.
|
|
|
d2a170 |
+ if rpm.RPMPROB_FILTER_OLDPACKAGE not in self.tsInfo.probFilterFlags:
|
|
|
d2a170 |
+ for m in self.tsInfo.getMembers():
|
|
|
d2a170 |
+ if m.ts_state == 'i' and self.allowedMultipleInstalls(m.po):
|
|
|
d2a170 |
+ if self._enable_oldpackage_flag(m.po):
|
|
|
d2a170 |
+ break
|
|
|
d2a170 |
+
|
|
|
d2a170 |
self.verbose_logger.debug('Depsolve time: %0.3f' % (time.time() - ds_st))
|
|
|
d2a170 |
return rescode, restring
|
|
|
d2a170 |
|
|
|
d2a170 |
@@ -4674,6 +4685,14 @@ much more problems).
|
|
|
d2a170 |
if flag not in self.tsInfo.probFilterFlags:
|
|
|
d2a170 |
self.tsInfo.probFilterFlags.append(flag)
|
|
|
d2a170 |
|
|
|
d2a170 |
+ def _enable_oldpackage_flag(self, po):
|
|
|
d2a170 |
+ """Add RPMPROB_FILTER_OLDPACKAGE if the package requires it."""
|
|
|
d2a170 |
+ for ipkg in self.rpmdb.searchNevra(name=po.name):
|
|
|
d2a170 |
+ if ipkg.verGT(po) and not canCoinstall(ipkg.arch, po.arch):
|
|
|
d2a170 |
+ self._add_prob_flags(rpm.RPMPROB_FILTER_OLDPACKAGE)
|
|
|
d2a170 |
+ return True
|
|
|
d2a170 |
+ return False
|
|
|
d2a170 |
+
|
|
|
d2a170 |
def _install_is_upgrade(self, po, ipkgs):
|
|
|
d2a170 |
""" See if po is an upgradeable version of an installed pkg.
|
|
|
d2a170 |
Non-compat. arch differences mean no. """
|
|
|
d2a170 |
@@ -4969,10 +4988,7 @@ much more problems).
|
|
|
d2a170 |
# and a remove, which also tries to remove the old version.
|
|
|
d2a170 |
self.tsInfo.remove(ipkg.pkgtup)
|
|
|
d2a170 |
break
|
|
|
d2a170 |
- for ipkg in self.rpmdb.searchNevra(name=po.name):
|
|
|
d2a170 |
- if ipkg.verGT(po) and not canCoinstall(ipkg.arch, po.arch):
|
|
|
d2a170 |
- self._add_prob_flags(rpm.RPMPROB_FILTER_OLDPACKAGE)
|
|
|
d2a170 |
- break
|
|
|
d2a170 |
+ self._enable_oldpackage_flag(po)
|
|
|
d2a170 |
|
|
|
d2a170 |
# it doesn't obsolete anything. If it does, mark that in the tsInfo, too
|
|
|
d2a170 |
obs_pkgs = list(self._find_obsoletees_direct(po))
|