[yum] update to latest HEAD Fix for history sync, and saving on install. Lots of minor bug fixes. Speedups

James Antill james at fedoraproject.org
Wed Sep 21 21:15:31 UTC 2011


commit b1872d21641e2e1ba0f1f91ece4329ca22972f8b
Author: James Antill <james at and.org>
Date:   Wed Sep 21 17:15:04 2011 -0400

    update to latest HEAD
    Fix for history sync, and saving on install.
    Lots of minor bug fixes.
    Speedups for upgrade_requirements_on_install=true.
    Fix generated data using bad caches.
    Changes for yum-cron.

 yum-HEAD.patch |  598 +++++++++++++++++++++++++++++++++++++++-----------------
 yum.spec       |   10 +-
 2 files changed, 425 insertions(+), 183 deletions(-)
---
diff --git a/yum-HEAD.patch b/yum-HEAD.patch
index 727e372..3aed55d 100644
--- a/yum-HEAD.patch
+++ b/yum-HEAD.patch
@@ -60,7 +60,7 @@ index 2f6154e..2e5a052 100644
 diff --git a/cli.py b/cli.py
 old mode 100644
 new mode 100755
-index 6056d38..a1e0e03
+index 6056d38..2f4cabc
 --- a/cli.py
 +++ b/cli.py
 @@ -25,7 +25,7 @@ import sys
@@ -204,7 +204,18 @@ index 6056d38..a1e0e03
              # now set  all the non-first-start opts from main from our setopts
              if self.main_setopts:
                  for opt in self.main_setopts.items:
-@@ -318,9 +346,11 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
+@@ -240,6 +268,10 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
+         except yum.Errors.ConfigError, e:
+             self.logger.critical(_('Config Error: %s'), e)
+             sys.exit(1)
++        except IOError, e:
++            e = '%s: %s' % (to_unicode(e.args[1]), repr(e.filename))
++            self.logger.critical(_('Config Error: %s'), e)
++            sys.exit(1)
+         except ValueError, e:
+             self.logger.critical(_('Options Error: %s'), e)
+             sys.exit(1)
+@@ -318,9 +350,11 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
          time.sleep(sleeptime)
          
      def parseCommands(self):
@@ -219,7 +230,7 @@ index 6056d38..a1e0e03
          self.verbose_logger.debug('Yum Version: %s', yum.__version__)
          self.verbose_logger.log(yum.logginglevels.DEBUG_4,
                                  'COMMAND: %s', self.cmdstring)
-@@ -365,7 +395,11 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
+@@ -365,7 +399,11 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
          self.history.write_addon_data('shell-cmds', data)
  
      def doShell(self):
@@ -232,7 +243,7 @@ index 6056d38..a1e0e03
  
          yumshell = shell.YumShell(base=self)
  
-@@ -382,8 +416,12 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
+@@ -382,8 +420,12 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
          return yumshell.result, yumshell.resultmsgs
  
      def errorSummary(self, errstring):
@@ -247,7 +258,7 @@ index 6056d38..a1e0e03
          summary = ''
          # do disk space report first
          p = re.compile('needs (\d+)MB on the (\S+) filesystem')
-@@ -408,16 +446,17 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
+@@ -408,16 +450,17 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
  
  
      def doCommands(self):
@@ -275,7 +286,7 @@ index 6056d38..a1e0e03
          # at this point we know the args are valid - we don't know their meaning
          # but we know we're not being sent garbage
          
-@@ -435,14 +474,18 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
+@@ -435,14 +478,18 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
              try:
                  self._getTs(needTsRemove)
              except yum.Errors.YumBaseError, e:
@@ -298,7 +309,7 @@ index 6056d38..a1e0e03
          # just make sure there's not, well, nothing to do
          if len(self.tsInfo) == 0:
              self.verbose_logger.info(_('Trying to run the transaction but nothing to do. Exiting.'))
-@@ -453,7 +496,7 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
+@@ -453,7 +500,7 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
          lsts = self.listTransaction()
          if self.verbose_logger.isEnabledFor(yum.logginglevels.INFO_1):
              self.verbose_logger.log(yum.logginglevels.INFO_1, lsts)
@@ -307,7 +318,7 @@ index 6056d38..a1e0e03
              #  If we are in quiet, and assumeyes isn't on we want to output
              # at least the transaction list anyway.
              self.logger.warn(lsts)
-@@ -491,7 +534,7 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
+@@ -491,7 +538,7 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
          
          # confirm with user
          if self._promptWanted():
@@ -316,7 +327,7 @@ index 6056d38..a1e0e03
                  self.verbose_logger.info(_('Exiting on user Command'))
                  return -1
  
-@@ -609,12 +652,14 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
+@@ -609,12 +656,14 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
          return resultobject.return_code
          
      def gpgsigcheck(self, pkgs):
@@ -336,7 +347,7 @@ index 6056d38..a1e0e03
          for po in pkgs:
              result, errmsg = self.sigCheckPkg(po)
  
-@@ -623,7 +668,8 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
+@@ -623,7 +672,8 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
                  continue            
  
              elif result == 1:
@@ -346,7 +357,7 @@ index 6056d38..a1e0e03
                      raise yum.Errors.YumBaseError, \
                              _('Refusing to automatically import keys when running ' \
                              'unattended.\nUse "-y" to override.')
-@@ -691,12 +737,60 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
+@@ -691,12 +741,62 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
                                       ", ".join(matches))
              self.verbose_logger.log(yum.logginglevels.INFO_2, msg)
  
@@ -376,7 +387,9 @@ index 6056d38..a1e0e03
 +            uret = []
 +            for req in pkg.requires:
 +                for npkg in self.returnInstalledPackagesByDep(req):
-+                    uret += self.update(pattern=npkg.name, requiringPo=reqpo)
++                    if npkg.name in done:
++                        continue
++                    uret += self.update(name=npkg.name, requiringPo=reqpo)
 +                    uret += _pkg2ups(npkg, reqpo=reqpo)
 +            return uret
 +
@@ -412,7 +425,7 @@ index 6056d38..a1e0e03
          # get the list of available packages
          # iterate over the user's list
          # add packages to Transaction holding class if they match.
-@@ -710,11 +804,12 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
+@@ -710,11 +810,12 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
          for arg in userlist:
              if (arg.endswith('.rpm') and (yum.misc.re_remote_url(arg) or
                                            os.path.exists(arg))):
@@ -427,7 +440,7 @@ index 6056d38..a1e0e03
              except yum.Errors.InstallError:
                  self.verbose_logger.log(yum.logginglevels.INFO_2,
                                          _('No package %s%s%s available.'),
-@@ -723,6 +818,7 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
+@@ -723,6 +824,7 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
                  self._maybeYouMeant(arg)
              else:
                  done = True
@@ -435,7 +448,7 @@ index 6056d38..a1e0e03
          if len(self.tsInfo) > oldcount:
              change = len(self.tsInfo) - oldcount
              return 2, [P_('%d package to install', '%d packages to install', change) % change]
-@@ -732,9 +828,27 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
+@@ -732,9 +834,27 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
          return 0, [_('Nothing to do')]
          
      def updatePkgs(self, userlist, quiet=0, update_to=False):
@@ -466,7 +479,7 @@ index 6056d38..a1e0e03
          # if there is no userlist, then do global update below
          # this is probably 90% of the calls
          # if there is a userlist then it's for updating pkgs, not obsoleting
-@@ -745,21 +859,19 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
+@@ -745,21 +865,19 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
  
          else:
              # go through the userlist - look for items that are local rpms. If we find them
@@ -497,7 +510,7 @@ index 6056d38..a1e0e03
  
          if len(self.tsInfo) > oldcount:
              change = len(self.tsInfo) - oldcount
-@@ -770,9 +882,24 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
+@@ -770,9 +888,24 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
      #  Note that we aren't in __init__ yet for a couple of reasons, but we 
      # probably will get there for 3.2.28.
      def distroSyncPkgs(self, userlist):
@@ -525,7 +538,7 @@ index 6056d38..a1e0e03
  
          level = 'diff'
          if userlist and userlist[0] in ('full', 'diff', 'different'):
-@@ -866,9 +993,19 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
+@@ -866,9 +999,19 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
              return 0, [_('No Packages marked for Distribution Synchronization')]
  
      def erasePkgs(self, userlist):
@@ -548,7 +561,7 @@ index 6056d38..a1e0e03
          oldcount = len(self.tsInfo)
  
          all_rms = []
-@@ -884,9 +1021,20 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
+@@ -884,9 +1027,20 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
              return 0, [_('No Packages marked for removal')]
      
      def downgradePkgs(self, userlist):
@@ -572,7 +585,7 @@ index 6056d38..a1e0e03
  
          oldcount = len(self.tsInfo)
          
-@@ -911,20 +1059,32 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
+@@ -911,20 +1065,32 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
          return 0, [_('Nothing to do')]
          
      def reinstallPkgs(self, userlist):
@@ -609,7 +622,7 @@ index 6056d38..a1e0e03
              except yum.Errors.ReinstallRemoveError:
                  self._checkMaybeYouMeant(arg, always_output=False)
              except yum.Errors.ReinstallInstallError, e:
-@@ -940,15 +1100,27 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
+@@ -940,15 +1106,27 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
              except yum.Errors.ReinstallError, e:
                  assert False, "Shouldn't happen, but just in case"
                  self.verbose_logger.log(yum.logginglevels.INFO_2, e)
@@ -640,7 +653,7 @@ index 6056d38..a1e0e03
          # read in each package into a YumLocalPackage Object
          # append it to self.localPackages
          # check if it can be installed or updated based on nevra versus rpmdb
-@@ -972,20 +1144,25 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
+@@ -972,20 +1150,25 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
          return 0, [_('Nothing to do')]
  
      def returnPkgLists(self, extcmds, installed_available=False):
@@ -680,7 +693,7 @@ index 6056d38..a1e0e03
          special = ['available', 'installed', 'all', 'extras', 'updates', 'recent',
                     'obsoletes']
          
-@@ -1017,8 +1194,25 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
+@@ -1017,8 +1200,25 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
          return ypl
  
      def search(self, args):
@@ -708,7 +721,7 @@ index 6056d38..a1e0e03
          
          # call the yum module search function with lists of tags to search
          # and what to search for
-@@ -1108,9 +1302,20 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
+@@ -1108,9 +1308,20 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
          return 0, matching
  
      def deplist(self, args):
@@ -731,7 +744,7 @@ index 6056d38..a1e0e03
          pkgs = []
          for arg in args:
              if (arg.endswith('.rpm') and (yum.misc.re_remote_url(arg) or
-@@ -1131,10 +1336,19 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
+@@ -1131,10 +1342,19 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
          return 0, []
  
      def provides(self, args):
@@ -755,7 +768,7 @@ index 6056d38..a1e0e03
          old_sdup = self.conf.showdupesfromrepos
          # For output, as searchPackageProvides() is always in showdups mode
          self.conf.showdupesfromrepos = True
-@@ -1163,8 +1377,19 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
+@@ -1163,8 +1383,19 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
          return 0, []
      
      def resolveDepCli(self, args):
@@ -777,7 +790,7 @@ index 6056d38..a1e0e03
          for arg in args:
              try:
                  pkg = self.returnPackageByDep(arg)
-@@ -1177,6 +1402,34 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
+@@ -1177,6 +1408,34 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
          return 0, []
      
      def cleanCli(self, userlist):
@@ -812,7 +825,7 @@ index 6056d38..a1e0e03
          hdrcode = pkgcode = xmlcode = dbcode = expccode = 0
          pkgresults = hdrresults = xmlresults = dbresults = expcresults = []
          msg = self.fmtKeyValFill(_('Cleaning repos: '), 
-@@ -1228,7 +1481,19 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
+@@ -1228,7 +1487,19 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
          return code, []
  
      def returnGroupLists(self, userlist):
@@ -822,9 +835,9 @@ index 6056d38..a1e0e03
 +        :param extcmds: a list of names or wildcards specifying
 +           groups to list
 +        :return: (exit_code, [ errors ])
- 
-+        exit_code is::
 +
++        exit_code is::
+ 
 +            0 = we're done, exit
 +            1 = we've errored, exit with error string
 +            2 = we've got work yet to do, onto the next stage        
@@ -832,18 +845,18 @@ index 6056d38..a1e0e03
          uservisible=1
              
          if len(userlist) > 0:
-@@ -1283,7 +1548,20 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
+@@ -1283,7 +1554,20 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
          return 0, [_('Done')]
  
      def returnGroupSummary(self, userlist):
 +        """Print a summary of the groups that match the given names or
 +        wildcards.
- 
++
 +        :param userlist: a list of names or wildcards specifying the
 +           groups to summarise. If *userlist* is an empty list, all
 +           installed and available packages will be summarised
 +        :return: (exit_code, [ errors ])
-+
+ 
 +        exit_code is::
 +
 +            0 = we're done, exit
@@ -853,7 +866,7 @@ index 6056d38..a1e0e03
          uservisible=1
              
          if len(userlist) > 0:
-@@ -1327,7 +1605,19 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
+@@ -1327,7 +1611,19 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
          return 0, [_('Done')]
      
      def returnGroupInfo(self, userlist):
@@ -874,7 +887,7 @@ index 6056d38..a1e0e03
          for strng in userlist:
              group_matched = False
              for group in self.comps.return_groups(strng):
-@@ -1340,8 +1630,18 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
+@@ -1340,8 +1636,18 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
          return 0, []
          
      def installGroups(self, grouplist):
@@ -895,7 +908,7 @@ index 6056d38..a1e0e03
          pkgs_used = []
          
          for group_string in grouplist:
-@@ -1368,8 +1668,18 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
+@@ -1368,8 +1674,18 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
              return 2, [P_('%d package to Install', '%d packages to Install', len(pkgs_used)) % len(pkgs_used)]
  
      def removeGroups(self, grouplist):
@@ -905,9 +918,9 @@ index 6056d38..a1e0e03
 +        :param grouplist: a list of names or wildcards specifying
 +           groups to be removed
 +        :return: (exit_code, [ errors ])
- 
-+        exit_code is::
 +
++        exit_code is::
+ 
 +            0 = we're done, exit
 +            1 = we've errored, exit with error string
 +            2 = we've got work yet to do, onto the next stage
@@ -915,7 +928,7 @@ index 6056d38..a1e0e03
          pkgs_used = []
          for group_string in grouplist:
              try:
-@@ -1389,7 +1699,7 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
+@@ -1389,7 +1705,7 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
  
      def _promptWanted(self):
          # shortcut for the always-off/always-on options
@@ -924,7 +937,7 @@ index 6056d38..a1e0e03
              return False
          if self.conf.alwaysprompt:
              return True
-@@ -1400,7 +1710,6 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
+@@ -1400,7 +1716,6 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
          #  package wasn't explictly given on the command line
          for txmbr in self.tsInfo.getMembers():
              if txmbr.isDep or \
@@ -932,7 +945,7 @@ index 6056d38..a1e0e03
                     txmbr.name not in self.extcmds:
                  return True
          
-@@ -1408,11 +1717,11 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
+@@ -1408,11 +1723,11 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
          return False
  
      def usage(self):
@@ -946,7 +959,7 @@ index 6056d38..a1e0e03
          sys.stdout.write(self.optparser.get_usage())
      
      def _installable(self, pkg, ematch=False):
-@@ -1468,9 +1777,9 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
+@@ -1468,9 +1783,9 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
          return False
  
  class YumOptionParser(OptionParser):
@@ -958,7 +971,7 @@ index 6056d38..a1e0e03
  
      def __init__(self,base, **kwargs):
          # check if this is called with a utils=True/False parameter
-@@ -1488,13 +1797,23 @@ class YumOptionParser(OptionParser):
+@@ -1488,13 +1803,23 @@ class YumOptionParser(OptionParser):
          self._addYumBasicOptions()
  
      def error(self, msg):
@@ -984,7 +997,7 @@ index 6056d38..a1e0e03
          try:
              args = _filtercmdline(
                          ('--noplugins','--version','-q', '-v', "--quiet", "--verbose"), 
-@@ -1521,7 +1840,15 @@ class YumOptionParser(OptionParser):
+@@ -1521,7 +1846,15 @@ class YumOptionParser(OptionParser):
          return ret
          
      def setupYumConfig(self, args=None):
@@ -1001,7 +1014,7 @@ index 6056d38..a1e0e03
          if not args:
              (opts, cmds) = self.parse_args()
          else:
-@@ -1536,7 +1863,9 @@ class YumOptionParser(OptionParser):
+@@ -1536,7 +1869,9 @@ class YumOptionParser(OptionParser):
                  
              # Handle remaining options
              if opts.assumeyes:
@@ -1012,7 +1025,7 @@ index 6056d38..a1e0e03
  
              #  Instead of going cache-only for a non-root user, try to use a
              # user writable cachedir. If that fails fall back to cache-only.
-@@ -1640,6 +1969,14 @@ class YumOptionParser(OptionParser):
+@@ -1640,6 +1975,14 @@ class YumOptionParser(OptionParser):
          sys.exit(1)
  
      def getRoot(self,opts):
@@ -1027,7 +1040,7 @@ index 6056d38..a1e0e03
          self._checkAbsInstallRoot(opts)
          # If the conf file is inside the  installroot - use that.
          # otherwise look for it in the normal root
-@@ -1713,6 +2050,10 @@ class YumOptionParser(OptionParser):
+@@ -1713,6 +2056,10 @@ class YumOptionParser(OptionParser):
                          help=_("verbose operation"))
          group.add_option("-y", "--assumeyes", dest="assumeyes",
                  action="store_true", help=_("answer yes for all questions"))
@@ -2236,7 +2249,7 @@ index f1e06e8..2faeb59 100644
              ;;
          version)
 diff --git a/output.py b/output.py
-index b6aa277..eefcd69 100755
+index b6aa277..be4e4d9 100755
 --- a/output.py
 +++ b/output.py
 @@ -1,6 +1,6 @@
@@ -2861,7 +2874,7 @@ index b6aa277..eefcd69 100755
          self.tsInfo.makelists(True, True)
          pkglist_lines = []
          data  = {'n' : {}, 'v' : {}, 'r' : {}}
-@@ -1102,19 +1417,46 @@ class YumOutput:
+@@ -1102,19 +1417,77 @@ class YumOutput:
  Transaction Summary
  %s
  """) % ('=' * self.term.columns))
@@ -2871,7 +2884,11 @@ index b6aa277..eefcd69 100755
 -            (_('Remove'), len(self.tsInfo.removed) + len(self.tsInfo.depremoved)),
 -            (_('Reinstall'), len(self.tsInfo.reinstalled)),
 -            (_('Downgrade'), len(self.tsInfo.downgraded)),
-+        for action, count, depcount in (
+-        ):
+-            if count: out.append('%-9s %5d %s\n' % (
+-                action, count, P_('Package', 'Packages', count),
+-            ))
++        summary_data =  (
 +            (_('Install'), len(self.tsInfo.installed),
 +             len(self.tsInfo.depinstalled)),
 +            (_('Upgrade'), len(self.tsInfo.updated),
@@ -2883,28 +2900,56 @@ index b6aa277..eefcd69 100755
 +            (_('Skipped (dependency problems)'), len(self.skipped_packages), 0),
 +            (_('Not installed'), len(self._not_found_i.values()), 0),
 +            (_('Not available'), len(self._not_found_a.values()), 0),
-         ):
--            if count: out.append('%-9s %5d %s\n' % (
--                action, count, P_('Package', 'Packages', count),
--            ))
++        )
++        max_msg_action   = 0
++        max_msg_count    = 0
++        max_msg_pkgs     = 0
++        max_msg_depcount = 0
++        for action, count, depcount in summary_data:
++            if not count and not depcount:
++                continue
++
++            msg_pkgs = P_('Package', 'Packages', count)
++            len_msg_action   = utf8_width(action)
++            len_msg_count    = utf8_width(str(count))
++            len_msg_pkgs     = utf8_width(msg_pkgs)
++
++            if depcount:
++                len_msg_depcount = utf8_width(str(depcount))
++            else:
++                len_msg_depcount = 0
++
++            # dito. max() by hand, due to RHEL-5
++            if len_msg_action > max_msg_action:
++                max_msg_action = len_msg_action
++            if len_msg_count > max_msg_count:
++                max_msg_count = len_msg_count
++            if len_msg_pkgs > max_msg_pkgs:
++                max_msg_pkgs = len_msg_pkgs
++            if len_msg_depcount > max_msg_depcount:
++                max_msg_depcount = len_msg_depcount
++
++        for action, count, depcount in summary_data:
 +            msg_pkgs = P_('Package', 'Packages', count)
 +            if depcount:
 +                msg_deppkgs = P_('Dependent package', 'Dependent packages',
 +                                 depcount)
-+                max_msg_pkgs  = utf8_width(_('Package'))
-+                max_msg_pkgs2 = utf8_width(_('Packages'))
-+                if max_msg_pkgs2 > max_msg_pkgs:
-+                    max_msg_pkgs = max_msg_pkgs2
 +                if count:
-+                    msg = '%-9s %5d %-*s (+%5d %s)\n'
-+                    out.append(msg % (action, count, max_msg_pkgs, msg_pkgs,
-+                                      depcount, msg_deppkgs))
++                    msg = '%s  %*d %s (+%*d %s)\n'
++                    out.append(msg % (utf8_width_fill(action, max_msg_action),
++                                      max_msg_count, count,
++                                      utf8_width_fill(msg_pkgs, max_msg_pkgs),
++                                      max_msg_depcount, depcount, msg_deppkgs))
 +                else:
-+                    msg = '%-9s %5s %-*s ( %5d %s)\n'
-+                    out.append(msg % (action, '', max_msg_pkgs, '',
-+                                      depcount, msg_deppkgs))
++                    msg = '%s  %*s %s ( %*d %s)\n'
++                    out.append(msg % (utf8_width_fill(action, max_msg_action),
++                                      max_msg_count, '',
++                                      utf8_width_fill('', max_msg_pkgs),
++                                      max_msg_depcount, depcount, msg_deppkgs))
 +            elif count:
-+                out.append('%-9s %5d %s\n' % (action, count, msg_pkgs))
++                msg = '%s  %*d %s\n'
++                out.append(msg % (utf8_width_fill(action, max_msg_action),
++                                  max_msg_count, count, msg_pkgs))
          return ''.join(out)
          
      def postTransactionOutput(self):
@@ -2917,7 +2962,7 @@ index b6aa277..eefcd69 100755
          out = ''
          
          self.tsInfo.makelists()
-@@ -1179,9 +1521,9 @@ Transaction Summary
+@@ -1179,9 +1552,9 @@ Transaction Summary
          return out
  
      def setupProgressCallbacks(self):
@@ -2930,7 +2975,7 @@ index b6aa277..eefcd69 100755
          # if we're below 2 on the debug level we don't need to be outputting
          # progress bars - this is hacky - I'm open to other options
          # One of these is a download
-@@ -1216,10 +1558,12 @@ Transaction Summary
+@@ -1216,10 +1589,12 @@ Transaction Summary
          self.dsCallback = dscb
      
      def setupProgessCallbacks(self):
@@ -2944,27 +2989,27 @@ index b6aa277..eefcd69 100755
          confirm_func = self._cli_confirm_gpg_key_import
          gpg_import_func = self.getKeyForRepo
          gpgca_import_func = self.getCAKeyForRepo
-@@ -1233,14 +1577,12 @@ Transaction Summary
+@@ -1233,14 +1608,12 @@ Transaction Summary
              self.repos.gpgca_import_func = gpgca_import_func
  
      def interrupt_callback(self, cbobj):
 -        '''Handle CTRL-C's during downloads
+-
+-        If a CTRL-C occurs a URLGrabError will be raised to push the download
+-        onto the next mirror.  
+-        
+-        If two CTRL-C's occur in quick succession then yum will exit.
 +        '''Handle CTRL-C's during downloads.  If a CTRL-C occurs a
 +        URLGrabError will be raised to push the download onto the next
 +        mirror.  If two CTRL-C's occur in quick succession then yum
 +        will exit.
  
--        If a CTRL-C occurs a URLGrabError will be raised to push the download
--        onto the next mirror.  
--        
--        If two CTRL-C's occur in quick succession then yum will exit.
--
 -        @param cbobj: urlgrabber callback obj
 +        :param cbobj: :class:`urlgrabber.grabber.CallbackObject`
          '''
          delta_exit_chk = 2.0      # Delta between C-c's so we treat as exit
          delta_exit_str = _("two") # Human readable version of above
-@@ -1269,6 +1611,14 @@ to exit.
+@@ -1269,6 +1642,14 @@ to exit.
  
      def download_callback_total_cb(self, remote_pkgs, remote_size,
                                     download_start_timestamp):
@@ -2979,7 +3024,7 @@ index b6aa277..eefcd69 100755
          if len(remote_pkgs) <= 1:
              return
          if not hasattr(urlgrabber.progress, 'TerminalLine'):
-@@ -1434,8 +1784,17 @@ to exit.
+@@ -1434,8 +1815,17 @@ to exit.
          return tids, printall
  
      def historyListCmd(self, extcmds):
@@ -2989,16 +3034,16 @@ index b6aa277..eefcd69 100755
 +
 +        :param extcmds: list of extra command line arguments
 +        :return: (exit_code, [errors])
- 
-+        exit_code is::
 +
++        exit_code is::
+ 
 +            0 = we're done, exit
 +            1 = we've errored, exit with error string
 +        """
          tids, printall = self._history_list_transactions(extcmds)
          if tids is None:
              return 1, ['Failed history list']
-@@ -1564,6 +1923,16 @@ to exit.
+@@ -1564,6 +1954,16 @@ to exit.
          return old[0]
  
      def historyInfoCmd(self, extcmds):
@@ -3015,7 +3060,7 @@ index b6aa277..eefcd69 100755
          def str2int(x):
              try:
                  return int(x)
-@@ -1656,6 +2025,9 @@ to exit.
+@@ -1656,6 +2056,9 @@ to exit.
      def _hpkg2from_repo(self, hpkg):
          """ Given a pkg, find the ipkg.ui_from_repo ... if none, then
              get an apkg. ... and put a ? in there. """
@@ -3025,7 +3070,41 @@ index b6aa277..eefcd69 100755
          ipkgs = self.rpmdb.searchPkgTuple(hpkg.pkgtup)
          if not ipkgs:
              apkgs = self.pkgSack.searchPkgTuple(hpkg.pkgtup)
-@@ -1833,6 +2205,13 @@ to exit.
+@@ -1678,7 +2081,7 @@ to exit.
+         _pkg_states_installed['maxlen'] = maxlen
+         _pkg_states_available['maxlen'] = maxlen
+         def _simple_pkg(pkg, prefix_len, was_installed=False, highlight=False,
+-                        pkg_max_len=0):
++                        pkg_max_len=0, show_repo=True):
+             prefix = " " * prefix_len
+             if was_installed:
+                 _pkg_states = _pkg_states_installed
+@@ -1702,9 +2105,11 @@ to exit.
+             else:
+                 (hibeg, hiend) = self._highlight('normal')
+             state = utf8_width_fill(state, _pkg_states['maxlen'])
++            ui_repo = ''
++            if show_repo:
++                ui_repo = self._hpkg2from_repo(hpkg)
+             print "%s%s%s%s %-*s %s" % (prefix, hibeg, state, hiend,
+-                                        pkg_max_len, hpkg,
+-                                        self._hpkg2from_repo(hpkg))
++                                        pkg_max_len, hpkg, ui_repo)
+ 
+         if type(old.tid) == type([]):
+             print _("Transaction ID :"), "%u..%u" % (old.tid[0], old.tid[-1])
+@@ -1794,7 +2199,9 @@ to exit.
+             print _("Packages Skipped:")
+             pkg_max_len = max((len(str(hpkg)) for hpkg in old.trans_skip))
+         for hpkg in old.trans_skip:
+-            _simple_pkg(hpkg, 4, pkg_max_len=pkg_max_len)
++            #  Don't show the repo. here because we can't store it as they were,
++            # by definition, not installed.
++            _simple_pkg(hpkg, 4, pkg_max_len=pkg_max_len, show_repo=False)
+ 
+         if old.rpmdb_problems:
+             print _("Rpmdb Problems:")
+@@ -1833,6 +2240,13 @@ to exit.
                                'Updated'      : _('Updated'),
                                }
      def historyInfoCmdPkgsAltered(self, old, pats=[]):
@@ -3039,7 +3118,7 @@ index b6aa277..eefcd69 100755
          last = None
          #  Note that these don't use _simple_pkg() because we are showing what
          # happened to them in the transaction ... not the difference between the
-@@ -1886,6 +2265,10 @@ to exit.
+@@ -1886,6 +2300,10 @@ to exit.
                                          self._hpkg2from_repo(hpkg))
  
      def historySummaryCmd(self, extcmds):
@@ -3050,7 +3129,7 @@ index b6aa277..eefcd69 100755
          tids, printall = self._history_list_transactions(extcmds)
          if tids is None:
              return 1, ['Failed history info']
-@@ -1946,6 +2329,10 @@ to exit.
+@@ -1946,6 +2364,10 @@ to exit.
                               utf8_width_fill(uiacts, 16, 16), count)
  
      def historyAddonInfoCmd(self, extcmds):
@@ -3061,7 +3140,7 @@ index b6aa277..eefcd69 100755
          tid = None
          if len(extcmds) > 1:
              tid = extcmds[1]
-@@ -1983,16 +2370,19 @@ to exit.
+@@ -1983,16 +2405,19 @@ to exit.
          
          for item in extcmds[2:]:
              if item in addon_info:
@@ -3087,7 +3166,7 @@ index b6aa277..eefcd69 100755
          tids = self.history.search(extcmds)
          limit = None
          if extcmds and not tids:
-@@ -2078,9 +2468,95 @@ to exit.
+@@ -2078,9 +2503,95 @@ to exit.
              if lastdbv.end_rpmdbversion != rpmdbv:
                  self._rpmdb_warn_checks()
  
@@ -3184,7 +3263,7 @@ index b6aa277..eefcd69 100755
      
      def __init__(self, ayum=None):
          """requires yum-cli log and errorlog functions as arguments"""
-@@ -2089,6 +2565,25 @@ class DepSolveProgressCallBack:
+@@ -2089,6 +2600,25 @@ class DepSolveProgressCallBack:
          self.ayum = ayum
  
      def pkgAdded(self, pkgtup, mode):
@@ -3210,7 +3289,7 @@ index b6aa277..eefcd69 100755
          modedict = { 'i': _('installed'),
                       'u': _('an update'),
                       'e': _('erased'),
-@@ -2104,43 +2599,85 @@ class DepSolveProgressCallBack:
+@@ -2104,43 +2634,85 @@ class DepSolveProgressCallBack:
              modeterm)
          
      def start(self):
@@ -3298,7 +3377,7 @@ index b6aa277..eefcd69 100755
          needname, needflags, needversion = reqTup
  
          yb = self.ayum
-@@ -2225,45 +2762,89 @@ class DepSolveProgressCallBack:
+@@ -2225,45 +2797,89 @@ class DepSolveProgressCallBack:
          return msg
      
      def procConflict(self, name, confname):
@@ -3392,7 +3471,7 @@ index b6aa277..eefcd69 100755
          progressbar(current, total, name)
  
  def _pkgname_ui(ayum, pkgname, ts_states=None):
-@@ -2316,10 +2897,7 @@ def _pkgname_ui(ayum, pkgname, ts_states=None):
+@@ -2316,10 +2932,7 @@ def _pkgname_ui(ayum, pkgname, ts_states=None):
      return pkgname
  
  class YumCliRPMCallBack(RPMBaseCallback):
@@ -3404,7 +3483,7 @@ index b6aa277..eefcd69 100755
  
      width = property(lambda x: _term_width())
  
-@@ -2337,11 +2915,31 @@ class YumCliRPMCallBack(RPMBaseCallback):
+@@ -2337,11 +2950,31 @@ class YumCliRPMCallBack(RPMBaseCallback):
      #  Installing things have pkg objects passed to the events, so only need to
      # lookup for erased/obsoleted.
      def pkgname_ui(self, pkgname, ts_states=('e', 'od', 'ud', None)):
@@ -3438,7 +3517,7 @@ index b6aa277..eefcd69 100755
          process = self.action[action]
  
          if not hasattr(self, '_max_action_wid'):
-@@ -2366,6 +2964,7 @@ class YumCliRPMCallBack(RPMBaseCallback):
+@@ -2366,6 +2999,7 @@ class YumCliRPMCallBack(RPMBaseCallback):
          
          if self.output and (sys.stdout.isatty() or te_current == te_total):
              (fmt, wid1, wid2) = self._makefmt(percent, ts_current, ts_total,
@@ -3446,7 +3525,7 @@ index b6aa277..eefcd69 100755
                                                pkgname=pkgname, wid1=wid1)
              msg = fmt % (utf8_width_fill(process, wid1, wid1),
                           utf8_width_fill(pkgname, wid2, wid2))
-@@ -2377,6 +2976,11 @@ class YumCliRPMCallBack(RPMBaseCallback):
+@@ -2377,6 +3011,11 @@ class YumCliRPMCallBack(RPMBaseCallback):
                  print " "
  
      def scriptout(self, package, msgs):
@@ -3458,7 +3537,7 @@ index b6aa277..eefcd69 100755
          if msgs:
              sys.stdout.write(to_unicode(msgs))
              sys.stdout.flush()
-@@ -2431,6 +3035,15 @@ class YumCliRPMCallBack(RPMBaseCallback):
+@@ -2431,6 +3070,15 @@ class YumCliRPMCallBack(RPMBaseCallback):
  
  
  def progressbar(current, total, name=None):
@@ -9137,10 +9216,10 @@ index 0000000..e38e80f
 +exec /usr/sbin/yum-cron cleanup
 diff --git a/yum-cron/yum-cron.sh b/yum-cron/yum-cron.sh
 new file mode 100755
-index 0000000..d549471
+index 0000000..e300fa7
 --- /dev/null
 +++ b/yum-cron/yum-cron.sh
-@@ -0,0 +1,172 @@
+@@ -0,0 +1,170 @@
 +#!/bin/bash
 +
 +# This script is designed to be run from cron to automatically keep your
@@ -9149,13 +9228,10 @@ index 0000000..d549471
 +# /etc/sysconfig/yum-cron.
 +
 +
-+# These are used by /etc/init.d/yum-cron on shutdown to protect against
++# This is used by /etc/init.d/yum-cron on shutdown to protect against
 +# abruptly shutting down mid-transaction. Therefore, you shouldn't change
-+# them without changing that.
-+LOCKDIR=/var/lock/yum-cron.lock
-+PIDFILE=$LOCKDIR/pidfile
-+TSLOCK=$LOCKDIR/ts.lock
-+
++# it without changing that.
++PIDFILE=/var/lock/yum-cron.pid
 +
 +# This is the home of the yum scripts which power the various actions the
 +# yum-cron system performs.
@@ -9176,6 +9252,13 @@ index 0000000..d549471
 +  exit 1
 +fi  
 +
++# This must be set above. But there a couple of places where horrible
++# things might happen if it's unset, so, let's check.
++if [[ -z "$PIDFILE" ]]; then
++  echo "Error! \$PIDFILE variable must be set in yum-cron."
++  exit 1
++fi
++
 +# Read the settings from our config file.
 +if [[ -f /etc/sysconfig/yum-cron ]]; then
 +  source /etc/sysconfig/yum-cron
@@ -9190,35 +9273,33 @@ index 0000000..d549471
 +
 +# This holds the output from the "meat" of this script, so that it can
 +# be nicely mailed to the configured destination when we're done.
-+YUMTMP=$(mktemp /var/run/yum-cron.XXXXXX)
-+touch $YUMTMP 
-+[[ -x /sbin/restorecon ]] && /sbin/restorecon $YUMTMP
++YUMOUTPUT=$(mktemp /var/run/yum-cron.XXXXXX)
++touch $YUMOUTPUT 
++[[ -x /sbin/restorecon ]] && /sbin/restorecon $YUMOUTPUT
 +
 +# Here is the gigantic block of lockfile logic.
 +#
-+# Note: the lockfile code doesn't currently try and use YUMTMP to email
++# Note: the lockfile code doesn't currently try and use YUMOUTPUT to email
 +# messages nicely, so this gets handled by normal cron error mailing.
 +#
-+
-+# We use mkdir for the lockfile, as this will test for and if possible
-+# create the lock in one atomic action. (So there's no race condition.)
-+if mkdir $LOCKDIR 2>/dev/null; then
-+  # Store the current process ID in the lock directory so we can check for
-+  # staleness later.
-+  echo "$$" >"${PIDFILE}"
-+  # And, clean up locks and tempfile when the script exits or is killed.
-+  trap "{ rm -f $PIDFILE $TSLOCK; rmdir $LOCKDIR 2>/dev/null; rm -f $YUMTMP; exit 255; }" INT TERM EXIT
++	
++# We use noclobber for the pidfile, as this will test for and if possible 
++# create the file in one atomic action. (So there's no race condition.) The 
++# current process ID is stored in the file so we can check for staleness 
++# later.
++if (set -o noclobber; echo "$$" > $PIDFILE) 2>/dev/null; then
++  # We got the lock. So now, set a trap to clean up locks and the output
++  # tempfile when the script exits or is killed.
++  trap "rm -f $PIDFILE" INT TERM EXIT
 +else
 +  # Lock failed -- check if a running process exists.  
 +  # First, if there's no PID file in the lock directory, something bad has
-+  # happened.  We can't know the process name, so, clean up the old lockdir
-+  # and restart.
++  # happened.  We can't know the process name, so, restart.
 +  if [[ ! -f $PIDFILE ]]; then
-+    rm -rf "${LOCKDIR}"
-+    echo "yum-cron: no lock PID, clearing and restarting myself" >&2
++    echo "yum-cron: no lock PID, restarting myself" >&2
 +    exec $0 "$@"
 +  fi
-+  OTHERPID="$(cat "${PIDFILE}")"
++  OTHERPID="$(< $PIDFILE)" 2>/dev/null
 +  # if cat wasn't able to read the file anymore, another instance probably is
 +  # about to remove the lock -- exit, we're *still* locked
 +  if [[ $? != 0 ]]; then
@@ -9228,12 +9309,12 @@ index 0000000..d549471
 +  if ! kill -0 $OTHERPID &>/dev/null; then
 +    # Lock is stale. Remove it and restart.
 +    echo "yum-cron: removing stale lock of nonexistant PID ${OTHERPID}" >&2
-+    rm -rf "${LOCKDIR}"
++    rm -f $PIDFILE
 +    echo "yum-cron: restarting myself" >&2
 +    exec $0 "$@"
 +  else
 +    # Remove lockfiles more than a day old -- they must be stale.
-+    find $LOCKDIR -type f -name 'pidfile' -amin +1440 -exec rm -rf $LOCKDIR \;
++    find $PIDFILE -type f -amin +1440 -exec rm -f $PIDFILE \;
 +    # If it's still there, it *wasn't* too old. Bail!
 +    if [[ -f $PIDFILE ]]; then
 +      # Lock is valid and OTHERPID is active -- exit, we're locked!
@@ -9241,8 +9322,7 @@ index 0000000..d549471
 +      exit 0
 +    else
 +      # Lock was invalid. Restart.
-+      echo "yum-cron: removing stale lock belonging to stale PID ${OTHERPID}" >&2
-+      echo "yum-cron: restarting myself" >&2
++      echo "yum-cron: removed stale lock belonging to PID ${OTHERPID}; restarting." >&2
 +      exec $0 "$@"
 +    fi
 +  fi
@@ -9264,8 +9344,6 @@ index 0000000..d549471
 +        # Note that in all cases, yum is updated first, and then 
 +        # everything else.
 +        if [[ "$CHECK_ONLY" == "yes" ]]; then
-+          # TSLOCK is used by the safe-shutdown code in the init script.
-+          touch $TSLOCK
 +          /usr/bin/yum $YUM_PARAMETER -e 0 -d 0 -y check-update 1> /dev/null 2>&1
 +          case $? in
 +            1)   exit 1;;
@@ -9281,7 +9359,6 @@ index 0000000..d549471
 +          # Don't run if we can't access the repos -- if this is set, 
 +          # and there's a problem, we exit silently (but return an error
 +          # code).
-+          touch $TSLOCK
 +          /usr/bin/yum $YUM_PARAMETER -e 0 -d 0 check-update 2>&-
 +          case $? in
 +            1)   exit 1;;
@@ -9291,7 +9368,6 @@ index 0000000..d549471
 +          esac
 +        else
 +          # and here's the "just do it".
-+          touch $TSLOCK
 +          /usr/bin/yum $YUM_PARAMETER -e ${ERROR_LEVEL:-0} -d ${DEBUG_LEVEL:-0} -y update yum
 +          /usr/bin/yum $YUM_PARAMETER -e ${ERROR_LEVEL:-0} -d ${DEBUG_LEVEL:-0} -y shell $YUMSCRIPT
 +        fi
@@ -9301,16 +9377,17 @@ index 0000000..d549471
 +        ;;
 +  esac       
 +
-+} >> $YUMTMP 2>&1
++} >> $YUMOUTPUT 2>&1
 +
 +if [[ ! -z "$MAILTO" && -x /bin/mail ]]; then 
 +# If MAILTO is set, use mail command for prettier output.
-+  [[ -s "$YUMTMP" ]] && mail -s "System update: $SYSTEMNAME" $MAILTO < $YUMTMP 
++  [[ -s "$YUMOUTPUT" ]] && \
++    mail -s "System update: $SYSTEMNAME" $MAILTO < $YUMOUTPUT && \
++    rm -f $YUMOUTPUT
 +else 
 +# The default behavior is to use cron's internal mailing of output.
-+  cat $YUMTMP
++  cat $YUMOUTPUT && rm -f $YUMOUTPUT
 +fi 
-+rm -f $YUMTMP 
 +
 +exit 0
 diff --git a/yum-cron/yum-cron.sysconfig b/yum-cron/yum-cron.sysconfig
@@ -9413,10 +9490,10 @@ index 0000000..4c8c40d
 +SERVICE_WAIT_TIME=300
 diff --git a/yum-cron/yum-cron.sysvinit b/yum-cron/yum-cron.sysvinit
 new file mode 100755
-index 0000000..084dd32
+index 0000000..ee531c6
 --- /dev/null
 +++ b/yum-cron/yum-cron.sysvinit
-@@ -0,0 +1,103 @@
+@@ -0,0 +1,108 @@
 +#!/bin/bash
 +#
 +# yum-cron      Enable or disable scheduled yum system updates.
@@ -9437,48 +9514,53 @@ index 0000000..084dd32
 +test -f /etc/sysconfig/yum-cron && . /etc/sysconfig/yum-cron
 +
 +lockfile=/var/lock/subsys/yum-cron
-+tslock=/var/lock/yum-cron.lock/ts.lock
-+yumcronpid=/var/lock/yum-cron.lock/pidfile
++
++# This is generated by /usr/sbin/yum-cron and will exist when that script
++# is running and not otherwise.
++pidfile=/var/lock/yum-cron.pid
 +
 +RETVAL=0
 +
 +start() {
 +	echo -n $"Enabling scheduled yum updates: "
++	# The cron script exits silently if this file doesn't exist.
 +	touch "$lockfile" && success || failure
 +	RETVAL=$?
 +	echo
 +}
 +
 +stop() {
++        # Disabling this is just removing the so-called lock file.  But we
++        # also have logic to delay shutdown if a transaction is in-progress.
++        # All that affects is the exit of _this_ script, which may be
++        # waited on by other things in the shutdown process.
 +	echo -n $"Disabling scheduled yum updates: "
-+	if [ -f "$yumcronpid" -a "$SERVICE_WAITS" = "yes" ]; then
-+	  yum_done=0
-+	  if [ ! -f $tslock ]; then
-+	    # No transaction yet in progress, just kill it
-+	    kill `cat $yumcronpid > /dev/null 2>&1` > /dev/null 2>&1
-+	    yum_done=1
-+	  fi
-+	  if [ $yum_done -eq 0 ]; then
-+	    echo -n $"Waiting for in-progress yum transaction "
-+	    if [ -z "$SERVICE_WAIT_TIME" ]; then
-+	      SERVICE_WAIT_TIME=300
-+	    fi
-+	    start=`date +%s`
-+	    end=`expr $start + $SERVICE_WAIT_TIME`
-+	    while [ `date +%s` -le $end ]
-+	    do
-+	      sleep 5
-+	      if [ ! -f "$tslock" ]; then
-+		yum_done=1
-+	        break
-+	      fi
-+	    done
-+	    if [ $yum_done -eq 1 ]; then
-+	      echo -n " ok "
-+	    else
-+	      echo -n " failed "
-+	    fi
-+	  fi
++	if [ "$SERVICE_WAITS" = "yes" ]; then
++	  # if SERVICE_WAITS is yes, we check for an active pid
++	  # file and recheck in 5 second increments up to 
++	  # SERVICE_WAIT_TIME before continuing.
++          if (set -o noclobber; ! echo "$$" > $pidfile ) 2>/dev/null; then
++            # yum-cron has the lock. Read the pid, and wait and then loop
++            # until it's done.
++            activepid="$(< $pidfile)" 2>/dev/null
++            if [ $? != 0 ]; then 
++              echo; echo -n $"Stale yum-cron lock ignored. "
++            else
++              echo; echo -n $"Waiting for in-progress yum transaction"
++              end=$( expr $( date +%s ) + ${SERVICE_WAIT_TIME:-300} )
++              while checkpid $activepid 2>/dev/null ; do
++                echo -n "."
++                if [ $( date +%s ) -gt $end ]; then
++                  echo -n " Timed out. "
++                  break
++                fi
++                sleep 5
++              done
++            fi
++          else
++            # we got the lock. we don't really want it; remove and move on.
++            rm -f "$pidfile"
++          fi
 +	fi
 +	rm -f "$lockfile" && success || failure
 +	RETVAL=$?
@@ -9522,10 +9604,10 @@ index 0000000..084dd32
 +exit $RETVAL
 diff --git a/yum-cron/yum-update.cron.sh b/yum-cron/yum-update.cron.sh
 new file mode 100755
-index 0000000..c439ad3
+index 0000000..b9edddf
 --- /dev/null
 +++ b/yum-cron/yum-update.cron.sh
-@@ -0,0 +1,28 @@
+@@ -0,0 +1,35 @@
 +#!/bin/bash
 +
 +# Only run if this flag is set. The flag is created by the yum-cron init
@@ -9552,6 +9634,13 @@ index 0000000..c439ad3
 +# the setting in the sysconfig file.
 +[[ $RANDOMWAIT -gt 0 ]] && sleep $(( $RANDOM % ($RANDOMWAIT * 60) + 1 ))
 +
++# Double-check to make sure that we're still supposed to be 
++# active after the random wait.
++if [[ ! -f /var/lock/subsys/yum-cron ]]; then
++  exit 0
++fi
++
++
 +# Action!
 +exec /usr/sbin/yum-cron update
 diff --git a/yum-updatesd.py b/yum-updatesd.py
@@ -13461,7 +13550,7 @@ index bca9651..00c17ad 100644
              index = self.failures
          else:
 diff --git a/yum/history.py b/yum/history.py
-index 5385bd1..a9b12cf 100644
+index 5385bd1..8e62f50 100644
 --- a/yum/history.py
 +++ b/yum/history.py
 @@ -97,9 +97,58 @@ def _setupHistorySearchSQL(patterns=None, ignore_case=False):
@@ -13628,7 +13717,15 @@ index 5385bd1..a9b12cf 100644
          if not os.path.exists(self.conf.db_path):
              try:
                  os.makedirs(self.conf.db_path)
-@@ -644,7 +744,7 @@ class YumHistory:
+@@ -638,13 +738,15 @@ 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:
              self._conn.close()
              self._conn = None
  
@@ -13637,7 +13734,7 @@ index 5385bd1..a9b12cf 100644
          cur = self._get_cursor()
          executeSQL(cur, """SELECT pkgtupid, checksum FROM pkgtups
                             WHERE name=? AND arch=? AND
-@@ -659,6 +759,9 @@ class YumHistory:
+@@ -659,6 +761,9 @@ class YumHistory:
              if checksum == sql_checksum:
                  return sql_pkgtupid
          
@@ -13647,7 +13744,7 @@ index 5385bd1..a9b12cf 100644
          (n,a,e,v,r) = pkgtup
          (n,a,e,v,r) = (to_unicode(n),to_unicode(a),
                         to_unicode(e),to_unicode(v),to_unicode(r))
-@@ -674,23 +777,28 @@ class YumHistory:
+@@ -674,23 +779,28 @@ class YumHistory:
                                  (name, arch, epoch, version, release)
                                  VALUES (?, ?, ?, ?, ?)""", (n,a,e,v,r))
          return cur.lastrowid
@@ -13684,7 +13781,7 @@ index 5385bd1..a9b12cf 100644
  
      @staticmethod
      def txmbr2state(txmbr):
-@@ -984,7 +1092,8 @@ class YumHistory:
+@@ -984,7 +1094,8 @@ class YumHistory:
                        ORDER BY name ASC, epoch ASC""", (tid,))
          ret = []
          for row in cur:
@@ -13694,7 +13791,7 @@ index 5385bd1..a9b12cf 100644
              ret.append(obj)
          return ret
      def _old_data_pkgs(self, tid):
-@@ -998,7 +1107,7 @@ class YumHistory:
+@@ -998,7 +1109,7 @@ class YumHistory:
          ret = []
          for row in cur:
              obj = YumHistoryPackageState(row[0],row[1],row[2],row[3],row[4],
@@ -13703,7 +13800,7 @@ index 5385bd1..a9b12cf 100644
              obj.done     = row[6] == 'TRUE'
              obj.state_installed = None
              if _sttxt2stcode[obj.state] in TS_INSTALL_STATES:
-@@ -1018,7 +1127,8 @@ class YumHistory:
+@@ -1018,7 +1129,8 @@ class YumHistory:
                        ORDER BY name ASC, epoch ASC""", (tid,))
          ret = []
          for row in cur:
@@ -13713,7 +13810,7 @@ index 5385bd1..a9b12cf 100644
              ret.append(obj)
          return ret
      def _old_prob_pkgs(self, rpid):
-@@ -1032,7 +1142,8 @@ class YumHistory:
+@@ -1032,7 +1144,8 @@ class YumHistory:
                        ORDER BY name ASC, epoch ASC""", (rpid,))
          ret = []
          for row in cur:
@@ -13723,7 +13820,7 @@ index 5385bd1..a9b12cf 100644
              obj.main = row[6] == 'TRUE'
              ret.append(obj)
          return ret
-@@ -1151,6 +1262,127 @@ class YumHistory:
+@@ -1151,6 +1264,127 @@ class YumHistory:
          assert len(ret) == 1
          return ret[0]
  
@@ -13761,10 +13858,8 @@ index 5385bd1..a9b12cf 100644
 +        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)
@@ -13812,10 +13907,12 @@ index 5385bd1..a9b12cf 100644
 +        """ 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
 +
@@ -13851,7 +13948,7 @@ index 5385bd1..a9b12cf 100644
      def _yieldSQLDataList(self, patterns, fields, ignore_case):
          """Yields all the package data for the given params. """
  
-@@ -1220,6 +1452,47 @@ class YumHistory:
+@@ -1220,6 +1454,47 @@ class YumHistory:
              tids.add(row[0])
          return tids
  
@@ -13899,7 +13996,7 @@ index 5385bd1..a9b12cf 100644
      _update_ops_2 = ['''\
  \
   CREATE TABLE trans_skip_pkgs (
-@@ -1374,6 +1647,8 @@ class YumHistory:
+@@ -1374,6 +1649,8 @@ class YumHistory:
              cur.execute(op)
          for op in self._update_ops_2:
              cur.execute(op)
@@ -13948,7 +14045,7 @@ index 9889bf6..85ad15e 100755
      '''
      Setup the yum translation domain and make _() and P_() translation wrappers
 diff --git a/yum/misc.py b/yum/misc.py
-index 2f6ddfe..37c572b 100644
+index 2f6ddfe..04490a6 100644
 --- a/yum/misc.py
 +++ b/yum/misc.py
 @@ -940,14 +940,16 @@ def unlink_f(filename):
@@ -13972,6 +14069,20 @@ index 2f6ddfe..37c572b 100644
  
  def _getloginuid():
      """ Get the audit-uid/login-uid, if available. None is returned if there
+@@ -1112,10 +1114,12 @@ def decompress(filename, dest=None, fn_only=False, check_timestamps=False):
+         if check_timestamps:
+             fi = stat_f(filename)
+             fo = stat_f(out)
+-            if fi and fo and fo.st_mtime > fi.st_mtime:
++            if fi and fo and fo.st_mtime == fi.st_mtime:
+                 return out
+ 
+         _decompress_chunked(filename, out, ztype)
++        if check_timestamps and fi:
++            os.utime(out, (fi.st_mtime, fi.st_mtime))
+         
+     return out
+     
 diff --git a/yum/packages.py b/yum/packages.py
 index 5ef9951..f72c068 100644
 --- a/yum/packages.py
@@ -14064,6 +14175,52 @@ index 5ef9951..f72c068 100644
          self.__mode_cache = {}
          self.__prcoPopulated = False
  
+diff --git a/yum/pgpmsg.py b/yum/pgpmsg.py
+index ee825c6..dae60c9 100644
+--- a/yum/pgpmsg.py
++++ b/yum/pgpmsg.py
+@@ -934,7 +934,8 @@ class pgp_certificate(object):
+         """load(pkts)
+ Initialize the pgp_certificate with a list of OpenPGP packets. The list of packets will
+ be scanned to make sure they are valid for a pgp certificate."""
+-        
++
++
+         # each certificate should begin with a public key packet
+         if pkts[0].pkt_typ != CTB_PKT_PK_CERT :
+             raise ValueError('first PGP packet should be a public-key packet, not %s' % map_to_str(ctb_pkt_to_str, pkts[0].pkt_typ))
+@@ -1093,6 +1094,16 @@ be scanned to make sure they are valid for a pgp certificate."""
+                         self.rvkd_subkeys.append(subkey)
+                     else :
+                         self.subkeys.append(subkey)
++                elif pkts[pkt_idx].pkt_typ == CTB_PKT_SIG :
++
++                    # ok, well at least the type is good, we'll assume the cert is
++                    # revoked
++                    self.revocations.append(pkts[pkt_idx])
++
++                    # increment the pkt_idx to go to the next one
++                    pkt_idx = pkt_idx + 1
++
++                
+                 else :
+                     break
+ 
+@@ -1234,7 +1245,6 @@ a PGP "certificate" includes a public key, user id(s), and signature.
+ 
+             # ok, the sum looks ok so we'll actually decode the thing
+             pkt_list = decode(cert_msg)
+-
+             # turn it into a real cert
+             cert_list = []
+             while len(pkt_list) > 0 :
+@@ -1283,5 +1293,5 @@ def decode_multiple_keys(msg):
+ 
+ if __name__ == '__main__' :
+     import sys
+-    for pgp_cert in decode_msg(open(sys.argv[1]).read()) :
++    for pgp_cert in decode_multiple_keys(open(sys.argv[1]).read()) :
+         print pgp_cert
 diff --git a/yum/plugins.py b/yum/plugins.py
 index bfc49b7..9ddcae6 100644
 --- a/yum/plugins.py
@@ -16732,3 +16889,80 @@ index 9f79f4f..4b1112a 100755
      errcode = None
      if 'YUM_PROF' in os.environ:
          if os.environ['YUM_PROF'] == 'cprof':
+commit aa1b063446d28a3ba002c12b255653a9a20a134c
+Author: James Antill <james at and.org>
+Date:   Fri Sep 16 16:56:11 2011 -0400
+
+    verifyTransaction progress, using rpmtrans.display.event() cb. BZ 737826.
+
+diff --git a/yum/__init__.py b/yum/__init__.py
+index 5fb7c00..2887f36 100644
+--- a/yum/__init__.py
++++ b/yum/__init__.py
+@@ -1654,10 +1654,10 @@ class YumBase(depsolve.Depsolve):
+         self.plugins.run('posttrans')
+         # sync up what just happened versus what is in the rpmdb
+         if not self.ts.isTsFlagSet(rpm.RPMTRANS_FLAG_TEST):
+-            self.verifyTransaction(resultobject)
++            self.verifyTransaction(resultobject, cb.display.event)
+         return resultobject
+ 
+-    def verifyTransaction(self, resultobject=None):
++    def verifyTransaction(self, resultobject=None, decb=None):
+         """Check that the transaction did what was expected, and 
+         propagate external yumdb information.  Output error messages
+         if the transaction did not do what was expected.
+@@ -1665,6 +1665,10 @@ class YumBase(depsolve.Depsolve):
+         :param resultobject: the :class:`yum.misc.GenericHolder`
+            object returned from the :func:`runTransaction` call that
+            ran the transaction
++        :param decb: the display event callback for the rpm transaction, we use
++           this to call "events" 
++           object returned from the :func:`runTransaction` call that
++           ran the transaction
+         """
+         # check to see that the rpmdb and the tsInfo roughly matches
+         # push package object metadata outside of rpmdb into yumdb
+@@ -1679,7 +1683,12 @@ class YumBase(depsolve.Depsolve):
+         
+         vt_st = time.time()
+         self.plugins.run('preverifytrans')
++        count = 0
+         for txmbr in self.tsInfo:
++            if decb is not None:
++                count += 1
++                decb(txmbr.name, 'verifying',
++                     count, len(self.tsInfo), count, len(self.tsInfo))
+             if txmbr.output_state in TS_INSTALL_STATES:
+                 if not self.rpmdb.contains(po=txmbr.po):
+                     # maybe a file log here, too
+diff --git a/yum/rpmtrans.py b/yum/rpmtrans.py
+index 9b265f9..4d468dc 100644
+--- a/yum/rpmtrans.py
++++ b/yum/rpmtrans.py
+@@ -77,6 +77,7 @@ class RPMBaseCallback:
+                         TS_OBSOLETED: _('Obsoleted'),
+                         TS_OBSOLETING: _('Installing'),
+                         TS_UPDATED: _('Cleanup'),
++                        'verifying': _('Verifying'),
+                         'repackaging': _('Repackaging')}
+         # The fileaction are not translated, most sane IMHO / Tim
+         self.fileaction = { TS_UPDATE: 'Updated', 
+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"""
diff --git a/yum.spec b/yum.spec
index 1753959..9c09879 100644
--- a/yum.spec
+++ b/yum.spec
@@ -18,7 +18,7 @@
 Summary: RPM package installer/updater/manager
 Name: yum
 Version: 3.4.3
-Release: 9%{?dist}
+Release: 10%{?dist}
 License: GPLv2+
 Group: System Environment/Base
 Source0: http://yum.baseurl.org/download/3.4/%{name}-%{version}.tar.gz
@@ -316,6 +316,14 @@ exit 0
 %endif
 
 %changelog
+* Tue Sep 21 2011 James Antill <james at fedoraproject.org> - 3.4.3-10
+- update to latest HEAD
+- Fix for history sync, and saving on install.
+- Lots of minor bug fixes.
+- Speedups for upgrade_requirements_on_install=true.
+- Fix generated data using bad caches.
+- Changes for yum-cron.
+
 * Tue Aug 23 2011 James Antill <james at fedoraproject.org> - 3.4.3-9
 - update to latest HEAD
 - Update translations.


More information about the scm-commits mailing list