[yum] latest head

Seth Vidal skvidal at fedoraproject.org
Wed Oct 20 16:32:28 UTC 2010


commit 136c197794d23f2690c5b61f167c14626301f366
Author: Seth Vidal <skvidal at fedoraproject.org>
Date:   Wed Oct 20 12:32:25 2010 -0400

    latest head

 yum-HEAD.patch |  487 +++++++++++++++++++++++++++++++++++++++++++++++++-------
 yum.spec       |   10 +-
 2 files changed, 440 insertions(+), 57 deletions(-)
---
diff --git a/yum-HEAD.patch b/yum-HEAD.patch
index c9eef36..dad3273 100644
--- a/yum-HEAD.patch
+++ b/yum-HEAD.patch
@@ -407,7 +407,7 @@ index 49d98c6..b48bdf6 100644
  \fBcost \fR
  relative cost of accessing this repository. Useful for weighing one repo's packages
 diff --git a/etc/yum.bash b/etc/yum.bash
-index 3e6e243..25d3cc6 100644
+index 3e6e243..303f190 100644
 --- a/etc/yum.bash
 +++ b/etc/yum.bash
 @@ -79,18 +79,20 @@ _yum()
@@ -423,6 +423,7 @@ index 3e6e243..25d3cc6 100644
 -    for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )) ; do
 -        for c in ${cmds[@]} check-rpmdb erase groupupdate grouperase \
 -            whatprovides distribution-synchronization ; do
+-            [ ${COMP_WORDS[i]} = $c ] && cmd=$c && break
 +    # Commands offered as completions
 +    local cmds=( check check-update clean deplist distro-sync downgrade
 +        groupinfo groupinstall grouplist groupremove help history info install
@@ -435,7 +436,7 @@ index 3e6e243..25d3cc6 100644
 +        # Recognize additional commands and aliases
 +        for c in ${cmds[@]} check-rpmdb distribution-synchronization erase \
 +            groupupdate grouperase localinstall localupdate whatprovides ; do
-             [ ${COMP_WORDS[i]} = $c ] && cmd=$c && break
++            [[ ${COMP_WORDS[i]} == $c ]] && cmd=$c && break
          done
 -        [ -z $cmd ] || break
      done
@@ -519,7 +520,7 @@ index 3e6e243..25d3cc6 100644
              ;;
          version)
 diff --git a/output.py b/output.py
-index 3a90995..cfca45f 100755
+index 3a90995..a32a3a9 100755
 --- a/output.py
 +++ b/output.py
 @@ -43,6 +43,8 @@ from yum.rpmtrans import RPMBaseCallback
@@ -819,7 +820,7 @@ index 3a90995..cfca45f 100755
  
          if tid is not None:
              old = self.history.old(tids=[tid])
-@@ -1794,6 +1896,85 @@ to exit.
+@@ -1794,6 +1896,90 @@ to exit.
  
              print ''
  
@@ -827,9 +828,9 @@ index 3a90995..cfca45f 100755
 +        """ Shows the user a list of data about the history, from the point
 +            of a package(s) instead of via. transactions. """
 +        tids = self.history.search(extcmds)
++        limit = None
 +        if not tids:
-+            self.logger.critical(_('Bad package(s), given (nothing found)'))
-+            return 1, ['Failed history package-list']
++            limit = 20
 +
 +        all_uistates = self._history_state2uistate
 +
@@ -840,7 +841,10 @@ index 3a90995..cfca45f 100755
 +                     utf8_width_fill(_("Package"), 53, 53))
 +        print "-" * 79
 +        fmt = "%6u | %s | %-50s"
-+        for old in self.history.old(tids):
++        num = 0
++        for old in self.history.old(tids, limit=limit):
++            if limit is not None and num and (num +len(old.trans_data)) > limit:
++                break
 +            last = None
 +
 +            # Copy and paste from list ... uh.
@@ -862,9 +866,10 @@ index 3a90995..cfca45f 100755
 +                lmark = '>'
 +
 +            for hpkg in old.trans_data: # Find a pkg to go with each cmd...
-+                x,m,u = yum.packages.parsePackages([hpkg], extcmds)
-+                if not x and not m:
-+                    continue
++                if limit is None:
++                    x,m,u = yum.packages.parsePackages([hpkg], extcmds)
++                    if not x and not m:
++                        continue
 +
 +                uistate = all_uistates.get(hpkg.state, hpkg.state)
 +                uistate = utf8_width_fill(uistate, 14)
@@ -890,6 +895,7 @@ index 3a90995..cfca45f 100755
 +                    if hpkg.state in ('Updated', 'Downgrade'):
 +                        last = hpkg
 +
++                num += 1
 +                print fmt % (old.tid, uistate, cn), "%s%s" % (lmark,rmark)
 +
 +        # And, again, copy and paste...
@@ -905,7 +911,29 @@ index 3a90995..cfca45f 100755
  
  
  class DepSolveProgressCallBack:
-@@ -1882,10 +2063,12 @@ class DepSolveProgressCallBack:
+@@ -1807,15 +1993,17 @@ class DepSolveProgressCallBack:
+ 
+     def pkgAdded(self, pkgtup, mode):
+         modedict = { 'i': _('installed'),
+-                     'u': _('updated'),
+-                     'o': _('obsoleted'),
++                     'u': _('an update'),
+                      'e': _('erased'),
+                      'r': _('reinstalled'),
+-                     'd': _('downgraded')}
++                     'd': _('a downgrade'),
++                     'o': _('obsoleting'),
++                     'ud': _('updated'),
++                     'od': _('obsoleted'),}
+         (n, a, e, v, r) = pkgtup
+         modeterm = modedict[mode]
+         self.verbose_logger.log(logginglevels.INFO_2,
+-            _('---> Package %s.%s %s:%s-%s set to be %s'), n, a, e, v, r,
++            _('---> Package %s.%s %s:%s-%s will be %s'), n, a, e, v, r,
+             modeterm)
+         
+     def start(self):
+@@ -1882,10 +2070,12 @@ class DepSolveProgressCallBack:
                  msg += _('\n        Not found')
              return msg
  
@@ -921,7 +949,7 @@ index 3a90995..cfca45f 100755
              action = _('Installed')
              rmed = yb.tsInfo.getMembersWithState(pkg.pkgtup, TS_REMOVE_STATES)
              if rmed:
-@@ -1901,21 +2084,40 @@ class DepSolveProgressCallBack:
+@@ -1901,21 +2091,40 @@ class DepSolveProgressCallBack:
                      if rtype not in relmap:
                          continue
                      nevr = (rpkg.name, rpkg.epoch, rpkg.version, rpkg.release)
@@ -968,6 +996,15 @@ index 3a90995..cfca45f 100755
          return msg
      
      def procConflict(self, name, confname):
+@@ -1970,7 +2179,7 @@ def _pkgname_ui(ayum, pkgname, ts_states=None):
+     if ts_states is None:
+         #  Note 'd' is a placeholder for downgrade, and
+         # 'r' is a placeholder for reinstall. Neither exist atm.
+-        ts_states = ('d', 'e', 'i', 'r', 'u')
++        ts_states = ('d', 'e', 'i', 'r', 'u', 'od', 'ud')
+ 
+     matches = []
+     def _cond_add(po):
 diff --git a/po/es.po b/po/es.po
 index 4ac1f0a..0d6fc4d 100644
 --- a/po/es.po
@@ -33848,6 +33885,34 @@ index dac8abd..1e3302b 100644
          self.po.prco['provides'].append(("seth", "EQ", (1, 2, 3)))
          self.po.prco['requires'].append(("foo", "GE", (4, 5, None)))
  
+diff --git a/test/simpleobsoletestests.py b/test/simpleobsoletestests.py
+index dfaa7e5..97a9923 100644
+--- a/test/simpleobsoletestests.py
++++ b/test/simpleobsoletestests.py
+@@ -560,10 +560,7 @@ class SimpleObsoletesTests(OperationsTests):
+         res, msg = self.runOperation(['install', 'dapl-2.0.15'], rps, aps)
+ 
+         self.assert_(res=='ok', msg)
+-        # This will almost certainly fail, but it's pretty weird:
+-        self.assertResult((all['arp3'], all['aoop1'], all['aoop2']))
+-        # FIXME: Optimally we'd get:
+-        # self.assertResult((all['arp3'], all['arp4']))
++        self.assertResult((all['arp3'], all['arp4']))
+     def testRLDaplMessWeirdUp1(self):
+         rps, aps, ret, all = self._helperRLDaplMess()
+         res, msg = self.runOperation(['update', 'dapl-1.2.1.1-7'], rps, aps)
+@@ -582,10 +579,7 @@ class SimpleObsoletesTests(OperationsTests):
+         res, msg = self.runOperation(['update', 'dapl-2.0.15'], rps, aps)
+ 
+         self.assert_(res=='ok', msg)
+-        # This will almost certainly fail, but it's pretty weird:
+-        self.assertResult((all['arp3'], all['aoop1'], all['aoop2']))
+-        # FIXME: Optimally we'd get:
+-        # self.assertResult((all['arp3'], all['arp4']))
++        self.assertResult((all['arp3'], all['arp4']))
+ 
+     def testRLDaplFixUpdateNotInstall(self):
+         rps, aps, ret, all = self._helperRLDaplMess()
 diff --git a/test/simpleremovetests.py b/test/simpleremovetests.py
 index e20e43c..be820bc 100644
 --- a/test/simpleremovetests.py
@@ -33990,10 +34055,23 @@ index df641f7..6bc2efe 100644
 +        self.assert_(res=='ok', msg)
 +        self.assertResult((pa1, pa2))
 diff --git a/test/testbase.py b/test/testbase.py
-index f91fbf1..803ce9c 100644
+index f91fbf1..30cf177 100644
 --- a/test/testbase.py
 +++ b/test/testbase.py
-@@ -399,7 +399,7 @@ class OperationsTests(_DepsolveTestsBase):
+@@ -128,8 +128,10 @@ class DepSolveProgressCallBack:
+     def pkgAdded(self, pkgtup, mode):
+         modedict = { 'i': _('installed'),
+                      'u': _('updated'),
+-                     'o': _('obsoleted'),
+-                     'e': _('erased')}
++                     'od': _('obsoleted'),
++                     'o': _('obsoleting'),
++                     'e': _('erased'),
++                     'ud':_('update'),}
+         (n, a, e, v, r) = pkgtup
+         modeterm = modedict[mode]
+         self.verbose_logger.log(logginglevels.INFO_2,
+@@ -399,7 +401,7 @@ class OperationsTests(_DepsolveTestsBase):
      """
  
      def runOperation(self, args, installed=[], available=[],
@@ -34002,7 +34080,7 @@ index f91fbf1..803ce9c 100644
          """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
-@@ -428,9 +428,18 @@ class OperationsTests(_DepsolveTestsBase):
+@@ -428,9 +430,18 @@ class OperationsTests(_DepsolveTestsBase):
              po.repoid = po.repo.id
              self.depsolver._pkgSack.addPackage(po)
  
@@ -34079,10 +34157,38 @@ index c3c7133..fc05aa6 100644
  Requires: python-iniparse
  Requires: pygpgme
 diff --git a/yum/__init__.py b/yum/__init__.py
-index 2ea9f20..4596e71 100644
+index 2ea9f20..14eabc9 100644
 --- a/yum/__init__.py
 +++ b/yum/__init__.py
-@@ -294,6 +294,11 @@ class YumBase(depsolve.Depsolve):
+@@ -21,6 +21,19 @@ The Yum RPM software updater.
+ import os
+ import os.path
+ import rpm
++
++def _rpm_ver_atleast(vertup):
++    """ Check if rpm is at least the current vertup. Can return False/True/None
++        as rpm hasn't had version info for a long time. """
++    if not hasattr(rpm, '__version_info__'):
++        return None
++    try:
++        # 4.8.x rpm used strings for the tuple members, so convert.
++        vi = tuple([ int(num) for num in rpm.__version_info__])
++        return vi >= vertup
++    except:
++        return None # Something went wrong...
++
+ import re
+ import types
+ import errno
+@@ -86,6 +99,7 @@ __version_info__ = tuple([ int(num) for num in __version__.split('.')])
+ # multiple YumBase() objects.
+ default_grabber.opts.user_agent += " yum/" + __version__
+ 
++
+ class _YumPreBaseConf:
+     """This is the configuration interface for the YumBase configuration.
+        So if you want to change if plugins are on/off, or debuglevel/etc.
+@@ -294,6 +308,11 @@ class YumBase(depsolve.Depsolve):
              startupconf.syslog_facility = syslog_facility
          if syslog_device != None:
              startupconf.syslog_device = syslog_device
@@ -34094,7 +34200,7 @@ index 2ea9f20..4596e71 100644
          if releasever != None:
              startupconf.releasever = releasever
  
-@@ -442,7 +447,11 @@ class YumBase(depsolve.Depsolve):
+@@ -442,7 +461,11 @@ class YumBase(depsolve.Depsolve):
          @return: YumRepository instance.
          '''
          repo = yumRepo.YumRepository(section)
@@ -34107,7 +34213,7 @@ index 2ea9f20..4596e71 100644
  
          # Ensure that the repo name is set
          if not repo.name:
-@@ -752,7 +761,7 @@ class YumBase(depsolve.Depsolve):
+@@ -752,7 +775,7 @@ class YumBase(depsolve.Depsolve):
              groupfile = repo.getGroups()
              # open it up as a file object so iterparse can cope with our compressed file
              if groupfile:
@@ -34116,7 +34222,7 @@ index 2ea9f20..4596e71 100644
                  
              try:
                  self._comps.add(groupfile)
-@@ -790,7 +799,8 @@ class YumBase(depsolve.Depsolve):
+@@ -790,7 +813,8 @@ class YumBase(depsolve.Depsolve):
                  # fetch the sqlite tagdb
                  try:
                      tag_md = repo.retrieveMD('pkgtags')
@@ -34126,7 +34232,7 @@ index 2ea9f20..4596e71 100644
                      # feed it into _tags.add()
                      self._tags.add(repo.id, tag_sqlite)
                  except (Errors.RepoError, Errors.PkgTagsError), e:
-@@ -976,8 +986,6 @@ class YumBase(depsolve.Depsolve):
+@@ -976,8 +1000,6 @@ class YumBase(depsolve.Depsolve):
                  restring.append(_('Trying to remove "%s", which is protected') %
                                  pkgname)
  
@@ -34135,7 +34241,7 @@ index 2ea9f20..4596e71 100644
          self.verbose_logger.debug('Depsolve time: %0.3f' % (time.time() - ds_st))
          return rescode, restring
  
-@@ -1311,7 +1319,10 @@ class YumBase(depsolve.Depsolve):
+@@ -1311,7 +1333,10 @@ class YumBase(depsolve.Depsolve):
                  self.run_with_package_names.add('yum-metadata-parser')
                  break
  
@@ -34147,7 +34253,7 @@ index 2ea9f20..4596e71 100644
              using_pkgs_pats = list(self.run_with_package_names)
              using_pkgs = self.rpmdb.returnPackages(patterns=using_pkgs_pats)
              rpmdbv  = self.rpmdb.simpleVersion(main_only=True)[0]
-@@ -1330,10 +1341,14 @@ class YumBase(depsolve.Depsolve):
+@@ -1330,10 +1355,14 @@ class YumBase(depsolve.Depsolve):
                  cmdline = ' '.join(self.args)
              elif hasattr(self, 'cmds') and self.cmds:
                  cmdline = ' '.join(self.cmds)
@@ -34162,7 +34268,7 @@ index 2ea9f20..4596e71 100644
              
              self.plugins.run('historybegin')
          #  Just before we update the transaction, update what we think the
-@@ -1341,7 +1356,7 @@ class YumBase(depsolve.Depsolve):
+@@ -1341,7 +1370,7 @@ class YumBase(depsolve.Depsolve):
          # "something" happens and the rpmdb is different from what we think it
          # will be we store what we thought, not what happened (so it'll be an
          # invalid cache).
@@ -34171,7 +34277,7 @@ index 2ea9f20..4596e71 100644
  
          errors = self.ts.run(cb.callback, '')
          # ts.run() exit codes are, hmm, "creative": None means all ok, empty 
-@@ -1382,7 +1397,8 @@ class YumBase(depsolve.Depsolve):
+@@ -1382,7 +1411,8 @@ class YumBase(depsolve.Depsolve):
                  except (IOError, OSError), e:
                      self.logger.critical(_('Failed to remove transaction file %s') % fn)
  
@@ -34181,7 +34287,7 @@ index 2ea9f20..4596e71 100644
          self.plugins.run('posttrans')
          # sync up what just happened versus what is in the rpmdb
          if not self.ts.isTsFlagSet(rpm.RPMTRANS_FLAG_TEST):
-@@ -1403,8 +1419,8 @@ class YumBase(depsolve.Depsolve):
+@@ -1403,8 +1433,8 @@ class YumBase(depsolve.Depsolve):
          #    that there is not also an install of this pkg in the tsInfo (reinstall)
          # for any kind of install add from_repo to the yumdb, and the cmdline
          # and the install reason
@@ -34192,7 +34298,7 @@ index 2ea9f20..4596e71 100644
          self.plugins.run('preverifytrans')
          for txmbr in self.tsInfo:
              if txmbr.output_state in TS_INSTALL_STATES:
-@@ -1482,13 +1498,15 @@ class YumBase(depsolve.Depsolve):
+@@ -1482,13 +1512,15 @@ class YumBase(depsolve.Depsolve):
                  self.verbose_logger.log(logginglevels.DEBUG_2, 'What is this? %s' % txmbr.po)
  
          self.plugins.run('postverifytrans')
@@ -34209,7 +34315,7 @@ index 2ea9f20..4596e71 100644
  
      def costExcludePackages(self):
          """ Create an excluder for repos. with higher cost. Eg.
-@@ -1836,6 +1854,10 @@ class YumBase(depsolve.Depsolve):
+@@ -1836,6 +1868,10 @@ class YumBase(depsolve.Depsolve):
  
          self.plugins.run('postdownload', pkglist=pkglist, errors=errors)
  
@@ -34220,7 +34326,7 @@ index 2ea9f20..4596e71 100644
          return errors
  
      def verifyHeader(self, fo, po, raiseError):
-@@ -1919,7 +1941,7 @@ class YumBase(depsolve.Depsolve):
+@@ -1919,7 +1955,7 @@ class YumBase(depsolve.Depsolve):
              - 2 - Fatal GPG verification error, give up.
          '''
          if hasattr(po, 'pkgtype') and po.pkgtype == 'local':
@@ -34229,7 +34335,7 @@ index 2ea9f20..4596e71 100644
              hasgpgkey = 0
          else:
              repo = self.repos.getRepo(po.repoid)
-@@ -3100,6 +3122,9 @@ class YumBase(depsolve.Depsolve):
+@@ -3100,6 +3136,9 @@ class YumBase(depsolve.Depsolve):
  
      def _find_obsoletees(self, po):
          """ Return the pkgs. that are obsoleted by the po we pass in. """
@@ -34239,7 +34345,7 @@ index 2ea9f20..4596e71 100644
          if not isinstance(po, YumLocalPackage):
              for (obstup, inst_tup) in self.up.getObsoletersTuples(name=po.name):
                  if po.pkgtup == obstup:
-@@ -3160,7 +3185,7 @@ class YumBase(depsolve.Depsolve):
+@@ -3160,7 +3199,7 @@ class YumBase(depsolve.Depsolve):
                      try:
                          mypkgs = self.returnPackagesByDep(arg)
                      except yum.Errors.YumBaseError, e:
@@ -34248,7 +34354,7 @@ index 2ea9f20..4596e71 100644
                      else:
                          # install MTA* == fail, because provides don't do globs
                          # install /usr/kerberos/bin/* == success (and we want
-@@ -3490,7 +3515,7 @@ class YumBase(depsolve.Depsolve):
+@@ -3490,7 +3529,7 @@ class YumBase(depsolve.Depsolve):
              availpkgs.extend(m)
  
              if not availpkgs and not instpkgs:
@@ -34257,7 +34363,7 @@ index 2ea9f20..4596e71 100644
          
          else: # we have kwargs, sort them out.
              nevra_dict = self._nevra_kwarg_parse(kwargs)
-@@ -3576,6 +3601,9 @@ class YumBase(depsolve.Depsolve):
+@@ -3576,6 +3615,9 @@ class YumBase(depsolve.Depsolve):
                          self.tsInfo.addObsoleted(obsoletee, po)
                          tx_return.append(txmbr)
                  else:
@@ -34267,7 +34373,7 @@ index 2ea9f20..4596e71 100644
                      txmbr = self._add_up_txmbr(requiringPo, po, installed_pkg)
                      tx_return.append(txmbr)
                          
-@@ -3599,6 +3627,9 @@ class YumBase(depsolve.Depsolve):
+@@ -3599,6 +3641,9 @@ class YumBase(depsolve.Depsolve):
                  
                  else:
                      updated_pkg =  self.getInstalledPackageObject(updated)
@@ -34277,7 +34383,7 @@ index 2ea9f20..4596e71 100644
                      txmbr = self._add_up_txmbr(requiringPo,
                                                 available_pkg, updated_pkg)
                      tx_return.append(txmbr)
-@@ -3669,7 +3700,8 @@ class YumBase(depsolve.Depsolve):
+@@ -3669,7 +3714,8 @@ class YumBase(depsolve.Depsolve):
                          self.logger.critical(_('%s') % e)
                      
                      if not depmatches:
@@ -34287,7 +34393,7 @@ index 2ea9f20..4596e71 100644
                      else:
                          pkgs.extend(depmatches)
                  
-@@ -3690,6 +3722,14 @@ class YumBase(depsolve.Depsolve):
+@@ -3690,6 +3736,14 @@ class YumBase(depsolve.Depsolve):
              if self.conf.protected_packages and po.pkgtup == kern_pkgtup:
                  self.logger.warning(_("Skipping the running kernel: %s") % po)
                  continue
@@ -34302,7 +34408,7 @@ index 2ea9f20..4596e71 100644
              txmbr = self.tsInfo.addErase(po)
              tx_return.append(txmbr)
          
-@@ -3952,7 +3992,7 @@ class YumBase(depsolve.Depsolve):
+@@ -3952,7 +4006,7 @@ class YumBase(depsolve.Depsolve):
              EOL """
  
          if not po and not kwargs:
@@ -34311,7 +34417,7 @@ index 2ea9f20..4596e71 100644
  
          doing_group_pkgs = False
          if po:
-@@ -3975,7 +4015,7 @@ class YumBase(depsolve.Depsolve):
+@@ -3975,7 +4029,7 @@ class YumBase(depsolve.Depsolve):
                      try:
                          apkgs = self.returnPackagesByDep(arg)
                      except yum.Errors.YumBaseError, e:
@@ -34320,7 +34426,37 @@ index 2ea9f20..4596e71 100644
  
          else:
              nevra_dict = self._nevra_kwarg_parse(kwargs)
-@@ -4276,12 +4316,11 @@ class YumBase(depsolve.Depsolve):
+@@ -4196,23 +4250,20 @@ class YumBase(depsolve.Depsolve):
+         key_installed = False
+ 
+         self.logger.info(_('Retrieving GPG key from %s') % keyurl)
+-
++       
+         # Go get the GPG key from the given URL
+         try:
+             url = misc.to_utf8(keyurl)
+             if repo is None:
+-                rawkey = urlgrabber.urlread(url, limit=9999)
++                opts = {limit:9999}
++                text = 'global/gpgkey'
+             else:
+                 #  If we have a repo. use the proxy etc. configuration for it.
+                 # In theory we have a global proxy config. too, but meh...
+                 # external callers should just update.
+-                ug = URLGrabber(bandwidth = repo.bandwidth,
+-                                retry = repo.retries,
+-                                throttle = repo.throttle,
+-                                progress_obj = repo.callback,
+-                                proxies=repo.proxy_dict)
+-                ug.opts.user_agent = default_grabber.opts.user_agent
+-                rawkey = ug.urlread(url, text=repo.id + "/gpgkey")
++                opts = repo._default_grabopts()
++                text = repo.id + '/gpgkey'
++            rawkey = urlgrabber.urlread(url, **opts)
+ 
+         except urlgrabber.grabber.URLGrabError, e:
+             raise Errors.YumBaseError(_('GPG key retrieval failed: ') +
+@@ -4276,12 +4327,11 @@ class YumBase(depsolve.Depsolve):
          keyurls = repo.gpgkey
          key_installed = False
  
@@ -34334,7 +34470,7 @@ index 2ea9f20..4596e71 100644
                  # Check if key is already installed
                  if misc.keyInstalled(ts, info['keyid'], info['timestamp']) >= 0:
                      self.logger.info(_('GPG key at %s (0x%s) is already installed') % (
-@@ -4306,6 +4345,7 @@ class YumBase(depsolve.Depsolve):
+@@ -4306,6 +4356,7 @@ class YumBase(depsolve.Depsolve):
                      raise Errors.YumBaseError, _("Not installing key")
                  
                  # Import the key
@@ -34391,10 +34527,94 @@ index 06d5a6b..5c728d4 100644
  # it under the terms of the GNU General Public License as published by
  # the Free Software Foundation; either version 2 of the License, or
 diff --git a/yum/depsolve.py b/yum/depsolve.py
-index e9b3fa7..886cca8 100644
+index e9b3fa7..cba0fc5 100644
 --- a/yum/depsolve.py
 +++ b/yum/depsolve.py
-@@ -1195,6 +1195,10 @@ class Depsolve(object):
+@@ -38,7 +38,7 @@ import Errors
+ import warnings
+ warnings.simplefilter("ignore", Errors.YumFutureDeprecationWarning)
+ 
+-from yum import _
++from yum import _, _rpm_ver_atleast
+ 
+ try:
+     assert max(2, 4) == 4
+@@ -376,6 +376,34 @@ class Depsolve(object):
+         self.verbose_logger.log(logginglevels.DEBUG_2, _('Mode for pkg providing %s: %s'), 
+             niceformatneed, needmode)
+ 
++        if needmode in ['ud']: # the thing it needs is being updated or obsoleted away 
++            # try to update the requiring package in hopes that all this problem goes away :(
++            self.verbose_logger.log(logginglevels.DEBUG_2, _('Trying to update %s to resolve dep'), requiringPo)
++            # if the required pkg was updated, not obsoleted, then try to
++            # only update the requiring po
++            origobs = self.conf.obsoletes
++            self.conf.obsoletes = 0
++            txmbrs = self.update(po=requiringPo, requiringPo=requiringPo)
++            self.conf.obsoletes = origobs
++            if not txmbrs:
++                txmbrs = self.update(po=requiringPo, requiringPo=requiringPo)
++                if not txmbrs:
++                    msg = self._err_missing_requires(requiringPo, requirement)
++                    self.verbose_logger.log(logginglevels.DEBUG_2, _('No update paths found for %s. Failure!'), requiringPo)
++                    return self._requiringFromTransaction(requiringPo, requirement, errorlist)
++            checkdeps = 1
++
++        if needmode in ['od']: # the thing it needs is being updated or obsoleted away 
++            # try to update the requiring package in hopes that all this problem goes away :(
++            self.verbose_logger.log(logginglevels.DEBUG_2, _('Trying to update %s to resolve dep'), requiringPo)
++            txmbrs = self.update(po=requiringPo, requiringPo=requiringPo)
++            if not txmbrs:
++                msg = self._err_missing_requires(requiringPo, requirement)
++                self.verbose_logger.log(logginglevels.DEBUG_2, _('No update paths found for %s. Failure!'), requiringPo)
++                return self._requiringFromTransaction(requiringPo, requirement, errorlist)
++            checkdeps = 1
++
++            
+         if needmode in ['e']:
+             self.verbose_logger.log(logginglevels.DEBUG_2, _('TSINFO: %s package requiring %s marked as erase'),
+                 requiringPo, needname)
+@@ -384,11 +412,10 @@ class Depsolve(object):
+             checkdeps = 1
+         
+         if needmode in ['i', 'u']:
+-            length = len(self.tsInfo)
+-            self.update(name=name, epoch=epoch, version=ver, release=rel,
+-                        requiringPo=requiringPo)
++            newupdates = self.update(name=name, epoch=epoch, version=ver, release=rel,
++                                     requiringPo=requiringPo)
+             txmbrs = self.tsInfo.getMembersWithState(requiringPo.pkgtup, TS_REMOVE_STATES)
+-            if len(self.tsInfo) != length and txmbrs:
++            if newupdates and txmbrs:
+                 if txmbrs[0].output_state == TS_OBSOLETED:
+                     self.verbose_logger.log(logginglevels.DEBUG_2, _('TSINFO: Obsoleting %s with %s to resolve dep.'),
+                                             requiringPo, txmbrs[0].obsoleted_by[0])
+@@ -795,8 +822,11 @@ class Depsolve(object):
+                     dscb_ts_state = 'd'
+                 if dscb_ts_state == 'u' and txmbr.reinstall:
+                     dscb_ts_state = 'r'
+-                if dscb_ts_state == 'u' and not txmbr.updates:
+-                    dscb_ts_state = 'i'
++                if dscb_ts_state == 'u':
++                    if txmbr.output_state == TS_OBSOLETING:
++                        dscb_ts_state = 'o'
++                    elif not txmbr.updates:
++                        dscb_ts_state = 'i'
+                 self.dsCallback.pkgAdded(txmbr.pkgtup, dscb_ts_state)
+             self.verbose_logger.log(logginglevels.DEBUG_2,
+                                     _("Checking deps for %s") %(txmbr,))
+@@ -1092,6 +1122,10 @@ class Depsolve(object):
+                         continue
+                     ret.append( (po, self._prco_req_nfv2req(r, f, v),
+                                  conflicting_po) )
++
++        if _rpm_ver_atleast((4, 9, 0)):
++            return ret # Don't need the conflicts cache anymore
++
+         self.rpmdb.transactionCacheConflictPackages(cpkgs)
+         return ret
+ 
+@@ -1195,6 +1229,10 @@ class Depsolve(object):
                      #  We get here from bestPackagesFromList(), give a giant
                      # bump to stuff that is already installed.
                      pkgresults[pkg] += 1000
@@ -34406,7 +34626,7 @@ index e9b3fa7..886cca8 100644
                  # just b/c they're not installed pkgs doesn't mean they should
                  # be ignored entirely. Just not preferred
 diff --git a/yum/history.py b/yum/history.py
-index 502b908..a8004af 100644
+index 502b908..26d6ee2 100644
 --- a/yum/history.py
 +++ b/yum/history.py
 @@ -27,8 +27,9 @@ import yum.misc as misc
@@ -34819,7 +35039,36 @@ index 502b908..a8004af 100644
              obj.state_installed = None
              if _sttxt2stcode[obj.state] in TS_INSTALL_STATES:
                  obj.state_installed = True
-@@ -914,17 +1247,19 @@ class YumHistory:
+@@ -843,12 +1176,25 @@ class YumHistory:
+             return set()
+ 
+         data = _setupHistorySearchSQL(patterns, ignore_case)
+-        (need_full, patterns, fields, names) = data
++        (need_full, npatterns, fields, names) = data
+ 
+         ret = []
+         pkgtupids = set()
+-        for row in self._yieldSQLDataList(patterns, fields, ignore_case):
+-            pkgtupids.add(row[0])
++
++        if npatterns:
++            for row in self._yieldSQLDataList(npatterns, fields, ignore_case):
++                pkgtupids.add(row[0])
++        else:
++            # Too many patterns, *sigh*
++            pat_max = PATTERNS_MAX
++            if not need_full:
++                pat_max = PATTERNS_INDEXED_MAX
++            for npatterns in yum.misc.seq_max_split(patterns, pat_max):
++                data = _setupHistorySearchSQL(npatterns, ignore_case)
++                (need_full, nps, fields, names) = data
++                assert nps
++                for row in self._yieldSQLDataList(nps, fields, ignore_case):
++                    pkgtupids.add(row[0])
+ 
+         sql =  """SELECT tid FROM trans_data_pkgs WHERE pkgtupid IN """
+         sql += "(%s)" % ",".join(['?'] * len(pkgtupids))
+@@ -914,17 +1260,19 @@ class YumHistory:
              version || '-' || release || '.' || arch AS nevra
       FROM trans_skip_pkgs JOIN pkgtups USING(pkgtupid)
       ORDER BY name;
@@ -35117,7 +35366,7 @@ index afc7947..31b1080 100755
                  if cpeid:
                      tag = """   <distro cpeid="%s">%s</distro>\n""" % (
 diff --git a/yum/rpmsack.py b/yum/rpmsack.py
-index ae73c32..ae64fa6 100644
+index ae73c32..6d6bf1c 100644
 --- a/yum/rpmsack.py
 +++ b/yum/rpmsack.py
 @@ -195,13 +195,20 @@ class RPMDBPackageSack(PackageSackBase):
@@ -35238,7 +35487,47 @@ index ae73c32..ae64fa6 100644
      def readOnlyTS(self):
          if not self.ts:
              self.ts =  initReadOnlyTransaction(root=self.root)
-@@ -543,7 +625,7 @@ class RPMDBPackageSack(PackageSackBase):
+@@ -511,12 +593,34 @@ class RPMDBPackageSack(PackageSackBase):
+         return pkgobjlist
+ 
+     def _uncached_returnConflictPackages(self):
++        """ Load the packages which have conflicts from the rpmdb, newer
++            versions of rpm have an index here so this is as fast as
++            cached (we test rpm version at cache write time). """
++
+         if self._cached_conflicts_data is None:
+-            ret = []
+-            for pkg in self.returnPackages():
+-                if len(pkg.conflicts):
+-                    ret.append(pkg)
+-            self._cached_conflicts_data = ret
++            result = {}
++            ts = self.readOnlyTS()
++            mi = ts.dbMatch('conflictname')
++
++            for hdr in mi:
++                if hdr['name'] == 'gpg-pubkey': # Just in case...
++                    continue
++
++                po = self._makePackageObject(hdr, mi.instance())
++                result[po.pkgid] = po
++                if po._has_hdr:
++                    continue # Unlikely, but, meh...
++
++                po.hdr = hdr
++                po._has_hdr = True
++                po.conflicts
++                po._has_hdr = False
++                del po.hdr
++            self._cached_conflicts_data = result.values()
++
++            if self.auto_close:
++                self.ts.close()
++
+         return self._cached_conflicts_data
+ 
+     def _write_conflicts_new(self, pkgs, rpmdbv):
+@@ -543,7 +647,7 @@ class RPMDBPackageSack(PackageSackBase):
          misc.unlink_f(self._cachedir + "/version")
          misc.unlink_f(self._cachedir + '/conflicts')
          misc.unlink_f(self._cachedir + '/file-requires')
@@ -35247,7 +35536,7 @@ index ae73c32..ae64fa6 100644
          #  We have a couple of options here, we can:
          #
          # . Ignore it and continue - least invasive, least likely to get any
-@@ -627,8 +709,8 @@ class RPMDBPackageSack(PackageSackBase):
+@@ -627,8 +731,8 @@ class RPMDBPackageSack(PackageSackBase):
              data = self._trans_cache_store['file-requires']
              self._write_file_requires(rpmdbv, data)
  
@@ -35258,7 +35547,7 @@ index ae73c32..ae64fa6 100644
              self._write_package_checksums(rpmdbv, data)
  
          self._trans_cache_store = {}
-@@ -803,22 +885,23 @@ class RPMDBPackageSack(PackageSackBase):
+@@ -803,22 +907,23 @@ class RPMDBPackageSack(PackageSackBase):
          os.rename(self._cachedir + '/file-requires.tmp',
                    self._cachedir + '/file-requires')
  
@@ -35286,7 +35575,7 @@ index ae73c32..ae64fa6 100644
          frpmdbv = fo.readline()
          if not frpmdbv or rpmdbv != frpmdbv[:-1]:
              return
-@@ -837,7 +920,10 @@ class RPMDBPackageSack(PackageSackBase):
+@@ -837,7 +942,10 @@ class RPMDBPackageSack(PackageSackBase):
  
                  T = _read_str(fo)
                  D = _read_str(fo)
@@ -35298,7 +35587,7 @@ index ae73c32..ae64fa6 100644
  
              if fo.readline() != '': # Should be EOF
                  return
-@@ -845,7 +931,13 @@ class RPMDBPackageSack(PackageSackBase):
+@@ -845,7 +953,13 @@ class RPMDBPackageSack(PackageSackBase):
              self._deal_with_bad_rpmdbcache("pkg checksums")
              return
  
@@ -35312,7 +35601,7 @@ index ae73c32..ae64fa6 100644
              (n, a, e, v, r) = pkgtup
              pkg = self.searchNevra(n, e, v, r, a)
              if not pkg:
-@@ -863,24 +955,26 @@ class RPMDBPackageSack(PackageSackBase):
+@@ -863,24 +977,26 @@ class RPMDBPackageSack(PackageSackBase):
          if not self.__cache_rpmdb__:
              return
  
@@ -35343,7 +35632,15 @@ index ae73c32..ae64fa6 100644
  
      def _get_cached_simpleVersion_main(self):
          """ Return the cached string of the main rpmdbv. """
-@@ -1422,9 +1516,10 @@ class RPMDBAdditionalData(object):
+@@ -1046,7 +1162,6 @@ class RPMDBPackageSack(PackageSackBase):
+         if self.auto_close:
+             self.ts.close()
+ 
+-
+     def _header_from_index(self, idx):
+         """returns a package header having been given an index"""
+         warnings.warn('_header_from_index() will go away in a future version of Yum.\n',
+@@ -1422,9 +1537,10 @@ class RPMDBAdditionalData(object):
      # dirs have files per piece of info we're keeping
      #    repoid, install reason, status, blah, (group installed for?), notes?
      
@@ -35355,7 +35652,7 @@ index ae73c32..ae64fa6 100644
          self.conf.writable = False
          
          self._packages = {} # pkgid = dir
-@@ -1566,7 +1661,6 @@ class RPMDBAdditionalDataPackage(object):
+@@ -1566,7 +1682,6 @@ class RPMDBAdditionalDataPackage(object):
  
          self._yumdb_cache['attr'][value][2].add(fn)
          self._yumdb_cache[fn] = value
@@ -35363,7 +35660,7 @@ index ae73c32..ae64fa6 100644
  
          return True
  
-@@ -1587,6 +1681,11 @@ class RPMDBAdditionalDataPackage(object):
+@@ -1587,6 +1702,11 @@ class RPMDBAdditionalDataPackage(object):
          if attr.endswith('.tmp'):
              raise AttributeError, "Cannot set attribute %s on %s" % (attr, self)
  
@@ -35429,7 +35726,7 @@ index 820f003..fb8333f 100644
          return returnList
   
 diff --git a/yum/transactioninfo.py b/yum/transactioninfo.py
-index 31d3569..6cf400a 100644
+index 31d3569..4c59301 100644
 --- a/yum/transactioninfo.py
 +++ b/yum/transactioninfo.py
 @@ -1,3 +1,4 @@
@@ -35437,7 +35734,68 @@ index 31d3569..6cf400a 100644
  # This program is free software; you can redistribute it and/or modify
  # it under the terms of the GNU General Public License as published by
  # the Free Software Foundation; either version 2 of the License, or
-@@ -645,7 +646,9 @@ class TransactionData:
+@@ -82,7 +83,7 @@ class TransactionData:
+         self.debug = 0
+         self.changed = False
+         self.installonlypkgs = []
+-        
++        self.state_counter = 0
+         self.conditionals = {} # key = pkgname, val = list of pos to add
+ 
+         self.rpmdb = None
+@@ -265,6 +266,7 @@ class TransactionData:
+         self.pkgdict[txmember.pkgtup].append(txmember)
+         self._namedict.setdefault(txmember.name, []).append(txmember)
+         self.changed = True
++        self.state_counter += 1
+         if self._isLocalPackage(txmember):
+             self.localSack.addPackage(txmember.po)
+         elif isinstance(txmember.po, YumAvailablePackageSqlite):
+@@ -305,6 +307,7 @@ class TransactionData:
+         if not self._namedict[pkgtup[0]]:
+             del self._namedict[pkgtup[0]]
+         self.changed = True        
++        self.state_counter += 1
+     
+     def exists(self, pkgtup):
+         """tells if the pkg is in the class"""
+@@ -418,7 +421,8 @@ class TransactionData:
+ 
+         if self.rpmdb.contains(po=txmbr.po):
+             txmbr.reinstall = True
+-
++        
++        self.findObsoletedByThisMember(txmbr)
+         self.add(txmbr)
+         return txmbr
+ 
+@@ -469,6 +473,7 @@ class TransactionData:
+             txmbr.updates.append(oldpo)
+             
+         self.add(txmbr)
++        self.findObsoletedByThisMember(txmbr)
+         return txmbr
+ 
+     def addDowngrade(self, po, oldpo):
+@@ -496,7 +501,7 @@ class TransactionData:
+         txmbr.current_state = TS_INSTALL
+         txmbr.output_state =  TS_UPDATED
+         txmbr.po.state = TS_UPDATED
+-        txmbr.ts_state = None # FIXME: should use a real state here.
++        txmbr.ts_state = 'ud'
+         txmbr.relatedto.append((updating_po, 'updatedby'))
+         txmbr.updated_by.append(updating_po)
+         self.add(txmbr)
+@@ -528,7 +533,7 @@ class TransactionData:
+         txmbr.current_state = TS_INSTALL
+         txmbr.output_state =  TS_OBSOLETED
+         txmbr.po.state = TS_OBSOLETED
+-        txmbr.ts_state = None # FIXME: should use a real state here.
++        txmbr.ts_state = 'od'
+         txmbr.relatedto.append((obsoleting_po, 'obsoletedby'))
+         txmbr.obsoleted_by.append(obsoleting_po)
+         self.add(txmbr)
+@@ -645,12 +650,26 @@ class TransactionData:
              csum = None
              if 'checksum_type' in ydbi and 'checksum_data' in ydbi:
                  csum = (ydbi.checksum_type, ydbi.checksum_data)
@@ -35448,6 +35806,23 @@ index 31d3569..6cf400a 100644
              main.update(pkg, csum)
  
          self.rpmdb.transactionCachePackageChecksums(pkg_checksum_tups)
+ 
+         return main
++    
++    def findObsoletedByThisMember(self, txmbr):
++        """addObsoleted() pkgs for anything that this txmbr will obsolete"""
++        # this is mostly to keep us in-line with what will ACTUALLY happen
++        # when rpm hits the obsoletes, whether we added them or not
++        for obs_n in txmbr.po.obsoletes_names:
++            for pkg in self.rpmdb.searchNevra(name=obs_n):
++                if pkg.obsoletedBy([txmbr.po]):
++                    self.addObsoleted(pkg, txmbr.po)
++                    txmbr.output_state = TS_OBSOLETING
++                    txmbr.po.state = TS_OBSOLETING
++
+ 
+ class ConditionalTransactionData(TransactionData):
+     """A transaction data implementing conditional package addition"""
 diff --git a/yum/update_md.py b/yum/update_md.py
 index 9e492ba..74db5ad 100644
 --- a/yum/update_md.py
diff --git a/yum.spec b/yum.spec
index a12ba6e..1b1255e 100644
--- a/yum.spec
+++ b/yum.spec
@@ -5,7 +5,7 @@
 Summary: RPM installer/updater
 Name: yum
 Version: 3.2.28
-Release: 10%{?dist}
+Release: 11%{?dist}
 License: GPLv2+
 Group: System Environment/Base
 Source0: http://yum.baseurl.org/download/3.2/%{name}-%{version}.tar.gz
@@ -156,6 +156,14 @@ rm -rf $RPM_BUILD_ROOT
 %dir %{yum_pluginslib}
 
 %changelog
+* Wed Oct 20 2010 Seth Vidal <skvidal at fedoraproject.org> - 3.2.28-11
+- latest head
+- depsolve enhancements on update/obsoletes
+- show recent pkgs in history package-list instead of a specific pkg
+- bz: 644432, 644265
+- make sure urlgrabber is using the right config settings for fetching gpg keys
+
+
 * Fri Oct 15 2010 James Antill <james at fedoraproject.org> - 3.2.28-10
 - latest head 
 - Fix major breakage from the "list updates" speedup :).


More information about the scm-commits mailing list