[yum-commits] Branch 'yum-3_2_X' - 3 commits - docs/yum.8 yumcommands.py yum/__init__.py
James Antill
james at osuosl.org
Tue May 17 19:22:15 UTC 2011
docs/yum.8 | 19 ++++++++++++++-----
yum/__init__.py | 52 ++++++++++++++++++++++++++++++++++++++++++----------
yumcommands.py | 4 ++++
3 files changed, 60 insertions(+), 15 deletions(-)
New commits:
commit d025f8cde6233e6f7bf1bf6c12b190746a804aff
Author: James Antill <james at and.org>
Date: Fri Apr 29 16:28:11 2011 -0400
Don't use .up object on package install, unless we have to.
Huge perf. gain, now takes ~60% of time to get to y/N choice. 45%
when obsoletes are off.
Somewhat ugly workaround needed to get obsoletes data.
Also fixes bug when obsoletes are off and we install something which
obsoletes things (they still need to be obsoleted, as rpm will do it).
diff --git a/yum/__init__.py b/yum/__init__.py
index 1291da9..740273e 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -726,7 +726,10 @@ class YumBase(depsolve.Depsolve):
if self.conf.debuglevel >= 7:
self._up.debug = 1
- if self.conf.obsoletes:
+ if hasattr(self, '_up_obs_hack'):
+ self._up.rawobsoletes = self._up_obs_hack.rawobsoletes
+ del self._up_obs_hack
+ elif self.conf.obsoletes:
obs_init = time.time()
# Note: newest=True here is semi-required for repos. with multiple
# versions. The problem is that if pkgA-2 _accidentally_ obsoletes
@@ -3183,7 +3186,23 @@ class YumBase(depsolve.Depsolve):
def _pkg2obspkg(self, po):
""" Given a package return the package it's obsoleted by and so
we should install instead. Or None if there isn't one. """
- thispkgobsdict = self.up.checkForObsolete([po.pkgtup])
+ if self._up is not None:
+ thispkgobsdict = self.up.checkForObsolete([po.pkgtup])
+ else:
+ # This is pretty hacky, but saves a huge amount of time for small
+ # ops.
+ if not self.conf.obsoletes:
+ return None
+
+ if not hasattr(self, '_up_obs_hack'):
+ obs_init = time.time()
+ up = rpmUtils.updates.Updates([], [])
+ up.rawobsoletes = self.pkgSack.returnObsoletes(newest=True)
+ self.verbose_logger.debug('Obs Init time: %0.3f' % (time.time()
+ - obs_init))
+ self._up_obs_hack = up
+ thispkgobsdict = self._up_obs_hack.checkForObsolete([po.pkgtup])
+
if po.pkgtup in thispkgobsdict:
obsoleting = thispkgobsdict[po.pkgtup]
oobsoleting = []
@@ -3316,10 +3335,19 @@ class YumBase(depsolve.Depsolve):
installed_pkg = self.getInstalledPackageObject(inst_tup)
yield installed_pkg
else:
- for obs_n in po.obsoletes_names:
- for pkg in self.rpmdb.searchNevra(name=obs_n):
- if pkg.obsoletedBy([po]):
- yield pkg
+ for pkg in self._find_obsoletees_direct(po):
+ yield pkg
+
+ def _find_obsoletees_direct(self, po):
+ """ Return the pkgs. that are obsoleted by the po we pass in. This works
+ directly on the package data, for two reasons:
+ 1. Consulting .up. has a slow setup for small/fast ops.
+ 2. We need this work even if obsoletes are turned off, because rpm
+ will be doing it for us. """
+ for obs_n in po.obsoletes_names:
+ for pkg in self.rpmdb.searchNevra(name=obs_n):
+ if pkg.obsoletedBy([po]):
+ yield pkg
def _add_prob_flags(self, *flags):
""" Add all of the passed flags to the tsInfo.probFilterFlags array. """
@@ -3466,7 +3494,8 @@ class YumBase(depsolve.Depsolve):
continue
# make sure this shouldn't be passed to update:
- if po.pkgtup in self.up.updating_dict:
+ if (self.rpmdb.searchNames([po.name]) and
+ po.pkgtup in self.up.updating_dict):
txmbrs = self.update(po=po)
tx_return.extend(txmbrs)
continue
@@ -3474,7 +3503,9 @@ class YumBase(depsolve.Depsolve):
# Make sure we're not installing a package which is obsoleted by
# something else in the repo. Unless there is a obsoletion loop,
# at which point ignore everything.
- obsoleting_pkg = self._test_loop(po, self._pkg2obspkg)
+ obsoleting_pkg = None
+ if self.conf.obsoletes:
+ obsoleting_pkg = self._test_loop(po, self._pkg2obspkg)
if obsoleting_pkg is not None:
# this is not a definitive check but it'll make sure we don't
# pull in foo.i586 when foo.x86_64 already obsoletes the pkg and
@@ -3543,8 +3574,9 @@ class YumBase(depsolve.Depsolve):
break
# it doesn't obsolete anything. If it does, mark that in the tsInfo, too
- if po.pkgtup in self.up.getObsoletesList(name=po.name):
- for obsoletee in self._find_obsoletees(po):
+ obs_pkgs = list(self._find_obsoletees_direct(po))
+ if obs_pkgs:
+ for obsoletee in obs_pkgs:
txmbr = self.tsInfo.addObsoleting(po, obsoletee)
self.tsInfo.addObsoleted(obsoletee, po)
tx_return.append(txmbr)
commit d850e78612e50730d86396d5ca920169143a03a2
Author: James Antill <james at and.org>
Date: Wed Apr 27 00:51:22 2011 -0400
Add repofile to repolist -v output.
diff --git a/yumcommands.py b/yumcommands.py
index 74a1f00..fb70f3e 100644
--- a/yumcommands.py
+++ b/yumcommands.py
@@ -1017,6 +1017,10 @@ class RepoListCommand(YumCommand):
out += [base.fmtKeyValFill(_("Repo-excluded: "),
ui_excludes_num)]
+ if repo.repofile:
+ out += [base.fmtKeyValFill(_("Repo-filename: "),
+ repo.repofile)]
+
base.verbose_logger.log(logginglevels.DEBUG_3,
"%s\n",
"\n".join(map(misc.to_unicode, out)))
commit 32e9e034492a25daec4a8d762dc4a9e03f088aae
Author: James Antill <james at and.org>
Date: Tue Apr 26 15:45:21 2011 -0400
Try to do a better explanation of how history undo/redo/rollback work.
diff --git a/docs/yum.8 b/docs/yum.8
index ede03b9..1b5d161 100644
--- a/docs/yum.8
+++ b/docs/yum.8
@@ -341,11 +341,20 @@ no arguments. list can be passed the keyword "all" to list all the transactions.
The packages-list command takes a package (with wildcards, as in
\fBSpecifying package names\fP).
-The undo/redo/rollback commands take either a transaction id or the keyword last
-and an offset from the last transaction (Eg. if you've done 250 transactions,
-"last" refers to transaction 250, and "last-4" refers to transaction 246).
-The undo/redo commands will act on the specified transaction, while the rollback
-command will undo all transactions upto the point of the specified transaction.
+The undo/redo/rollback commands take either a single transaction id or the
+keyword last and an offset from the last transaction (Eg. if you've done 250
+transactions, "last" refers to transaction 250, and "last-4" refers to
+transaction 246).
+
+The undo/redo commands act on the specified transaction, undo'ing or repeating
+the work of that transaction. While the rollback command will undo all
+transactions upto the point of the specified transaction. For example, if you
+have 3 transactions, where package A; B and C where installed respectively.
+Then "undo 1" will try to remove pacakge A, "redo 1" will try to install package
+A (if it is not still installed), and "rollback 1" will try to remove packages
+B and C. Note that after a "rollback 1" you will have a fourth transaction,
+although the ending rpmdb version (see: yum version) should be the same in
+transactions 1 and 4.
The addon-info command takes a transaction ID, and the packages-list command
takes a package (with wildcards).
More information about the Yum-commits
mailing list