[yum-commits] Branch 'yum-3_2_X' - 2 commits - yum/packageSack.py yum/repos.py yum/rpmtrans.py yum/yumRepo.py
James Antill
james at osuosl.org
Tue Feb 24 21:56:11 UTC 2009
yum/packageSack.py | 20 +++++++++++++++++---
yum/repos.py | 3 +++
yum/rpmtrans.py | 4 ++--
yum/yumRepo.py | 13 +++++++++++++
4 files changed, 35 insertions(+), 5 deletions(-)
New commits:
commit a52ad20b4db69cf49157fbb903f0cf2006f18394
Author: James Antill <james at and.org>
Date: Tue Feb 24 16:56:04 2009 -0500
Fix for bad merge fix in rpmtrans script errors
diff --git a/yum/rpmtrans.py b/yum/rpmtrans.py
index 298a5e9..a30dd06 100644
--- a/yum/rpmtrans.py
+++ b/yum/rpmtrans.py
@@ -515,11 +515,11 @@ class RPMTransaction:
scriptlet_name = rpm.tagnames.get(bytes, "<unknown>")
if total:
msg = ("Error in %s scriptlet in rpm package %s" %
- (rpm.tagnames[tagnum], txmbr.po))
+ (scriptlet_name, txmbr.po))
txmbr.output_state = TS_FAILED
else:
msg = ("Non-fatal %s scriptlet failure in rpm package %s" %
- (rpm.tagnames[tagnum], txmbr.po))
+ (scriptlet_name, txmbr.po))
self.display.errorlog(msg)
# FIXME - what else should we do here? raise a failure and abort?
commit 90e3f36fb8bd9c9396b327f2b267b9b181eeba95
Author: James Antill <james at and.org>
Date: Tue Feb 24 00:43:24 2009 -0500
Sort the repos/sacks, so they are used in the same order
diff --git a/yum/packageSack.py b/yum/packageSack.py
index b95d1a7..997f4fb 100644
--- a/yum/packageSack.py
+++ b/yum/packageSack.py
@@ -40,6 +40,20 @@ class PackageSackBase(object):
else:
return iter(ret)
+ def __cmp__(self, other):
+ if other is None:
+ return 1
+
+ s_repos = list(self.added)
+ o_repos = list(other.added)
+ if len(s_repos) != len(o_repos):
+ return len(s_repos) - len(o_repos)
+ for (s_repo, o_repo) in zip(sorted(s_repos), sorted(o_repos)):
+ ret = cmp(s_repo, o_repo)
+ if ret:
+ return ret
+ return 0
+
def setCompatArchs(self, compatArchs):
raise NotImplementedError()
@@ -260,7 +274,7 @@ class MetaSack(PackageSackBase):
def __len__(self):
ret = 0
- for sack in self.sacks.values():
+ for sack in sorted(self.sacks.values()):
ret += len(sack)
return ret
@@ -449,7 +463,7 @@ class MetaSack(PackageSackBase):
def _computeAggregateListResult(self, methodName, *args):
result = []
- for sack in self.sacks.values():
+ for sack in sorted(self.sacks.values()):
if hasattr(sack, methodName):
method = getattr(sack, methodName)
try:
@@ -464,7 +478,7 @@ class MetaSack(PackageSackBase):
def _computeAggregateDictResult(self, methodName, *args):
result = {}
- for sack in self.sacks.values():
+ for sack in sorted(self.sacks.values()):
if hasattr(sack, methodName):
method = getattr(sack, methodName)
try:
diff --git a/yum/repos.py b/yum/repos.py
index 694fd93..63d1493 100644
--- a/yum/repos.py
+++ b/yum/repos.py
@@ -167,6 +167,7 @@ class RepoStorage:
if repo.isEnabled():
returnlist.append(repo)
+ returnlist.sort()
return returnlist
def listGroupsEnabled(self):
@@ -267,6 +268,8 @@ class Repository:
self.disable()
def __cmp__(self, other):
+ """ Sort base class repos. by alphanumeric on their id, also
+ see __cmp__ in YumRepository(). """
if self.id > other.id:
return 1
elif self.id < other.id:
diff --git a/yum/yumRepo.py b/yum/yumRepo.py
index afd0877..964f19d 100644
--- a/yum/yumRepo.py
+++ b/yum/yumRepo.py
@@ -281,6 +281,19 @@ class YumRepository(Repository, config.RepoConf):
self._grabfunc = None
self._grab = None
+ def __cmp__(self, other):
+ """ Sort yum repos. by cost, and then by alphanumeric on their id. """
+ if other is None:
+ return 1
+ if hasattr(other, 'cost'):
+ ocost = other.cost
+ else:
+ ocost = 1000
+ ret = cmp(self.cost, ocost)
+ if ret:
+ return 1
+ return cmp(self.id, other.id)
+
def _getSack(self):
# FIXME: Note that having the repo hold the sack, which holds "repos"
# is not only confusing but creates a circular dep.
More information about the Yum-commits
mailing list