[yum-commits] Branch 'yum-3_2_X' - 3 commits - docs/yum.8 output.py test/operationstests.py test/testbase.py yum/__init__.py yum/packageSack.py yum/sqlitesack.py
James Antill
james at osuosl.org
Thu Dec 10 19:40:33 UTC 2009
docs/yum.8 | 13 ++++++
output.py | 20 +++++-----
test/operationstests.py | 93 ++++++++++++++++++++++++++++++++++++++++++++++++
test/testbase.py | 5 ++
yum/__init__.py | 2 -
yum/packageSack.py | 17 ++++++--
yum/sqlitesack.py | 5 ++
7 files changed, 139 insertions(+), 16 deletions(-)
New commits:
commit 6fda6572526fb1219dc24c42678e363ead5cdbca
Author: James Antill <james at and.org>
Date: Thu Dec 10 14:33:12 2009 -0500
Document the secret end column of history list, giving away all our sekretz!
diff --git a/docs/yum.8 b/docs/yum.8
index 6ba873e..ced16e3 100644
--- a/docs/yum.8
+++ b/docs/yum.8
@@ -248,6 +248,19 @@ The info/list/summary commands take either a transactions id or a package (with
wildcards, as in \fBSpecifying package names\fP), all three can also be passed
no arguments. list can be passed the keyword "all" to list all the transactions.
undo/redo just take a transaction id.
+
+In "history list" output the Altered column also gives some extra information
+if there was something not good with the transaction.
+
+.I \fB>\fR - The rpmdb was changed, outside yum, after the transaction.
+.br
+.I \fB<\fR - The rpmdb was changed, outside yum, before the transaction.
+.br
+.I \fB*\fR - The transaction aborted before completion.
+.br
+.I \fB#\fR - The transaction completed, but with a non-zero status.
+.br
+
.IP
.IP "\fBhelp\fP"
Produces help, either for all commands or if given a command name then the help
diff --git a/output.py b/output.py
index a59ca66..b748ef9 100755
--- a/output.py
+++ b/output.py
@@ -1271,16 +1271,16 @@ to exit.
num, uiacts = self._history_uiactions(old.trans_data)
name = utf8_width_fill(name, 22, 22)
uiacts = utf8_width_fill(uiacts, 14, 14)
- if old.altered_lt_rpmdb and old.altered_gt_rpmdb:
- print fmt % (old.tid, name, tm, uiacts, num), "><"
- elif old.return_code is None:
- print fmt % (old.tid, name, tm, uiacts, num), "**"
- elif old.altered_lt_rpmdb:
- print fmt % (old.tid, name, tm, uiacts, num), " <"
- elif old.altered_gt_rpmdb:
- print fmt % (old.tid, name, tm, uiacts, num), "> "
- else:
- print fmt % (old.tid, name, tm, uiacts, num)
+ rmark = lmark = ' '
+ if old.return_code is None:
+ rmark = lmark = '*'
+ elif old.return_code:
+ rmark = lmark = '#'
+ if old.altered_lt_rpmdb:
+ rmark = '<'
+ if old.altered_gt_rpmdb:
+ lmark = '>'
+ print fmt % (old.tid, name, tm, uiacts, num), "%s%s" % (lmark,rmark)
lastdbv = self.history.last()
if lastdbv is not None:
# If this is the last transaction, is good and it doesn't
commit 0a2be67617d0b103cfeb04470cd7fb092bb9da2f
Author: James Antill <james at and.org>
Date: Thu Dec 10 12:27:33 2009 -0500
Test cases for previous change
diff --git a/test/operationstests.py b/test/operationstests.py
index 18f4b84..dd85ed6 100644
--- a/test/operationstests.py
+++ b/test/operationstests.py
@@ -141,3 +141,96 @@ class KernelTests(OperationsTests):
p = self.pkgs
res, msg = self.runOperation(['install','kernel-2.6.23.8'], p.inst, p.avail)
self.assertResult(p.inst)
+
+class MultiLibTests(OperationsTests):
+
+ @staticmethod
+ def buildPkgs(pkgs, *args):
+ pkgs.inst = []
+ pkgs.i_foo_1_12_x = FakePackage('foo', '1', '12',arch='x86_64')
+ pkgs.i_wbar_1_12_i = FakePackage('wbar', '1', '12', arch='i586')
+ pkgs.inst.append(pkgs.i_foo_1_12_x)
+ pkgs.inst.append(pkgs.i_wbar_1_12_i)
+
+ pkgs.avail = []
+ pkgs.a_foo_0_2_x = FakePackage('foo', '0', '2', arch='x86_64')
+ pkgs.a_foo_0_2_i = FakePackage('foo', '0', '2', arch='i686')
+ pkgs.a_foo_1_12_x = FakePackage('foo', '1', '12', arch='x86_64')
+ pkgs.a_foo_1_12_i = FakePackage('foo', '1', '12', arch='i686')
+ pkgs.a_foo_2_22_x = FakePackage('foo', '2', '22', arch='x86_64')
+ pkgs.a_foo_2_22_i = FakePackage('foo', '2', '22', arch='i686')
+ pkgs.a_bar_1_12_x = FakePackage('bar', '1', '12', arch='x86_64')
+ pkgs.a_bar_1_12_i = FakePackage('bar', '1', '12', arch='i686')
+ pkgs.a_bar_2_22_x = FakePackage('bar', '2', '22', arch='x86_64')
+ pkgs.a_bar_2_22_i = FakePackage('bar', '2', '22', arch='i686')
+
+ # ibar is .i?86 older
+ pkgs.a_ibar_2_22_x = FakePackage('ibar', '2', '22', arch='x86_64')
+ pkgs.a_ibar_1_12_i = FakePackage('ibar', '1', '12', arch='i686')
+
+ # xbar is .x86_64 older
+ pkgs.a_xbar_1_12_x = FakePackage('xbar', '1', '12', arch='x86_64')
+ pkgs.a_xbar_2_22_i = FakePackage('xbar', '2', '22', arch='i686')
+
+ # wbar is arch changing update/downgrade
+ pkgs.a_wbar_0_2_i = FakePackage('wbar', '0', '2', arch='i386')
+ pkgs.a_wbar_2_22_i = FakePackage('wbar', '2', '22', arch='i686')
+
+ for i in ('a_foo_0_2', 'a_foo_1_12', 'a_foo_2_22',
+ 'a_bar_1_12', 'a_bar_2_22'):
+ pkgs.avail.append(getattr(pkgs, i + '_x'))
+ pkgs.avail.append(getattr(pkgs, i + '_i'))
+ pkgs.avail.append(pkgs.a_ibar_2_22_x)
+ pkgs.avail.append(pkgs.a_ibar_1_12_i)
+ pkgs.avail.append(pkgs.a_xbar_1_12_x)
+ pkgs.avail.append(pkgs.a_xbar_2_22_i)
+ pkgs.avail.append(pkgs.a_wbar_0_2_i)
+ pkgs.avail.append(pkgs.a_wbar_2_22_i)
+
+ def testBestInstall1(self):
+ p = self.pkgs
+ ninst = p.inst[:]
+ ninst.append(p.a_bar_2_22_x)
+ res, msg = self.runOperation(['install', 'bar'], p.inst, p.avail)
+ self.assertResult(ninst)
+
+ def testBestInstall2(self):
+ p = self.pkgs
+ ninst = p.inst[:]
+ ninst.append(p.a_bar_1_12_x)
+ res, msg = self.runOperation(['install', 'bar-1'], p.inst, p.avail)
+ self.assertResult(ninst)
+
+ def testAllInstall1(self):
+ p = self.pkgs
+ ninst = p.inst[:]
+ ninst.append(p.a_bar_2_22_x)
+ ninst.append(p.a_bar_2_22_i)
+ res, msg = self.runOperation(['install', 'bar'], p.inst, p.avail,
+ {'multilib_policy' : 'all'})
+ self.assertResult(ninst)
+
+ def testAllInstall2(self):
+ p = self.pkgs
+ ninst = p.inst[:]
+ ninst.append(p.a_bar_1_12_x)
+ ninst.append(p.a_bar_1_12_i)
+ res, msg = self.runOperation(['install', 'bar-1'], p.inst, p.avail,
+ {'multilib_policy' : 'all'})
+ self.assertResult(ninst)
+
+ def testAllInstall3(self):
+ p = self.pkgs
+ ninst = p.inst[:]
+ ninst.append(p.a_ibar_2_22_x)
+ res, msg = self.runOperation(['install', 'ibar'], p.inst, p.avail,
+ {'multilib_policy' : 'all'})
+ self.assertResult(ninst)
+
+ def testAllInstall4(self):
+ p = self.pkgs
+ ninst = p.inst[:]
+ ninst.append(p.a_xbar_2_22_i)
+ res, msg = self.runOperation(['install', 'xbar'], p.inst, p.avail,
+ {'multilib_policy' : 'all'})
+ self.assertResult(ninst)
diff --git a/test/testbase.py b/test/testbase.py
index 3edfe57..c004bdb 100644
--- a/test/testbase.py
+++ b/test/testbase.py
@@ -332,7 +332,8 @@ class OperationsTests(_DepsolveTestsBase):
buildPkg code.
"""
- def runOperation(self, args, installed=[], available=[]):
+ def runOperation(self, args, installed=[], available=[],
+ confs={}):
"""Sets up and runs the depsolver. args[0] must be a valid yum command
("install", "update", ...). It might be followed by pkg names as on the
yum command line. The pkg objects in installed are added to self.rpmdb and
@@ -345,6 +346,8 @@ class OperationsTests(_DepsolveTestsBase):
self.xsack = depsolver._pkgSack = packageSack.PackageSack()
self.repo = depsolver.repo = FakeRepo("installed")
depsolver.conf = FakeConf()
+ for conf in confs:
+ setattr(depsolver.conf, conf, confs[conf])
# We are running nosetest, so we want to see some yum output
# if a testcase if failing
depsolver.doLoggingSetup(9,9)
diff --git a/yum/__init__.py b/yum/__init__.py
index 19e4121..72702b8 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -51,7 +51,7 @@ import transactioninfo
import urlgrabber
from urlgrabber.grabber import URLGrabber, URLGrabError
from urlgrabber.progress import format_number
-from packageSack import packagesNewestByName, ListPackageSack
+from packageSack import packagesNewestByName, packagesNewestByNameArch, ListPackageSack
import depsolve
import plugins
import logginglevels
@@ -2339,7 +2339,7 @@ class YumBase(depsolve.Depsolve):
use.append(pkg)
pkgs = use
- pkgs = packagesNewestByName(pkgs)
+ pkgs = packagesNewestByNameArch(pkgs)
if not self.tsInfo.conditionals.has_key(cond):
self.tsInfo.conditionals[cond] = []
@@ -2782,7 +2782,7 @@ class YumBase(depsolve.Depsolve):
pkgs = use
- pkgs = packagesNewestByName(pkgs)
+ pkgs = packagesNewestByNameArch(pkgs)
pkgbyname = {}
for pkg in pkgs:
@@ -3097,7 +3097,7 @@ class YumBase(depsolve.Depsolve):
# This is done so we don't have to returnObsoletes(newest=True)
# 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 packagesNewestByName(obs_pkgs):
+ for obsoleting_pkg in packagesNewestByNameArch(obs_pkgs):
tx_return.extend(self.install(po=obsoleting_pkg))
for available_pkg in availpkgs:
for obsoleted in self.up.obsoleting_dict.get(available_pkg.pkgtup, []):
commit 1ab6cc75011175131b1baaab271f546163989863
Author: James Antill <james at and.org>
Date: Thu Dec 10 11:35:03 2009 -0500
Fix bugs where we want to install old versions of multiarch packages,
which just upsets everything.
This is mostly a revert of:
commit f6317aabb2734357311b6103286a76054c3cd0e9
Author: James Antill <james at and.org>
Date: Sat May 31 17:08:44 2008 -0400
We want to keep other arches in the multilib_policy=all case. bug#449056
...but that was because of the confusing name, and the fact we had
another bug which caused the problem, which we fixed a few weeks later:
commit 40471d1d681f62415487def517ac90f253fafa9b
Author: James Antill <james at and.org>
Date: Tue Jun 24 17:21:26 2008 -0400
Fix packagesNewestByName() to use comparePoEVR as pkg.__cmp__ uses
.arch in
thus we'd only get one pkg from the alph sorted arch.
kind of a weird interface, not quite the "same" as
packageNewestByNameArch
...with that fix I believe the original bug#449056 wouldn't have
happened.
diff --git a/yum/__init__.py b/yum/__init__.py
index 220be09..19e4121 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -51,7 +51,7 @@ import transactioninfo
import urlgrabber
from urlgrabber.grabber import URLGrabber, URLGrabError
from urlgrabber.progress import format_number
-from packageSack import packagesNewestByNameArch, ListPackageSack
+from packageSack import packagesNewestByName, ListPackageSack
import depsolve
import plugins
import logginglevels
@@ -2339,7 +2339,7 @@ class YumBase(depsolve.Depsolve):
use.append(pkg)
pkgs = use
- pkgs = packagesNewestByNameArch(pkgs)
+ pkgs = packagesNewestByName(pkgs)
if not self.tsInfo.conditionals.has_key(cond):
self.tsInfo.conditionals[cond] = []
@@ -2782,7 +2782,7 @@ class YumBase(depsolve.Depsolve):
pkgs = use
- pkgs = packagesNewestByNameArch(pkgs)
+ pkgs = packagesNewestByName(pkgs)
pkgbyname = {}
for pkg in pkgs:
@@ -3097,7 +3097,7 @@ class YumBase(depsolve.Depsolve):
# This is done so we don't have to returnObsoletes(newest=True)
# 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):
+ for obsoleting_pkg in packagesNewestByName(obs_pkgs):
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/packageSack.py b/yum/packageSack.py
index 7f563dc..1e99661 100644
--- a/yum/packageSack.py
+++ b/yum/packageSack.py
@@ -233,7 +233,9 @@ class PackageSackBase(object):
def returnNewestByName(self, name=None, patterns=None, ignore_case=False):
"""return list of newest packages based on name matching
this means(in name.arch form): foo.i386 and foo.noarch will
- be compared to each other for highest version"""
+ be compared to each other for highest version.
+ Note that given: foo-1.i386; foo-2.i386 and foo-3.x86_64
+ The last _two_ pkgs will be returned, not just one of them. """
raise NotImplementedError()
def simplePkgList(self, patterns=None, ignore_case=False):
@@ -507,7 +509,9 @@ class MetaSack(PackageSackBase):
def returnNewestByName(self, name=None, patterns=None, ignore_case=False):
"""return list of newest packages based on name matching
this means(in name.arch form): foo.i386 and foo.noarch will
- be compared to each other for highest version"""
+ be compared to each other for highest version.
+ Note that given: foo-1.i386; foo-2.i386 and foo-3.x86_64
+ The last _two_ pkgs will be returned, not just one of them. """
pkgs = self._computeAggregateListResult("returnNewestByName", name,
patterns, ignore_case)
pkgs = packagesNewestByName(pkgs)
@@ -912,7 +916,10 @@ class PackageSack(PackageSackBase):
def returnNewestByName(self, name=None, patterns=None, ignore_case=False):
"""return list of newest packages based on name matching
this means(in name.arch form): foo.i386 and foo.noarch will
- be compared to each other for highest version"""
+ be compared to each other for highest version.
+ Note that given: foo-1.i386; foo-2.i386 and foo-3.x86_64
+ The last _two_ pkgs will be returned, not just one of them. """
+
highdict = {}
for pkg in self.returnPackages(patterns=patterns,
ignore_case=ignore_case):
@@ -975,7 +982,9 @@ class PackageSack(PackageSackBase):
return matches
def packagesNewestByName(pkgs):
- """ Does the same as PackageSack.returnNewestByName() """
+ """ Does the same as PackageSack.returnNewestByName().
+ Note that given: foo-1.i386; foo-2.i386 and foo-3.x86_64
+ The last _two_ pkgs will be returned, not just one of them. """
newest = {}
for pkg in pkgs:
key = pkg.name
diff --git a/yum/sqlitesack.py b/yum/sqlitesack.py
index e50edb1..812d765 100644
--- a/yum/sqlitesack.py
+++ b/yum/sqlitesack.py
@@ -1427,6 +1427,11 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack):
@catchSqliteException
def returnNewestByName(self, name=None, patterns=None, ignore_case=False):
+ """return list of newest packages based on name matching
+ this means(in name.arch form): foo.i386 and foo.noarch will
+ be compared to each other for highest version.
+ Note that given: foo-1.i386; foo-2.i386 and foo-3.x86_64
+ The last _two_ pkgs will be returned, not just one of them. """
# If name is set do it from the database otherwise use our parent's
# returnNewestByName
if self._skip_all():
More information about the Yum-commits
mailing list