[yum-commits] Branch 'yum-3_2_X' - 10 commits - cli.py docs/yum.8 test/testbase.py utils.py yumcommands.py yum/depsolve.py yum/history.py yum/__init__.py yum/packages.py
James Antill
james at osuosl.org
Thu Sep 29 13:56:00 UTC 2011
cli.py | 15 +++++++--
docs/yum.8 | 8 +++-
test/testbase.py | 1
utils.py | 14 ++++++--
yum/__init__.py | 28 ++++++++++++++++
yum/depsolve.py | 13 +++++++
yum/history.py | 14 ++++----
yum/packages.py | 91 +++++++++++++++++++++++++++++++++++++++++--------------
yumcommands.py | 6 +++
9 files changed, 150 insertions(+), 40 deletions(-)
New commits:
commit 177da6c875c5d439cd1ef6c6438429c41019e7ee
Merge: 329820f 05a8627
Author: James Antill <james at and.org>
Date: Thu Sep 29 09:55:56 2011 -0400
Merge branch 'yum-3_2_X' of ssh://yum.baseurl.org/srv/projects/yum/git/yum into yum-3_2_X
* 'yum-3_2_X' of ssh://yum.baseurl.org/srv/projects/yum/git/yum:
Fix comment, log output, and else block of cwd read/exec check.
commit 329820fea5dea0a29d7ddf00265e0d430528e4d0
Author: James Antill <james at and.org>
Date: Wed Sep 28 16:56:01 2011 -0400
Solve some of the obsoletes are conflicts mess. testObsoletesOffPostAvail2+
diff --git a/yum/depsolve.py b/yum/depsolve.py
index 8fe4952..699a23c 100644
--- a/yum/depsolve.py
+++ b/yum/depsolve.py
@@ -816,6 +816,19 @@ class Depsolve(object):
if checkdep:
break # The next conflict might be the same pkg
+ # check Obsoletes
+ # Atm. This is _just_ checking for transaction members which
+ # obsolete each other. Because rpm will now auto. obs. those
+ # anyway. We _don't_ check for installed pkgs. which might obs.
+ # something to be installed, even though rpm will also do that.
+ for txmbr in self.tsInfo.getMembersWithState(None, output_states=TS_INSTALL_STATES):
+ for obs_n in txmbr.po.obsoletes_names:
+ for otxmbr in self.tsInfo.matchNaevr(name=obs_n):
+ if otxmbr.output_state not in TS_INSTALL_STATES:
+ continue
+ if otxmbr.po.obsoletedBy([txmbr.po]):
+ self.tsInfo.remove(otxmbr.pkgtup)
+
if CheckDeps:
if self.dsCallback: self.dsCallback.restartLoop()
self.verbose_logger.log(logginglevels.DEBUG_1, _('Restarting Loop'))
commit fe11b842c4e1eea88a51dfb810ff2c2d4b8ea554
Author: James Antill <james at and.org>
Date: Wed Sep 28 16:07:11 2011 -0400
Make resolvedep a hidden command.
diff --git a/cli.py b/cli.py
index 816a61b..bbe8e55 100755
--- a/cli.py
+++ b/cli.py
@@ -1402,7 +1402,8 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
except yum.Errors.YumBaseError:
ipkg = None
else:
- self.verbose_logger.info(ipkg.envra)
+ self.verbose_logger.info("%s %s" % (ipkg.envra,
+ ipkg.ui_from_repo))
try:
pkg = self.returnPackageByDep(arg)
except yum.Errors.YumBaseError:
@@ -1410,7 +1411,8 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
self.logger.critical(_('No Package Found for %s'), arg)
else:
if not pkg.verEQ(ipkg):
- self.verbose_logger.info(pkg.envra)
+ self.verbose_logger.info("%s %s" % (pkg.envra,
+ pkg.ui_from_repo))
return 0, []
diff --git a/docs/yum.8 b/docs/yum.8
index 255c755..48d2465 100644
--- a/docs/yum.8
+++ b/docs/yum.8
@@ -52,6 +52,7 @@ gnome\-packagekit application\&.
.I \fR * shell [filename]
.br
.I \fR * resolvedep dep1 [dep2] [\&.\&.\&.]
+ (maintained for legacy reasons only - use repoquery or yum provides)
.br
.I \fR * localinstall rpmfile1 [rpmfile2] [\&.\&.\&.]
(maintained for legacy reasons only - use install)
@@ -237,12 +238,13 @@ that file is executed in yum shell mode. See \fIyum-shell(8)\fP for more info
.IP
.IP "\fBresolvedep\fP"
Is used to list packages providing the specified dependencies, at most one
-package is listed per dependency.
+package is listed per dependency. This command is maintained for legacy
+reasons only, use repoquery instead.
.IP
.IP "\fBlocalinstall\fP"
Is used to install a set of local rpm files. If required the enabled
repositories will be used to resolve dependencies. Note that the install command
-will do a local install, if given a filename. This option is maintained for legacy
+will do a local install, if given a filename. This command is maintained for legacy
reasons only.
.IP
.IP "\fBlocalupdate\fP"
@@ -250,7 +252,7 @@ Is used to update the system by specifying local rpm files. Only the specified
rpm files of which an older version is already installed will be installed,
the remaining specified packages will be ignored.
If required the enabled repositories will be used to resolve dependencies. Note
-that the update command will do a local update, if given a filename. This option is maintained for
+that the update command will do a local update, if given a filename. This command is maintained for
legacy reasons only.
.IP
.IP "\fBreinstall\fP"
diff --git a/yumcommands.py b/yumcommands.py
index 2ab9a28..0f0d29c 100644
--- a/yumcommands.py
+++ b/yumcommands.py
@@ -1414,6 +1414,10 @@ class ResolveDepCommand(YumCommand):
resolvedep command.
"""
+ def __init__(self):
+ YumCommand.__init__(self)
+ self.hidden = True
+
def getNames(self):
"""Return a list containing the names of this command. This
command can be called from the command line by using any of these names.
@@ -1434,7 +1438,7 @@ class ResolveDepCommand(YumCommand):
:return: a one line summary of this command
"""
- return _("Determine which package provides the given dependency")
+ return "repoquery --pkgnarrow=all --whatprovides --qf '%{envra} %{ui_from_repo}'"
def doCommand(self, base, basecmd, extcmds):
"""Execute this command.
commit 9c485b857ec0dd54f990398a0aa6840d3467cddc
Author: Nils Philippsen <nils at redhat.com>
Date: Wed Sep 28 17:25:56 2011 +0200
use USER_HZ value reported by OS
POSIX operating systems report the USER_HZ value (i.e. how many jiffies
fit in one second, concerning userspace) via sysconf(_SC_CLK_TCK).
diff --git a/utils.py b/utils.py
index 99533a6..08b09fb 100755
--- a/utils.py
+++ b/utils.py
@@ -15,6 +15,7 @@
"""Various utility functions, and a utility class."""
+import os
import sys
import time
import exceptions
@@ -30,6 +31,12 @@ from optparse import OptionGroup
import yum.plugins as plugins
from urlgrabber.progress import format_number
+try:
+ _USER_HZ = os.sysconf(os.sysconf_names['SC_CLK_TCK'])
+except (AttributeError, KeyError):
+ # Huh, non-Unix platform? Or just really old?
+ _USER_HZ = 100
+
def suppress_keyboard_interrupt_message():
"""Change settings so that nothing will be printed to the
terminal after an uncaught :class:`exceptions.KeyboardInterrupt`.
@@ -45,14 +52,13 @@ def suppress_keyboard_interrupt_message():
sys.excepthook = new_hook
def jiffies_to_seconds(jiffies):
- """Convert a number of jiffies to seconds, using the convention
- that 100 jiffies = 1 second.
+ """Convert a number of jiffies to seconds. How many jiffies are in a second
+ is system-dependent, e.g. 100 jiffies = 1 second is common.
:param jiffies: a number of jiffies
:return: the equivalent number of seconds
"""
- Hertz = 100 # FIXME: Hack, need to get this, AT_CLKTCK elf note *sigh*
- return int(jiffies) / Hertz
+ return int(jiffies) / _USER_HZ
def seconds_to_ui_time(seconds):
"""Return a human-readable string representation of the length of
commit fc2166f85bafbce05dfc50f15a5c3bc92304b415
Author: James Antill <james at and.org>
Date: Wed Sep 28 12:04:58 2011 -0400
Let resolvedep look for installed packages, output is as compat. as possible.
diff --git a/cli.py b/cli.py
index 2f4cabc..816a61b 100755
--- a/cli.py
+++ b/cli.py
@@ -1398,12 +1398,19 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
"""
for arg in args:
try:
+ ipkg = self.returnInstalledPackageByDep(arg)
+ except yum.Errors.YumBaseError:
+ ipkg = None
+ else:
+ self.verbose_logger.info(ipkg.envra)
+ try:
pkg = self.returnPackageByDep(arg)
except yum.Errors.YumBaseError:
- self.logger.critical(_('No Package Found for %s'), arg)
+ if not ipkg:
+ self.logger.critical(_('No Package Found for %s'), arg)
else:
- msg = '%s:%s-%s-%s.%s' % (pkg.epoch, pkg.name, pkg.version, pkg.release, pkg.arch)
- self.verbose_logger.info(msg)
+ if not pkg.verEQ(ipkg):
+ self.verbose_logger.info(pkg.envra)
return 0, []
commit c1d558e5e08b3b56bfaccb64ce43ec742971de4c
Author: James Antill <james at and.org>
Date: Wed Sep 28 12:01:01 2011 -0400
Add returnInstalledPackageByDep() to pair with returnPackageByDep().
diff --git a/yum/__init__.py b/yum/__init__.py
index 5fb7c00..cc968fd 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -3459,6 +3459,34 @@ class YumBase(depsolve.Depsolve):
return self.rpmdb.getProvides(depname, depflags, depver).keys()
+ def returnInstalledPackageByDep(self, depstring):
+ """Return the best, or first, installed package object that provides the
+ given dependencies.
+
+ :param depstring: a string specifying the dependency to return
+ the package that fulfils
+ :return: the best, or first, installed package that fulfils the given
+ dependency
+ :raises: a :class:`yum.Errors.YumBaseError` if no packages that
+ fulfil the given dependency can be found
+ """
+ # we get all sorts of randomness here
+ errstring = depstring
+ if type(depstring) not in types.StringTypes:
+ errstring = str(depstring)
+
+ try:
+ pkglist = self.returnInstalledPackagesByDep(depstring)
+ except Errors.YumBaseError:
+ raise Errors.YumBaseError, _('No Package found for %s') % errstring
+
+ ps = ListPackageSack(pkglist)
+ result = self._bestPackageFromList(ps.returnNewestByNameArch())
+ if result is None:
+ raise Errors.YumBaseError, _('No Package found for %s') % errstring
+
+ return result
+
def _bestPackageFromList(self, pkglist):
"""take list of package objects and return the best package object.
If the list is empty, return None.
commit f9b3d0b592f3b267d4e50af33a88060c7d561b97
Author: James Antill <james at and.org>
Date: Thu Sep 22 15:45:12 2011 -0400
Add all the missing nevra attrs people could ever want, mainly for repoquery
diff --git a/yum/packages.py b/yum/packages.py
index f72c068..15316c8 100644
--- a/yum/packages.py
+++ b/yum/packages.py
@@ -243,42 +243,87 @@ class PackageObject(object):
def _ui_envra(self):
if self.epoch == '0':
- out = '%s-%s-%s.%s' % (self.name,
- self.version,
- self.release,
- self.arch)
+ return self.nvra
else:
- out = '%s:%s-%s-%s.%s' % (self.epoch,
- self.name,
- self.version,
- self.release,
- self.arch)
- return out
+ return self.envra
ui_envra = property(fget=lambda self: self._ui_envra())
def _ui_nevra(self):
if self.epoch == '0':
- out = '%s-%s-%s.%s' % (self.name,
- self.version,
- self.release,
- self.arch)
+ return self.nvra
else:
- out = '%s-%s:%s-%s.%s' % (self.name,
- self.epoch,
- self.version,
- self.release,
- self.arch)
- return out
+ return self.nevra
ui_nevra = property(fget=lambda self: self._ui_nevra())
def _ui_evr(self):
if self.epoch == '0':
- out = '%s-%s' % (self.version, self.release)
+ return self.vr
else:
- out = '%s:%s-%s' % (self.epoch, self.version, self.release)
- return out
+ return self.evr
ui_evr = property(fget=lambda self: self._ui_evr())
+ def _ui_evra(self):
+ if self.epoch == '0':
+ return self.vra
+ else:
+ return self.evra
+ ui_evra = property(fget=lambda self: self._ui_evra())
+
+ def _ui_nevr(self):
+ if self.epoch == '0':
+ return self.nvr
+ else:
+ return self.nevr
+ ui_nevr = property(fget=lambda self: self._ui_nevr())
+
+ def _na(self):
+ return '%s.%s' % (self.name, self.arch)
+ na = property(fget=lambda self: self._na())
+
+ def _vr(self):
+ return '%s-%s' % (self.version, self.release)
+ vr = property(fget=lambda self: self._vr())
+
+ def _vra(self):
+ return '%s-%s.%s' % (self.version, self.release, self.arch)
+ vra = property(fget=lambda self: self._vra())
+
+ def _evr(self):
+ return '%s:%s-%s' % (self.epoch, self.version, self.release)
+ evr = property(fget=lambda self: self._evr())
+
+ def _evra(self):
+ return '%s:%s-%s.%s' % (self.epoch,self.version,self.release, self.arch)
+ evra = property(fget=lambda self: self._evra())
+
+ def _nvr(self):
+ return '%s-%s-%s' % (self.name, self.version, self.release)
+ nvr = property(fget=lambda self: self._nvr())
+
+ def _nvra(self):
+ return '%s-%s-%s.%s' % (self.name, self.version,self.release, self.arch)
+ nvra = property(fget=lambda self: self._nvra())
+
+ def _nevr(self):
+ return '%s-%s:%s-%s' % (self.name, self.epoch,self.version,self.release)
+ nevr = property(fget=lambda self: self._nevr())
+
+ def _nevra(self):
+ return '%s-%s:%s-%s.%s' % (self.name,
+ self.epoch, self.version, self.release,
+ self.arch)
+ nevra = property(fget=lambda self: self._nevra())
+
+ def _envr(self):
+ return '%s:%s-%s-%s' % (self.epoch,self.name, self.version,self.release)
+ envr = property(fget=lambda self: self._envr())
+
+ def _envra(self):
+ return '%s:%s-%s-%s.%s' % (self.epoch, self.name,
+ self.version, self.release,
+ self.arch)
+ envra = property(fget=lambda self: self._envra())
+
def __str__(self):
return self.ui_envra
commit bd68865d70245943a3f208a018975be38f6e1d3d
Author: James Antill <james at and.org>
Date: Wed Sep 21 17:12:29 2011 -0400
Fix most of the tests due to missing FakeConf value.
diff --git a/test/testbase.py b/test/testbase.py
index d0f22be..c185a7f 100644
--- a/test/testbase.py
+++ b/test/testbase.py
@@ -55,6 +55,7 @@ class FakeConf(object):
self.protected_packages = []
self.protected_multilib = False
self.clean_requirements_on_remove = True
+ self.upgrade_requirements_on_install = False
class FakeSack:
""" Fake PackageSack to use with FakeRepository"""
commit 6bee89b0dd4acbeef217b39282dbfbcfad258e36
Author: James Antill <james at and.org>
Date: Tue Sep 20 11:58:24 2011 -0400
Use SQL rollback, on syncdb failure, even though it'll never happen anyway.
diff --git a/yum/history.py b/yum/history.py
index bbd9bf2..8e62f50 100644
--- a/yum/history.py
+++ b/yum/history.py
@@ -738,6 +738,8 @@ class YumHistory:
return self._conn.cursor()
def _commit(self):
return self._conn.commit()
+ def _rollback(self):
+ return self._conn.rollback()
def close(self):
if self._conn is not None:
@@ -1345,10 +1347,12 @@ class YumHistory:
""" Sync. all the data for rpmdb/yumdb for this installed pkg. """
if not self._wipe_anydb(ipkg, "rpm"):
return False
- self._wipe_anydb(ipkg, "yum")
- if not self._save_rpmdb(ipkg):
+ if not (self._wipe_anydb(ipkg, "yum") and
+ self._save_rpmdb(ipkg) and
+ self._save_yumdb(ipkg)):
+ self._rollback()
return False
- self._save_yumdb(ipkg)
+
self._commit()
return True
commit 1e47267d7ad6aa75e2532800d33a399b3446eb8d
Author: James Antill <james at and.org>
Date: Tue Sep 20 11:51:46 2011 -0400
Use the correct test to see if the INSERT worked, needed for RHEL-5 sqlite.
diff --git a/yum/history.py b/yum/history.py
index a9b12cf..bbd9bf2 100644
--- a/yum/history.py
+++ b/yum/history.py
@@ -1296,10 +1296,8 @@ class YumHistory:
sql = """INSERT INTO pkg_%(db)sdb (pkgtupid, %(db)sdb_key, %(db)sdb_val)
VALUES (?, ?, ?)""" % {'db' : db}
executeSQL(cur, sql, (pid, attr, to_unicode(val)))
- for row in cur:
- return row[0]
- return None
+ return cur.lastrowid
def _save_rpmdb_key(self, pkg, attr, val):
return self._save_anydb_key(pkg, "rpm", attr, val)
More information about the Yum-commits
mailing list