[yum-commits] 15 commits - test/simpleupdatetests.py yumcommands.py yum-cron/yum-cron.py yum/depsolve.py yum/igroups.py yum/logginglevels.py yum/transactioninfo.py
James Antill
james at osuosl.org
Mon Aug 19 19:48:27 UTC 2013
test/simpleupdatetests.py | 150 ++++++++++++++++++++++++++++++++++++++++++++++
yum-cron/yum-cron.py | 2
yum/depsolve.py | 9 +-
yum/igroups.py | 28 +++++++-
yum/logginglevels.py | 4 -
yum/transactioninfo.py | 25 +++++--
yumcommands.py | 7 ++
7 files changed, 210 insertions(+), 15 deletions(-)
New commits:
commit 1a745c373ab06e809ea9f68c718535db228bae3e
Author: James Antill <james at and.org>
Date: Mon Aug 19 15:48:05 2013 -0400
Add the mark convert messages.
diff --git a/yumcommands.py b/yumcommands.py
index bceb569..03fc58a 100644
--- a/yumcommands.py
+++ b/yumcommands.py
@@ -1002,11 +1002,13 @@ class GroupsCommand(YumCommand):
pass
elif not os.path.exists(os.path.dirname(base.igroups.filename)):
base.logger.critical(_("There is no installed groups file."))
+ base.logger.critical(_("Maybe run: yum groups mark convert"))
elif not os.access(os.path.dirname(base.igroups.filename), os.R_OK):
base.logger.critical(_("You don't have access to the groups DBs."))
raise cli.CliError
elif not os.path.exists(base.igroups.filename):
base.logger.critical(_("There is no installed groups file."))
+ base.logger.critical(_("Maybe run: yum groups mark convert"))
elif not os.access(base.igroups.filename, os.R_OK):
base.logger.critical(_("You don't have access to the groups DB."))
raise cli.CliError
commit 34a51662f771f06f3fecc95b5c3799356c23f68c
Merge: 1b0c9b0 eaccbc6
Author: James Antill <james at and.org>
Date: Mon Aug 19 15:46:02 2013 -0400
Merge branch 'master' of ssh://yum.baseurl.org/srv/projects/yum/git/yum
* 'master' of ssh://yum.baseurl.org/srv/projects/yum/git/yum: (10 commits)
Increase the timescale for "locally rebuilding deltarpms"
...
commit 1b0c9b0ada8063d65c335541b1f7212687571954
Author: James Antill <james at and.org>
Date: Mon Aug 19 14:33:34 2013 -0400
Sort the keys logging convert keys, to unbreak -d9. Fix -99 = no logging.
diff --git a/yum/logginglevels.py b/yum/logginglevels.py
index 8a811ae..f441eb9 100644
--- a/yum/logginglevels.py
+++ b/yum/logginglevels.py
@@ -87,7 +87,7 @@ def logLevelFromErrorLevel(error_level):
def logLevelFromDebugLevel(debug_level):
""" Convert an old-style debug logging level to the new style. """
- debug_table = {
+ debug_table = {-5 : __NO_LOGGING,
-4 : logging.CRITICAL, -3 : logging.ERROR, -2 : logging.WARNING,
-1 : __NO_LOGGING, 0 : logging.INFO, 1 : INFO_1, 2 : INFO_2,
3 : logging.DEBUG, 4 : DEBUG_1, 5 : DEBUG_2, 6 : DEBUG_3, 7 : DEBUG_4}
@@ -100,7 +100,7 @@ def __convertLevel(level, table):
try:
new_level = table[level]
except KeyError:
- keys = table.keys()
+ keys = sorted(table.keys())
# We didn't find the level in the table, check if it's smaller
# than the smallest level
if level < keys[0]:
commit 3eaca8456a9b8c4321a2d3facf6e1084853ef492
Author: James Antill <james at and.org>
Date: Mon Aug 19 14:27:25 2013 -0400
Pass the req. name (_reqFromTrans) into compare_providers, for provs. vercmp.
diff --git a/yum/depsolve.py b/yum/depsolve.py
index 482113b..4d16ef2 100644
--- a/yum/depsolve.py
+++ b/yum/depsolve.py
@@ -691,7 +691,7 @@ class Depsolve(object):
# Always do compare providers for multiple pkgs, it deals with
# newest etc. ... so no need to do NewestNameArch() ... and it
# stops compare_providers from being clever.
- pkgresults = self._compare_providers(pkgs, requiringPo)
+ pkgresults = self._compare_providers(pkgs, requiringPo,req=needname)
best = pkgresults[0][0]
if self.rpmdb.contains(po=best): # is it already installed?
commit 49b91061c323e98da180b9ea93cfb91df587c0e3
Author: James Antill <james at and.org>
Date: Mon Aug 19 14:24:37 2013 -0400
Show which conf file yum-cron is looking for.
diff --git a/yum-cron/yum-cron.py b/yum-cron/yum-cron.py
index 0f354e0..1bbeb6b 100755
--- a/yum-cron/yum-cron.py
+++ b/yum-cron/yum-cron.py
@@ -756,7 +756,7 @@ class YumCronBase(yum.YumBase):
# list of the files that were read successfully, so check that it
# contains config_file
if config_file_name not in confparser.read(config_file_name):
- print >> sys.stderr, "Error reading config file"
+ print >> sys.stderr, "Error reading config file:", config_file_name
sys.exit(1)
# Populate the values into the opts object
commit 75c0f102bfdba8ccf32889c9176401aee86e9bf8
Author: James Antill <james at and.org>
Date: Fri Aug 16 12:16:42 2013 -0400
Rename testUpdateForDeps tests to give more meaning, check reason results.
diff --git a/test/simpleupdatetests.py b/test/simpleupdatetests.py
index 93a6355..ba65e55 100644
--- a/test/simpleupdatetests.py
+++ b/test/simpleupdatetests.py
@@ -1099,6 +1099,11 @@ class SimpleUpdateTests(OperationsTests):
self.tsInfo.makelists()
self.assertEquals([], self.tsInfo.depupdated)
+ def _pkg2txmbr(self, pkg):
+ for txmbr in self.tsInfo.getMembers(pkg.pkgtup):
+ return txmbr
+ return None
+
def _testUpdateForDeps_setup(self):
foo11 = FakePackage('foo', '1', '1', '0', 'i386')
foo11.addRequires('bar', 'EQ', ('0', '1', '1'))
@@ -1114,7 +1119,7 @@ class SimpleUpdateTests(OperationsTests):
return foo11, foo12, bar11, bar12
- def testUpdateForDeps1(self):
+ def testUpdateForDeps_install_all1(self):
foo11, foo12, bar11, bar12 = self._testUpdateForDeps_setup()
res, msg = self.runOperation(['install', 'foo', 'bar'], [foo11, bar11], [foo12, bar12])
@@ -1125,7 +1130,7 @@ class SimpleUpdateTests(OperationsTests):
self.tsInfo.makelists()
self.assertEquals([], self.tsInfo.depupdated)
- def testUpdateForDeps2(self):
+ def testUpdateForDeps_upgrade_all2(self):
foo11, foo12, bar11, bar12 = self._testUpdateForDeps_setup()
res, msg = self.runOperation(['upgrade', 'foo', 'bar'], [foo11, bar11], [foo12, bar12])
@@ -1133,10 +1138,12 @@ class SimpleUpdateTests(OperationsTests):
self.assert_(res=='ok', msg)
self.assertResult((foo12, bar12))
+ self.assert_(self._pkg2txmbr(bar12).reason == 'user')
+
self.tsInfo.makelists()
self.assertEquals([], self.tsInfo.depupdated)
- def testUpdateForDeps3(self):
+ def testUpdateForDeps_upgrade_all3(self):
foo11, foo12, bar11, bar12 = self._testUpdateForDeps_setup()
bar11.yumdb_info.reason = 'dep'
@@ -1145,10 +1152,12 @@ class SimpleUpdateTests(OperationsTests):
self.assert_(res=='ok', msg)
self.assertResult((foo12, bar12))
+ self.assert_(self._pkg2txmbr(bar12).reason == 'dep')
+
self.tsInfo.makelists()
self.assertEquals([], self.tsInfo.depupdated)
- def testUpdateForDeps4(self):
+ def testUpdateForDeps_upgrade_foo4(self):
foo11, foo12, bar11, bar12 = self._testUpdateForDeps_setup()
foo11.yumdb_info.reason = 'user'
bar11.yumdb_info.reason = 'dep'
@@ -1158,10 +1167,14 @@ class SimpleUpdateTests(OperationsTests):
self.assert_(res=='ok', msg)
self.assertResult((foo12, bar12))
+ print foo12.yumdb_info.reason
+ self.assert_(self._pkg2txmbr(foo12).reason == 'user')
+ self.assert_(self._pkg2txmbr(bar12).reason == 'dep')
+
self.tsInfo.makelists()
self.assertEquals([bar12], self.tsInfo.depupdated)
- def testUpdateForDeps5(self):
+ def testUpdateForDeps_upgrade_bar5(self):
foo11, foo12, bar11, bar12 = self._testUpdateForDeps_setup()
foo11.yumdb_info.reason = 'user'
bar11.yumdb_info.reason = 'dep'
@@ -1171,10 +1184,13 @@ class SimpleUpdateTests(OperationsTests):
self.assert_(res=='ok', msg)
self.assertResult((foo12, bar12))
+ self.assert_(self._pkg2txmbr(foo12).reason == 'user')
+ self.assert_(self._pkg2txmbr(bar12).reason == 'dep')
+
self.tsInfo.makelists()
self.assertEquals([foo12], self.tsInfo.depupdated)
- def testUpdateForDeps6(self):
+ def testUpdateForDeps_install_foo6(self):
foo11, foo12, bar11, bar12 = self._testUpdateForDeps_setup()
res, msg = self.runOperation(['install', 'foo'], [], [foo11, bar11, foo12, bar12])
@@ -1182,10 +1198,13 @@ class SimpleUpdateTests(OperationsTests):
self.assert_(res=='ok', msg)
self.assertResult((foo12, bar12))
+ self.assert_(self._pkg2txmbr(foo12).reason == 'user')
+ self.assert_(self._pkg2txmbr(bar12).reason == 'dep')
+
self.tsInfo.makelists()
self.assertEquals([bar12], self.tsInfo.depinstalled)
- def testUpdateForDeps7(self):
+ def testUpdateForDeps_install_bar7(self):
foo11, foo12, bar11, bar12 = self._testUpdateForDeps_setup()
res, msg = self.runOperation(['install', 'bar'], [], [foo11, bar11, foo12, bar12])
@@ -1193,10 +1212,13 @@ class SimpleUpdateTests(OperationsTests):
self.assert_(res=='ok', msg)
self.assertResult((foo12, bar12))
+ self.assert_(self._pkg2txmbr(foo12).reason == 'dep')
+ self.assert_(self._pkg2txmbr(bar12).reason == 'user')
+
self.tsInfo.makelists()
self.assertEquals([foo12], self.tsInfo.depinstalled)
- def testUpdateForDeps8(self):
+ def testUpdateForDeps_downgrade_all8(self):
foo11, foo12, bar11, bar12 = self._testUpdateForDeps_setup()
foo12.yumdb_info.reason = 'user'
bar12.yumdb_info.reason = 'blahg'
@@ -1206,8 +1228,5 @@ class SimpleUpdateTests(OperationsTests):
self.assert_(res=='ok', msg)
self.assertResult((foo11, bar11))
- for txmbr in self.tsInfo:
- if txmbr.po == foo11:
- self.assert_(txmbr.reason == 'user')
- if txmbr.po == bar11:
- self.assert_(txmbr.reason == 'blahg')
+ self.assert_(self._pkg2txmbr(foo11).reason == 'user')
+ self.assert_(self._pkg2txmbr(bar11).reason == 'blahg')
commit d59e30c7b3c6be226022936220a873538aa6f079
Author: James Antill <james at and.org>
Date: Wed Jul 31 17:53:35 2013 -0400
Also check groups dirname(), for better user messages. BZ 982361.
diff --git a/yumcommands.py b/yumcommands.py
index 1341f23..bceb569 100644
--- a/yumcommands.py
+++ b/yumcommands.py
@@ -1000,6 +1000,11 @@ class GroupsCommand(YumCommand):
if base.conf.group_command != 'objects':
pass
+ elif not os.path.exists(os.path.dirname(base.igroups.filename)):
+ base.logger.critical(_("There is no installed groups file."))
+ elif not os.access(os.path.dirname(base.igroups.filename), os.R_OK):
+ base.logger.critical(_("You don't have access to the groups DBs."))
+ raise cli.CliError
elif not os.path.exists(base.igroups.filename):
base.logger.critical(_("There is no installed groups file."))
elif not os.access(base.igroups.filename, os.R_OK):
commit 7e2a362cc39af5fd35a7e78dda13df5f424e82ce
Author: James Antill <james at and.org>
Date: Wed Jul 31 17:51:21 2013 -0400
Override users umask for groups files, so users can read it. BZ 982361.
diff --git a/yum/igroups.py b/yum/igroups.py
index cbb070f..73fbc2b 100644
--- a/yum/igroups.py
+++ b/yum/igroups.py
@@ -21,6 +21,28 @@ import os
import fnmatch
import re
+def _open_no_umask(*args):
+ """ Annoying people like to set umask's for root, which screws everything
+ up for user readable stuff. """
+ oumask = os.umask(022)
+ try:
+ ret = open(*args)
+ finally:
+ os.umask(oumask)
+
+ return ret
+
+def _makedirs_no_umask(*args):
+ """ Annoying people like to set umask's for root, which screws everything
+ up for user readable stuff. """
+ oumask = os.umask(022)
+ try:
+ ret = os.makedirs(*args)
+ finally:
+ os.umask(oumask)
+
+ return ret
+
class InstalledGroup(object):
def __init__(self, gid):
self.gid = gid
@@ -147,7 +169,7 @@ class InstalledGroups(object):
db_path = os.path.dirname(self.filename)
if not os.path.exists(db_path):
try:
- os.makedirs(db_path)
+ _makedirs_no_umask(db_path)
except (IOError, OSError), e:
# some sort of useful thing here? A warning?
return False
@@ -161,7 +183,7 @@ class InstalledGroups(object):
self.changed = False
def _write_pkg_grps(self):
- fo = open(self.filename + '.tmp', 'w')
+ fo = _open_no_umask(self.filename + '.tmp', 'w')
fo.write("1\n") # version
fo.write("%u\n" % len(self.groups))
@@ -174,7 +196,7 @@ class InstalledGroups(object):
os.rename(self.filename + '.tmp', self.filename)
def _write_grp_grps(self):
- fo = open(self.grp_filename + '.tmp', 'w')
+ fo = _open_no_umask(self.grp_filename + '.tmp', 'w')
fo.write("1\n") # version
fo.write("%u\n" % len(self.environments))
commit b4c2bf345298369a147d5fe3b4d7bdd7bf08d484
Author: James Antill <james at and.org>
Date: Tue Jul 16 09:43:16 2013 -0400
Fix downgrade keeping .reason, note that remove+install doesn't. BZ 961938.
diff --git a/yum/transactioninfo.py b/yum/transactioninfo.py
index 5e8659d..d34f3a8 100644
--- a/yum/transactioninfo.py
+++ b/yum/transactioninfo.py
@@ -530,6 +530,10 @@ class TransactionData:
if not atxmbr: # Fail?
self.remove(itxmbr.pkgtup)
return None
+
+ if 'reason' in oldpo.yumdb_info:
+ atxmbr.reason = oldpo.yumdb_info.reason
+
atxmbr.relatedto.append((oldpo, 'downgrades'))
atxmbr.downgrades.append(oldpo)
commit e344981ff42f8748b68d591ad81acf8039470307
Author: James Antill <james at and.org>
Date: Tue Jul 16 09:42:03 2013 -0400
Add testcase for downgrade keeping .reason. BZ 961938.
diff --git a/test/simpleupdatetests.py b/test/simpleupdatetests.py
index 63b7e62..93a6355 100644
--- a/test/simpleupdatetests.py
+++ b/test/simpleupdatetests.py
@@ -1195,3 +1195,19 @@ class SimpleUpdateTests(OperationsTests):
self.tsInfo.makelists()
self.assertEquals([foo12], self.tsInfo.depinstalled)
+
+ def testUpdateForDeps8(self):
+ foo11, foo12, bar11, bar12 = self._testUpdateForDeps_setup()
+ foo12.yumdb_info.reason = 'user'
+ bar12.yumdb_info.reason = 'blahg'
+
+ res, msg = self.runOperation(['downgrade', 'foo', 'bar'], [foo12, bar12], [foo11, bar11, foo12, bar12])
+
+ self.assert_(res=='ok', msg)
+ self.assertResult((foo11, bar11))
+
+ for txmbr in self.tsInfo:
+ if txmbr.po == foo11:
+ self.assert_(txmbr.reason == 'user')
+ if txmbr.po == bar11:
+ self.assert_(txmbr.reason == 'blahg')
commit a345c2856a209dbc3b195cd70712dcfe422dacbc
Author: James Antill <james at and.org>
Date: Tue Jul 16 09:29:18 2013 -0400
Don't set isDep for pkgs installed by user which satisfy reqs. BZ 961938.
diff --git a/yum/depsolve.py b/yum/depsolve.py
index aaefe9b..482113b 100644
--- a/yum/depsolve.py
+++ b/yum/depsolve.py
@@ -1086,7 +1086,7 @@ class Depsolve(object):
continue
for member in self.tsInfo.getMembersWithState(
pkgtup=po.pkgtup, output_states=TS_INSTALL_STATES):
- member.setAsDep(txmbr.po)
+ member.setAsDep(txmbr.po, relonly=True)
return ret
diff --git a/yum/transactioninfo.py b/yum/transactioninfo.py
index 8316b9b..5e8659d 100644
--- a/yum/transactioninfo.py
+++ b/yum/transactioninfo.py
@@ -826,11 +826,12 @@ class TransactionMember:
po.yumdb_info.get('releasever')
po.yumdb_info.get('changed_by')
- def setAsDep(self, po=None):
+ def setAsDep(self, po=None, relonly=False):
"""sets the transaction member as a dependency and maps the dep into the
relationship list attribute"""
-
- self.isDep = 1
+
+ if not relonly:
+ self.isDep = 1
if po:
self.relatedto.append((po, 'dependson'))
self.depends_on.append(po)
commit b820cedb5871fc0ed66cab7b9eb0451b6c67b0b9
Author: James Antill <james at and.org>
Date: Tue Jul 16 09:28:00 2013 -0400
Don't check .reason for upgrades, in makelist. And inherit on upgrade.
diff --git a/yum/transactioninfo.py b/yum/transactioninfo.py
index 57a6764..8316b9b 100644
--- a/yum/transactioninfo.py
+++ b/yum/transactioninfo.py
@@ -379,7 +379,7 @@ class TransactionData:
for txmbr in self.getMembers():
if txmbr.output_state == TS_UPDATE:
- if txmbr.isDep and txmbr.reason != 'user':
+ if txmbr.isDep:
self.depupdated.append(txmbr)
else:
self.updated.append(txmbr)
@@ -401,6 +401,8 @@ class TransactionData:
for evg in txmbr.environments:
if evg not in self.instenvironments:
self.instenvironments.append(evg)
+ # "user" here is kind of a hack ... we really shouldn't have
+ # .isDep == True, but this probably doesn't hurt.
if txmbr.isDep and txmbr.reason != 'user':
self.depinstalled.append(txmbr)
else:
@@ -459,7 +461,6 @@ class TransactionData:
txmbr.output_state = TS_INSTALL
txmbr.po.state = TS_INSTALL
txmbr.ts_state = 'u'
- txmbr.reason = 'user'
if self.rpmdb.contains(po=txmbr.po):
txmbr.reinstall = True
@@ -477,7 +478,6 @@ class TransactionData:
txmbr.output_state = TS_TRUEINSTALL
txmbr.po.state = TS_INSTALL
txmbr.ts_state = 'i'
- txmbr.reason = 'user'
if self.rpmdb.contains(po=txmbr.po):
txmbr.reinstall = True
@@ -546,6 +546,10 @@ class TransactionData:
txmbr.ts_state = 'ud'
txmbr.relatedto.append((updating_po, 'updatedby'))
txmbr.updated_by.append(updating_po)
+
+ if 'reason' in po.yumdb_info: # Propbably worthless, but...
+ txmbr.reason = po.yumdb_info.reason
+
self.add(txmbr)
return txmbr
@@ -578,6 +582,10 @@ class TransactionData:
txmbr.ts_state = 'od'
txmbr.relatedto.append((obsoleting_po, 'obsoletedby'))
txmbr.obsoleted_by.append(obsoleting_po)
+
+ if 'reason' in po.yumdb_info: # Propbably worthless, but...
+ txmbr.reason = po.yumdb_info.reason
+
self.add(txmbr)
for otxmbr in self.getMembersWithState(obsoleting_po.pkgtup,
[TS_OBSOLETING]):
commit 793e29ef626e5a96f15ff6fa1883ceb3cd69b84e
Author: James Antill <james at and.org>
Date: Tue Jul 16 09:26:00 2013 -0400
Inherit reason from install package into txmbr. BZ BZ 961938.
diff --git a/yum/depsolve.py b/yum/depsolve.py
index 52b751b..aaefe9b 100644
--- a/yum/depsolve.py
+++ b/yum/depsolve.py
@@ -711,7 +711,10 @@ class Depsolve(object):
# FIXME: we should probably handle updating multiple packages...
txmbr = self.tsInfo.addUpdate(best, inst[0])
txmbr.setAsDep(po=requiringPo)
- txmbr.reason = "dep"
+ if 'reason' in inst[0].yumdb_info:
+ txmbr.reason = inst[0].yumdb_info.reason
+ else:
+ txmbr.reason = 'dep'
checkdeps = True
self._last_req = best
else:
commit 637fb71e37f755a59b93a2521fbf0f94dc0d7b9f
Author: James Antill <james at and.org>
Date: Tue Jul 16 09:24:21 2013 -0400
Add more makelists tests.
diff --git a/test/simpleupdatetests.py b/test/simpleupdatetests.py
index c485992..63b7e62 100644
--- a/test/simpleupdatetests.py
+++ b/test/simpleupdatetests.py
@@ -1080,7 +1080,7 @@ class SimpleUpdateTests(OperationsTests):
self.assert_(res=='ok', msg)
self.assertResult((pax2, pai2, pa2))
- def testUpdateForDeps(self):
+ def testUpdateForDeps0(self):
foo11 = FakePackage('foo', '1', '1', '0', 'i386')
foo11.addRequires('bar', 'EQ', ('0', '1', '1'))
@@ -1097,7 +1097,101 @@ class SimpleUpdateTests(OperationsTests):
self.assertResult((foo12, bar12))
self.tsInfo.makelists()
- for txmbr in self.tsInfo:
- print txmbr,
- print txmbr.reason
self.assertEquals([], self.tsInfo.depupdated)
+
+ def _testUpdateForDeps_setup(self):
+ foo11 = FakePackage('foo', '1', '1', '0', 'i386')
+ foo11.addRequires('bar', 'EQ', ('0', '1', '1'))
+
+ foo12 = FakePackage('foo', '1', '2', '0', 'i386')
+ foo12.addRequires('bar', 'EQ', ('0', '1', '2'))
+
+ bar11 = FakePackage('bar', '1', '1', '0', 'i386')
+ bar11.addRequires('foo', 'EQ', ('0', '1', '1'))
+
+ bar12 = FakePackage('bar', '1', '2', '0', 'i386')
+ bar12.addRequires('foo', 'EQ', ('0', '1', '2'))
+
+ return foo11, foo12, bar11, bar12
+
+ def testUpdateForDeps1(self):
+ foo11, foo12, bar11, bar12 = self._testUpdateForDeps_setup()
+
+ res, msg = self.runOperation(['install', 'foo', 'bar'], [foo11, bar11], [foo12, bar12])
+
+ self.assert_(res=='ok', msg)
+ self.assertResult((foo12, bar12))
+
+ self.tsInfo.makelists()
+ self.assertEquals([], self.tsInfo.depupdated)
+
+ def testUpdateForDeps2(self):
+ foo11, foo12, bar11, bar12 = self._testUpdateForDeps_setup()
+
+ res, msg = self.runOperation(['upgrade', 'foo', 'bar'], [foo11, bar11], [foo12, bar12])
+
+ self.assert_(res=='ok', msg)
+ self.assertResult((foo12, bar12))
+
+ self.tsInfo.makelists()
+ self.assertEquals([], self.tsInfo.depupdated)
+
+ def testUpdateForDeps3(self):
+ foo11, foo12, bar11, bar12 = self._testUpdateForDeps_setup()
+ bar11.yumdb_info.reason = 'dep'
+
+ res, msg = self.runOperation(['upgrade', 'foo', 'bar'], [foo11, bar11], [foo12, bar12])
+
+ self.assert_(res=='ok', msg)
+ self.assertResult((foo12, bar12))
+
+ self.tsInfo.makelists()
+ self.assertEquals([], self.tsInfo.depupdated)
+
+ def testUpdateForDeps4(self):
+ foo11, foo12, bar11, bar12 = self._testUpdateForDeps_setup()
+ foo11.yumdb_info.reason = 'user'
+ bar11.yumdb_info.reason = 'dep'
+
+ res, msg = self.runOperation(['upgrade', 'foo'], [foo11, bar11], [foo12, bar12])
+
+ self.assert_(res=='ok', msg)
+ self.assertResult((foo12, bar12))
+
+ self.tsInfo.makelists()
+ self.assertEquals([bar12], self.tsInfo.depupdated)
+
+ def testUpdateForDeps5(self):
+ foo11, foo12, bar11, bar12 = self._testUpdateForDeps_setup()
+ foo11.yumdb_info.reason = 'user'
+ bar11.yumdb_info.reason = 'dep'
+
+ res, msg = self.runOperation(['upgrade', 'bar'], [foo11, bar11], [foo12, bar12])
+
+ self.assert_(res=='ok', msg)
+ self.assertResult((foo12, bar12))
+
+ self.tsInfo.makelists()
+ self.assertEquals([foo12], self.tsInfo.depupdated)
+
+ def testUpdateForDeps6(self):
+ foo11, foo12, bar11, bar12 = self._testUpdateForDeps_setup()
+
+ res, msg = self.runOperation(['install', 'foo'], [], [foo11, bar11, foo12, bar12])
+
+ self.assert_(res=='ok', msg)
+ self.assertResult((foo12, bar12))
+
+ self.tsInfo.makelists()
+ self.assertEquals([bar12], self.tsInfo.depinstalled)
+
+ def testUpdateForDeps7(self):
+ foo11, foo12, bar11, bar12 = self._testUpdateForDeps_setup()
+
+ res, msg = self.runOperation(['install', 'bar'], [], [foo11, bar11, foo12, bar12])
+
+ self.assert_(res=='ok', msg)
+ self.assertResult((foo12, bar12))
+
+ self.tsInfo.makelists()
+ self.assertEquals([foo12], self.tsInfo.depinstalled)
commit 4cd053dd624cd56e71278138de570a8425dd9c9d
Author: Paul Nasrat <pnasrat at gmail.com>
Date: Fri Jul 12 14:37:38 2013 -0400
Add unit test for confusing depupdated output.
BZ 961938
diff --git a/test/simpleupdatetests.py b/test/simpleupdatetests.py
index 9e22a6b..c485992 100644
--- a/test/simpleupdatetests.py
+++ b/test/simpleupdatetests.py
@@ -1080,3 +1080,24 @@ class SimpleUpdateTests(OperationsTests):
self.assert_(res=='ok', msg)
self.assertResult((pax2, pai2, pa2))
+ def testUpdateForDeps(self):
+ foo11 = FakePackage('foo', '1', '1', '0', 'i386')
+ foo11.addRequires('bar', 'EQ', ('0', '1', '1'))
+
+ foo12 = FakePackage('foo', '1', '2', '0', 'i386')
+ foo12.addRequires('bar', 'EQ', ('0', '1', '2'))
+
+ bar11 = FakePackage('bar', '1', '1', '0', 'i386')
+ bar11.yumdb_info.reason = 'dep'
+ bar12 = FakePackage('bar', '1', '2', '0', 'i386')
+
+ res, msg = self.runOperation(['install', 'foo', 'bar'], [foo11, bar11], [foo12, bar12])
+
+ self.assert_(res=='ok', msg)
+ self.assertResult((foo12, bar12))
+
+ self.tsInfo.makelists()
+ for txmbr in self.tsInfo:
+ print txmbr,
+ print txmbr.reason
+ self.assertEquals([], self.tsInfo.depupdated)
More information about the Yum-commits
mailing list