[yum] update to latest HEAD Fix RepoStorage problem for pulp. Add list of not found packages. Minor bug fi

James Antill james at fedoraproject.org
Thu Jun 2 17:09:31 UTC 2011


commit 75c32bf111fd9aba47e87ecd0bd6ac6a64ca60da
Author: James Antill <james at and.org>
Date:   Thu Jun 2 13:09:07 2011 -0400

    update to latest HEAD
    Fix RepoStorage problem for pulp.
    Add list of not found packages.
    Minor bug fixes.

 yum-HEAD.patch |  588 +++++++++++++++++++++++++++++++++++++++++++++++++++++---
 yum.spec       |    8 +-
 2 files changed, 565 insertions(+), 31 deletions(-)
---
diff --git a/yum-HEAD.patch b/yum-HEAD.patch
index 99dd54c..e196b4c 100644
--- a/yum-HEAD.patch
+++ b/yum-HEAD.patch
@@ -1,7 +1,34 @@
 diff --git a/cli.py b/cli.py
-index 957c182..f4bd7b1 100644
+index 957c182..7ef147d 100644
 --- a/cli.py
 +++ b/cli.py
+@@ -448,7 +448,7 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
+         # 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.'))
+-            return 1
++            return -1
+ 
+         # NOTE: In theory we can skip this in -q -y mode, for a slight perf.
+         #       gain. But it's probably doom to have a different code path.
+@@ -495,7 +495,7 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
+         if self._promptWanted():
+             if not self.userconfirm():
+                 self.verbose_logger.info(_('Exiting on user Command'))
+-                return 1
++                return -1
+ 
+         self.verbose_logger.log(yum.logginglevels.INFO_2,
+             _('Downloading Packages:'))
+@@ -512,7 +512,7 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
+ 
+         # Check GPG signatures
+         if self.gpgsigcheck(downloadpkgs) != 0:
+-            return 1
++            return -1
+         
+         self.initActionTs()
+         # save our dsCallback out
 @@ -1143,17 +1143,23 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
          cb = self.matchcallback_verbose
          matching = self.searchPackageProvides(args, callback=cb,
@@ -254,10 +281,21 @@ index 31f0c83..f1e06e8 100644
  } &&
  complete -F _yum -o filenames yum yummain.py
 diff --git a/output.py b/output.py
-index cf541f8..71e4e24 100755
+index cf541f8..398dafa 100755
 --- a/output.py
 +++ b/output.py
-@@ -1367,6 +1367,14 @@ to exit.
+@@ -1048,7 +1048,9 @@ class YumOutput:
+             pkglist_lines.append((action, lines))
+ 
+         for (action, pkglist) in [(_('Skipped (dependency problems)'),
+-                                   self.skipped_packages),]:
++                                   self.skipped_packages),
++                                  (_('Not installed'), self._not_found_i.values()),
++                                  (_('Not available'), self._not_found_a.values())]:
+             lines = []
+             for po in pkglist:
+                 a_wid = _add_line(lines, data, a_wid, po)
+@@ -1367,6 +1369,14 @@ to exit.
          ''' Convert a user "TID" string of 2..4 into: (2, 4). '''
          def str2int(x):
              try:
@@ -272,7 +310,7 @@ index cf541f8..71e4e24 100755
                  return int(x)
              except ValueError:
                  return None
-@@ -1383,6 +1391,9 @@ to exit.
+@@ -1383,6 +1393,9 @@ to exit.
          if etid > old.tid:
              return None
  
@@ -129767,6 +129805,19 @@ index 0000000..1ca32df
 +#, python-format
 +msgid "Error opening rpm %s - error %s"
 +msgstr ""
+diff --git a/rpmUtils/arch.py b/rpmUtils/arch.py
+index 72cba60..6082005 100644
+--- a/rpmUtils/arch.py
++++ b/rpmUtils/arch.py
+@@ -359,6 +359,8 @@ def getBaseArch(myarch=None):
+         return "sparc"
+     elif myarch.startswith("ppc64"):
+         return "ppc"
++    elif myarch.startswith("arm"):
++        return "arm"
+         
+     if isMultiLibArch(arch=myarch):
+         if myarch in multilibArches:
 diff --git a/rpmUtils/miscutils.py b/rpmUtils/miscutils.py
 index cdb1cb6..aea4550 100644
 --- a/rpmUtils/miscutils.py
@@ -129782,11 +129833,48 @@ index cdb1cb6..aea4550 100644
  def checkSig(ts, package):
      """Takes a transaction set and a package, check it's sigs, 
      return 0 if they are all fine
+diff --git a/shell.py b/shell.py
+index 7eef413..999bffc 100644
+--- a/shell.py
++++ b/shell.py
+@@ -355,11 +355,13 @@ class YumShell(cmd.Cmd):
+                 if e.errno == 32:
+                     self.logger.critical('\n\nExiting on Broken Pipe')
+             else:
+-                if returnval not in [0,1]:
++                if returnval not in [0,1,-1]:
+                     self.verbose_logger.info('Transaction encountered a serious error.')
+                 else:
+                     if returnval == 1:
+                         self.verbose_logger.info('There were non-fatal errors in the transaction')
++                    elif returnval == -1:
++                        self.verbose_logger.info("Transaction didn't start")
+                     self.verbose_logger.log(logginglevels.INFO_2,
+                         'Finished Transaction')
+                 self.base.closeRpmDB()
 diff --git a/yum/__init__.py b/yum/__init__.py
-index 1291da9..61c71cf 100644
+index 1291da9..77c4d00 100644
 --- a/yum/__init__.py
 +++ b/yum/__init__.py
-@@ -726,7 +726,10 @@ class YumBase(depsolve.Depsolve):
+@@ -79,7 +79,7 @@ warnings.simplefilter("ignore", Errors.YumFutureDeprecationWarning)
+ 
+ from packages import parsePackages, comparePoEVR
+ from packages import YumAvailablePackage, YumLocalPackage, YumInstalledPackage
+-from packages import YumUrlPackage
++from packages import YumUrlPackage, YumNotFoundPackage
+ from constants import *
+ from yum.rpmtrans import RPMTransaction,SimpleCliCallBack
+ from yum.i18n import to_unicode, to_str
+@@ -182,6 +182,8 @@ class YumBase(depsolve.Depsolve):
+         self._tags = None
+         self._ts_save_file = None
+         self.skipped_packages = []   # packages skip by the skip-broken code
++        self._not_found_a = {}
++        self._not_found_i = {}
+         self.logger = logging.getLogger("yum.YumBase")
+         self.verbose_logger = logging.getLogger("yum.verbose.YumBase")
+         self._override_sigchecks = False
+@@ -726,7 +728,10 @@ class YumBase(depsolve.Depsolve):
          if self.conf.debuglevel >= 7:
              self._up.debug = 1
          
@@ -129798,7 +129886,7 @@ index 1291da9..61c71cf 100644
              obs_init = time.time()    
              #  Note: newest=True here is semi-required for repos. with multiple
              # versions. The problem is that if pkgA-2 _accidentally_ obsoletes
-@@ -997,6 +1000,10 @@ class YumBase(depsolve.Depsolve):
+@@ -997,6 +1002,10 @@ class YumBase(depsolve.Depsolve):
          if self.tsInfo.pkgSack is not None: # rm Transactions don't have pkgSack
              self.tsInfo.pkgSack.dropCachedData()
  
@@ -129809,7 +129897,7 @@ index 1291da9..61c71cf 100644
          txmbrs = []
          if rescode == 2 and self.conf.protected_multilib and self.arch.multilib:
              txmbrs = self.tsInfo.getMembersWithState(None, TS_INSTALL_STATES)
-@@ -1033,6 +1040,7 @@ class YumBase(depsolve.Depsolve):
+@@ -1033,6 +1042,7 @@ class YumBase(depsolve.Depsolve):
                  xrestring.append(msg % (first, other))
          if xrestring:
              rescode = 1
@@ -129817,7 +129905,7 @@ index 1291da9..61c71cf 100644
              restring = xrestring
  
          #  This is a version of the old "protect-packages" plugin, it allows
-@@ -1085,6 +1093,7 @@ class YumBase(depsolve.Depsolve):
+@@ -1085,6 +1095,7 @@ class YumBase(depsolve.Depsolve):
              for pkgname in sorted(bad_togo):
                  restring.append(_('Trying to remove "%s", which is protected') %
                                  pkgname)
@@ -129825,7 +129913,35 @@ index 1291da9..61c71cf 100644
  
          if rescode == 2:
              self.save_ts(auto=True)
-@@ -2688,9 +2697,7 @@ class YumBase(depsolve.Depsolve):
+@@ -1216,6 +1227,27 @@ class YumBase(depsolve.Depsolve):
+             return 1, orig_restring
+         return rescode, restring
+ 
++    def _add_not_found(self, pkgs, nevra_dict):
++        if pkgs:
++            return None
++
++        pkgtup = (nevra_dict['name'], nevra_dict['arch'],
++                  nevra_dict['epoch'], nevra_dict['version'],
++                  nevra_dict['release'])
++        if None in pkgtup:
++            return None
++        return pkgtup
++    def _add_not_found_a(self, pkgs, nevra_dict):
++        pkgtup = self._add_not_found(pkgs, nevra_dict)
++        if pkgtup is None:
++            return
++        self._not_found_a[pkgtup] = YumNotFoundPackage(pkgtup)
++    def _add_not_found_i(self, pkgs, nevra_dict):
++        pkgtup = self._add_not_found(pkgs, nevra_dict)
++        if pkgtup is None:
++            return
++        self._not_found_i[pkgtup] = YumNotFoundPackage(pkgtup)
++
+     def _checkMissingObsoleted(self):
+         """ 
+         If multiple packages is obsoleting the same package
+@@ -2688,9 +2720,7 @@ class YumBase(depsolve.Depsolve):
                  where = self.returnInstalledPackagesByDep(arg)
                  usedDepString = True
                  for po in where:
@@ -129836,7 +129952,71 @@ index 1291da9..61c71cf 100644
  
                      if len(tmpvalues) > 0:
                          if callback:
-@@ -3183,7 +3190,23 @@ class YumBase(depsolve.Depsolve):
+@@ -2775,7 +2805,7 @@ class YumBase(depsolve.Depsolve):
+         
+         thesegroups = self.comps.return_groups(grpid)
+         if not thesegroups:
+-            raise Errors.GroupsError, _("No Group named %s exists") % grpid
++            raise Errors.GroupsError, _("No Group named %s exists") % to_unicode(grpid)
+ 
+         for thisgroup in thesegroups:
+             thisgroup.toremove = True
+@@ -2794,7 +2824,7 @@ class YumBase(depsolve.Depsolve):
+ 
+         thesegroups = self.comps.return_groups(grpid)
+         if not thesegroups:
+-            raise Errors.GroupsError, _("No Group named %s exists") % grpid
++            raise Errors.GroupsError, _("No Group named %s exists") % to_unicode(grpid)
+ 
+         for thisgroup in thesegroups:
+             thisgroup.toremove = False
+@@ -2825,13 +2855,13 @@ class YumBase(depsolve.Depsolve):
+         """
+ 
+         if not self.comps.has_group(grpid):
+-            raise Errors.GroupsError, _("No Group named %s exists") % grpid
++            raise Errors.GroupsError, _("No Group named %s exists") % to_unicode(grpid)
+         
+         txmbrs_used = []
+         thesegroups = self.comps.return_groups(grpid)
+      
+         if not thesegroups:
+-            raise Errors.GroupsError, _("No Group named %s exists") % grpid
++            raise Errors.GroupsError, _("No Group named %s exists") % to_unicode(grpid)
+ 
+         package_types = self.conf.group_package_types
+         if group_package_types:
+@@ -2920,11 +2950,11 @@ class YumBase(depsolve.Depsolve):
+             in the group(s) are force removed from the transaction. """
+         
+         if not self.comps.has_group(grpid):
+-            raise Errors.GroupsError, _("No Group named %s exists") % grpid
++            raise Errors.GroupsError, _("No Group named %s exists") % to_unicode(grpid)
+             
+         thesegroups = self.comps.return_groups(grpid)
+         if not thesegroups:
+-            raise Errors.GroupsError, _("No Group named %s exists") % grpid
++            raise Errors.GroupsError, _("No Group named %s exists") % to_unicode(grpid)
+         
+         for thisgroup in thesegroups:
+             thisgroup.selected = False
+@@ -2966,6 +2996,7 @@ class YumBase(depsolve.Depsolve):
+         pkgs = self.pkgSack.searchPkgTuple(pkgtup)
+ 
+         if len(pkgs) == 0:
++            self._add_not_found_a(pkgs, pkgtup)
+             if allow_missing: #  This can happen due to excludes after .up has
+                 return None   # happened.
+             raise Errors.DepError, _('Package tuple %s could not be found in packagesack') % str(pkgtup)
+@@ -2987,6 +3018,7 @@ class YumBase(depsolve.Depsolve):
+ 
+         pkgs = self.rpmdb.searchPkgTuple(pkgtup)
+         if len(pkgs) == 0:
++            self._add_not_found_i(pkgs, pkgtup)
+             raise Errors.RpmDBError, _('Package tuple %s could not be found in rpmdb') % str(pkgtup)
+ 
+         # Dito. FIXME from getPackageObject() for len() > 1 ... :)
+@@ -3183,7 +3215,23 @@ class YumBase(depsolve.Depsolve):
      def _pkg2obspkg(self, po):
          """ Given a package return the package it's obsoleted by and so
              we should install instead. Or None if there isn't one. """
@@ -129861,7 +130041,16 @@ index 1291da9..61c71cf 100644
          if po.pkgtup in thispkgobsdict:
              obsoleting  = thispkgobsdict[po.pkgtup]
              oobsoleting = []
-@@ -3316,10 +3339,19 @@ class YumBase(depsolve.Depsolve):
+@@ -3288,7 +3336,7 @@ class YumBase(depsolve.Depsolve):
+ 
+         thesegroups = self.comps.return_groups(grpid)
+         if not thesegroups:
+-            raise Errors.GroupsError, _("No Group named %s exists") % grpid
++            raise Errors.GroupsError, _("No Group named %s exists") % to_unicode(grpid)
+         pkgnames = set()
+         for thisgroup in thesegroups:
+             pkgnames.update(thisgroup.packages)
+@@ -3316,10 +3364,19 @@ class YumBase(depsolve.Depsolve):
                      installed_pkg =  self.getInstalledPackageObject(inst_tup)
                      yield installed_pkg
          else:
@@ -129885,7 +130074,15 @@ index 1291da9..61c71cf 100644
  
      def _add_prob_flags(self, *flags):
          """ Add all of the passed flags to the tsInfo.probFilterFlags array. """
-@@ -3466,7 +3498,8 @@ class YumBase(depsolve.Depsolve):
+@@ -3387,6 +3444,7 @@ class YumBase(depsolve.Depsolve):
+                 pkgs = self.pkgSack.searchNevra(name=nevra_dict['name'],
+                      epoch=nevra_dict['epoch'], arch=nevra_dict['arch'],
+                      ver=nevra_dict['version'], rel=nevra_dict['release'])
++                self._add_not_found_a(pkgs, nevra_dict)
+                 
+             if pkgs:
+                 # if was_pattern or nevra-dict['arch'] is none, take the list
+@@ -3466,7 +3524,8 @@ class YumBase(depsolve.Depsolve):
                      continue
              
              # make sure this shouldn't be passed to update:
@@ -129895,7 +130092,7 @@ index 1291da9..61c71cf 100644
                  txmbrs = self.update(po=po)
                  tx_return.extend(txmbrs)
                  continue
-@@ -3474,7 +3507,9 @@ class YumBase(depsolve.Depsolve):
+@@ -3474,7 +3533,9 @@ class YumBase(depsolve.Depsolve):
              #  Make sure we're not installing a package which is obsoleted by
              # something else in the repo. Unless there is a obsoletion loop,
              # at which point ignore everything.
@@ -129906,7 +130103,7 @@ index 1291da9..61c71cf 100644
              if obsoleting_pkg is not None:
                  # this is not a definitive check but it'll make sure we don't
                  # pull in foo.i586 when foo.x86_64 already obsoletes the pkg and
-@@ -3543,8 +3578,9 @@ class YumBase(depsolve.Depsolve):
+@@ -3543,8 +3604,9 @@ class YumBase(depsolve.Depsolve):
                      break
              
              # it doesn't obsolete anything. If it does, mark that in the tsInfo, too
@@ -129918,7 +130115,42 @@ index 1291da9..61c71cf 100644
                      txmbr = self.tsInfo.addObsoleting(po, obsoletee)
                      self.tsInfo.addObsoleted(obsoletee, po)
                      tx_return.append(txmbr)
-@@ -5095,9 +5131,13 @@ class YumBase(depsolve.Depsolve):
+@@ -3723,6 +3785,7 @@ class YumBase(depsolve.Depsolve):
+                 availpkgs = self.pkgSack.searchNevra(name=nevra_dict['name'],
+                             epoch=nevra_dict['epoch'], arch=nevra_dict['arch'],
+                             ver=nevra_dict['version'], rel=nevra_dict['release'])
++                self._add_not_found_a(availpkgs, nevra_dict)
+                 if len(availpkgs) > 1:
+                     availpkgs = self._compare_providers(availpkgs, requiringPo)
+                     availpkgs = map(lambda x: x[0], availpkgs)
+@@ -3913,7 +3976,7 @@ class YumBase(depsolve.Depsolve):
+                 pkgs = self.rpmdb.searchNevra(name=nevra_dict['name'], 
+                             epoch=nevra_dict['epoch'], arch=nevra_dict['arch'], 
+                             ver=nevra_dict['version'], rel=nevra_dict['release'])
+-
++                self._add_not_found_i(pkgs, nevra_dict)
+                 if len(pkgs) == 0:
+                     if not kwargs.get('silence_warnings', False):
+                         self.logger.warning(_("No package matched to remove"))
+@@ -4232,6 +4295,8 @@ class YumBase(depsolve.Depsolve):
+                                              arch=nevra_dict['arch'], 
+                                              ver=nevra_dict['version'],
+                                              rel=nevra_dict['release'])
++            self._add_not_found_a(apkgs, nevra_dict)
++
+         if not apkgs:
+             # Do we still want to return errors here?
+             # We don't in the cases below, so I didn't here...
+@@ -4455,7 +4520,7 @@ class YumBase(depsolve.Depsolve):
+         try:
+             url = misc.to_utf8(keyurl)
+             if repo is None:
+-                opts = {limit:9999}
++                opts = {'limit':9999}
+                 text = 'global/gpgkey'
+             else:
+                 #  If we have a repo. use the proxy etc. configuration for it.
+@@ -5095,9 +5160,13 @@ class YumBase(depsolve.Depsolve):
          
          msg = "%s\n" % self.rpmdb.simpleVersion(main_only=True)[0]
          msg += "%s\n" % self.ts.getTsFlags()
@@ -129935,8 +130167,34 @@ index 1291da9..61c71cf 100644
          msg += "%s\n" % len(self.tsInfo.getMembers())
          for txmbr in self.tsInfo.getMembers():
              msg += txmbr._dump()
+diff --git a/yum/misc.py b/yum/misc.py
+index 8e81c34..2f6ddfe 100644
+--- a/yum/misc.py
++++ b/yum/misc.py
+@@ -945,7 +945,7 @@ def stat_f(filename):
+     try:
+         return os.stat(filename)
+     except OSError, e:
+-        if e.errno != errno.ENOENT:
++        if e.errno not in (errno.ENOENT, errno.ENOTDIR):
+             raise
+         return None
+ 
+@@ -998,7 +998,11 @@ def setup_locale(override_codecs=True, override_time=False):
+ 
+ 
+ def get_my_lang_code():
+-    mylang = locale.getlocale(locale.LC_MESSAGES)
++    try:
++        mylang = locale.getlocale(locale.LC_MESSAGES)
++    except ValueError, e:
++        # This is RHEL-5 python crack, Eg. en_IN can't be parsed properly
++        mylang = (None, None)
+     if mylang == (None, None): # odd :)
+         mylang = 'C'
+     else:
 diff --git a/yum/packages.py b/yum/packages.py
-index 264aa9a..95c50a1 100644
+index 264aa9a..0d16293 100644
 --- a/yum/packages.py
 +++ b/yum/packages.py
 @@ -31,11 +31,12 @@ import warnings
@@ -129953,7 +130211,60 @@ index 264aa9a..95c50a1 100644
  
  import urlparse
  urlparse.uses_fragment.append("media")
-@@ -1139,7 +1140,10 @@ class YumAvailablePackage(PackageObject, RpmBase):
+@@ -273,6 +274,15 @@ class PackageObject(object):
+     def __str__(self):
+         return self.ui_envra
+ 
++    def printVer(self):
++        """returns a printable version string - including epoch, if it's set"""
++        if self.epoch != '0':
++            ver = '%s:%s-%s' % (self.epoch, self.version, self.release)
++        else:
++            ver = '%s-%s' % (self.version, self.release)
++
++        return ver
++
+     def verCMP(self, other):
+         """ Compare package to another one, only rpm-version ordering. """
+         if not other:
+@@ -353,6 +363,36 @@ class PackageObject(object):
+             if csumid:
+                 return (csumtype, csum)
+ 
++
++_not_found_repo = FakeRepository('-')
++_not_found_repo.cost = 0
++class YumNotFoundPackage(PackageObject):
++
++    def __init__(self, pkgtup):
++        self.name    = pkgtup[0]
++        self.arch    = pkgtup[1]
++        self.epoch   = pkgtup[2]
++        self.version = pkgtup[3]
++        self.release = pkgtup[4]
++        self.pkgtup  = pkgtup
++
++        self.size = 0
++        self._checksums = [] # (type, checksum, id(0,1)
++
++        self.repo = _not_found_repo
++        self.repoid = _not_found_repo.id
++
++    # Fakeout output.py that it's a real pkg. ...
++    def _ui_from_repo(self):
++        """ This just returns '-' """
++        return self.repoid
++    ui_from_repo = property(fget=lambda self: self._ui_from_repo())
++
++    def verifyLocalPkg(self):
++        """check the package checksum vs the localPkg
++           return True if pkg is good, False if not"""
++        return False
++
+ #  This is the virtual base class of actual packages, it basically requires a
+ # repo. even though it doesn't set one up in it's __init__. It also doesn't have
+ # PackageObject methods ... so is basically unusable on it's own
+@@ -1139,7 +1179,10 @@ class YumAvailablePackage(PackageObject, RpmBase):
          if hasattr(self, '_collapse_libc_requires') and self._collapse_libc_requires:
              libc_requires = filter(lambda x: x[0].startswith('libc.so.6'), mylist)
              if libc_requires:
@@ -129965,11 +130276,219 @@ index 264aa9a..95c50a1 100644
                  newlist = []
                  for i in mylist:
                      if i[0].startswith('libc.so.6') and i != best:
+diff --git a/yum/repos.py b/yum/repos.py
+index 4ea4961..3793bad 100644
+--- a/yum/repos.py
++++ b/yum/repos.py
+@@ -110,7 +110,12 @@ class RepoStorage:
+             repoobj.quick_enable_disable = self.quick_enable_disable
+         else:
+             self._cache_enabled_repos = None
+-        repoobj._override_sigchecks = self.ayum._override_sigchecks
++        #  At least pulp reuses RepoStorage but doesn't have a "real" YumBase()
++        # so we can't guarantee new YumBase() attrs. exist.
++        if not hasattr(self.ayum, '_override_sigchecks'):
++            repoobj._override_sigchecks = False
++        else:
++            repoobj._override_sigchecks = self.ayum._override_sigchecks
+ 
+     def delete(self, repoid):
+         if repoid in self.repos:
+diff --git a/yum/rpmtrans.py b/yum/rpmtrans.py
+index 08bf99d..6687080 100644
+--- a/yum/rpmtrans.py
++++ b/yum/rpmtrans.py
+@@ -272,21 +272,58 @@ class RPMTransaction:
+         else:
+             return (None, None)
+ 
++    def _fn_rm_installroot(self, filename):
++        """ Remove the installroot from the filename. """
++        # to handle us being inside a chroot at this point
++        # we hand back the right path to those 'outside' of the chroot() calls
++        # but we're using the right path inside.
++        if self.base.conf.installroot == '/':
++            return filename
++
++        return filename.replace(os.path.normpath(self.base.conf.installroot),'')
++
++    def ts_done_open(self):
++        """ Open the transaction done file, must be started outside the
++            chroot. """
++
++        if self.test: return False
++
++        if hasattr(self, '_ts_done'):
++            return True
++
++        self.ts_done_fn = '%s/transaction-done.%s' % (self.base.conf.persistdir,
++                                                      self._ts_time)
++        ts_done_fn = self._fn_rm_installroot(self.ts_done_fn)
++
++        try:
++            self._ts_done = open(ts_done_fn, 'w')
++        except (IOError, OSError), e:
++            self.display.errorlog('could not open ts_done file: %s' % e)
++            self._ts_done = None
++            return False
++        self._fdSetCloseOnExec(self._ts_done.fileno())
++        return True
++
++    def ts_done_write(self, msg):
++        """ Write some data to the transaction done file. """
++        if self._ts_done is None:
++            return
++
++        try:
++            self._ts_done.write(msg)
++            self._ts_done.flush()
++        except (IOError, OSError), e:
++            #  Having incomplete transactions is probably worse than having
++            # nothing.
++            self.display.errorlog('could not write to ts_done file: %s' % e)
++            self._ts_done = None
++            misc.unlink_f(self.ts_done_fn)
++
+     def ts_done(self, package, action):
+         """writes out the portions of the transaction which have completed"""
+         
+-        if self.test: return
++        if not self.ts_done_open(): return
+     
+-        if not hasattr(self, '_ts_done'):
+-            self.ts_done_fn = '%s/transaction-done.%s' % (self.base.conf.persistdir, self._ts_time)
+-            
+-            try:
+-                self._ts_done = open(self.ts_done_fn, 'w')
+-            except (IOError, OSError), e:
+-                self.display.errorlog('could not open ts_done file: %s' % e)
+-                return
+-            self._fdSetCloseOnExec(self._ts_done.fileno())
+-        
+         # walk back through self._te_tuples
+         # make sure the package and the action make some kind of sense
+         # write it out and pop(0) from the list
+@@ -322,14 +359,7 @@ class RPMTransaction:
+         # hope springs eternal that this isn't wrong
+         msg = '%s %s:%s-%s-%s.%s\n' % (t,e,n,v,r,a)
+ 
+-        try:
+-            self._ts_done.write(msg)
+-            self._ts_done.flush()
+-        except (IOError, OSError), e:
+-            #  Having incomplete transactions is probably worse than having
+-            # nothing.
+-            del self._ts_done
+-            misc.unlink_f(self.ts_done_fn)
++        self.ts_done_write(msg)
+         self._te_tuples.pop(0)
+     
+     def ts_all(self):
+@@ -361,17 +391,15 @@ class RPMTransaction:
+         self._ts_time = time.strftime('%Y-%m-%d.%H:%M.%S')
+         tsfn = '%s/transaction-all.%s' % (self.base.conf.persistdir, self._ts_time)
+         self.ts_all_fn = tsfn
+-        # to handle us being inside a chroot at this point
+-        # we hand back the right path to those 'outside' of the chroot() calls
+-        # but we're using the right path inside.
+-        if self.base.conf.installroot != '/':
+-            tsfn = tsfn.replace(os.path.normpath(self.base.conf.installroot),'')
++        tsfn = self._fn_rm_installroot(tsfn)
++
+         try:
+             if not os.path.exists(os.path.dirname(tsfn)):
+                 os.makedirs(os.path.dirname(tsfn)) # make the dir,
+             fo = open(tsfn, 'w')
+         except (IOError, OSError), e:
+             self.display.errorlog('could not open ts_all file: %s' % e)
++            self._ts_done = None
+             return
+ 
+         try:
+@@ -383,7 +411,9 @@ class RPMTransaction:
+         except (IOError, OSError), e:
+             #  Having incomplete transactions is probably worse than having
+             # nothing.
++            self.display.errorlog('could not write to ts_all file: %s' % e)
+             misc.unlink_f(tsfn)
++            self._ts_done = None
+ 
+     def callback( self, what, bytes, total, h, user ):
+         if what == rpm.RPMCALLBACK_TRANS_START:
+@@ -424,6 +454,7 @@ class RPMTransaction:
+         if self.test: return
+         self.trans_running = True
+         self.ts_all() # write out what transaction will do
++        self.ts_done_open()
+ 
+     def _transProgress(self, bytes, total, h):
+         pass
+diff --git a/yum/transactioninfo.py b/yum/transactioninfo.py
+index b0c7ddd..4d89d83 100644
+--- a/yum/transactioninfo.py
++++ b/yum/transactioninfo.py
+@@ -104,6 +104,7 @@ class TransactionData:
+         self.depupdated = []
+         self.reinstalled = []
+         self.downgraded = []
++        self.failed = []
+         
+     def __len__(self):
+         return len(self.pkgdict)
+diff --git a/yum/yumRepo.py b/yum/yumRepo.py
+index 6ba058c..e5e9ece 100644
+--- a/yum/yumRepo.py
++++ b/yum/yumRepo.py
+@@ -430,9 +430,10 @@ class YumRepository(Repository, config.RepoConf):
+ 
+         self._proxy_dict = {} # zap it
+         proxy_string = None
+-        if self.proxy not in [None, '_none_']:
++        empty = (None, '_none_', '')
++        if self.proxy not in empty:
+             proxy_string = '%s' % self.proxy
+-            if self.proxy_username is not None:
++            if self.proxy_username not in empty:
+                 proxy_parsed = urlparse.urlsplit(self.proxy, allow_fragments=0)
+                 proxy_proto = proxy_parsed[0]
+                 proxy_host = proxy_parsed[1]
+@@ -445,7 +446,7 @@ class YumRepository(Repository, config.RepoConf):
+                 proxy_string = '%s://%s@%s%s' % (proxy_proto,
+                         self.proxy_username, proxy_host, proxy_rest)
+ 
+-                if self.proxy_password is not None:
++                if self.proxy_password not in empty:
+                     proxy_string = '%s://%s:%s@%s%s' % (proxy_proto,
+                               self.proxy_username, self.proxy_password,
+                               proxy_host, proxy_rest)
+@@ -1067,6 +1068,14 @@ class YumRepository(Repository, config.RepoConf):
+ 
+     def _revertOldRepoXML(self):
+         """ If we have older data available, revert to it. """
++
++        #  If we can't do a timestamp check, then we can be looking at a
++        # completely different repo. from last time ... ergo. we can't revert.
++        #  We still want the old data, so we don't download twice. So we
++        # pretend everything is good until the revert.
++        if not self.timestamp_check:
++            raise Errors.RepoError, "Can't download or revert repomd.xml"
++
+         if 'old_repo_XML' not in self._oldRepoMDData:
+             self._oldRepoMDData = {}
+             return
 diff --git a/yumcommands.py b/yumcommands.py
-index d3014c5..a950011 100644
+index d3014c5..baf5e93 100644
 --- a/yumcommands.py
 +++ b/yumcommands.py
-@@ -158,7 +158,7 @@ class YumCommand:
+@@ -71,6 +71,7 @@ will install it for you.
+ For more information contact your distribution or package provider.
+ """)
+                 base.logger.critical(msg)
++                base.logger.critical(_("Problem repository: %s"), repo)
+                 raise cli.CliError
+ 
+ def checkPackageArg(base, basecmd, extcmds):
+@@ -158,7 +159,7 @@ class YumCommand:
  
      def doneCommand(self, base, msg, *args):
          if not self.done_command_once:
@@ -129978,7 +130497,7 @@ index d3014c5..a950011 100644
          self.done_command_once = True
  
      def getNames(self):
-@@ -1017,6 +1017,10 @@ class RepoListCommand(YumCommand):
+@@ -1017,6 +1018,10 @@ class RepoListCommand(YumCommand):
                          out += [base.fmtKeyValFill(_("Repo-excluded: "),
                                                     ui_excludes_num)]
  
@@ -129989,7 +130508,7 @@ index d3014c5..a950011 100644
                      base.verbose_logger.log(logginglevels.DEBUG_3,
                                              "%s\n",
                                              "\n".join(map(misc.to_unicode, out)))
-@@ -1056,14 +1060,14 @@ class RepoListCommand(YumCommand):
+@@ -1056,14 +1061,14 @@ class RepoListCommand(YumCommand):
              txt_rid  = utf8_width_fill(_('repo id'), id_len)
              txt_rnam = utf8_width_fill(_('repo name'), nm_len, nm_len)
              if arg == 'disabled': # Don't output a status column.
@@ -130007,7 +130526,7 @@ index d3014c5..a950011 100644
                                              utf8_width_fill(rid, id_len),
                                              utf8_width_fill(rname, nm_len,
                                                              nm_len))
-@@ -1071,7 +1075,7 @@ class RepoListCommand(YumCommand):
+@@ -1071,7 +1076,7 @@ class RepoListCommand(YumCommand):
  
                  if ui_num:
                      ui_num = utf8_width_fill(ui_num, ui_len, left=False)
@@ -130016,7 +130535,7 @@ index d3014c5..a950011 100644
                                          utf8_width_fill(rid, id_len),
                                          utf8_width_fill(rname, nm_len, nm_len),
                                          ui_enabled, ui_num)
-@@ -1140,8 +1144,7 @@ class HelpCommand(YumCommand):
+@@ -1140,8 +1145,7 @@ class HelpCommand(YumCommand):
      def doCommand(self, base, basecmd, extcmds):
          if extcmds[0] in base.yum_cli_commands:
              command = base.yum_cli_commands[extcmds[0]]
@@ -130026,7 +130545,7 @@ index d3014c5..a950011 100644
          return 0, []
  
      def needTs(self, base, basecmd, extcmds):
-@@ -1350,7 +1353,7 @@ class HistoryCommand(YumCommand):
+@@ -1350,7 +1354,7 @@ class HistoryCommand(YumCommand):
          return ['history']
  
      def getUsage(self):
@@ -130035,7 +130554,7 @@ index d3014c5..a950011 100644
  
      def getSummary(self):
          return _("Display, or use, the transaction history")
-@@ -1375,11 +1378,52 @@ class HistoryCommand(YumCommand):
+@@ -1375,11 +1379,52 @@ class HistoryCommand(YumCommand):
          if base.history_undo(old):
              return 2, ["Undoing transaction %u" % (old.tid,)]
  
@@ -130088,7 +130607,7 @@ index d3014c5..a950011 100644
                  'addon', 'addon-info',
                  'pkg', 'pkgs', 'pkg-list', 'pkgs-list',
                  'package', 'package-list', 'packages', 'packages-list')
-@@ -1387,7 +1431,7 @@ class HistoryCommand(YumCommand):
+@@ -1387,7 +1432,7 @@ class HistoryCommand(YumCommand):
              base.logger.critical(_('Invalid history sub-command, use: %s.'),
                                   ", ".join(cmds))
              raise cli.CliError
@@ -130097,7 +130616,7 @@ index d3014c5..a950011 100644
              checkRootUID(base)
              checkGPGKey(base)
          elif not os.access(base.history._db_file, os.R_OK):
-@@ -1415,6 +1459,8 @@ class HistoryCommand(YumCommand):
+@@ -1415,6 +1460,8 @@ class HistoryCommand(YumCommand):
              ret = self._hcmd_undo(base, extcmds)
          elif vcmd in ('redo', 'repeat'):
              ret = self._hcmd_redo(base, extcmds)
@@ -130106,7 +130625,7 @@ index d3014c5..a950011 100644
          elif vcmd == 'new':
              ret = self._hcmd_new(base, extcmds)
  
-@@ -1426,7 +1472,7 @@ class HistoryCommand(YumCommand):
+@@ -1426,7 +1473,7 @@ class HistoryCommand(YumCommand):
          vcmd = 'list'
          if extcmds:
              vcmd = extcmds[0]
@@ -130116,7 +130635,7 @@ index d3014c5..a950011 100644
  
  class CheckRpmdbCommand(YumCommand):
 diff --git a/yummain.py b/yummain.py
-index 1b94153..ea85926 100755
+index 1b94153..e3efd10 100755
 --- a/yummain.py
 +++ b/yummain.py
 @@ -189,9 +189,10 @@ def main(args):
@@ -130133,3 +130652,12 @@ index 1b94153..ea85926 100755
          if unlock(): return 200
          return 1
      elif result == 2:
+@@ -227,6 +228,8 @@ def main(args):
+         return_code = result
+         if base._ts_save_file:
+             verbose_logger.info(_("Your transaction was saved, rerun it with: yum load-transaction %s") % base._ts_save_file)
++    elif return_code < 0:
++        return_code = 1 # Means the pre-transaction checks failed...
+     else:
+         verbose_logger.log(logginglevels.INFO_2, _('Complete!'))
+ 
diff --git a/yum.spec b/yum.spec
index 1694004..c3fff79 100644
--- a/yum.spec
+++ b/yum.spec
@@ -7,7 +7,7 @@
 Summary: RPM package installer/updater/manager
 Name: yum
 Version: 3.4.1
-Release: 3%{?dist}
+Release: 4%{?dist}
 License: GPLv2+
 Group: System Environment/Base
 Source0: http://yum.baseurl.org/download/3.4/%{name}-%{version}.tar.gz
@@ -246,6 +246,12 @@ exit 0
 %config(noreplace) %{_sysconfdir}/sysconfig/yum-cron
 
 %changelog
+* Thu Jun  2 2011 James Antill <james at fedoraproject.org> - 3.4.1-4
+- update to latest HEAD
+- Fix RepoStorage problem for pulp.
+- Add list of not found packages.
+- Minor bug fixes.
+
 * Tue May 24 2011 James Antill <james at fedoraproject.org> - 3.4.1-3
 - update to latest HEAD
 - Tweak "yum provides"


More information about the scm-commits mailing list