[yum-commits] Branch 'yum-3_2_X' - 3 commits - yum/__init__.py yum/packageSack.py yum/pkgtag_db.py
James Antill
james at osuosl.org
Wed Feb 24 13:42:39 UTC 2010
yum/__init__.py | 6 +++++-
yum/packageSack.py | 26 ++++++++++++--------------
yum/pkgtag_db.py | 3 +--
3 files changed, 18 insertions(+), 17 deletions(-)
New commits:
commit 51e8b52493be16cc3b7620bd47a225ada6601327
Author: James Antill <james at and.org>
Date: Tue Feb 23 13:53:31 2010 -0500
Allow pkgtag_db to be loaded on RHEL-5, should work too
diff --git a/yum/pkgtag_db.py b/yum/pkgtag_db.py
index e72fd05..d2836e4 100644
--- a/yum/pkgtag_db.py
+++ b/yum/pkgtag_db.py
@@ -17,8 +17,7 @@
# parse sqlite tag database
# return pkgnames and tag that was matched
-import sqlite3 as sqlite
-from sqlutils import executeSQL, sql_esc, sql_esc_glob
+from sqlutils import sqlite, executeSQL, sql_esc, sql_esc_glob
from Errors import PkgTagsError
import sqlutils
import sys
commit ba5266876fd7d3749afcb0a25c9a0da0c60e1808
Author: James Antill <james at and.org>
Date: Tue Feb 23 13:52:06 2010 -0500
Much faster limiting obsoletes to the newest versions of packages
diff --git a/yum/packageSack.py b/yum/packageSack.py
index 0d9301b..1278cba 100644
--- a/yum/packageSack.py
+++ b/yum/packageSack.py
@@ -432,22 +432,20 @@ class MetaSack(PackageSackBase):
if not newest:
return self._computeAggregateDictResult("returnObsoletes")
- # FIXME - this is slooooooooooooooooooooooooooooooow
- # get the dict back
obsdict = self._computeAggregateDictResult("returnObsoletes")
- newest_tups = set((pkg.pkgtup for pkg in self.returnNewestByName()))
-
- # go through each of the keys of the obs dict and see if it is in the
- # sack of newest pkgs - if it is not - remove the entry
- togo = []
- for obstup in obsdict:
- if obstup not in newest_tups:
- togo.append(obstup)
- for obstup in togo:
- del obsdict[obstup]
-
- return obsdict
+ names = set((obstup[0] for obstup in obsdict))
+ nobsdict = {}
+ last_name = ''
+ last_pkg = None
+ for pkg in reversed(sorted(self.searchNames(names))):
+ if last_name == pkg.name and not pkg.verEQ(last_pkg):
+ continue
+ last_name = pkg.name
+ last_pkg = pkg
+ if pkg.pkgtup in obsdict:
+ nobsdict[pkg.pkgtup] = obsdict[pkg.pkgtup]
+ return nobsdict
def searchFiles(self, name):
"""return list of packages by filename"""
commit 77a77ec13bdbb80dbaefef9f05baabedddb9bcc1
Author: James Antill <james at and.org>
Date: Tue Feb 23 13:50:25 2010 -0500
Do process obsoletes for newest packages only.
diff --git a/yum/__init__.py b/yum/__init__.py
index 324a8ec..f21001d 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -624,7 +624,11 @@ class YumBase(depsolve.Depsolve):
if self.conf.obsoletes:
obs_init = time.time()
- self._up.rawobsoletes = self.pkgSack.returnObsoletes()
+ # Note: newest=True here is semi-required for repos. with multiple
+ # versions. The problem is that if pkgA-2 _accidentally_ obsoletes
+ # pkgB-1, and we keep all versions, we want to release a pkgA-3
+ # that doesn't do the obsoletes ... and thus. not obsolete pkgB-1.
+ self._up.rawobsoletes = self.pkgSack.returnObsoletes(newest=True)
self.verbose_logger.debug('up:Obs Init time: %0.3f' % (time.time() - obs_init))
self._up.myarch = self.arch.canonarch
More information about the Yum-commits
mailing list