[yum/f18] update to latest HEAD.

James Antill james at fedoraproject.org
Fri Aug 10 20:10:54 UTC 2012


commit d5b7fb97da76801ee636c7a37302b858cb98619b
Author: James Antill <james at and.org>
Date:   Fri Aug 10 16:10:38 2012 -0400

    update to latest HEAD.
    
    - Big update, mostly for "environment groups".

 yum-HEAD.patch | 2414 ++++++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 1990 insertions(+), 424 deletions(-)
---
diff --git a/yum-HEAD.patch b/yum-HEAD.patch
index e1b3d73..5eda0fc 100644
--- a/yum-HEAD.patch
+++ b/yum-HEAD.patch
@@ -96,7 +96,7 @@ index 2f6154e..2e5a052 100644
 diff --git a/cli.py b/cli.py
 old mode 100644
 new mode 100755
-index 6056d38..597efd6
+index 6056d38..8f8fdf9
 --- a/cli.py
 +++ b/cli.py
 @@ -25,7 +25,7 @@ import sys
@@ -253,6 +253,18 @@ index 6056d38..597efd6
          except ValueError, e:
              self.logger.critical(_('Options Error: %s'), e)
              sys.exit(1)
+@@ -290,9 +324,9 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
+                                    self.term.MODE['normal'])
+                 print _("  Installed: %s-%s at %s") %(name, ver,
+                                                    sm_ui_time(pkg.installtime))
+-                print _("  Built    : %s at %s") % (pkg.packager,
++                print _("  Built    : %s at %s") % (to_unicode(pkg.packager),
+                                                     sm_ui_time(pkg.buildtime))
+-                print _("  Committed: %s at %s") % (pkg.committer,
++                print _("  Committed: %s at %s") % (to_unicode(pkg.committer),
+                                                     sm_ui_date(pkg.committime))
+             sys.exit(0)
+ 
 @@ -318,9 +352,11 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
          time.sleep(sleeptime)
          
@@ -494,7 +506,7 @@ index 6056d38..597efd6
          # get the list of available packages
          # iterate over the user's list
          # add packages to Transaction holding class if they match.
-@@ -710,11 +822,26 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
+@@ -710,11 +822,36 @@ 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))):
@@ -509,12 +521,22 @@ index 6056d38..597efd6
 +                elif basecmd == 'install-n':
 +                    txmbrs = self.install(name=arg)
 +                elif basecmd == 'install-na':
-+                    n,a = arg.split('.')
++                    try:
++                        n,a = arg.rsplit('.', 1)
++                    except:
++                        self.verbose_logger.warning(_('Bad %s argument %s.'),
++                                                    basecmd, arg)
++                        continue
 +                    txmbrs = self.install(name=n, arch=a)
 +                elif basecmd == 'install-nevra':
-+                    nevr,a = arg.rsplit('.', 2)
-+                    n,ev,r = nevr.rsplit('-', 3)
-+                    e,v    = ev.split(':', 2)
++                    try:
++                        nevr,a = arg.rsplit('.', 1)
++                        n,ev,r = nevr.rsplit('-', 2)
++                        e,v    = ev.split(':', 1)
++                    except:
++                        self.verbose_logger.warning(_('Bad %s argument %s.'),
++                                                    basecmd, arg)
++                        continue
 +                    txmbrs = self.install(name=n,
 +                                          epoch=e, version=v, release=r, arch=a)
 +                else:
@@ -523,7 +545,7 @@ index 6056d38..597efd6
              except yum.Errors.InstallError:
                  self.verbose_logger.log(yum.logginglevels.INFO_2,
                                          _('No package %s%s%s available.'),
-@@ -723,6 +850,7 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
+@@ -723,6 +860,7 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
                  self._maybeYouMeant(arg)
              else:
                  done = True
@@ -531,7 +553,7 @@ index 6056d38..597efd6
          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 +860,27 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
+@@ -732,9 +870,27 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
          return 0, [_('Nothing to do')]
          
      def updatePkgs(self, userlist, quiet=0, update_to=False):
@@ -562,7 +584,7 @@ index 6056d38..597efd6
          # 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 +891,18 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
+@@ -745,21 +901,18 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
  
          else:
              # go through the userlist - look for items that are local rpms. If we find them
@@ -593,7 +615,7 @@ index 6056d38..597efd6
  
          if len(self.tsInfo) > oldcount:
              change = len(self.tsInfo) - oldcount
-@@ -770,9 +913,24 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
+@@ -770,9 +923,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):
@@ -621,7 +643,7 @@ index 6056d38..597efd6
  
          level = 'diff'
          if userlist and userlist[0] in ('full', 'diff', 'different'):
-@@ -831,6 +989,7 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
+@@ -831,6 +999,7 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
                          continue
  
                      nayi = napkg.yumdb_info
@@ -629,14 +651,16 @@ index 6056d38..597efd6
                      for apkg in self.pkgSack.searchPkgTuple(napkg.pkgtup):
                          if ('checksum_type' in nayi and
                              'checksum_data' in nayi and
-@@ -866,10 +1025,19 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
+@@ -865,15 +1034,54 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
+         else:
              return 0, [_('No Packages marked for Distribution Synchronization')]
  
-     def erasePkgs(self, userlist):
+-    def erasePkgs(self, userlist):
 -        """take user commands and populate a transaction wrapper with packages
 -           to be erased/removed"""
 -        
 -        oldcount = len(self.tsInfo)
++    def erasePkgs(self, userlist, pos=False, basecmd='remove'):
 +        """Take user commands and populate a transaction wrapper with
 +        packages to be erased.
 +
@@ -653,7 +677,42 @@ index 6056d38..597efd6
  
          all_rms = []
          for arg in userlist:
-@@ -884,12 +1052,24 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
+-            rms = self.remove(pattern=arg)
++            if pos:
++                rms = self.remove(po=arg)
++                if rms:
++                    all_rms.extend(rms)
++                continue
++
++            if False: pass
++            elif basecmd in ('erase-n', 'remove-n'):
++                rms = self.remove(name=arg)
++            elif basecmd in ('erase-na', 'remove-na'):
++                try:
++                    n,a = arg.rsplit('.', 1)
++                except:
++                    self.verbose_logger.warning(_('Bad %s argument %s.'),
++                                                basecmd, arg)
++                    continue
++                rms = self.remove(name=n, arch=a)
++            elif basecmd in ('erase-nevra', 'remove-nevra'):
++                try:
++                    nevr,a = arg.rsplit('.', 1)
++                    n,ev,r = nevr.rsplit('-', 2)
++                    e,v    = ev.split(':', 1)
++                except:
++                    self.verbose_logger.warning(_('Bad %s argument %s.'),
++                                                basecmd, arg)
++                    continue
++                rms = self.remove(name=n, epoch=e, version=v, release=r, arch=a)
++            else:
++                assert basecmd in ('erase', 'remove'), basecmd
++                rms = self.remove(pattern=arg)
++
+             if not rms:
+                 self._checkMaybeYouMeant(arg, always_output=False, rpmdb_only=True)
+             all_rms.extend(rms)
+@@ -884,12 +1092,24 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
              return 0, [_('No Packages marked for removal')]
      
      def downgradePkgs(self, userlist):
@@ -681,7 +740,7 @@ index 6056d38..597efd6
          for arg in userlist:
              if (arg.endswith('.rpm') and (yum.misc.re_remote_url(arg) or
                                            os.path.exists(arg))):
-@@ -905,26 +1085,44 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
+@@ -905,26 +1125,44 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
                                          self.term.MODE['bold'], arg,
                                          self.term.MODE['normal'])
                  self._maybeYouMeant(arg)
@@ -730,7 +789,7 @@ index 6056d38..597efd6
              except yum.Errors.ReinstallRemoveError:
                  self._checkMaybeYouMeant(arg, always_output=False)
              except yum.Errors.ReinstallInstallError, e:
-@@ -940,15 +1138,31 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
+@@ -940,15 +1178,31 @@ 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)
@@ -765,7 +824,7 @@ index 6056d38..597efd6
          # 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 +1186,25 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
+@@ -972,20 +1226,25 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
          return 0, [_('Nothing to do')]
  
      def returnPkgLists(self, extcmds, installed_available=False):
@@ -805,7 +864,7 @@ index 6056d38..597efd6
          special = ['available', 'installed', 'all', 'extras', 'updates', 'recent',
                     'obsoletes']
          
-@@ -1017,8 +1236,25 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
+@@ -1017,8 +1276,25 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
          return ypl
  
      def search(self, args):
@@ -833,7 +892,7 @@ index 6056d38..597efd6
          
          # call the yum module search function with lists of tags to search
          # and what to search for
-@@ -1108,9 +1344,20 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
+@@ -1108,9 +1384,20 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
          return 0, matching
  
      def deplist(self, args):
@@ -842,13 +901,13 @@ index 6056d38..597efd6
 +        """Print out a formatted list of dependencies for a list of
 +        packages.  This is a cli wrapper method for
 +        :class:`yum.YumBase.findDeps`.
-+
+ 
 +        :param args: a list of names or wildcards specifying packages
 +           that should have their dependenices printed
 +        :return: (exit_code, [ errors ])
 +
 +        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
@@ -856,7 +915,7 @@ index 6056d38..597efd6
          pkgs = []
          for arg in args:
              if (arg.endswith('.rpm') and (yum.misc.re_remote_url(arg) or
-@@ -1131,10 +1378,19 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
+@@ -1131,10 +1418,19 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
          return 0, []
  
      def provides(self, args):
@@ -880,7 +939,7 @@ index 6056d38..597efd6
          old_sdup = self.conf.showdupesfromrepos
          # For output, as searchPackageProvides() is always in showdups mode
          self.conf.showdupesfromrepos = True
-@@ -1147,6 +1403,8 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
+@@ -1147,6 +1443,8 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
              paths = set(sys.path + os.environ['PATH'].split(':'))
              nargs = []
              for arg in args:
@@ -889,7 +948,7 @@ index 6056d38..597efd6
                  if yum.misc.re_filename(arg) or yum.misc.re_glob(arg):
                      continue
                  for path in paths:
-@@ -1163,20 +1421,77 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
+@@ -1163,20 +1461,77 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
          return 0, []
      
      def resolveDepCli(self, args):
@@ -972,13 +1031,14 @@ index 6056d38..597efd6
          hdrcode = pkgcode = xmlcode = dbcode = expccode = 0
          pkgresults = hdrresults = xmlresults = dbresults = expcresults = []
          msg = self.fmtKeyValFill(_('Cleaning repos: '), 
-@@ -1228,7 +1543,19 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
+@@ -1228,130 +1583,248 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
          return code, []
  
      def returnGroupLists(self, userlist):
 +        """Print out a list of groups that match the given names or
 +        wildcards.
  
+-        uservisible=1
 +        :param extcmds: a list of names or wildcards specifying
 +           groups to list
 +        :return: (exit_code, [ errors ])
@@ -989,61 +1049,256 @@ index 6056d38..597efd6
 +            1 = we've errored, exit with error string
 +            2 = we've got work yet to do, onto the next stage        
 +        """
-         uservisible=1
++        return self._returnGroupLists(userlist)
++
++    def _returnGroupLists(self, userlist, summary=False):
++        # What data are we showing...
++        wts_map = {'hidden' : 'hidden',
++                   'language' : 'lang',
++                   'languages' : 'lang',
++                   'lang' : 'lang',
++                   'langs' : 'lang',
++                   'environment' : 'env',
++                   'environments' : 'env',
++                   'env' : 'env',
++                   'envs' : 'env',
++                   'package' : 'pkg',
++                   'packages' : 'pkg',
++                   'pkg' : 'pkg',
++                   'pkgs' : 'pkg',
++                   'available' : 'avail',
++                   'avail' : 'avail',
++                   'installed' : 'inst',
++                   'inst' : 'inst',
++                   'id' : 'id',
++                   'ids' : 'id',
++                   }
++        verb = self.verbose_logger.isEnabledFor(yum.logginglevels.DEBUG_3)
++        wts = {'hidden' : False,
++               'lang'   : False,
++               'env'    : True,
++               'pkg'    : True,
++               'inst'   : True,
++               'avail'  : True,
++               'id'     : verb}
              
-         if len(userlist) > 0:
-@@ -1254,7 +1581,7 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
-                 msg += ' (%s)' % group.groupid
-             if group.langonly:
-                 msg += ' [%s]' % group.langonly
+-        if len(userlist) > 0:
+-            if userlist[0] == 'hidden':
+-                uservisible=0
+-                userlist.pop(0)
++        while userlist:
++            arg = userlist[0]
++            val = True
++            if arg.startswith('no'):
++                arg = arg[2:]
++                val = False
++            if arg not in wts_map:
++                break
++            wts[wts_map[arg]] = val
++            userlist.pop(0)
+         if not userlist:
+             userlist = None # Match everything...
+ 
+-        installed, available = self.doGroupLists(uservisible=uservisible,
+-                                                 patterns=userlist)
++        uv  = not wts['hidden']
++        dGL = self.doGroupLists(patterns=userlist,
++                                uservisible=uv, return_evgrps=True)
++
++        installed, available, ievgrps, evgrps = dGL
++
++        if not wts['env']:
++            ievgrps = []
++            evgrps  = []
++
++        if not wts['inst']:
++            installed = []
++            ievgrps   = []
++        if not wts['avail']:
++            available = []
++            evgrps    = []
+         
+-        if not installed and not available:
+-            self.logger.error(_('Warning: No groups match: %s'),
+-                              ", ".join(userlist))
+-            return 0, []
++        done = []
++        def _out_grp(sect, groups):
++            if not groups:
++                return
+ 
+-        def _out_grp(sect, group):
+-            if not done:
+-                self.verbose_logger.log(yum.logginglevels.INFO_2, sect)
+-            msg = '   %s' % group.ui_name
+-            if self.verbose_logger.isEnabledFor(yum.logginglevels.DEBUG_3):
+-                msg += ' (%s)' % group.groupid
+-            if group.langonly:
+-                msg += ' [%s]' % group.langonly
 -            self.verbose_logger.log(yum.logginglevels.INFO_2, '%s', msg)
-+            self.verbose_logger.info('%s', msg)
- 
-         done = False
++            done.append(sect)
++            if summary:
++                self.verbose_logger.log(yum.logginglevels.INFO_2,
++                                        "%s %u", sect, len(groups))
++                return
+ 
+-        done = False
++            self.verbose_logger.log(yum.logginglevels.INFO_2, sect)
++
++            for group in groups:
++                msg = '   %s' % group.ui_name
++                if wts['id']:
++                    msg += ' (%s)' % group.compsid
++                if group.langonly:
++                    msg += ' [%s]' % group.langonly
++                self.verbose_logger.info('%s', msg)
++
++        _out_grp(_('Installed Environment Groups:'), ievgrps)
++        _out_grp(_('Available Environment Groups:'), evgrps)
++
++        groups = []
          for group in installed:
-@@ -1283,7 +1610,20 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
+             if group.langonly: continue
+-            _out_grp(_('Installed Groups:'), group)
+-            done = True
++            if not wts['pkg']: continue
++            groups.append(group)
++        _out_grp(_('Installed Groups:'), groups)
+ 
+-        done = False
++        groups = []
+         for group in installed:
+             if not group.langonly: continue
+-            _out_grp(_('Installed Language Groups:'), group)
+-            done = True
++            if not wts['lang']: continue
++            groups.append(group)
++        _out_grp(_('Installed Language Groups:'), groups)
+ 
+-        done = False
++        groups = []
+         for group in available:
+             if group.langonly: continue
+-            _out_grp(_('Available Groups:'), group)
+-            done = True
++            if not wts['pkg']: continue
++            groups.append(group)
++        _out_grp(_('Available Groups:'), groups)
+ 
+-        done = False
++        groups = []
+         for group in available:
+             if not group.langonly: continue
+-            _out_grp(_('Available Language Groups:'), group)
+-            done = True
++            if not wts['lang']: continue
++            groups.append(group)
++        _out_grp(_('Available Language Groups:'), groups)
++
++        if not done:
++            self.logger.error(_('Warning: No Environments/Groups match: %s'),
++                              ", ".join(userlist))
++            return 0, []
+ 
          return 0, [_('Done')]
  
      def returnGroupSummary(self, userlist):
 +        """Print a summary of the groups that match the given names or
 +        wildcards.
-+
+ 
+-        uservisible=1
+-            
+-        if len(userlist) > 0:
+-            if userlist[0] == 'hidden':
+-                uservisible=0
+-                userlist.pop(0)
+-        if not userlist:
+-            userlist = None # Match everything...
 +        :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 ])
  
+-        installed, available = self.doGroupLists(uservisible=uservisible,
+-                                                 patterns=userlist)
+-        
+-        def _out_grp(sect, num):
+-            if not num:
+-                return
+-            self.verbose_logger.log(yum.logginglevels.INFO_2, '%s %u', sect,num)
+-        done = 0
+-        for group in installed:
+-            if group.langonly: continue
+-            done += 1
+-        _out_grp(_('Installed Groups:'), done)
 +        exit_code is::
-+
+ 
+-        done = 0
+-        for group in installed:
+-            if not group.langonly: continue
+-            done += 1
+-        _out_grp(_('Installed Language Groups:'), done)
 +            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
 +        """
-         uservisible=1
-             
-         if len(userlist) > 0:
-@@ -1327,7 +1667,19 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
-         return 0, [_('Done')]
-     
-     def returnGroupInfo(self, userlist):
--        """returns complete information on a list of groups"""
++        return self._returnGroupLists(userlist, summary=True)
++    
++    def returnGroupInfo(self, userlist):
 +        """Print complete information about the groups that match the
 +        given names or wildcards.
-+
+ 
+-        done = False
+-        for group in available:
+-            if group.langonly: continue
+-            done += 1
+-        _out_grp(_('Available Groups:'), done)
 +        :param userlist: a list of names or wildcards specifying the
 +           groups to print information about
 +        :return: (exit_code, [ errors ])
-+
+ 
+-        done = False
+-        for group in available:
+-            if not group.langonly: continue
+-            done += 1
+-        _out_grp(_('Available Language Groups:'), done)
 +        exit_code is::
-+
+ 
+-        return 0, [_('Done')]
+-    
+-    def returnGroupInfo(self, userlist):
+-        """returns complete information on a list of groups"""
 +            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
 +        """
          for strng in userlist:
              group_matched = False
-             for group in self.comps.return_groups(strng):
-@@ -1339,9 +1691,19 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
+-            for group in self.comps.return_groups(strng):
+-                self.displayPkgsInGroups(group)
+-                group_matched = True
++
++            pkg_grp = True
++            grp_grp = True
++            if strng.startswith('@^'):
++                strng = strng[2:]
++                pkg_grp = False
++            elif strng.startswith('@'):
++                strng = strng[1:]
++                grp_grp = False
++
++            if grp_grp:
++                for evgroup in self.comps.return_environments(strng):
++                    self.displayGrpsInEnvironments(evgroup)
++                    group_matched = True
++            if pkg_grp:
++                for group in self.comps.return_groups(strng):
++                    self.displayPkgsInGroups(group)
++                    group_matched = True
+ 
+             if not group_matched:
+-                self.logger.error(_('Warning: Group %s does not exist.'), strng)
++                self.logger.error(_('Warning: Group/Environment %s does not exist.'), strng)
          
          return 0, []
          
@@ -1066,8 +1321,38 @@ index 6056d38..597efd6
          pkgs_used = []
          
          for group_string in grouplist:
-@@ -1351,7 +1713,7 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
++
++            grp_grp = True
++            pkg_grp = True
++            if group_string.startswith('@^'):
++                pkg_grp = False
++                group_string = group_string[2:]
++            elif group_string.startswith('@'):
++                grp_grp = False
++                group_string = group_string[1:]
++
+             group_matched = False
+-            for group in self.comps.return_groups(group_string):
++            groups = []
++            if grp_grp:
++                groups = self.comps.return_environments(group_string)
++            for group in groups:
+                 group_matched = True
  
++                try:
++                    txmbrs = self.selectEnvironment(group.environmentid,
++                                                    upgrade=upgrade)
++                except yum.Errors.GroupsError:
++                    self.logger.critical(_('Warning: Environment %s does not exist.'), group_string)
++                    continue
++                else:
++                    pkgs_used.extend(txmbrs)
++
++            groups = []
++            if pkg_grp:
++                groups = self.comps.return_groups(group_string)
++            for group in groups:
++                group_matched = True
              
                  try:
 -                    txmbrs = self.selectGroup(group.groupid)
@@ -1075,7 +1360,7 @@ index 6056d38..597efd6
                  except yum.Errors.GroupsError:
                      self.logger.critical(_('Warning: Group %s does not exist.'), group_string)
                      continue
-@@ -1368,8 +1730,18 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
+@@ -1368,17 +1841,61 @@ 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):
@@ -1094,8 +1379,58 @@ index 6056d38..597efd6
 +        """
          pkgs_used = []
          for group_string in grouplist:
-             try:
-@@ -1389,7 +1761,7 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
+-            try:
+-                txmbrs = self.groupRemove(group_string)
+-            except yum.Errors.GroupsError:
+-                self.logger.critical(_('No group named %s exists'), group_string)
+-                continue
+-            else:
+-                pkgs_used.extend(txmbrs)
++
++            grp_grp = True
++            pkg_grp = True
++            if group_string.startswith('@^'):
++                pkg_grp = False
++                group_string = group_string[2:]
++            elif group_string.startswith('@'):
++                grp_grp = False
++                group_string = group_string[1:]
++
++            groups = []
++            if grp_grp:
++                if self.conf.group_command == 'objects':
++                    groups = self.igroups.return_environments(group_string)
++                else:
++                    groups = self.comps.return_environments(group_string)
++                if not groups:
++                    self.logger.critical(_('No Environment named %s exists'), group_string)
++            for group in groups:
++                try:
++                    txmbrs = self.environmentRemove(group.environmentid)
++                except yum.Errors.GroupsError:
++                    continue
++                else:
++                    pkgs_used.extend(txmbrs)
++
++            groups = []
++            if pkg_grp:
++                if self.conf.group_command == 'objects':
++                    groups = self.igroups.return_groups(group_string)
++                else:
++                    groups = self.comps.return_groups(group_string)
++                if not groups:
++                    self.logger.critical(_('No group named %s exists'), group_string)
++            for group in groups:
++                try:
++                    txmbrs = self.groupRemove(group.groupid)
++                except yum.Errors.GroupsError:
++                    continue
++                else:
++                    pkgs_used.extend(txmbrs)
+                 
+         if not pkgs_used:
+             return 0, [_('No packages to remove from groups')]
+@@ -1389,7 +1906,7 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
  
      def _promptWanted(self):
          # shortcut for the always-off/always-on options
@@ -1104,7 +1439,7 @@ index 6056d38..597efd6
              return False
          if self.conf.alwaysprompt:
              return True
-@@ -1400,7 +1772,6 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
+@@ -1400,7 +1917,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 \
@@ -1112,7 +1447,7 @@ index 6056d38..597efd6
                     txmbr.name not in self.extcmds:
                  return True
          
-@@ -1408,11 +1779,11 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
+@@ -1408,11 +1924,11 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
          return False
  
      def usage(self):
@@ -1126,7 +1461,7 @@ index 6056d38..597efd6
          sys.stdout.write(self.optparser.get_usage())
      
      def _installable(self, pkg, ematch=False):
-@@ -1468,9 +1839,9 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
+@@ -1468,9 +1984,9 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
          return False
  
  class YumOptionParser(OptionParser):
@@ -1138,7 +1473,7 @@ index 6056d38..597efd6
  
      def __init__(self,base, **kwargs):
          # check if this is called with a utils=True/False parameter
-@@ -1488,13 +1859,23 @@ class YumOptionParser(OptionParser):
+@@ -1488,13 +2004,23 @@ class YumOptionParser(OptionParser):
          self._addYumBasicOptions()
  
      def error(self, msg):
@@ -1164,7 +1499,7 @@ index 6056d38..597efd6
          try:
              args = _filtercmdline(
                          ('--noplugins','--version','-q', '-v', "--quiet", "--verbose"), 
-@@ -1521,7 +1902,15 @@ class YumOptionParser(OptionParser):
+@@ -1521,7 +2047,15 @@ class YumOptionParser(OptionParser):
          return ret
          
      def setupYumConfig(self, args=None):
@@ -1181,7 +1516,13 @@ index 6056d38..597efd6
          if not args:
              (opts, cmds) = self.parse_args()
          else:
-@@ -1536,13 +1925,14 @@ class YumOptionParser(OptionParser):
+@@ -1533,16 +2067,20 @@ class YumOptionParser(OptionParser):
+         try:
+             # config file is parsed and moving us forward
+             # set some things in it.
++
++            if opts.tolerant or self.base.conf.tolerant: # Make it slower capt.
++                self.base.conf.recheck_installed_requires = True
                  
              # Handle remaining options
              if opts.assumeyes:
@@ -1201,7 +1542,7 @@ index 6056d38..597efd6
                  self.base.conf.cache = 1
  
              if opts.obsoletes:
-@@ -1610,10 +2000,6 @@ class YumOptionParser(OptionParser):
+@@ -1610,10 +2148,6 @@ class YumOptionParser(OptionParser):
                      self.base.usage()
                      sys.exit(1)
  
@@ -1212,7 +1553,7 @@ index 6056d38..597efd6
              # Disable all gpg key checking, if requested.
              if opts.nogpgcheck:
                  #  Altering the normal configs. doesn't work too well, esp. with
-@@ -1640,6 +2026,14 @@ class YumOptionParser(OptionParser):
+@@ -1640,6 +2174,14 @@ class YumOptionParser(OptionParser):
          sys.exit(1)
  
      def getRoot(self,opts):
@@ -1227,7 +1568,7 @@ index 6056d38..597efd6
          self._checkAbsInstallRoot(opts)
          # If the conf file is inside the  installroot - use that.
          # otherwise look for it in the normal root
-@@ -1713,6 +2107,10 @@ class YumOptionParser(OptionParser):
+@@ -1713,6 +2255,10 @@ class YumOptionParser(OptionParser):
                          help=_("verbose operation"))
          group.add_option("-y", "--assumeyes", dest="assumeyes",
                  action="store_true", help=_("answer yes for all questions"))
@@ -1933,7 +2274,7 @@ index 0000000..d2a0ed1
 +if __name__ == "__main__":
 +    generateAll(os.getcwd(), os.getcwd())
 diff --git a/docs/yum.8 b/docs/yum.8
-index 1a8202a..604377b 100644
+index 1a8202a..188cd3e 100644
 --- a/docs/yum.8
 +++ b/docs/yum.8
 @@ -52,6 +52,7 @@ gnome\-packagekit application\&.
@@ -1980,7 +2321,19 @@ index 1a8202a..604377b 100644
  "\fBupdate\fP foo" if foo-1-2 is installed. You can use the "\fBupdate-to\fP"
  if you'd prefer that nothing happen in the above case.
  .IP 
-@@ -224,10 +232,37 @@ to only remove packages which aren't required by something else.
+@@ -158,6 +166,11 @@ the "install" command\&.(See \fBSpecifying package names\fP for more information
+ 
+ Note that "yum" is included in the protected_packages configuration, by default.
+ So you can't accidentally remove yum itself.
++
++Because remove does a lot of work to make it as easy as possible to use, there
++are also a few specific remove commands "\fBremove-n\fP", "\fBremove-na\fP"
++and "\fBremove-nevra\fP". These only work on package names, and do not process
++wildcards etc.
+ .IP 
+ .IP "\fBlist\fP"
+ Is used to list various information about available
+@@ -224,10 +237,37 @@ to only remove packages which aren't required by something else.
  
  "\fBgroup info\fP" is used to give the description and package list of a group (and which type
  those packages are marked as). Note that you can use the yum-filter-data and
@@ -2019,7 +2372,7 @@ index 1a8202a..604377b 100644
  .IP
  .IP "\fBshell\fP"
  Is used to enter the 'yum shell', when a filename is specified the contents of
-@@ -235,12 +270,13 @@ that file is executed in yum shell mode. See \fIyum-shell(8)\fP for more info
+@@ -235,12 +275,13 @@ that file is executed in yum shell mode. See \fIyum-shell(8)\fP for more info
  .IP
  .IP "\fBresolvedep\fP"
  Is used to list packages providing the specified dependencies, at most one
@@ -2035,7 +2388,7 @@ index 1a8202a..604377b 100644
  reasons only.
  .IP
  .IP "\fBlocalupdate\fP"
-@@ -248,7 +284,7 @@ Is used to update the system by specifying local rpm files. Only the specified
+@@ -248,7 +289,7 @@ Is used to update the system by specifying local rpm files. Only the specified
  rpm files of which an older version is already installed will be installed,
  the remaining specified packages will be ignored.
  If required the enabled repositories will be used to resolve dependencies. Note
@@ -2044,7 +2397,7 @@ index 1a8202a..604377b 100644
  legacy reasons only.
  .IP
  .IP "\fBreinstall\fP"
-@@ -260,7 +296,7 @@ on groups, files, provides and filelists just like the "install" command\&.
+@@ -260,7 +301,7 @@ on groups, files, provides and filelists just like the "install" command\&.
  Will try and downgrade a package from the version currently installed to the
  previously highest version (or the specified version).
  The depsolver will not necessarily work, but if you specify all the packages it
@@ -2053,7 +2406,7 @@ index 1a8202a..604377b 100644
  work for "installonly" packages, like Kernels. downgrade operates
  on groups, files, provides, filelists and rpm files just like the "install" command\&.
  .IP
-@@ -294,8 +330,8 @@ package counts/etc. will be zeroed out).
+@@ -294,8 +335,8 @@ package counts/etc. will be zeroed out).
  .IP "\fBversion\fP"
  Produces a "version" of the rpmdb, and of the enabled repositories if "all" is
  given as the first argument. You can also specify version groups in the
@@ -2064,7 +2417,7 @@ index 1a8202a..604377b 100644
  packages (in sorted order), and the checksum_type/checksum_data entries from
  the yumdb. Note that this rpmdb version is now also used significantly within
  yum (esp. in yum history).
-@@ -321,26 +357,33 @@ and so takes sub-commands:
+@@ -321,26 +362,33 @@ and so takes sub-commands:
  .IP "\fBhistory\fP"
  The history command allows the user to view what has happened in past
  transactions (assuming the history_record config. option is set). You can use
@@ -2104,7 +2457,7 @@ index 1a8202a..604377b 100644
  A (if it is not still installed), and "rollback 1" will try to remove packages
  B and C. Note that after a "rollback 1" you will have a fourth transaction,
  although the ending rpmdb version (see: yum version) should be the same in
-@@ -349,6 +392,12 @@ transactions 1 and 4.
+@@ -349,6 +397,12 @@ transactions 1 and 4.
  The addon-info command takes a transaction ID, and the packages-list command
  takes a package (with wildcards).
  
@@ -2117,7 +2470,7 @@ index 1a8202a..604377b 100644
  In "history list" you can change the behaviour of the 2nd column via. the
  configuration option history_list_view.
  
-@@ -371,6 +420,15 @@ end of the package column in the packages-list command).
+@@ -371,6 +425,15 @@ end of the package column in the packages-list command).
  .I \fBs\fR - The transaction completed fine, but --skip-broken was enabled and had to skip some packages.
  .br
  
@@ -2133,7 +2486,7 @@ index 1a8202a..604377b 100644
  .IP
  .IP "\fBcheck\fP"
  Checks the local rpmdb and produces information on any problems it finds. You
-@@ -401,6 +459,11 @@ Assume yes; assume that the answer to any question which would be asked
+@@ -401,6 +464,11 @@ Assume yes; assume that the answer to any question which would be asked
  is yes\&.
  .br
  Configuration Option: \fBassumeyes\fP
@@ -2145,7 +2498,7 @@ index 1a8202a..604377b 100644
  .IP "\fB\-c, \-\-config=[config file]\fP" 
  Specifies the config file location - can take HTTP and FTP URLs and local file
  paths\&.
-@@ -420,7 +483,7 @@ Sets the error level to [number] Practical range 0 \- 10. 0 means print only cri
+@@ -420,7 +488,7 @@ Sets the error level to [number] Practical range 0 \- 10. 0 means print only cri
  .br
  Configuration Option: \fBerrorlevel\fP
  .IP "\fB\-\-rpmverbosity=[name]\fP" 
@@ -2154,6 +2507,16 @@ index 1a8202a..604377b 100644
  options are: 'critical', 'emergency', 'error', 'warn' and 'debug'.
  .br
  Configuration Option: \fBrpmverbosity\fP
+@@ -506,7 +574,8 @@ option will corrupt your cache (and you can use $releasever in your cachedir
+ configuration to stop this).
+ .PP 
+ .IP "\fB\-t, \-\-tolerant\fP"
+-This option currently does nothing.
++This option makes yum go slower, checking for things that shouldn't be possible
++making it more tolerant of external errors.
+ .br
+ .IP "\fB\-\-setopt=option=value\fP"
+ Set any config option in yum config or repo files. For options in the global 
 diff --git a/docs/yum.conf.5 b/docs/yum.conf.5
 index 515aa73..b456074 100644
 --- a/docs/yum.conf.5
@@ -3043,7 +3406,7 @@ index f1e06e8..b21c594 100644
  complete -F _yum -o filenames yum yummain.py
  
 diff --git a/output.py b/output.py
-index b6aa277..b3f2c75 100755
+index b6aa277..d29eba8 100755
 --- a/output.py
 +++ b/output.py
 @@ -1,6 +1,6 @@
@@ -3639,8 +4002,10 @@ index b6aa277..b3f2c75 100755
          print _('\nGroup: %s') % group.ui_name
  
          verb = self.verbose_logger.isEnabledFor(logginglevels.DEBUG_3)
-         if verb:
-             print _(' Group-Id: %s') % to_unicode(group.groupid)
+-        if verb:
+-            print _(' Group-Id: %s') % to_unicode(group.groupid)
++        if True:
++            print _(' Group-Id: %s') % to_unicode(group.compsid)
 +
 +        igroup_data = self._groupInstalledData(group)
 +        igrp_only   = set()
@@ -3674,7 +4039,7 @@ index b6aa277..b3f2c75 100755
              data = [data['envra'], data['rid']]
              columns = self.calcColumns(data)
              columns = (-columns[0], -columns[1])
-@@ -804,11 +1136,20 @@ class YumOutput:
+@@ -804,11 +1136,77 @@ class YumOutput:
              if len(pkg_names) > 0:
                  print section_name
                  self._displayPkgsFromNames(pkg_names, verb, pkg_names2pkgs,
@@ -3686,6 +4051,63 @@ index b6aa277..b3f2c75 100755
 +            self._displayPkgsFromNames(igrp_only, verb, pkg_names2pkgs,
 +                                       columns=columns,
 +                                       igroup_data=igroup_data)
++
++    def displayGrpsInEnvironments(self, evgroup):
++        """Output information about the groups in a given evgroup
++
++        :param group: an Environment object to output information about
++        """
++        print _('\nEnvironment Group: %s') % evgroup.ui_name
++        print _(' Environment-Id: %s') % to_unicode(evgroup.compsid)
++
++        igroup_data = self._groupInstalledEnvData(evgroup)
++        igrp_only   = set()
++        for grp_name in igroup_data:
++            if igroup_data[grp_name] == 'installed':
++                igrp_only.add(grp_name)
++        igrp_only.difference_update(evgroup.allgroups)
++        all_grps = evgroup.allgroups + list(igrp_only)
++
++        if evgroup.ui_description:
++            print _(' Description: %s') % to_unicode(evgroup.ui_description)
++
++        def _get_igrp_data(item, indent):
++            if not igroup_data:
++                return indent
++
++            assert item in igroup_data
++            if item not in igroup_data or igroup_data[item] == 'available':
++                indent += '+' # Group up/in will install i
++            elif igroup_data[item] == 'installed':
++                indent += '=' # Installed via. group
++            elif igroup_data[item] == 'blacklisted-installed':
++                if False: # Not sure it's worth listing these...
++                    return None # On the other hand, there's mark-packages
++                indent += ' ' # Installed, not via. group
++            else:
++                assert igroup_data[item] == 'blacklisted-available'
++                if False: # Not sure it's worth listing these...
++                    return None
++                indent += '-' # Not installed, and won't be
++            return indent
++
++        sections = ((_(' Mandatory Groups:'), evgroup.groups),
++                    (_(' Optional Groups:'),  evgroup.options))
++
++        for (section_name, grp_names) in sections:
++            if len(grp_names) > 0:
++                print section_name
++                for grp_name in sorted(grp_names):
++                    pindent = _get_igrp_data(grp_name, "   ")
++                    if pindent is None:
++                        continue
++
++                    print "%s%s" % (pindent, grp_name)
++
++        if igrp_only:
++            print _(' Installed Groups:')
++            for grp_name in sorted(igrp_only):
++                print "%s%s", "  ", grp_name
  
      def depListOutput(self, results):
 -        """take a list of findDeps results and 'pretty print' the output"""
@@ -3698,7 +4120,7 @@ index b6aa277..b3f2c75 100755
          verb = self.verbose_logger.isEnabledFor(logginglevels.DEBUG_3)
          for pkg in sorted(results):
              print _("package: %s") % pkg.compactPrint()
-@@ -832,7 +1173,18 @@ class YumOutput:
+@@ -832,7 +1230,18 @@ class YumOutput:
                      print "   provider: %s" % po.compactPrint()
  
      def format_number(self, number, SI=0, space=' '):
@@ -3718,7 +4140,7 @@ index b6aa277..b3f2c75 100755
          symbols = [ ' ', # (none)
                      'k', # kilo
                      'M', # mega
-@@ -870,16 +1222,31 @@ class YumOutput:
+@@ -870,16 +1279,31 @@ class YumOutput:
  
      @staticmethod
      def format_time(seconds, use_hours=0):
@@ -3756,7 +4178,7 @@ index b6aa277..b3f2c75 100755
          if self.conf.showdupesfromrepos:
              msg = '%s : ' % po
          else:
-@@ -923,7 +1290,15 @@ class YumOutput:
+@@ -923,7 +1347,15 @@ class YumOutput:
                  item = self._enc(item)
                  can_overflow = False
              else:
@@ -3773,7 +4195,7 @@ index b6aa277..b3f2c75 100755
  
              if matchfor:
                  item = self._sub_highlight(item, highlight, matchfor,
-@@ -935,14 +1310,34 @@ class YumOutput:
+@@ -935,14 +1367,34 @@ class YumOutput:
          print '\n\n'
  
      def matchcallback_verbose(self, po, values, matchfor=None):
@@ -3809,7 +4231,7 @@ index b6aa277..b3f2c75 100755
          for pkg in packages:
              # Just to be on the safe side, if for some reason getting
              # the package size fails, log the error and don't report download
-@@ -971,18 +1366,18 @@ class YumOutput:
+@@ -971,18 +1423,18 @@ class YumOutput:
  
          if (not error):
              if locsize:
@@ -3836,7 +4258,7 @@ index b6aa277..b3f2c75 100755
          totsize = 0
          error = False
          for pkg in packages:
-@@ -997,13 +1392,19 @@ class YumOutput:
+@@ -997,13 +1449,19 @@ class YumOutput:
                  self.logger.error(_('There was an error calculating installed size'))
                  break
          if (not error):
@@ -3861,7 +4283,7 @@ index b6aa277..b3f2c75 100755
          self.tsInfo.makelists(True, True)
          pkglist_lines = []
          data  = {'n' : {}, 'v' : {}, 'r' : {}}
-@@ -1032,8 +1433,7 @@ class YumOutput:
+@@ -1032,8 +1490,7 @@ class YumOutput:
              for (d, v) in (("n",len(n)), ("v",len(evr)), ("r",len(repoid))):
                  data[d].setdefault(v, 0)
                  data[d][v] += 1
@@ -3871,7 +4293,7 @@ index b6aa277..b3f2c75 100755
              return a_wid
  
          for (action, pkglist) in [(_('Installing'), self.tsInfo.installed),
-@@ -1102,19 +1502,72 @@ class YumOutput:
+@@ -1102,19 +1559,72 @@ class YumOutput:
  Transaction Summary
  %s
  """) % ('=' * self.term.columns))
@@ -3954,7 +4376,7 @@ index b6aa277..b3f2c75 100755
          out = ''
          
          self.tsInfo.makelists()
-@@ -1179,9 +1632,9 @@ Transaction Summary
+@@ -1179,9 +1689,9 @@ Transaction Summary
          return out
  
      def setupProgressCallbacks(self):
@@ -3967,7 +4389,7 @@ index b6aa277..b3f2c75 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 +1669,12 @@ Transaction Summary
+@@ -1216,10 +1726,12 @@ Transaction Summary
          self.dsCallback = dscb
      
      def setupProgessCallbacks(self):
@@ -3981,27 +4403,27 @@ index b6aa277..b3f2c75 100755
          confirm_func = self._cli_confirm_gpg_key_import
          gpg_import_func = self.getKeyForRepo
          gpgca_import_func = self.getCAKeyForRepo
-@@ -1233,14 +1688,12 @@ Transaction Summary
+@@ -1233,14 +1745,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 +1722,14 @@ to exit.
+@@ -1269,6 +1779,14 @@ to exit.
  
      def download_callback_total_cb(self, remote_pkgs, remote_size,
                                     download_start_timestamp):
@@ -4016,17 +4438,17 @@ index b6aa277..b3f2c75 100755
          if len(remote_pkgs) <= 1:
              return
          if not hasattr(urlgrabber.progress, 'TerminalLine'):
-@@ -1434,8 +1895,17 @@ to exit.
+@@ -1434,8 +1952,17 @@ to exit.
          return tids, printall
  
      def historyListCmd(self, extcmds):
 -        """ Shows the user a list of data about the history. """
 +        """Output a list of information about the history of yum
 +        transactions.
-+
+ 
 +        :param extcmds: list of extra command line arguments
 +        :return: (exit_code, [errors])
- 
++
 +        exit_code is::
 +
 +            0 = we're done, exit
@@ -4035,7 +4457,7 @@ index b6aa277..b3f2c75 100755
          tids, printall = self._history_list_transactions(extcmds)
          if tids is None:
              return 1, ['Failed history list']
-@@ -1564,6 +2034,16 @@ to exit.
+@@ -1564,6 +2091,16 @@ to exit.
          return old[0]
  
      def historyInfoCmd(self, extcmds):
@@ -4052,7 +4474,7 @@ index b6aa277..b3f2c75 100755
          def str2int(x):
              try:
                  return int(x)
-@@ -1656,6 +2136,9 @@ to exit.
+@@ -1656,6 +2193,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. """
@@ -4062,7 +4484,7 @@ index b6aa277..b3f2c75 100755
          ipkgs = self.rpmdb.searchPkgTuple(hpkg.pkgtup)
          if not ipkgs:
              apkgs = self.pkgSack.searchPkgTuple(hpkg.pkgtup)
-@@ -1672,13 +2155,12 @@ to exit.
+@@ -1672,13 +2212,12 @@ to exit.
                                   'o' : _('Updated'), 'n' : _('Downgraded')}
          _pkg_states_available = {'i' : _('Installed'), 'e' : _('Not installed'),
                                   'o' : _('Older'), 'n' : _('Newer')}
@@ -4079,7 +4501,7 @@ index b6aa277..b3f2c75 100755
              prefix = " " * prefix_len
              if was_installed:
                  _pkg_states = _pkg_states_installed
-@@ -1702,9 +2184,11 @@ to exit.
+@@ -1702,9 +2241,11 @@ to exit.
              else:
                  (hibeg, hiend) = self._highlight('normal')
              state = utf8_width_fill(state, _pkg_states['maxlen'])
@@ -4093,7 +4515,7 @@ index b6aa277..b3f2c75 100755
  
          if type(old.tid) == type([]):
              print _("Transaction ID :"), "%u..%u" % (old.tid[0], old.tid[-1])
-@@ -1778,8 +2262,8 @@ to exit.
+@@ -1778,8 +2319,8 @@ to exit.
              default_addons = set(['config-main', 'config-repos', 'saved_tx'])
              non_default = set(addon_info).difference(default_addons)
              if len(non_default) > 0:
@@ -4104,7 +4526,7 @@ index b6aa277..b3f2c75 100755
  
          if old.trans_with:
              # This is _possible_, but not common
-@@ -1794,7 +2278,9 @@ to exit.
+@@ -1794,7 +2335,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:
@@ -4115,7 +4537,7 @@ index b6aa277..b3f2c75 100755
  
          if old.rpmdb_problems:
              print _("Rpmdb Problems:")
-@@ -1833,6 +2319,13 @@ to exit.
+@@ -1833,6 +2376,13 @@ to exit.
                                'Updated'      : _('Updated'),
                                }
      def historyInfoCmdPkgsAltered(self, old, pats=[]):
@@ -4129,7 +4551,7 @@ index b6aa277..b3f2c75 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 +2379,10 @@ to exit.
+@@ -1886,6 +2436,10 @@ to exit.
                                          self._hpkg2from_repo(hpkg))
  
      def historySummaryCmd(self, extcmds):
@@ -4140,7 +4562,7 @@ index b6aa277..b3f2c75 100755
          tids, printall = self._history_list_transactions(extcmds)
          if tids is None:
              return 1, ['Failed history info']
-@@ -1946,6 +2443,10 @@ to exit.
+@@ -1946,6 +2500,10 @@ to exit.
                               utf8_width_fill(uiacts, 16, 16), count)
  
      def historyAddonInfoCmd(self, extcmds):
@@ -4151,7 +4573,7 @@ index b6aa277..b3f2c75 100755
          tid = None
          if len(extcmds) > 1:
              tid = extcmds[1]
-@@ -1983,16 +2484,19 @@ to exit.
+@@ -1983,16 +2541,19 @@ to exit.
          
          for item in extcmds[2:]:
              if item in addon_info:
@@ -4177,7 +4599,7 @@ index b6aa277..b3f2c75 100755
          tids = self.history.search(extcmds)
          limit = None
          if extcmds and not tids:
-@@ -2078,9 +2582,94 @@ to exit.
+@@ -2078,9 +2639,94 @@ to exit.
              if lastdbv.end_rpmdbversion != rpmdbv:
                  self._rpmdb_warn_checks()
  
@@ -4273,7 +4695,7 @@ index b6aa277..b3f2c75 100755
      
      def __init__(self, ayum=None):
          """requires yum-cli log and errorlog functions as arguments"""
-@@ -2089,6 +2678,25 @@ class DepSolveProgressCallBack:
+@@ -2089,6 +2735,25 @@ class DepSolveProgressCallBack:
          self.ayum = ayum
  
      def pkgAdded(self, pkgtup, mode):
@@ -4299,7 +4721,7 @@ index b6aa277..b3f2c75 100755
          modedict = { 'i': _('installed'),
                       'u': _('an update'),
                       'e': _('erased'),
-@@ -2104,43 +2712,85 @@ class DepSolveProgressCallBack:
+@@ -2104,43 +2769,85 @@ class DepSolveProgressCallBack:
              modeterm)
          
      def start(self):
@@ -4387,7 +4809,7 @@ index b6aa277..b3f2c75 100755
          needname, needflags, needversion = reqTup
  
          yb = self.ayum
-@@ -2225,46 +2875,106 @@ class DepSolveProgressCallBack:
+@@ -2225,46 +2932,106 @@ class DepSolveProgressCallBack:
          return msg
      
      def procConflict(self, name, confname):
@@ -4499,7 +4921,7 @@ index b6aa277..b3f2c75 100755
  
  def _pkgname_ui(ayum, pkgname, ts_states=None):
      """ Get more information on a simple pkgname, if we can. We need to search
-@@ -2316,10 +3026,7 @@ def _pkgname_ui(ayum, pkgname, ts_states=None):
+@@ -2316,10 +3083,7 @@ def _pkgname_ui(ayum, pkgname, ts_states=None):
      return pkgname
  
  class YumCliRPMCallBack(RPMBaseCallback):
@@ -4511,7 +4933,7 @@ index b6aa277..b3f2c75 100755
  
      width = property(lambda x: _term_width())
  
-@@ -2337,21 +3044,34 @@ class YumCliRPMCallBack(RPMBaseCallback):
+@@ -2337,21 +3101,34 @@ 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)):
@@ -4556,7 +4978,7 @@ index b6aa277..b3f2c75 100755
          
          if type(package) not in types.StringTypes:
              pkgname = str(package)
-@@ -2363,9 +3083,25 @@ class YumCliRPMCallBack(RPMBaseCallback):
+@@ -2363,9 +3140,25 @@ class YumCliRPMCallBack(RPMBaseCallback):
              percent = 0
          else:
              percent = (te_current*100L)/te_total
@@ -4583,7 +5005,7 @@ index b6aa277..b3f2c75 100755
                                                pkgname=pkgname, wid1=wid1)
              msg = fmt % (utf8_width_fill(process, wid1, wid1),
                           utf8_width_fill(pkgname, wid2, wid2))
-@@ -2377,6 +3113,11 @@ class YumCliRPMCallBack(RPMBaseCallback):
+@@ -2377,6 +3170,11 @@ class YumCliRPMCallBack(RPMBaseCallback):
                  print " "
  
      def scriptout(self, package, msgs):
@@ -4595,7 +5017,7 @@ index b6aa277..b3f2c75 100755
          if msgs:
              sys.stdout.write(to_unicode(msgs))
              sys.stdout.flush()
-@@ -2429,8 +3170,30 @@ class YumCliRPMCallBack(RPMBaseCallback):
+@@ -2429,8 +3227,30 @@ class YumCliRPMCallBack(RPMBaseCallback):
              wid2 = pnl
          return fmt, wid1, wid2
  
@@ -148560,7 +148982,7 @@ index 0000000..a98341d
 +        self.assertResult( (p.installed_1, p.update_4) )
 +
 diff --git a/test/simpleobsoletestests.py b/test/simpleobsoletestests.py
-index 97a9923..70dde98 100644
+index 97a9923..55e6f14 100644
 --- a/test/simpleobsoletestests.py
 +++ b/test/simpleobsoletestests.py
 @@ -244,6 +244,42 @@ class SimpleObsoletesTests(OperationsTests):
@@ -148606,11 +149028,40 @@ index 97a9923..70dde98 100644
      def _MultiObsHelper(self):
          ret = {'zsh'  : FakePackage('zsh', '1', '1', '0', 'noarch'),
                 'ksh'  : FakePackage('ksh', '1', '1', '0', 'noarch'),
+@@ -588,6 +624,28 @@ class SimpleObsoletesTests(OperationsTests):
+         # self.assert_(res=='err', msg)
+         self.assertResult([])
+ 
++    def testRLOpenSSLMess1(self):
++        osl1  = FakePackage('openssl',      '1.0.0', '1', arch='i386')
++        osl1.addProvides('libssl.1', 'EQ', ('0', '1', '1'))
++        osl2  = FakePackage('openssl',      '1.0.1', '1', arch='i386')
++        osll2 = FakePackage('openssl-libs', '1.0.1', '1', arch='i386')
++        osll2.addProvides('libssl.2', 'EQ', ('0', '2', '1'))
++        osll2.addObsoletes('openssl', 'LT', (None, '1.0.1', None))
++
++        oc1   = FakePackage('openconnect',  '2.0.1', '1', arch='i386')
++        oc1.addRequires('openssl', 'GE', ('0', '0.9.9', '1'))
++        oc2   = FakePackage('openconnect',  '2.0.2', '1', arch='i386')
++        oc2.addRequires('openssl', 'GE', ('0', '0.9.9', '1'))
++
++        res, msg = self.runOperation(['upgrade', 'openssl'],
++                                     [oc1, osl1],
++                                     [oc1, oc2, osl1, osl2, osll2])
++
++        # In theory don't need to upgrade oc1 => oc2
++        self.assertResult((oc2, osl2, osll2))
++
++
++
+ class GitMetapackageObsoletesTests(OperationsTests):
+ 
+     @staticmethod
 diff --git a/test/simpleupdatetests.py b/test/simpleupdatetests.py
-index 6177fb1..2c8bcb3 100644
+index 6177fb1..9e22a6b 100644
 --- a/test/simpleupdatetests.py
 +++ b/test/simpleupdatetests.py
-@@ -990,3 +990,72 @@ class SimpleUpdateTests(OperationsTests):
+@@ -990,3 +990,93 @@ class SimpleUpdateTests(OperationsTests):
          # Nothing to do...
          self.assert_(res==0, msg)
  
@@ -148683,8 +149134,29 @@ index 6177fb1..2c8bcb3 100644
 +        # Ideal:
 +        # self.assertResult((foo11, bar12, cbar11))
 +        self.assertResult((foo12, bar12, cbar11))
++
++    def testInstallOtherArch1(self):
++        #  Installing something with dep. on newer version should upgrade older
++        # version with other arch.
++        # Eg. BZ 791326
++        pax1 = FakePackage('inst', '1', '1', '0', 'x86_64')
++        pai1 = FakePackage('inst', '1', '1', '0', 'i686')
++        pax2 = FakePackage('inst', '2', '1', '0', 'x86_64')
++        pax2.addProvides('foo-x', 'EQ', ('0', '2', '1'))
++        pai2 = FakePackage('inst', '2', '1', '0', 'i686')
++        pai2.addProvides('foo-i', 'EQ', ('0', '2', '1'))
++
++        pa2 = FakePackage('bar', '1', '1', '0', 'i386')
++        pa2.addRequires('foo-i', 'EQ', ('0', '2', '1'))
++
++        res, msg = self.runOperation(['install', 'bar'],
++                                     [pax1],
++                                     [pax1, pai1, pax2, pai2, pa2])
++        self.assert_(res=='ok', msg)
++        self.assertResult((pax2, pai2, pa2))
++
 diff --git a/test/testbase.py b/test/testbase.py
-index d0f22be..0a931f1 100644
+index d0f22be..608da70 100644
 --- a/test/testbase.py
 +++ b/test/testbase.py
 @@ -55,6 +55,9 @@ class FakeConf(object):
@@ -148697,6 +149169,22 @@ index d0f22be..0a931f1 100644
  
  class FakeSack:
      """ Fake PackageSack to use with FakeRepository"""
+@@ -138,6 +141,7 @@ class FakePackage(packages.YumAvailablePackage):
+         self.yumdb_info = FakeYumDBInfo()
+ 
+         self.prco['provides'].append((name, 'EQ', (epoch, version, release)))
++        self.prco['strong_requires'] = []
+ 
+         # Just a unique integer
+         self.id = self.__hash__()
+@@ -149,6 +153,7 @@ class FakePackage(packages.YumAvailablePackage):
+         self.prco['provides'].append((name, flag, evr))
+     def addRequires(self, name, flag=None, evr=(None, None, None)):
+         self.prco['requires'].append((name, flag, evr))
++        self.prco['strong_requires'].append((name, flag, evr))
+     def addRequiresPkg(self, pkg):
+         self.required_pkgs.append(pkg)
+     def addRequiringPkg(self, pkg):
 diff --git a/test/yum-leak-test.py b/test/yum-leak-test.py
 index 760b770..dd64483 100755
 --- a/test/yum-leak-test.py
@@ -150752,7 +151240,7 @@ index abd203f..65c62a9 100644
  - 3.4.1
  - umask bug fix.
 diff --git a/yum/__init__.py b/yum/__init__.py
-index 99039e0..090882c 100644
+index 99039e0..c713cff 100644
 --- a/yum/__init__.py
 +++ b/yum/__init__.py
 @@ -46,8 +46,13 @@ import operator
@@ -151204,15 +151692,7 @@ index 99039e0..090882c 100644
          warnings.warn(_('doGroupSetup() will go away in a future version of Yum.\n'),
                  Errors.YumFutureDeprecationWarning, stacklevel=2)
  
-@@ -822,14 +931,13 @@ class YumBase(depsolve.Depsolve):
-             groupfile = repo.getGroups()
-             # open it up as a file object so iterparse can cope with our compressed file
-             if groupfile:
--                groupfile = misc.repo_gen_decompress(groupfile, 'groups.xml',
--                                                     cached=repo.cache)
-+                groupfile = misc.repo_gen_decompress(groupfile, 'groups.xml')
-                 # Do we want a RepoError here?
-                 
+@@ -829,7 +938,7 @@ class YumBase(depsolve.Depsolve):
              try:
                  self._comps.add(groupfile)
              except (Errors.GroupsError,Errors.CompsException), e:
@@ -151221,7 +151701,7 @@ index 99039e0..090882c 100644
                  self.logger.critical(msg)
              else:
                  repo.groups_added = True
-@@ -837,7 +945,10 @@ class YumBase(depsolve.Depsolve):
+@@ -837,7 +946,10 @@ class YumBase(depsolve.Depsolve):
          if self._comps.compscount == 0:
              raise Errors.GroupsError, _('No Groups Available in any repository')
  
@@ -151233,14 +151713,7 @@ index 99039e0..090882c 100644
          self.verbose_logger.debug('group time: %0.3f' % (time.time() - group_st))                
          return self._comps
  
-@@ -862,13 +973,11 @@ class YumBase(depsolve.Depsolve):
-                 # fetch the sqlite tagdb
-                 try:
-                     tag_md = repo.retrieveMD('pkgtags')
--                    tag_sqlite  = misc.repo_gen_decompress(tag_md,
--                                                           'pkgtags.sqlite',
--                                                           cached=repo.cache)
-+                    tag_sqlite  = misc.repo_gen_decompress(tag_md, 'pkgtags.sqlite')
+@@ -868,7 +980,7 @@ class YumBase(depsolve.Depsolve):
                      # feed it into _tags.add()
                      self._tags.add(repo.id, tag_sqlite)
                  except (Errors.RepoError, Errors.PkgTagsError), e:
@@ -151249,7 +151722,7 @@ index 99039e0..090882c 100644
                      self.logger.critical(msg)
                      
                  
-@@ -881,9 +990,18 @@ class YumBase(depsolve.Depsolve):
+@@ -881,9 +993,18 @@ class YumBase(depsolve.Depsolve):
          if self._history is None:
              pdb_path = self.conf.persistdir + "/history"
              self._history = yum.history.YumHistory(root=self.conf.installroot,
@@ -151269,7 +151742,7 @@ index 99039e0..090882c 100644
      # properties so they auto-create themselves with defaults
      repos = property(fget=lambda self: self._getRepos(),
                       fset=lambda self, value: setattr(self, "_repos", value),
-@@ -921,6 +1039,11 @@ class YumBase(depsolve.Depsolve):
+@@ -921,6 +1042,11 @@ class YumBase(depsolve.Depsolve):
                         fdel=lambda self: setattr(self, "_history", None),
                         doc="Yum History Object")
  
@@ -151281,7 +151754,7 @@ index 99039e0..090882c 100644
      pkgtags = property(fget=lambda self: self._getTags(),
                         fset=lambda self, value: setattr(self, "_tags",value),
                         fdel=lambda self: setattr(self, "_tags", None),
-@@ -928,9 +1051,10 @@ class YumBase(depsolve.Depsolve):
+@@ -928,9 +1054,10 @@ class YumBase(depsolve.Depsolve):
      
      
      def doSackFilelistPopulate(self):
@@ -151295,7 +151768,7 @@ index 99039e0..090882c 100644
          necessary = False
          
          # I can't think of a nice way of doing this, we have to have the sack here
-@@ -951,8 +1075,12 @@ class YumBase(depsolve.Depsolve):
+@@ -951,8 +1078,12 @@ class YumBase(depsolve.Depsolve):
              self.repos.populateSack(mdtype='filelists')
             
      def yumUtilsMsg(self, func, prog):
@@ -151310,7 +151783,7 @@ index 99039e0..090882c 100644
          if self.rpmdb.contains(name="yum-utils"):
              return
  
-@@ -964,8 +1092,17 @@ class YumBase(depsolve.Depsolve):
+@@ -964,8 +1095,17 @@ class YumBase(depsolve.Depsolve):
               (hibeg, prog, hiend))
  
      def buildTransaction(self, unfinished_transactions_check=True):
@@ -151330,7 +151803,7 @@ index 99039e0..090882c 100644
          if (unfinished_transactions_check and
              misc.find_unfinished_transactions(yumlibpath=self.conf.persistdir)):
              msg = _('There are unfinished transactions remaining. You might ' \
-@@ -1004,7 +1141,7 @@ class YumBase(depsolve.Depsolve):
+@@ -1004,7 +1144,7 @@ class YumBase(depsolve.Depsolve):
              # If transaction was changed by postresolve plugins then we should run skipbroken again
              (rescode, restring) = self._doSkipBroken(rescode, restring, clear_skipped=False )
  
@@ -151339,7 +151812,45 @@ index 99039e0..090882c 100644
              self.tsInfo.pkgSack.dropCachedData()
  
          # FIXME: This is horrible, see below and yummain. Maybe create a real
-@@ -1242,13 +1379,15 @@ class YumBase(depsolve.Depsolve):
+@@ -1044,6 +1184,37 @@ class YumBase(depsolve.Depsolve):
+                 if first.verEQ(other):
+                     continue
+                 msg = _('Protected multilib versions: %s != %s')
++                if not xrestring:
++                    #  People are confused about protected mutilib ... so give
++                    # them a nicer message.
++                    bigmsg = _("""\
++ Multilib version problems found. This often means that the root
++cause is something else and multilib version checking is just
++pointing it that there is a problem. Eg.:
++
++  1. You have an upgrade for %(name)s which is missing some
++     dependency that another package requires. Yum is trying to
++     solve this by installing an older version of %(name)s of the
++     different architecture. If you exclude the bad architecture
++     yum will tell you what the root cause is (which package
++     requires what).
++
++  2. You have multiple architectures of %(name)s installed, but
++     yum can only see an upgrade for one of those arcitectures.
++     If you don't want/need both architectures anymore then you
++     can remove the one with the missing update and everything
++     will work.
++
++  3. You have duplicate versions of %(name)s installed already.
++     You can use "yum check" to get yum show these errors.
++
++...you can also use --setopt=protected_multilib=false to remove
++this checking, however this is almost never the correct thing to
++do as something else is very likely to go wrong (often causing
++much more problems).
++
++""") % {'name' : pkgname}
++                    msg = bigmsg + msg
+                 xrestring.append(msg % (first, other))
+         if xrestring:
+             rescode = 1
+@@ -1242,13 +1413,15 @@ class YumBase(depsolve.Depsolve):
          if None in pkgtup:
              return None
          return pkgtup
@@ -151359,7 +151870,7 @@ index 99039e0..090882c 100644
          if pkgtup is None:
              return
          self._not_found_i[pkgtup] = YumNotFoundPackage(pkgtup)
-@@ -1454,8 +1593,14 @@ class YumBase(depsolve.Depsolve):
+@@ -1454,8 +1627,14 @@ class YumBase(depsolve.Depsolve):
          return probs
  
      def runTransaction(self, cb):
@@ -151375,7 +151886,7 @@ index 99039e0..090882c 100644
          self.plugins.run('pretrans')
  
          #  We may want to put this other places, eventually, but for now it's
-@@ -1516,10 +1661,23 @@ class YumBase(depsolve.Depsolve):
+@@ -1516,10 +1695,23 @@ class YumBase(depsolve.Depsolve):
                  pass
          self._ts_save_file = None
          
@@ -151399,7 +151910,7 @@ index 99039e0..090882c 100644
          
          # make resultobject - just a plain yumgenericholder object
          resultobject = misc.GenericHolder()
-@@ -1567,13 +1725,24 @@ class YumBase(depsolve.Depsolve):
+@@ -1567,13 +1759,24 @@ 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):
@@ -151429,7 +151940,7 @@ index 99039e0..090882c 100644
          # check to see that the rpmdb and the tsInfo roughly matches
          # push package object metadata outside of rpmdb into yumdb
          # delete old yumdb metadata entries
-@@ -1584,9 +1753,16 @@ class YumBase(depsolve.Depsolve):
+@@ -1584,9 +1787,16 @@ class YumBase(depsolve.Depsolve):
          #    that there is not also an install of this pkg in the tsInfo (reinstall)
          # for any kind of install add from_repo to the yumdb, and the cmdline
          # and the install reason
@@ -151446,7 +151957,7 @@ index 99039e0..090882c 100644
          for txmbr in self.tsInfo:
              if txmbr.output_state in TS_INSTALL_STATES:
                  if not self.rpmdb.contains(po=txmbr.po):
-@@ -1596,7 +1772,9 @@ class YumBase(depsolve.Depsolve):
+@@ -1596,7 +1806,9 @@ class YumBase(depsolve.Depsolve):
                                             ' but is not!' % txmbr.po))
                      # Note: Get Panu to do te.Failed() so we don't have to
                      txmbr.output_state = TS_FAILED
@@ -151456,7 +151967,7 @@ index 99039e0..090882c 100644
                  po = self.getInstalledPackageObject(txmbr.pkgtup)
                  rpo = txmbr.po
                  po.yumdb_info.from_repo = rpo.repoid
-@@ -1630,6 +1808,10 @@ class YumBase(depsolve.Depsolve):
+@@ -1630,6 +1842,10 @@ class YumBase(depsolve.Depsolve):
                      if md:
                          po.yumdb_info.from_repo_timestamp = str(md.timestamp)
  
@@ -151467,7 +151978,7 @@ index 99039e0..090882c 100644
                  loginuid = misc.getloginuid()
                  if txmbr.updates or txmbr.downgrades or txmbr.reinstall:
                      if txmbr.updates:
-@@ -1640,11 +1822,16 @@ class YumBase(depsolve.Depsolve):
+@@ -1640,11 +1856,16 @@ class YumBase(depsolve.Depsolve):
                          opo = po
                      if 'installed_by' in opo.yumdb_info:
                          po.yumdb_info.installed_by = opo.yumdb_info.installed_by
@@ -151484,7 +151995,7 @@ index 99039e0..090882c 100644
          # Remove old ones after installing new ones, so we can copy values.
          for txmbr in self.tsInfo:
              if txmbr.output_state in TS_INSTALL_STATES:
-@@ -1662,10 +1849,13 @@ class YumBase(depsolve.Depsolve):
+@@ -1662,10 +1883,13 @@ class YumBase(depsolve.Depsolve):
                                                 ' but is not!' % txmbr.po))
                          # Note: Get Panu to do te.Failed() so we don't have to
                          txmbr.output_state = TS_FAILED
@@ -151498,7 +152009,7 @@ index 99039e0..090882c 100644
                  self.verbose_logger.log(logginglevels.DEBUG_2, 'What is this? %s' % txmbr.po)
  
          self.plugins.run('postverifytrans')
-@@ -1680,10 +1870,11 @@ class YumBase(depsolve.Depsolve):
+@@ -1680,10 +1904,11 @@ class YumBase(depsolve.Depsolve):
          self.verbose_logger.debug('VerifyTransaction time: %0.3f' % (time.time() - vt_st))
  
      def costExcludePackages(self):
@@ -151514,7 +152025,7 @@ index 99039e0..090882c 100644
          # if all the repo.costs are equal then don't bother running things
          costs = {}
          for r in self.repos.listEnabled():
-@@ -1705,10 +1896,12 @@ class YumBase(depsolve.Depsolve):
+@@ -1705,10 +1930,12 @@ class YumBase(depsolve.Depsolve):
              done = True
  
      def excludePackages(self, repo=None):
@@ -151530,7 +152041,7 @@ index 99039e0..090882c 100644
          if "all" in self.conf.disable_excludes:
              return
          
-@@ -1735,9 +1928,11 @@ class YumBase(depsolve.Depsolve):
+@@ -1735,9 +1962,11 @@ class YumBase(depsolve.Depsolve):
              self.pkgSack.addPackageExcluder(repoid, exid,'exclude.match', match)
  
      def includePackages(self, repo):
@@ -151545,7 +152056,7 @@ index 99039e0..090882c 100644
          includelist = repo.getIncludePkgList()
          
          if len(includelist) == 0:
-@@ -1757,8 +1952,11 @@ class YumBase(depsolve.Depsolve):
+@@ -1757,8 +1986,11 @@ class YumBase(depsolve.Depsolve):
          self.pkgSack.addPackageExcluder(repo.id, exid, 'exclude.marked')
          
      def doLock(self, lockfile = YUM_PID_FILE):
@@ -151559,7 +152070,7 @@ index 99039e0..090882c 100644
          if self.conf.uid != 0:
              #  If we are a user, assume we are using the root cache ... so don't
              # bother locking.
-@@ -1774,38 +1972,26 @@ class YumBase(depsolve.Depsolve):
+@@ -1774,38 +2006,26 @@ class YumBase(depsolve.Depsolve):
          
          mypid=str(os.getpid())    
          while not self._lock(lockfile, mypid, 0644):
@@ -151613,7 +152124,7 @@ index 99039e0..090882c 100644
          # if we're not root then we don't lock - just return nicely
          #  Note that we can get here from __del__, so if we haven't created
          # YumBase.conf we don't want to do so here as creating stuff inside
-@@ -1830,31 +2016,69 @@ class YumBase(depsolve.Depsolve):
+@@ -1830,31 +2050,69 @@ class YumBase(depsolve.Depsolve):
          self._unlock(lockfile)
          self._lockfile = None
          
@@ -151693,7 +152204,7 @@ index 99039e0..090882c 100644
          failed = False
  
          if type(fo) is types.InstanceType:
-@@ -1894,9 +2118,16 @@ class YumBase(depsolve.Depsolve):
+@@ -1894,9 +2152,16 @@ class YumBase(depsolve.Depsolve):
          
          
      def verifyChecksum(self, fo, checksumType, csum):
@@ -151713,7 +152224,7 @@ index 99039e0..090882c 100644
          try:
              filesum = misc.checksum(checksumType, fo)
          except Errors.MiscError, e:
-@@ -1908,6 +2139,17 @@ class YumBase(depsolve.Depsolve):
+@@ -1908,6 +2173,17 @@ class YumBase(depsolve.Depsolve):
          return 0
  
      def downloadPkgs(self, pkglist, callback=None, callback_total=None):
@@ -151731,7 +152242,7 @@ index 99039e0..090882c 100644
          def mediasort(apo, bpo):
              # FIXME: we should probably also use the mediaid; else we
              # could conceivably ping-pong between different disc1's
-@@ -1979,8 +2221,9 @@ class YumBase(depsolve.Depsolve):
+@@ -1979,8 +2255,9 @@ class YumBase(depsolve.Depsolve):
              urlgrabber.progress.text_meter_total_size(remote_size)
          beg_download = time.time()
          i = 0
@@ -151742,7 +152253,7 @@ index 99039e0..090882c 100644
          for po in remote_pkgs:
              #  Recheck if the file is there, works around a couple of weird
              # edge cases.
-@@ -1992,52 +2235,47 @@ class YumBase(depsolve.Depsolve):
+@@ -1992,52 +2269,47 @@ class YumBase(depsolve.Depsolve):
                      remote_size -= po.size
                      if hasattr(urlgrabber.progress, 'text_meter_total_size'):
                          urlgrabber.progress.text_meter_total_size(remote_size,
@@ -151821,7 +152332,7 @@ index 99039e0..090882c 100644
          if hasattr(urlgrabber.progress, 'text_meter_total_size'):
              urlgrabber.progress.text_meter_total_size(0)
          if callback_total is not None and not errors:
-@@ -2052,7 +2290,22 @@ class YumBase(depsolve.Depsolve):
+@@ -2052,7 +2324,22 @@ class YumBase(depsolve.Depsolve):
          return errors
  
      def verifyHeader(self, fo, po, raiseError):
@@ -151845,7 +152356,7 @@ index 99039e0..090882c 100644
          if type(fo) is types.InstanceType:
              fo = fo.filename
              
-@@ -2076,9 +2329,12 @@ class YumBase(depsolve.Depsolve):
+@@ -2076,9 +2363,12 @@ class YumBase(depsolve.Depsolve):
          return 1
          
      def downloadHeader(self, po):
@@ -151860,7 +152371,7 @@ index 99039e0..090882c 100644
          if hasattr(po, 'pkgtype') and po.pkgtype == 'local':
              return
                  
-@@ -2122,15 +2378,17 @@ class YumBase(depsolve.Depsolve):
+@@ -2122,15 +2412,17 @@ class YumBase(depsolve.Depsolve):
              return
  
      def sigCheckPkg(self, po):
@@ -151886,7 +152397,7 @@ index 99039e0..090882c 100644
          if self._override_sigchecks:
              check = False
              hasgpgkey = 0
-@@ -2181,6 +2439,9 @@ class YumBase(depsolve.Depsolve):
+@@ -2181,6 +2473,9 @@ class YumBase(depsolve.Depsolve):
          return result, msg
  
      def cleanUsedHeadersPackages(self):
@@ -151896,7 +152407,7 @@ index 99039e0..090882c 100644
          filelist = []
          for txmbr in self.tsInfo:
              if txmbr.po.state not in TS_INSTALL_STATES:
-@@ -2218,27 +2479,42 @@ class YumBase(depsolve.Depsolve):
+@@ -2218,27 +2513,42 @@ class YumBase(depsolve.Depsolve):
                      _('%s removed'), fn)
          
      def cleanHeaders(self):
@@ -151941,7 +152452,7 @@ index 99039e0..090882c 100644
          cachedir = self.conf.persistdir + "/rpmdb-indexes/"
          if not os.path.exists(cachedir):
              filelist = []
-@@ -2272,8 +2548,29 @@ class YumBase(depsolve.Depsolve):
+@@ -2272,8 +2582,29 @@ class YumBase(depsolve.Depsolve):
  
      def doPackageLists(self, pkgnarrow='all', patterns=None, showdups=None,
                         ignore_case=False):
@@ -151973,7 +152484,7 @@ index 99039e0..090882c 100644
          if showdups is None:
              showdups = self.conf.showdupesfromrepos
          ygh = misc.GenericHolder(iter=pkgnarrow)
-@@ -2323,10 +2620,22 @@ class YumBase(depsolve.Depsolve):
+@@ -2323,10 +2654,22 @@ class YumBase(depsolve.Depsolve):
                      key = (pkg.name, pkg.arch)
                      if pkg.pkgtup in dinst:
                          reinstall_available.append(pkg)
@@ -151999,7 +152510,7 @@ index 99039e0..090882c 100644
  
          # produce the updates list of tuples
          elif pkgnarrow == 'updates':
-@@ -2461,14 +2770,13 @@ class YumBase(depsolve.Depsolve):
+@@ -2461,14 +2804,13 @@ class YumBase(depsolve.Depsolve):
  
          
      def findDeps(self, pkgs):
@@ -152019,7 +152530,7 @@ index 99039e0..090882c 100644
          results = {}
  
          for pkg in pkgs:
-@@ -2495,10 +2803,22 @@ class YumBase(depsolve.Depsolve):
+@@ -2495,10 +2837,22 @@ class YumBase(depsolve.Depsolve):
      # pre 3.2.10 API used to always showdups, so that's the default atm.
      def searchGenerator(self, fields, criteria, showdups=True, keys=False, 
                                               searchtags=True, searchrpmdb=True):
@@ -152046,7 +152557,7 @@ index 99039e0..090882c 100644
          sql_fields = []
          for f in fields:
              sql_fields.append(RPM_TO_SQLITE.get(f, f))
-@@ -2661,6 +2981,14 @@ class YumBase(depsolve.Depsolve):
+@@ -2661,6 +3015,14 @@ class YumBase(depsolve.Depsolve):
                      yield (po, vs)
  
      def searchPackageTags(self, criteria):
@@ -152061,7 +152572,7 @@ index 99039e0..090882c 100644
          results = {} # name = [(criteria, taglist)]
          for c in criteria:
              c = c.lower()
-@@ -2677,11 +3005,16 @@ class YumBase(depsolve.Depsolve):
+@@ -2677,11 +3039,16 @@ class YumBase(depsolve.Depsolve):
          return results
          
      def searchPackages(self, fields, criteria, callback=None):
@@ -152083,7 +152594,7 @@ index 99039e0..090882c 100644
          warnings.warn(_('searchPackages() will go away in a future version of Yum.\
                        Use searchGenerator() instead. \n'),
                  Errors.YumFutureDeprecationWarning, stacklevel=2)           
-@@ -2700,13 +3033,23 @@ class YumBase(depsolve.Depsolve):
+@@ -2700,13 +3067,23 @@ class YumBase(depsolve.Depsolve):
      
      def searchPackageProvides(self, args, callback=None,
                                callback_has_matchfor=False):
@@ -152111,7 +152622,7 @@ index 99039e0..090882c 100644
              else:
                  isglob = True
                  canBeFile = misc.re_filename(arg)
-@@ -2723,7 +3066,7 @@ class YumBase(depsolve.Depsolve):
+@@ -2723,7 +3100,7 @@ class YumBase(depsolve.Depsolve):
                  where = self.returnPackagesByDep(arg)
              else:
                  usedDepString = False
@@ -152120,10 +152631,16 @@ index 99039e0..090882c 100644
              self.verbose_logger.log(logginglevels.DEBUG_1,
                 P_('Searching %d package', 'Searching %d packages', len(where)), len(where))
              
-@@ -2817,25 +3160,93 @@ class YumBase(depsolve.Depsolve):
+@@ -2817,25 +3194,160 @@ class YumBase(depsolve.Depsolve):
              
          return matches
  
+-    def doGroupLists(self, uservisible=0, patterns=None, ignore_case=True):
+-        """returns two lists of groups, installed groups and available groups
+-           optional 'uservisible' bool to tell it whether or not to return
+-           only groups marked as uservisible"""
+-        
+-        
 +    def _groupInstalledData(self, group):
 +        """ Return a dict of
 +             pkg_name =>
@@ -152158,30 +152675,81 @@ index 99039e0..090882c 100644
 +
 +        return ret
 +
++    def _groupInstalledEnvData(self, evgroup):
++        """ Return a dict of
++             grp_name =>
++             (installed, available,
++             backlisted-installed, blacklisted-available). """
++        ret = {}
++        if not evgroup or self.conf.group_command != 'objects':
++            return ret
++
++        grp_names = {}
++        if evgroup.environmentid in self.igroups.groups:
++            grp_names = self.igroups.environments[evgroup.environmentid]
++            grp_names = grp_names.grp_names
++
++        for grp_name in set(evgroup.allgroups + list(grp_names)):
++            igrp = self.igroups.groups.get(grp_name)
++            if grp_name not in grp_names and not igrp:
++                ret[grp_name] = 'available'
++                continue
++
++            if not igrp:
++                ret[grp_name] = 'blacklisted-available'
++                continue
++
++            if igrp.environment == evgroup.environmentid:
++                ret[grp_name] = 'installed'
++                break
++            else:
++                ret[grp_name] = 'blacklisted-installed'
++
++        return ret
++
 +    def _groupReturnGroups(self, patterns=None, ignore_case=True):
 +        igrps = None
++        ievgrps = None
 +        if patterns is None:
 +            grps = self.comps.groups
 +            if self.conf.group_command == 'objects':
 +                igrps = self.igroups.groups.values()
-+            return igrps, grps
++            evgrps = self.comps.environments
++            if False and self.conf.group_command == 'objects':
++                # FIXME: Environment groups.
++                ievgrps = self.igroups.environments.values()
++            return igrps, grps, ievgrps, evgrps
++
++        gpats = []
++        epats = []
++        for pat in patterns:
++            if pat.startswith('@^'):
++                epats.append(pat[2:])
++            elif pat.startswith('@'):
++                gpats.append(pat[1:])
++            else:
++                epats.append(pat)
++                gpats.append(pat)
++
++        epats = ",".join(epats)
++        gpats = ",".join(gpats)
 +
-+        pats = ",".join(patterns)
 +        cs   = not ignore_case
-+        grps = self.comps.return_groups(pats, case_sensitive=cs)
++        grps = self.comps.return_groups(gpats, case_sensitive=cs)
 +        #  Because we want name matches too, and we don't store group names
 +        # we need to add the groupid's we've found:
 +        if self.conf.group_command == 'objects':
-+            pats += "," + ",".join([grp.groupid for grp in grps])
-+            igrps = self.igroups.return_groups(pats, case_sensitive=cs)
-+        return igrps, grps
++            gpats = gpats + "," + ",".join([grp.groupid for grp in grps])
++            igrps = self.igroups.return_groups(gpats, case_sensitive=cs)
 +
-     def doGroupLists(self, uservisible=0, patterns=None, ignore_case=True):
--        """returns two lists of groups, installed groups and available groups
--           optional 'uservisible' bool to tell it whether or not to return
--           only groups marked as uservisible"""
--        
--        
++        evgrps = self.comps.return_environments(epats, case_sensitive=cs)
++        if self.conf.group_command == 'objects':
++            epats = epats+ "," + ",".join([grp.environmentid for grp in evgrps])
++            ievgrps = self.igroups.return_environments(epats, case_sensitive=cs)
++        return igrps, grps, ievgrps, evgrps
++
++    def doGroupLists(self, uservisible=0, patterns=None, ignore_case=True,
++                     return_evgrps=False):
 +        """Return two lists of groups: installed groups and available
 +        groups.
 +
@@ -152192,9 +152760,13 @@ index 99039e0..090882c 100644
 +           lists.  If not given, all groups will be included
 +        :param ignore_case: whether to ignore case when determining
 +           whether group names match the strings in *patterns*
++        :param return_evgrps: whether to return environment groups as well as
++           package groups
 +        """
          installed = []
          available = []
++        einstalled = []
++        eavailable = []
  
          if self.comps.compscount == 0:
              raise Errors.GroupsError, _('No group data available for configured repositories')
@@ -152204,7 +152776,8 @@ index 99039e0..090882c 100644
 -        else:
 -            grps = self.comps.return_groups(",".join(patterns),
 -                                            case_sensitive=not ignore_case)
-+        igrps, grps = self._groupReturnGroups(patterns, ignore_case)
++        igrps, grps, ievgrps, evgrps = self._groupReturnGroups(patterns,
++                                                               ignore_case)
 +
 +        if igrps is not None:
 +            digrps = {}
@@ -152212,6 +152785,12 @@ index 99039e0..090882c 100644
 +                digrps[igrp.gid] = igrp
 +            igrps = digrps
 +
++        if ievgrps is not None:
++            digrps = {}
++            for ievgrp in ievgrps:
++                digrps[ievgrp.evgid] = ievgrp
++            ievgrps = digrps
++
          for grp in grps:
 -            if grp.installed:
 +            if igrps is None:
@@ -152225,23 +152804,53 @@ index 99039e0..090882c 100644
                  if uservisible:
                      if grp.user_visible:
                          installed.append(grp)
-@@ -2848,12 +3259,29 @@ class YumBase(depsolve.Depsolve):
+@@ -2847,34 +3359,98 @@ class YumBase(depsolve.Depsolve):
+                         available.append(grp)
                  else:
                      available.append(grp)
++
++        for evgrp in evgrps:
++            if ievgrps is None:
++                evgrp_installed = evgrp.installed
++            else:
++                evgrp_installed = evgrp.environmentid in ievgrps
++                if evgrp_installed:
++                    del ievgrps[evgrp.environmentid]
++
++            if evgrp_installed:
++                einstalled.append(evgrp)
++            else:
++                eavailable.append(evgrp)
              
 +        if igrps is None:
-+            return sorted(installed), sorted(available)
++            igrps = {}
++        if ievgrps is None:
++            ievgrps = {}
 +
 +        for igrp in igrps.values():
 +            #  These are installed groups that aren't in comps anymore. so we
 +            # create fake comps groups for them.
 +            grp = comps.Group()
++            grp.groupid = igrp.gid
 +            grp.installed = True
 +            grp.name = grp.groupid
 +            for pkg_name in igrp.pkg_names:
 +                grp.mandatory_packages[pkg_name] = 1
 +            installed.append(grp)
 +
++        for ievgrp in ievgrps.values():
++            #  These are installed evgroups that aren't in comps anymore. so we
++            # create fake comps evgroups for them.
++            evgrp = comps.Environment()
++            grp.environmentid = ievgrp.evgid
++            evgrp.installed = True
++            evgrp.name = evgrp.environmentid
++            evgrp._groups = list(ievgrp.groups)
++            einstalled.append(evgrp)
++
++        if return_evgrps:
++            return (sorted(installed), sorted(available),
++                    sorted(einstalled), sorted(eavailable))
          return sorted(installed), sorted(available)
      
 -    
@@ -152256,26 +152865,41 @@ index 99039e0..090882c 100644
 +           transaction set by this function
 +        """
          txmbrs_used = []
-         
-         thesegroups = self.comps.return_groups(grpid)
-@@ -2861,20 +3289,28 @@ class YumBase(depsolve.Depsolve):
+-        
+-        thesegroups = self.comps.return_groups(grpid)
++
++        if self.conf.group_command == 'objects':
++            thesegroups = self.igroups.return_groups(grpid)
++        else:
++            thesegroups = self.comps.return_groups(grpid)
+         if not thesegroups:
              raise Errors.GroupsError, _("No Group named %s exists") % to_unicode(grpid)
  
          for thisgroup in thesegroups:
 +            igroup_data = self._groupInstalledData(thisgroup)
 +
              thisgroup.toremove = True
-             pkgs = thisgroup.packages
-             for pkg in thisgroup.packages:
+-            pkgs = thisgroup.packages
+-            for pkg in thisgroup.packages:
++
++            if self.conf.group_command == 'objects':
++                pkgs = thisgroup.pkg_names
++                gid  = thisgroup.gid
++            else:
++                pkgs = thisgroup.packages
++                gid  = thisgroup.groupid
++
++            for pkg in pkgs:
 +                if pkg in igroup_data and igroup_data[pkg] != 'installed':
 +                    continue
 +
                  txmbrs = self.remove(name=pkg, silence_warnings=True)
                  txmbrs_used.extend(txmbrs)
                  for txmbr in txmbrs:
-                     txmbr.groups.append(thisgroup.groupid)
+-                    txmbr.groups.append(thisgroup.groupid)
++                    txmbr.groups.append(gid)
 +            if igroup_data:
-+                self.igroups.del_group(thisgroup.groupid)
++                self.igroups.del_group(gid)
              
          return txmbrs_used
  
@@ -152289,7 +152913,7 @@ index 99039e0..090882c 100644
          thesegroups = self.comps.return_groups(grpid)
          if not thesegroups:
              raise Errors.GroupsError, _("No Group named %s exists") % to_unicode(grpid)
-@@ -2898,13 +3334,18 @@ class YumBase(depsolve.Depsolve):
+@@ -2898,13 +3474,58 @@ class YumBase(depsolve.Depsolve):
                              self.tsInfo.remove(txmbr.po.pkgtup)
          
          
@@ -152300,8 +152924,48 @@ index 99039e0..090882c 100644
 -           Optionally take:
 -           group_package_types=List - overrides self.conf.group_package_types
 -           enable_group_conditionals=Bool - overrides self.conf.enable_group_conditionals
++    def environmentRemove(self, evgrpid):
++        """Mark all the packages in the given group to be removed.
++
++        :param evgrpid: the name of the environment containing the groups to
++           mark for removal
++        :return: a list of transaction members added to the
++           transaction set by this function
++        """
++        txmbrs_used = []
++
++        if self.conf.group_command == 'objects':
++            thesegroups = self.igroups.return_environments(evgrpid)
++        else:
++            thesegroups = self.comps.return_environments(evgrpid)
++        if not thesegroups:
++            raise Errors.GroupsError, _("No Environment named %s exists") % to_unicode(evgrpid)
++
++        for thisgroup in thesegroups:
++            igroup_data = self._groupInstalledEnvData(thisgroup)
++
++            if self.conf.group_command == 'objects':
++                grps  = thisgroup.grp_names
++                evgid = thisgroup.evgid
++            else:
++                grps  = thisgroup.allgroups
++                evgid = thisgroup.environmentid
++
++            for grp in grps:
++                if grp in igroup_data and igroup_data[grp] != 'installed':
++                    continue
++
++                txmbrs = self.groupRemove(grp)
++                txmbrs_used.extend(txmbrs)
++                for txmbr in txmbrs:
++                    txmbr.environments.append(evgid)
++            if igroup_data:
++                self.igroups.del_environment(evgid)
++
++        return txmbrs_used
++
 +    def selectGroup(self, grpid, group_package_types=[],
-+                    enable_group_conditionals=None, upgrade=False):
++                    enable_group_conditionals=None, upgrade=False, ievgrp=None):
 +        """Mark all the packages in the given group to be installed.
 +
 +        :param grpid: the name of the group containing the packages to
@@ -152315,7 +152979,17 @@ index 99039e0..090882c 100644
          """
  
          if not self.comps.has_group(grpid):
-@@ -2934,12 +3375,47 @@ class YumBase(depsolve.Depsolve):
+@@ -2920,6 +3541,9 @@ class YumBase(depsolve.Depsolve):
+         if group_package_types:
+             package_types = group_package_types
+ 
++        if self.conf.group_command == 'compat':
++            upgrade = False
++
+         for thisgroup in thesegroups:
+             if thisgroup.selected:
+                 continue
+@@ -2934,12 +3558,49 @@ class YumBase(depsolve.Depsolve):
              if 'optional' in package_types:
                  pkgs.extend(thisgroup.optional_packages)
  
@@ -152325,7 +152999,8 @@ index 99039e0..090882c 100644
 +                if thisgroup.groupid in self.igroups.groups:
 +                    igrp = self.igroups.groups[thisgroup.groupid]
 +                else:
-+                    self.igroups.add_group(thisgroup.groupid,thisgroup.packages)
++                    self.igroups.add_group(thisgroup.groupid,
++                                           thisgroup.packages, ievgrp)
 +            pkgs.extend(list(igroup_data.keys()))
 +
              old_txmbrs = len(txmbrs_used)
@@ -152353,7 +153028,8 @@ index 99039e0..090882c 100644
 +                    if (upgrade and
 +                        (self.conf.group_command == 'simple' or
 +                         (igroup_data and igroup_data[pkg] == 'installed'))):
-+                        txmbrs = self.update(name = pkg)
++                        txmbrs = self.update(name = pkg,
++                                             pkg_warning_level='debug2')
 +                    elif igroup_data and igroup_data[pkg] == 'installed':
 +                        pass # Don't upgrade on install.
 +                    else:
@@ -152364,15 +153040,28 @@ index 99039e0..090882c 100644
                  except Errors.InstallError, e:
                      self.verbose_logger.debug(_('No package named %s available to be installed'),
                          pkg)
-@@ -2953,6 +3429,7 @@ class YumBase(depsolve.Depsolve):
+@@ -2953,7 +3614,9 @@ class YumBase(depsolve.Depsolve):
                  group_conditionals = enable_group_conditionals
  
              count_cond_test = 0
+-            if group_conditionals:
 +            # FIXME: What do we do about group conditionals when group==objects
-             if group_conditionals:
++            #        or group upgrade for group_command=simple?
++            if not upgrade and group_conditionals:
                  for condreq, cond in thisgroup.conditional_packages.iteritems():
                      if self.isPackageInstalled(cond):
-@@ -2997,10 +3474,14 @@ class YumBase(depsolve.Depsolve):
+                         try:
+@@ -2990,17 +3653,22 @@ class YumBase(depsolve.Depsolve):
+                         if cond not in self.tsInfo.conditionals:
+                             self.tsInfo.conditionals[cond] = []
+                         self.tsInfo.conditionals[cond].extend(pkgs)
+-            if len(txmbrs_used) == old_txmbrs:
+-                self.logger.critical(_('Warning: Group %s does not have any packages.'), thisgroup.groupid)
++
++            if not upgrade and len(txmbrs_used) == old_txmbrs:
++                self.logger.critical(_('Warning: Group %s does not have any packages to install.'), thisgroup.groupid)
+                 if count_cond_test:
+                     self.logger.critical(_('Group %s does have %u conditional packages, which may get installed.'), count_cond_test)
          return txmbrs_used
  
      def deselectGroup(self, grpid, force=False):
@@ -152391,9 +153080,100 @@ index 99039e0..090882c 100644
          
          if not self.comps.has_group(grpid):
              raise Errors.GroupsError, _("No Group named %s exists") % to_unicode(grpid)
-@@ -3035,12 +3516,21 @@ class YumBase(depsolve.Depsolve):
+@@ -3008,7 +3676,8 @@ class YumBase(depsolve.Depsolve):
+         thesegroups = self.comps.return_groups(grpid)
+         if not thesegroups:
+             raise Errors.GroupsError, _("No Group named %s exists") % to_unicode(grpid)
+-        
++
++        # FIXME: Do something with groups as objects, and env. groups.
+         for thisgroup in thesegroups:
+             thisgroup.selected = False
+             
+@@ -3034,13 +3703,102 @@ class YumBase(depsolve.Depsolve):
+                         for pkg in self.tsInfo.conditionals.get(txmbr.name, []):
                              self.tsInfo.remove(pkg.pkgtup)
          
++    def selectEnvironment(self, evgrpid, group_package_types=[],
++                          enable_group_conditionals=None, upgrade=False):
++        """Mark all the groups in the given environment group to be installed.
++
++        :param evgrpid: the name of the env. group containing the groups to
++           mark for installation
++        :param group_package_types: a list of the types of groups to
++           work with.  This overrides self.conf.group_package_types
++        :param enable_group_conditionals: overrides
++           self.conf.enable_group_conditionals
++        :return: a list of transaction members added to the
++           transaction set by this function
++        """
++        evgrps = self.comps.return_environments(evgrpid)
++        if not evgrps:
++            raise Errors.GroupsError, _("No Environment named %s exists") % to_unicode(evgrpid)
++
++        ret = []
++        for evgrp in evgrps:
++
++            ievgrp = None
++            if self.conf.group_command == 'compat':
++                grps = ",".join(sorted(evgrp.groups))
++            elif self.conf.group_command == 'simple':
++                if not upgrade:
++                    grps = ",".join(sorted(evgrp.groups))
++                else: # Only upgrade the installed groups...
++                    grps = []
++                    for grpid in evgrp.groups:
++                        grp = self.comps.return_group(grpid)
++                        if grp is None:
++                            continue
++                        if not grp.installed:
++                            continue
++                        grps.append(grpid)
++                    grps = ",".join(sorted(grps))
++            elif self.conf.group_command == 'objects':
++                igroup_data = self._groupInstalledEnvData(evgrp)
++ 
++                grps = []
++                for grpid in evgrp.groups:
++                    if (grpid not in igroup_data or
++                        igroup_data[grpid].startswith('blacklisted')):
++                        msg = _('Skipping group %s from environment %s'),
++                        self.verbose_logger.log(logginglevels.DEBUG_2,
++                                                msg, grpid, evgrp.environmentid)
++                        continue
++                    grps.apped(grp)
++                if evgrp.environmentid in self.igroups.environments:
++                    ievgrp = self.igroups.environments[evgrp.environmentid]
++                else:
++                    self.igroups.add_environment(evgrp.environmentid,
++                                                 evgrp.allgroups)
++                grps = ",".join(sorted(grps))
++
++            txs = self.selectGroup(grps,
++                                   group_package_types,
++                                   enable_group_conditionals, upgrade,
++                                   ievgrp=ievgrp)
++            ret.extend(txs)
++        return ret
++
++    def deselectEnvironment(self, evgrpid, force=False):
++        """Unmark the groups in the given environment group from being
++        installed.
++
++        :param evgrpid: the name of the environment group containing the
++           groups to unmark from installation
++        :param force: if True, force remove all the packages in the
++           given groups from the transaction
++        """
++        evgrps = self.comps.return_environments(evgrpid)
++        if not thesegroups:
++            raise Errors.GroupsError, _("No Environment named %s exists") % to_unicode(evgrpid)
++
++        for evgrp in evgrps:
++            grps = ",".join(sorted(evgrp.groups))
++            self.deselectGroup(grps, force)
++            # FIXME: env. needs to be marked not-to-be-installed, etc.
++
      def getPackageObject(self, pkgtup, allow_missing=False):
 -        """retrieves a packageObject from a pkgtuple - if we need
 -           to pick and choose which one is best we better call out
@@ -152419,7 +153199,7 @@ index 99039e0..090882c 100644
          # look it up in the self.localPackages first:
          for po in self.localPackages:
              if po.pkgtup == pkgtup:
-@@ -3049,7 +3539,7 @@ class YumBase(depsolve.Depsolve):
+@@ -3049,7 +3807,7 @@ class YumBase(depsolve.Depsolve):
          pkgs = self.pkgSack.searchPkgTuple(pkgtup)
  
          if len(pkgs) == 0:
@@ -152428,7 +153208,7 @@ index 99039e0..090882c 100644
              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)
-@@ -3065,13 +3555,21 @@ class YumBase(depsolve.Depsolve):
+@@ -3065,13 +3823,21 @@ class YumBase(depsolve.Depsolve):
          return result
  
      def getInstalledPackageObject(self, pkgtup):
@@ -152455,7 +153235,7 @@ index 99039e0..090882c 100644
              raise Errors.RpmDBError, _('Package tuple %s could not be found in rpmdb') % str(pkgtup)
  
          # Dito. FIXME from getPackageObject() for len() > 1 ... :)
-@@ -3079,9 +3577,11 @@ class YumBase(depsolve.Depsolve):
+@@ -3079,9 +3845,11 @@ class YumBase(depsolve.Depsolve):
          return po
          
      def gpgKeyCheck(self):
@@ -152469,7 +153249,7 @@ index 99039e0..090882c 100644
          gpgkeyschecked = self.conf.cachedir + '/.gpgkeyschecked.yum'
          if os.path.exists(gpgkeyschecked):
              return 1
-@@ -3106,9 +3606,13 @@ class YumBase(depsolve.Depsolve):
+@@ -3106,9 +3874,13 @@ class YumBase(depsolve.Depsolve):
              return 1
  
      def returnPackagesByDep(self, depstring):
@@ -152485,7 +153265,7 @@ index 99039e0..090882c 100644
          if not depstring:
              return []
  
-@@ -3135,9 +3639,16 @@ class YumBase(depsolve.Depsolve):
+@@ -3135,9 +3907,16 @@ class YumBase(depsolve.Depsolve):
          return self.pkgSack.getProvides(depname, depflags, depver).keys()
  
      def returnPackageByDep(self, depstring):
@@ -152505,7 +153285,7 @@ index 99039e0..090882c 100644
          # we get all sorts of randomness here
          errstring = depstring
          if type(depstring) not in types.StringTypes:
-@@ -3149,16 +3660,22 @@ class YumBase(depsolve.Depsolve):
+@@ -3149,16 +3928,22 @@ class YumBase(depsolve.Depsolve):
              raise Errors.YumBaseError, _('No Package found for %s') % errstring
          
          ps = ListPackageSack(pkglist)
@@ -152532,7 +153312,7 @@ index 99039e0..090882c 100644
          if not depstring:
              return []
  
-@@ -3184,12 +3701,47 @@ class YumBase(depsolve.Depsolve):
+@@ -3184,12 +3969,47 @@ class YumBase(depsolve.Depsolve):
  
          return self.rpmdb.getProvides(depname, depflags, depver).keys()
  
@@ -152582,7 +153362,7 @@ index 99039e0..090882c 100644
          
          
          if len(pkglist) == 0:
-@@ -3198,14 +3750,23 @@ class YumBase(depsolve.Depsolve):
+@@ -3198,14 +4018,23 @@ class YumBase(depsolve.Depsolve):
          if len(pkglist) == 1:
              return pkglist[0]
  
@@ -152612,7 +153392,7 @@ index 99039e0..090882c 100644
          returnlist = []
          compatArchList = self.arch.get_arch_list(arch)
          multiLib = []
-@@ -3222,9 +3783,9 @@ class YumBase(depsolve.Depsolve):
+@@ -3222,9 +4051,9 @@ class YumBase(depsolve.Depsolve):
                  singleLib.append(po)
                  
          # we now have three lists.  find the best package(s) of each
@@ -152625,7 +153405,7 @@ index 99039e0..090882c 100644
  
          if single_name and multi and single and multi.name != single.name:
              # Sinlge _must_ match multi, if we want a single package name
-@@ -3238,7 +3799,7 @@ class YumBase(depsolve.Depsolve):
+@@ -3238,7 +4067,7 @@ class YumBase(depsolve.Depsolve):
          # if there's a noarch and it's newer than the multilib, we want
          # just the noarch.  otherwise, we want multi + single
          elif multi:
@@ -152634,7 +153414,7 @@ index 99039e0..090882c 100644
              if best.arch == "noarch":
                  returnlist.append(no)
              else:
-@@ -3246,7 +3807,7 @@ class YumBase(depsolve.Depsolve):
+@@ -3246,7 +4075,7 @@ class YumBase(depsolve.Depsolve):
                  if single: returnlist.append(single)
          # similar for the non-multilib case
          elif single:
@@ -152643,7 +153423,7 @@ index 99039e0..090882c 100644
              if best.arch == "noarch":
                  returnlist.append(no)
              else:
-@@ -3350,23 +3911,27 @@ class YumBase(depsolve.Depsolve):
+@@ -3350,28 +4179,58 @@ class YumBase(depsolve.Depsolve):
              done = True
  
              slow = next_func(slow)
@@ -152658,6 +153438,20 @@ index 99039e0..090882c 100644
          assert pattern[0] == '@'
          group_string = pattern[1:]
          tx_return = []
++
++        if group_string and group_string[0] == '^':
++            group_string = group_string[1:]
++            # Actually dealing with "environment groups".
++            for env_grp in self.comps.return_environments(group_string):
++                try:
++                    txmbrs = self.selectEnvironment(env_grp.environmentid,
++                                                    upgrade=upgrade)
++                    tx_return.extend(txmbrs)
++                except yum.Errors.GroupsError:
++                    self.logger.critical(_('Warning: Environment Group %s does not exist.'), group_string)
++                    continue
++            return tx_return
++
          for group in self.comps.return_groups(group_string):
              try:
 -                txmbrs = self.selectGroup(group.groupid)
@@ -152676,16 +153470,46 @@ index 99039e0..090882c 100644
      def _at_groupremove(self, pattern):
          " Do groupremove via. leading @ on the cmd line, for remove."
          assert pattern[0] == '@'
-@@ -3398,7 +3963,7 @@ class YumBase(depsolve.Depsolve):
+         group_string = pattern[1:]
+         tx_return = []
++
++        if group_string and group_string[0] == '^':
++            group_string = group_string[1:]
++            # Actually dealing with "environment groups".
++            try:
++                txmbrs = self.environmentRemove(group_string)
++            except yum.Errors.GroupsError:
++                self.logger.critical(_('Warning: Environment Group %s does not exist.'), group_string)
++            else:
++                tx_return.extend(txmbrs)
++            return tx_return
++
+         try:
+             txmbrs = self.groupRemove(group_string)
+         except yum.Errors.GroupsError:
+@@ -3387,6 +4246,8 @@ class YumBase(depsolve.Depsolve):
+         assert pattern[0] == '@'
+         grpid = pattern[1:]
+ 
++        # FIXME: **** environment groups and groups as objects... ****
++
+         thesegroups = self.comps.return_groups(grpid)
+         if not thesegroups:
+             raise Errors.GroupsError, _("No Group named %s exists") % to_unicode(grpid)
+@@ -3398,7 +4259,11 @@ class YumBase(depsolve.Depsolve):
      def _minus_deselect(self, pattern):
          """ Remove things from the transaction, like kickstart. """
          assert pattern[0] == '-'
 -        pat = pattern[1:]
 +        pat = pattern[1:].strip()
++
++        if pat and pat.startswith('@^'):
++            pat = pat[2:]
++            return self.deselectEnvironment(pat)
  
          if pat and pat[0] == '@':
              pat = pat[1:]
-@@ -3437,14 +4002,61 @@ class YumBase(depsolve.Depsolve):
+@@ -3437,14 +4302,61 @@ class YumBase(depsolve.Depsolve):
              if flag not in self.tsInfo.probFilterFlags:
                  self.tsInfo.probFilterFlags.append(flag)
  
@@ -152753,7 +153577,7 @@ index 99039e0..090882c 100644
          pkgs = []
          was_pattern = False
          if po:
-@@ -3477,20 +4089,12 @@ class YumBase(depsolve.Depsolve):
+@@ -3477,20 +4389,12 @@ class YumBase(depsolve.Depsolve):
                      self.verbose_logger.debug(_('Checking for virtual provide or file-provide for %s'), 
                          arg)
  
@@ -152780,7 +153604,7 @@ index 99039e0..090882c 100644
              else:
                  nevra_dict = self._nevra_kwarg_parse(kwargs)
  
-@@ -3577,8 +4181,8 @@ class YumBase(depsolve.Depsolve):
+@@ -3577,8 +4481,8 @@ class YumBase(depsolve.Depsolve):
                      continue
              
              # make sure this shouldn't be passed to update:
@@ -152791,7 +153615,7 @@ index 99039e0..090882c 100644
                  txmbrs = self.update(po=po)
                  tx_return.extend(txmbrs)
                  continue
-@@ -3587,7 +4191,7 @@ class YumBase(depsolve.Depsolve):
+@@ -3587,7 +4491,7 @@ class YumBase(depsolve.Depsolve):
              # something else in the repo. Unless there is a obsoletion loop,
              # at which point ignore everything.
              obsoleting_pkg = None
@@ -152800,7 +153624,7 @@ index 99039e0..090882c 100644
                  obsoleting_pkg = self._test_loop(po, self._pkg2obspkg)
              if obsoleting_pkg is not None:
                  # this is not a definitive check but it'll make sure we don't
-@@ -3600,23 +4204,23 @@ class YumBase(depsolve.Depsolve):
+@@ -3600,23 +4504,23 @@ class YumBase(depsolve.Depsolve):
                      already_obs = pkgs[0]
  
                  if already_obs:
@@ -152831,7 +153655,7 @@ index 99039e0..090882c 100644
                      continue
  
              # make sure we don't have a name.arch of this already installed
-@@ -3630,7 +4234,7 @@ class YumBase(depsolve.Depsolve):
+@@ -3630,7 +4534,7 @@ class YumBase(depsolve.Depsolve):
                          found = True
                          break
                  if not found:
@@ -152840,7 +153664,7 @@ index 99039e0..090882c 100644
                      txmbrs = self.update(po=po)
                      tx_return.extend(txmbrs)
                      continue
-@@ -3719,14 +4323,33 @@ class YumBase(depsolve.Depsolve):
+@@ -3719,19 +4623,47 @@ class YumBase(depsolve.Depsolve):
          return txmbr
  
      def update(self, po=None, requiringPo=None, update_to=False, **kwargs):
@@ -152881,7 +153705,21 @@ index 99039e0..090882c 100644
          # check for args - if no po nor kwargs, do them all
          # if po, do it, ignore all else
          # if no po do kwargs
-@@ -3765,7 +4388,12 @@ class YumBase(depsolve.Depsolve):
+         # uninstalled pkgs called for update get returned with errors in a list, maybe?
+ 
++        pkg_warn = kwargs.get('pkg_warning_level', 'flibble')
++        def _dbg2(*args, **kwargs):
++            self.verbose_logger.log(logginglevels.DEBUG_2, *args, **kwargs)
++        level2func = {'debug2' : _dbg2,
++                      'warning' : self.verbose_logger.warning}
++        if pkg_warn not in level2func:
++            pkg_warn = 'warning'
++        pkg_warn = level2func[pkg_warn]
++
+         tx_return = []
+         if not po and not kwargs: # update everything (the easy case)
+             self.verbose_logger.log(logginglevels.DEBUG_2, _('Updating Everything'))
+@@ -3765,7 +4697,12 @@ class YumBase(depsolve.Depsolve):
                      if new is None:
                          continue
                      tx_return.extend(self.update(po=new))
@@ -152895,7 +153733,7 @@ index 99039e0..090882c 100644
              return tx_return
  
          # complications
-@@ -3787,7 +4415,7 @@ class YumBase(depsolve.Depsolve):
+@@ -3787,7 +4724,7 @@ class YumBase(depsolve.Depsolve):
                  return self._minus_deselect(kwargs['pattern'])
  
              if kwargs['pattern'] and kwargs['pattern'][0] == '@':
@@ -152904,7 +153742,16 @@ index 99039e0..090882c 100644
  
              arg = kwargs['pattern']
              if not update_to:
-@@ -3920,6 +4548,18 @@ class YumBase(depsolve.Depsolve):
+@@ -3843,7 +4780,7 @@ class YumBase(depsolve.Depsolve):
+                     availpkgs = self._compare_providers(availpkgs, requiringPo)
+                     availpkgs = map(lambda x: x[0], availpkgs)
+                 elif not availpkgs:
+-                    self.logger.warning(_("No package matched to upgrade: %s"), self._ui_nevra_dict(nevra_dict))
++                    pkg_warn(_("No package matched to upgrade: %s"), self._ui_nevra_dict(nevra_dict))
+        
+         # for any thing specified
+         # get the list of available pkgs matching it (or take the po)
+@@ -3920,6 +4857,18 @@ class YumBase(depsolve.Depsolve):
                      tx_return.append(txmbr)
                          
          for available_pkg in availpkgs:
@@ -152923,7 +153770,7 @@ index 99039e0..090882c 100644
              #  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.
-@@ -3985,11 +4625,18 @@ class YumBase(depsolve.Depsolve):
+@@ -3985,11 +4934,18 @@ class YumBase(depsolve.Depsolve):
          return tx_return
          
      def remove(self, po=None, **kwargs):
@@ -152947,7 +153794,7 @@ index 99039e0..090882c 100644
          if not po and not kwargs:
              raise Errors.RemoveError, 'Nothing specified to remove'
          
-@@ -4055,17 +4702,19 @@ class YumBase(depsolve.Depsolve):
+@@ -4055,17 +5011,19 @@ class YumBase(depsolve.Depsolve):
          return tx_return
  
      def installLocal(self, pkg, po=None, updateonly=False):
@@ -152977,7 +153824,7 @@ index 99039e0..090882c 100644
          # read in the package into a YumLocalPackage Object
          # append it to self.localPackages
          # check if it can be installed or updated based on nevra versus rpmdb
-@@ -4183,16 +4832,15 @@ class YumBase(depsolve.Depsolve):
+@@ -4183,16 +5141,15 @@ class YumBase(depsolve.Depsolve):
          return tx_return
  
      def reinstallLocal(self, pkg, po=None):
@@ -153002,7 +153849,7 @@ index 99039e0..090882c 100644
          if not po:
              try:
                  po = YumUrlPackage(self, ts=self.rpmdb.readOnlyTS(), url=pkg,
-@@ -4215,9 +4863,19 @@ class YumBase(depsolve.Depsolve):
+@@ -4215,9 +5172,19 @@ class YumBase(depsolve.Depsolve):
          return self.reinstall(po=po)
  
      def reinstall(self, po=None, **kwargs):
@@ -153025,7 +153872,7 @@ index 99039e0..090882c 100644
          self._add_prob_flags(rpm.RPMPROB_FILTER_REPLACEPKG,
                               rpm.RPMPROB_FILTER_REPLACENEWFILES,
                               rpm.RPMPROB_FILTER_REPLACEOLDFILES)
-@@ -4259,16 +4917,15 @@ class YumBase(depsolve.Depsolve):
+@@ -4259,16 +5226,15 @@ class YumBase(depsolve.Depsolve):
          return tx_mbrs
          
      def downgradeLocal(self, pkg, po=None):
@@ -153050,7 +153897,7 @@ index 99039e0..090882c 100644
          if not po:
              try:
                  po = YumUrlPackage(self, ts=self.rpmdb.readOnlyTS(), url=pkg,
-@@ -4309,13 +4966,19 @@ class YumBase(depsolve.Depsolve):
+@@ -4309,13 +5275,19 @@ class YumBase(depsolve.Depsolve):
          return False
          
      def downgrade(self, po=None, **kwargs):
@@ -153077,7 +153924,7 @@ index 99039e0..090882c 100644
          if not po and not kwargs:
              raise Errors.DowngradeError, 'Nothing specified to downgrade'
  
-@@ -4421,6 +5084,9 @@ class YumBase(depsolve.Depsolve):
+@@ -4421,6 +5393,9 @@ class YumBase(depsolve.Depsolve):
                  warned_nas.add(na)
                  continue
  
@@ -153087,7 +153934,7 @@ index 99039e0..090882c 100644
              if pkg.verGE(lipkg):
                  if na not in warned_nas:
                      msg = _('Only Upgrade available on package: %s') % pkg
-@@ -4457,7 +5123,7 @@ class YumBase(depsolve.Depsolve):
+@@ -4457,7 +5432,7 @@ class YumBase(depsolve.Depsolve):
          if e and v and r:
              evr = '%s:%s-%s' % (e, v, r)
          elif v and r:
@@ -153096,7 +153943,7 @@ index 99039e0..090882c 100644
          elif e and v:
              evr = '%s:%s' % (e, v)
          elif v: # e and r etc. is just too weird to print
-@@ -4500,12 +5166,24 @@ class YumBase(depsolve.Depsolve):
+@@ -4500,12 +5475,24 @@ class YumBase(depsolve.Depsolve):
  
          return returndict
  
@@ -153124,7 +153971,7 @@ index 99039e0..090882c 100644
          old_conf_obs = self.conf.obsoletes
          self.conf.obsoletes = False
          done = False
-@@ -4515,19 +5193,46 @@ class YumBase(depsolve.Depsolve):
+@@ -4515,19 +5502,46 @@ class YumBase(depsolve.Depsolve):
                      done = True
          for pkg in transaction.trans_data:
              if pkg.state == 'Downgrade':
@@ -153171,7 +154018,7 @@ index 99039e0..090882c 100644
                  if self.install(pkgtup=pkg.pkgtup):
                      done = True
          for pkg in transaction.trans_data:
-@@ -4538,8 +5243,14 @@ class YumBase(depsolve.Depsolve):
+@@ -4538,8 +5552,14 @@ class YumBase(depsolve.Depsolve):
          return done
  
      def history_undo(self, transaction):
@@ -153188,7 +154035,7 @@ index 99039e0..090882c 100644
          # NOTE: This is somewhat basic atm. ... for instance we don't check
          #       that we are going from the old new version. However it's still
          #       better than the RHN rollback code, and people pay for that :).
-@@ -4616,7 +5327,7 @@ class YumBase(depsolve.Depsolve):
+@@ -4616,7 +5636,7 @@ class YumBase(depsolve.Depsolve):
  
          except urlgrabber.grabber.URLGrabError, e:
              raise Errors.YumBaseError(_('GPG key retrieval failed: ') +
@@ -153197,7 +154044,7 @@ index 99039e0..090882c 100644
                                        
          # check for a .asc file accompanying it - that's our gpg sig on the key
          # suck it down and do the check
-@@ -4649,7 +5360,7 @@ class YumBase(depsolve.Depsolve):
+@@ -4649,7 +5669,7 @@ class YumBase(depsolve.Depsolve):
              keys_info = misc.getgpgkeyinfo(rawkey, multiple=True)
          except ValueError, e:
              raise Errors.YumBaseError(_('Invalid GPG Key from %s: %s') % 
@@ -153206,7 +154053,7 @@ index 99039e0..090882c 100644
          keys = []
          for keyinfo in keys_info:
              thiskey = {}
-@@ -4674,39 +5385,49 @@ class YumBase(depsolve.Depsolve):
+@@ -4674,39 +5694,49 @@ class YumBase(depsolve.Depsolve):
              if pkgs:
                  pkgs = sorted(pkgs)[-1]
                  msg = (_('Importing %s key 0x%s:\n'
@@ -153274,7 +154121,7 @@ index 99039e0..090882c 100644
          user_cb_fail = False
          for keyurl in keyurls:
              keys = self._retrievePublicKey(keyurl, repo)
-@@ -4725,7 +5446,9 @@ class YumBase(depsolve.Depsolve):
+@@ -4725,7 +5755,9 @@ class YumBase(depsolve.Depsolve):
                      # Try installing/updating GPG key
                      self._getKeyImportMessage(info, keyurl)
                      rc = False
@@ -153285,7 +154132,7 @@ index 99039e0..090882c 100644
                          rc = True
                          
                      # grab the .sig/.asc for the keyurl, if it exists
-@@ -4751,8 +5474,8 @@ class YumBase(depsolve.Depsolve):
+@@ -4751,8 +5783,8 @@ class YumBase(depsolve.Depsolve):
                  ts = self.rpmdb.readOnlyTS()
                  result = ts.pgpImportPubkey(misc.procgpgkey(info['raw_key']))
                  if result != 0:
@@ -153296,7 +154143,7 @@ index 99039e0..090882c 100644
                  self.logger.info(_('Key imported successfully'))
                  key_installed = True
  
-@@ -4760,18 +5483,20 @@ class YumBase(depsolve.Depsolve):
+@@ -4760,18 +5792,20 @@ class YumBase(depsolve.Depsolve):
              raise Errors.YumBaseError, _("Didn't install any keys")
  
          if not key_installed:
@@ -153322,7 +154169,7 @@ index 99039e0..090882c 100644
      
      def _getAnyKeyForRepo(self, repo, destdir, keyurl_list, is_cakey=False, callback=None):
          """
-@@ -4788,6 +5513,18 @@ class YumBase(depsolve.Depsolve):
+@@ -4788,6 +5822,18 @@ class YumBase(depsolve.Depsolve):
          """
  
          key_installed = False
@@ -153341,7 +154188,7 @@ index 99039e0..090882c 100644
          user_cb_fail = False
          for keyurl in keyurl_list:
              keys = self._retrievePublicKey(keyurl, repo, getSig=not is_cakey)
-@@ -4819,8 +5556,11 @@ class YumBase(depsolve.Depsolve):
+@@ -4819,8 +5865,11 @@ class YumBase(depsolve.Depsolve):
                  if not key_installed:
                      self._getKeyImportMessage(info, keyurl, keytype)
                      rc = False
@@ -153354,7 +154201,7 @@ index 99039e0..090882c 100644
                      elif callback:
                          rc = callback({"repo": repo, "userid": info['userid'],
                                          "hexkeyid": info['hexkeyid'], "keyurl": keyurl,
-@@ -4835,7 +5575,8 @@ class YumBase(depsolve.Depsolve):
+@@ -4835,7 +5884,8 @@ class YumBase(depsolve.Depsolve):
                  # Import the key
                  result = misc.import_key_to_pubring(info['raw_key'], info['hexkeyid'], gpgdir=destdir)
                  if not result:
@@ -153364,7 +154211,7 @@ index 99039e0..090882c 100644
                  self.logger.info(_('Key imported successfully'))
                  key_installed = True
                  # write out the key id to imported_cakeys in the repos basedir
-@@ -4851,36 +5592,35 @@ class YumBase(depsolve.Depsolve):
+@@ -4851,36 +5901,35 @@ class YumBase(depsolve.Depsolve):
                              pass
  
          if not key_installed and user_cb_fail:
@@ -153417,7 +154264,7 @@ index 99039e0..090882c 100644
          self._getAnyKeyForRepo(repo, repo.gpgcadir, repo.gpgcakey, is_cakey=True, callback=callback)
  
      def _limit_installonly_pkgs(self):
-@@ -4927,6 +5667,7 @@ class YumBase(depsolve.Depsolve):
+@@ -4927,6 +5976,7 @@ class YumBase(depsolve.Depsolve):
          ts = self.rpmdb.readOnlyTS()
          (cur_kernel_v, cur_kernel_r) = misc.get_running_kernel_version_release(ts)
          install_only_names = set(self.conf.installonlypkgs)
@@ -153425,7 +154272,7 @@ index 99039e0..090882c 100644
          for m in self.tsInfo.getMembers():
              if m.ts_state not in ('i', 'u'):
                  continue
-@@ -4937,12 +5678,21 @@ class YumBase(depsolve.Depsolve):
+@@ -4937,12 +5987,21 @@ class YumBase(depsolve.Depsolve):
              if not po_names.intersection(install_only_names):
                  continue
  
@@ -153451,7 +154298,7 @@ index 99039e0..090882c 100644
              for po in installed:
                  if (po.version, po.release) == (cur_kernel_v, cur_kernel_r): 
                      # don't remove running
-@@ -4959,19 +5709,22 @@ class YumBase(depsolve.Depsolve):
+@@ -4959,19 +6018,22 @@ class YumBase(depsolve.Depsolve):
              txmbr.depends_on.append(rel)
  
      def processTransaction(self, callback=None,rpmTestDisplay=None, rpmDisplay=None):
@@ -153487,7 +154334,7 @@ index 99039e0..090882c 100644
          
          if not callback:
              callback = callbacks.ProcessTransNoOutputCallback()
-@@ -5114,13 +5867,19 @@ class YumBase(depsolve.Depsolve):
+@@ -5114,13 +6176,19 @@ class YumBase(depsolve.Depsolve):
          return results
  
      def add_enable_repo(self, repoid, baseurls=[], mirrorlist=None, **kwargs):
@@ -153514,7 +154361,7 @@ index 99039e0..090882c 100644
          # out of place fixme - maybe we should make this the default repo addition
          # routine and use it from getReposFromConfigFile(), etc.
          newrepo = yumRepo.YumRepository(repoid)
-@@ -5167,9 +5926,15 @@ class YumBase(depsolve.Depsolve):
+@@ -5167,9 +6235,15 @@ class YumBase(depsolve.Depsolve):
  
      def setCacheDir(self, force=False, tmpdir=None, reuse=True,
                      suffix='/$basearch/$releasever'):
@@ -153533,7 +154380,7 @@ index 99039e0..090882c 100644
          if not force and os.geteuid() == 0:
              return True # We are root, not forced, so happy with the global dir.
          if tmpdir is None:
-@@ -5179,7 +5944,7 @@ class YumBase(depsolve.Depsolve):
+@@ -5179,7 +6253,7 @@ class YumBase(depsolve.Depsolve):
          try:
              cachedir = misc.getCacheDir(tmpdir, reuse)
          except (IOError, OSError), e:
@@ -153542,7 +154389,7 @@ index 99039e0..090882c 100644
              cachedir = None
              
          if cachedir is None:
-@@ -5190,6 +5955,7 @@ class YumBase(depsolve.Depsolve):
+@@ -5190,6 +6264,7 @@ class YumBase(depsolve.Depsolve):
              self.prerepoconf.cachedir = cachedir
          else:
              self.repos.setCacheDir(cachedir)
@@ -153550,7 +154397,7 @@ index 99039e0..090882c 100644
          self.conf.cachedir = cachedir
          return True # We got a new cache dir
  
-@@ -5220,13 +5986,24 @@ class YumBase(depsolve.Depsolve):
+@@ -5220,13 +6295,24 @@ class YumBase(depsolve.Depsolve):
          self.history.write_addon_data('config-repos', myrepos)
          
      def verify_plugins_cb(self, verify_package):
@@ -153578,7 +154425,7 @@ index 99039e0..090882c 100644
          if self.tsInfo._unresolvedMembers:
              if auto:
                  self.logger.critical(_("Dependencies not solved. Will not save unresolved transaction."))
-@@ -5234,7 +6011,7 @@ class YumBase(depsolve.Depsolve):
+@@ -5234,7 +6320,7 @@ class YumBase(depsolve.Depsolve):
              raise Errors.YumBaseError(_("Dependencies not solved. Will not save unresolved transaction."))
          
          if not filename:
@@ -153587,7 +154434,7 @@ index 99039e0..090882c 100644
              fd,filename = tempfile.mkstemp(suffix='.yumtx', prefix=prefix)
              f = os.fdopen(fd, 'w')
          else:
-@@ -5244,13 +6021,17 @@ class YumBase(depsolve.Depsolve):
+@@ -5244,13 +6330,17 @@ class YumBase(depsolve.Depsolve):
          
          msg = "%s\n" % self.rpmdb.simpleVersion(main_only=True)[0]
          msg += "%s\n" % self.ts.getTsFlags()
@@ -153608,7 +154455,7 @@ index 99039e0..090882c 100644
          msg += "%s\n" % len(self.tsInfo.getMembers())
          for txmbr in self.tsInfo.getMembers():
              msg += txmbr._dump()
-@@ -5260,13 +6041,25 @@ class YumBase(depsolve.Depsolve):
+@@ -5260,13 +6350,25 @@ class YumBase(depsolve.Depsolve):
          except (IOError, OSError), e:
              self._ts_save_file = None
              if auto:
@@ -153640,7 +154487,7 @@ index 99039e0..090882c 100644
          # check rpmversion - if not match throw a fit
          # check repoversions  (and repos)- if not match throw a fit
          # load each txmbr - if pkgs being updated don't exist, bail w/error
-@@ -5276,26 +6069,45 @@ class YumBase(depsolve.Depsolve):
+@@ -5276,26 +6378,45 @@ class YumBase(depsolve.Depsolve):
          try:
              data = open(filename, 'r').readlines()
          except (IOError, OSError), e:
@@ -153688,7 +154535,7 @@ index 99039e0..090882c 100644
              if ignorerpm:
                  msg += _(" ignoring, as requested.")
                  self.logger.critical(_(msg))
-@@ -5318,8 +6130,17 @@ class YumBase(depsolve.Depsolve):
+@@ -5318,8 +6439,17 @@ class YumBase(depsolve.Depsolve):
          numrepos = int(data[2].strip())
          repos = []
          rindex=3+numrepos
@@ -153707,7 +154554,7 @@ index 99039e0..090882c 100644
  
          # pkgs/txmbrs
          numpkgs = int(data[rindex].strip())
-@@ -5329,6 +6150,7 @@ class YumBase(depsolve.Depsolve):
+@@ -5329,6 +6459,7 @@ class YumBase(depsolve.Depsolve):
          pkgcount = 0
          pkgprob = False
          curpkg = None
@@ -153715,7 +154562,7 @@ index 99039e0..090882c 100644
          for l in data[pkgstart:]:
              l = l.rstrip()
              # our main txmbrs
-@@ -5438,6 +6260,11 @@ class YumBase(depsolve.Depsolve):
+@@ -5438,6 +6569,11 @@ class YumBase(depsolve.Depsolve):
                  msg += _(" aborting.")
                  raise Errors.YumBaseError(msg)
              
@@ -153727,7 +154574,7 @@ index 99039e0..090882c 100644
          return self.tsInfo.getMembers()
  
      def _remove_old_deps(self):
-@@ -5470,18 +6297,6 @@ class YumBase(depsolve.Depsolve):
+@@ -5470,18 +6606,6 @@ class YumBase(depsolve.Depsolve):
                      if requiring == required: # if they are self-requiring skip them
                          continue
                          
@@ -153746,7 +154593,7 @@ index 99039e0..090882c 100644
                      #for tbi_pkg in self.tsInfo.getMembersWithState(output_states=TS_INSTALL_STATES):
                      #   for reqtuple in tbi_pkg.po.requires:
                      #        if required.provides_for(reqtuple):
-@@ -5533,7 +6348,24 @@ class YumBase(depsolve.Depsolve):
+@@ -5533,7 +6657,24 @@ class YumBase(depsolve.Depsolve):
                      # Debugging output
                      self.verbose_logger.log(logginglevels.DEBUG_2, _("%s has revdep %s which was user-installed."), pkg, curpkg)
                      ok_to_remove[pkg] = False
@@ -153771,7 +154618,7 @@ index 99039e0..090882c 100644
                  visited[curpkg] = True
              all_leaves_visited = True
              leaves = curpkg.requiring_packages()
-@@ -5547,4 +6379,3 @@ class YumBase(depsolve.Depsolve):
+@@ -5547,4 +6688,3 @@ class YumBase(depsolve.Depsolve):
          # Debugging output
          self.verbose_logger.log(logginglevels.DEBUG_2, _("%s has no user-installed revdeps."), pkg)
          return False
@@ -153923,6 +154770,322 @@ index 7ad25ce..a9a8e53 100644
 +        """
          pass
          
+diff --git a/yum/comps.py b/yum/comps.py
+index 65f6d5e..cf671b6 100755
+--- a/yum/comps.py
++++ b/yum/comps.py
+@@ -43,6 +43,16 @@ class CompsObj(object):
+         return self.name
+ 
+     @property
++    def compsid(self):
++        """ Return the "id": categoryid, groupid, environmentid. """
++
++        for idT in ('categoryid', 'groupid', 'environmentid'):
++            if hasattr(self, idT):
++                return getattr(self, idT)
++
++        return None
++
++    @property
+     def ui_name(self):
+         """ Return the "name" of the object for the current locale. """
+         return self.nameByLang(get_my_lang_code())
+@@ -108,7 +118,7 @@ class Group(CompsObj):
+         self.optional_packages = {}
+         self.default_packages = {}
+         self.conditional_packages = {}
+-        self.langonly = None ## what the hell is this?
++        self.langonly = None
+         self.groupid = None
+         self.display_order = 1024
+         self.installed = False
+@@ -272,6 +282,137 @@ class Group(CompsObj):
+         return msg      
+ 
+ 
++class Environment(CompsObj):
++    """ Environment object parsed from group data in each repo, and merged """
++
++    def __init__(self, elem=None):
++        self.name = ""
++        self.environmentid = None
++        self.description = ""
++        self.translated_name = {}
++        self.translated_description = {}
++        self.display_order = 1024
++        self.langonly = None
++        self.installed = False
++        self._groups = {}
++        self._options = {}
++
++        if elem:
++            self.parse(elem)
++
++    def _allgroupiter(self):
++        lst = self._groups.keys() + \
++              self._options.keys()
++        return lst
++
++    allgroups = property(_allgroupiter)
++
++    def _groupiter(self):
++        return self._groups.keys()
++
++    groups = property(_groupiter)
++
++    def _optioniter(self):
++        return self._options.keys()
++
++    options = property(_optioniter)
++
++    def parse(self, elem):
++        for child in elem:
++            if child.tag == 'id':
++                myid = child.text
++                if self.environmentid is not None:
++                    raise CompsException
++                self.environmentid = myid
++
++            elif child.tag == 'name':
++                text = child.text
++                if text:
++                    text = text.encode('utf8')
++
++                lang = child.attrib.get(lang_attr)
++                if lang:
++                    self.translated_name[lang] = text
++                else:
++                    self.name = text
++
++            elif child.tag == 'description':
++                text = child.text
++                if text:
++                    text = text.encode('utf8')
++
++                lang = child.attrib.get(lang_attr)
++                if lang:
++                    self.translated_description[lang] = text
++                else:
++                    self.description = text
++
++            elif child.tag == 'grouplist':
++                self.parse_group_list(child)
++
++            elif child.tag == 'optionlist':
++                self.parse_option_list(child)
++
++            elif child.tag == 'display_order':
++                self.display_order = parse_number(child.text)
++
++    def parse_group_list(self, grouplist_elem):
++        for child in grouplist_elem:
++            if child.tag == 'groupid':
++                groupid = child.text
++                self._groups[groupid] = 1
++
++    def parse_option_list(self, optionlist_elem):
++        for child in optionlist_elem:
++            if child.tag == 'groupid':
++                optionid = child.text
++                self._options[optionid] = 1
++
++    def add(self, obj):
++        """Add another category object to this object"""
++
++        for grp in obj.groups:
++            self._groups[grp] = 1
++
++        for grp in obj.options:
++            self._options[grp] = 1
++
++        # name and description translations
++        for lang in obj.translated_name:
++            if lang not in self.translated_name:
++                self.translated_name[lang] = obj.translated_name[lang]
++
++        for lang in obj.translated_description:
++            if lang not in self.translated_description:
++                self.translated_description[lang] = obj.translated_description[lang]
++
++    def xml(self):
++        """write out an xml stanza for the environment object"""
++        msg ="""
++  <environment>
++   <id>%s</id>
++   <display_order>%s</display_order>\n""" % (self.environmentid, self.display_order)
++
++        msg +="""   <name>%s</name>\n""" % self.name
++        for (lang, val) in self.translated_name.items():
++            msg += """   <name xml:lang="%s">%s</name>\n""" % (lang, val)
++
++        msg += """   <description>%s</description>\n""" % self.description
++        for (lang, val) in self.translated_description.items():
++            msg += """    <description xml:lang="%s">%s</description>\n""" % (lang, val)
++
++        msg += """    <grouplist>\n"""
++        for grp in self.groups:
++            msg += """     <groupid>%s</groupid>\n""" % grp
++        msg += """    </grouplist>\n"""
++        msg += """    <optionlist>\n"""
++        for grp in self.options:
++            msg += """     <optionid>%s</optionid>\n""" % grp
++        msg += """    </optionlist>\n"""
++        msg += """  </environment>\n"""
++
++        return msg
++
+ class Category(CompsObj):
+     """ Category object parsed from group data in each repo. and merged. """
+ 
+@@ -376,6 +517,7 @@ class Category(CompsObj):
+ class Comps(object):
+     def __init__(self, overwrite_groups=False):
+         self._groups = {}
++        self._environments = {}
+         self._categories = {}
+         self.compscount = 0
+         self.overwrite_groups = overwrite_groups
+@@ -388,12 +530,18 @@ class Comps(object):
+         grps.sort(key=lambda x: (x.display_order, x.name))
+         return grps
+         
++    def get_environments(self):
++        environments = self._environments.values()
++        environments.sort(key=lambda x: (x.display_order, x.name))
++        return environments
++
+     def get_categories(self):
+         cats = self._categories.values()
+         cats.sort(key=lambda x: (x.display_order, x.name))
+         return cats
+     
+     groups = property(get_groups)
++    environments = property(get_environments)
+     categories = property(get_categories)
+     
+     def has_group(self, grpid):
+@@ -447,6 +595,57 @@ class Comps(object):
+ 
+         return returns.values()
+ 
++    def has_environment(self, environmentid):
++        exists = self.return_environments(environmentid)
++
++        if exists:
++            return True
++
++        return False
++
++    def return_environment(self, environmentid):
++        """Return the first group which matches"""
++        environments = self.return_environments(environmentid)
++        if environments:
++            return environments[0]
++
++        return None
++
++    def return_environments(self, env_pattern, case_sensitive=False):
++        """return all environments which match either by glob or exact match"""
++        returns = {}
++
++        for item in env_pattern.split(','):
++            item = item.strip()
++            if item in self._environments:
++                env = self._environments[item]
++                returns[env.environmentid] = env
++                continue
++
++            if case_sensitive:
++                match = re.compile(fnmatch.translate(item)).match
++            else:
++                match = re.compile(fnmatch.translate(item), flags=re.I).match
++
++            done = False
++            for env in self.environments:
++                for name in env.name, env.environmentid, env.ui_name:
++                    if match(name):
++                        done = True
++                        returns[env.environmentid] = env
++                        break
++            if done:
++                continue
++
++            # If we didn't match to anything in the current locale, try others
++            for env in self.environments:
++                for name in env.translated_name.values():
++                    if match(name):
++                        returns[env.environmentid] = env
++                        break
++
++        return returns.values()
++
+     #  This is close to returnPackages() etc. API ... need to std. these names
+     # the above return_groups uses different, but equal, API.
+     def return_categories(self, pattern, ignore_case=True):
+@@ -490,6 +689,13 @@ class Comps(object):
+         else:
+             self._groups[group.groupid] = group
+ 
++    def add_environment(self, environment):
++        if environment.environmentid in self._environments:
++            env = self._environments[environment.environmentid]
++            env.add(environment)
++        else:
++            self._environments[environment.environmentid] = environment
++
+     def add_category(self, category):
+         if category.categoryid in self._categories:
+             thatcat = self._categories[category.categoryid]
+@@ -520,6 +726,9 @@ class Comps(object):
+                 if elem.tag == "group":
+                     group = Group(elem)
+                     self.add_group(group)
++                if elem.tag == "environment":
++                    environment = Environment(elem)
++                    self.add_environment(environment)
+                 if elem.tag == "category":
+                     category = Category(elem)
+                     self.add_category(category)
+@@ -557,6 +766,24 @@ class Comps(object):
+                     if pkgname in inst_pkg_names:
+                         group.installed = True
+                         break
++
++        # Now do basically the same thing for evgroups.
++        inst_grp_names = {}
++        for group in self.groups:
++            inst_grp_names[group.groupid] = group.installed
++        for evgroup in self.environments:
++            if evgroup.groups:
++                evgroup.installed = True
++                for grpname in evgroup.groups:
++                    if not inst_grp_names.get(grpname):
++                        evgroup.installed = False
++                        break
++            else:
++                evgroup.installed = False
++                for grpname in evgroup.optional:
++                    if grpname in inst_grp_names:
++                        evgroup.installed = True
++                        break
+         
+         self.compiled = True
+     
+@@ -595,6 +822,13 @@ def main():
+             for pkg in group.packages:
+                 print '  ' + pkg
+         
++        for environment in p.environments:
++            print environment.name
++            for group in environment.groups:
++                print '  ' + group
++            for group in environment.options:
++                print '  *' + group
++
+         for category in p.categories:
+             print category.name
+             for group in category.groups:
 diff --git a/yum/config.py b/yum/config.py
 index d09511f..2bf4f45 100644
 --- a/yum/config.py
@@ -154928,7 +156091,7 @@ index d09511f..2bf4f45 100644
  
          if name not in cfgOptions and option.default == value:
 diff --git a/yum/depsolve.py b/yum/depsolve.py
-index 6d744c0..449cf48 100644
+index 6d744c0..5e95662 100644
 --- a/yum/depsolve.py
 +++ b/yum/depsolve.py
 @@ -31,13 +31,15 @@ from transactioninfo import TransactionMember
@@ -155137,7 +156300,40 @@ index 6d744c0..449cf48 100644
                      msg = self._err_missing_requires(requiringPo, requirement)
                      self.verbose_logger.log(logginglevels.DEBUG_2, _('No update paths found for %s. Failure!'), requiringPo)
                      return self._requiringFromTransaction(requiringPo, requirement, errorlist)
-@@ -696,6 +776,13 @@ class Depsolve(object):
+@@ -405,12 +485,30 @@ class Depsolve(object):
+             # try to update the requiring package in hopes that all this problem goes away :(
+             self.verbose_logger.log(logginglevels.DEBUG_2, _('Trying to update %s to resolve dep'), requiringPo)
+             txmbrs = self.update(po=requiringPo, requiringPo=requiringPo)
++            fixed = False
+             if not txmbrs:
+                 msg = self._err_missing_requires(requiringPo, requirement)
+-                self.verbose_logger.log(logginglevels.DEBUG_2, _('No update paths found for %s. Failure!'), requiringPo)
++                self.verbose_logger.log(logginglevels.DEBUG_2, _('No update paths found for %s. Failure due to requirement: %s!'), requiringPo, msg)
++            else:
++                req_lookup = (needname, needflags,
++                              rpmUtils.miscutils.stringToVersion(needversion))
++
++            for txmbr in txmbrs:
++                #  This works for upgrades, and for obsoletes, on one side.
++                # Also catches upgrades that don't work on the other.
++                if txmbr.output_state in TS_INSTALL_STATES:
++                    if txmbr.po.checkPrco('requires', req_lookup):
++                        fixed = False
++                        break
++                    else:
++                        fixed = True
++            if txmbrs and not fixed:
++                msg = self._err_missing_requires(requiringPo, requirement)
++                self.verbose_logger.log(logginglevels.DEBUG_2, _("Update for %s. Doesn't fix requirement: %s!"), requiringPo, msg)
++
++            if not fixed:
+                 return self._requiringFromTransaction(requiringPo, requirement, errorlist)
+             checkdeps = 1
+-
+             
+         if needmode in ['e']:
+             self.verbose_logger.log(logginglevels.DEBUG_2, _('TSINFO: %s package requiring %s marked as erase'),
+@@ -696,6 +794,13 @@ class Depsolve(object):
                  self.tsInfo.remove(txmbr.pkgtup)
  
      def prof_resolveDeps(self):
@@ -155151,7 +156347,7 @@ index 6d744c0..449cf48 100644
          fn = "anaconda.prof.0"
          import hotshot, hotshot.stats
          prof = hotshot.Profile(fn)
-@@ -709,6 +796,13 @@ class Depsolve(object):
+@@ -709,6 +814,13 @@ class Depsolve(object):
          return rc
  
      def cprof_resolveDeps(self):
@@ -155165,7 +156361,7 @@ index 6d744c0..449cf48 100644
          import cProfile, pstats
          prof = cProfile.Profile()
          rc = prof.runcall(self.resolveDeps)
-@@ -722,7 +816,17 @@ class Depsolve(object):
+@@ -722,7 +834,17 @@ class Depsolve(object):
          return rc
  
      def resolveDeps(self, full_check=True, skipping_broken=False):
@@ -155184,7 +156380,7 @@ index 6d744c0..449cf48 100644
          if not len(self.tsInfo):
              return (0, [_('Success - empty transaction')])
  
-@@ -778,6 +882,25 @@ class Depsolve(object):
+@@ -778,6 +900,25 @@ class Depsolve(object):
                      if checkdep:
                          break # The next conflict might be the same pkg
  
@@ -155210,7 +156406,7 @@ index 6d744c0..449cf48 100644
                  if CheckDeps:
                      if self.dsCallback: self.dsCallback.restartLoop()
                      self.verbose_logger.log(logginglevels.DEBUG_1, _('Restarting Loop'))
-@@ -920,9 +1043,12 @@ class Depsolve(object):
+@@ -920,9 +1061,12 @@ class Depsolve(object):
  
          # if this is an update, we should check what the old
          # requires were to make things faster
@@ -155225,7 +156421,7 @@ index 6d744c0..449cf48 100644
          oldreqs = set(oldreqs)
  
          ret = []
-@@ -1150,6 +1276,11 @@ class Depsolve(object):
+@@ -1150,6 +1294,11 @@ class Depsolve(object):
          return ret
  
      def isPackageInstalled(self, pkgname):
@@ -155237,7 +156433,7 @@ index 6d744c0..449cf48 100644
          lst = self.tsInfo.matchNaevr(name = pkgname)
          for txmbr in lst:
              if txmbr.output_state in TS_INSTALL_STATES:
-@@ -1166,7 +1297,7 @@ class Depsolve(object):
+@@ -1166,7 +1315,7 @@ class Depsolve(object):
          return True
      _isPackageInstalled = isPackageInstalled
  
@@ -155246,7 +156442,7 @@ index 6d744c0..449cf48 100644
          """take the list of pkgs and score them based on the requesting package
             return a dictionary of po=score"""
          self.verbose_logger.log(logginglevels.DEBUG_4,
-@@ -1210,6 +1341,24 @@ class Depsolve(object):
+@@ -1210,6 +1359,24 @@ class Depsolve(object):
                  return None
              return x
  
@@ -155271,7 +156467,7 @@ index 6d744c0..449cf48 100644
          #  Actual start of _compare_providers().
  
          # Do a NameArch filtering, based on repo. __cmp__
-@@ -1332,6 +1481,26 @@ class Depsolve(object):
+@@ -1332,6 +1499,26 @@ class Depsolve(object):
                          _('common prefix of %s between %s and %s' % (cpl, po, reqpo)))
                  
                      pkgresults[po] += cpl*2
@@ -155298,7 +156494,7 @@ index 6d744c0..449cf48 100644
                  
          #  If we have more than one "best", see what would happen if we picked
          # each package ... ie. what things do they require that _aren't_ already
-@@ -1393,42 +1562,52 @@ class Depsolve(object):
+@@ -1393,42 +1580,52 @@ class Depsolve(object):
  
  
  class DepCheck(object):
@@ -155341,12 +156537,12 @@ index 6d744c0..449cf48 100644
  
  class Requires(object):
 -
--    """
--    A pure data class for holding a package and the list of things it
--    requires.
 +    """A pure data class for holding a package and the list of things
 +    it requires.
      """
+-    A pure data class for holding a package and the list of things it
+-    requires.
+-    """
 -
      def __init__(self, pkg,requires):
          self.pkg = pkg # po of requiring pkg
@@ -156020,10 +157216,10 @@ index 9889bf6..76a258d 100755
      Setup the yum translation domain and make _() and P_() translation wrappers
 diff --git a/yum/igroups.py b/yum/igroups.py
 new file mode 100644
-index 0000000..625ee66
+index 0000000..6a04f3a
 --- /dev/null
 +++ b/yum/igroups.py
-@@ -0,0 +1,141 @@
+@@ -0,0 +1,267 @@
 +#! /usr/bin/python -tt
 +# This program is free software; you can redistribute it and/or modify
 +# it under the terms of the GNU General Public License as published by
@@ -156039,7 +157235,7 @@ index 0000000..625ee66
 +# along with this program; if not, write to the Free Software
 +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 +#
-+# Copyright 2010 Red Hat
++# Copyright 2010, 2012 Red Hat
 +#
 +# James Antill <james at fedoraproject.org>
 +
@@ -156051,6 +157247,7 @@ index 0000000..625ee66
 +    def __init__(self, gid):
 +        self.gid       = gid
 +        self.pkg_names = set()
++        self.environment = None
 +
 +    def __cmp__(self, other):
 +        if other is None:
@@ -156066,12 +157263,36 @@ index 0000000..625ee66
 +        return sorted(pkg_names.difference(self.pkg_names))
 +
 +
++class InstalledEnvironment(object):
++    def __init__(self, evgid):
++        self.evgid     = evgid
++        self.grp_names = set()
++
++    def __cmp__(self, other):
++        if other is None:
++            return 1
++        return cmp(self.evgid, other.evgid)
++
++    def _additions(self, grp_names):
++        grp_names = set(grp_names)
++        return sorted(grp_names.difference(self.grp_names))
++
++    def _removals(self, grp_names):
++        grp_names = set(grp_names)
++        return sorted(grp_names.difference(self.grp_names))
++
++
 +class InstalledGroups(object):
 +    def __init__(self, db_path):
-+        self.filename = db_path + "/installed"
 +        self.groups   = {}
 +        self.changed  = False
++        self.environments = {}
 +
++        self._read_pkg_grps(db_path)
++        self._read_grp_grps(db_path)
++
++    def _read_pkg_grps(self, db_path):
++        self.filename = db_path + "/installed"
 +        if not os.access(self.filename, os.R_OK):
 +            return
 +
@@ -156095,6 +157316,38 @@ index 0000000..625ee66
 +                num -= 1
 +                grp.pkg_names.add(_read_str(fo))
 +
++    def _read_grp_grps(self, db_path):
++        self.grp_filename = db_path + "/environment"
++        if not os.access(self.grp_filename, os.R_OK):
++            return
++
++        def _read_str(fo):
++            return fo.readline()[:-1]
++
++        fo = open(self.grp_filename)
++        ver = int(_read_str(fo))
++        if ver != 1:
++            return
++
++        groups_num = int(_read_str(fo))
++        while groups_num > 0:
++            groups_num -= 1
++
++            evgrp = InstalledEnvironment(_read_str(fo))
++            self.environments[evgrp.evgid] = evgrp
++
++            num = int(_read_str(fo))
++            while num > 0:
++                num -= 1
++                grpname = _read_str(fo)
++                memb = _read_str(fo)
++                evgrp.grp_names.add(grpname)
++                assert memb in ('true', 'false')
++                if memb == 'true':
++                    assert grpname in self.groups
++                    if grpname in self.groups:
++                        self.groups[grpname].environment = evgrp.evgid
++
 +    def close(self):
 +        pass
 +
@@ -156113,6 +157366,12 @@ index 0000000..625ee66
 +        if not os.access(db_path, os.W_OK):
 +            return False
 +
++        self._write_pkg_grps()
++        self._write_grp_grps()
++
++        self.changed = False
++
++    def _write_pkg_grps(self):
 +        fo = open(self.filename + '.tmp', 'w')
 +
 +        fo.write("1\n") # version
@@ -156124,9 +157383,26 @@ index 0000000..625ee66
 +                fo.write("%s\n" % pkgname)
 +        fo.close()
 +        os.rename(self.filename + '.tmp', self.filename)
-+        self.changed = False
 +
-+    def add_group(self, groupid, pkg_names):
++    def _write_grp_grps(self):
++        fo = open(self.grp_filename + '.tmp', 'w')
++
++        fo.write("1\n") # version
++        fo.write("%u\n" % len(self.environments))
++        for evgrp in sorted(self.environments.values()):
++            fo.write("%s\n" % evgrp.evgid)
++            fo.write("%u\n" % len(evgrp.grp_names))
++            for grpname in sorted(evgrp.grp_names):
++                fo.write("%s\n" % grpname)
++                if self.groups[grpname].environment == evgrp.evgid:
++                    fo.write("%s\n" % "true")
++                else:
++                    fo.write("%s\n" % "false")
++
++        fo.close()
++        os.rename(self.grp_filename + '.tmp', self.grp_filename)
++
++    def add_group(self, groupid, pkg_names, ievgrp=None):
 +        self.changed = True
 +
 +        if groupid not in self.groups:
@@ -156136,6 +157412,11 @@ index 0000000..625ee66
 +        for pkg_name in pkg_names:
 +            grp.pkg_names.add(pkg_name)
 +
++        if ievgrp is not None:
++            grp.environment = ievgrp.evgid
++            ievgrp.grp_names.add(groupid)
++        return grp
++
 +    def del_group(self, groupid):
 +        self.changed = True
 +
@@ -156165,6 +157446,47 @@ index 0000000..625ee66
 +                    break
 +
 +        return returns.values()
++
++    def add_environment(self, evgroupid, grp_names):
++        self.changed = True
++
++        if evgroupid not in self.environments:
++            self.environments[evgroupid] = InstalledEnvironment(evgroupid)
++        grp = self.environments[evgroupid]
++
++        for grp_name in grp_names:
++            grp.grp_names.add(grp_name)
++        return grp
++
++    def del_environment(self, evgroupid):
++        self.changed = True
++
++        if evgroupid in self.environments:
++            del self.environments[evgroupid]
++
++    def return_environments(self, evgroup_pattern, case_sensitive=False):
++        returns = {}
++
++        for item in evgroup_pattern.split(','):
++            item = item.strip()
++            if item in self.environments:
++                thisgroup = self.environments[item]
++                returns[thisgroup.evgid] = thisgroup
++                continue
++
++            if case_sensitive:
++                match = re.compile(fnmatch.translate(item)).match
++            else:
++                match = re.compile(fnmatch.translate(item), flags=re.I).match
++
++            done = False
++            for group in self.environments.values():
++                if match(group.evgid):
++                    done = True
++                    returns[group.evgid] = group
++                    break
++
++        return returns.values()
 diff --git a/yum/metalink.py b/yum/metalink.py
 index aaa4f25..51895fd 100755
 --- a/yum/metalink.py
@@ -157234,7 +158556,7 @@ index bfc49b7..9ddcae6 100644
      b = parsever(b)
  
 diff --git a/yum/repos.py b/yum/repos.py
-index 3793bad..3cbbe25 100644
+index 3793bad..97fa71e 100644
 --- a/yum/repos.py
 +++ b/yum/repos.py
 @@ -22,6 +22,7 @@ import misc
@@ -157245,7 +158567,7 @@ index 3793bad..3cbbe25 100644
  
  from weakref import proxy as weakref
  
-@@ -67,6 +68,40 @@ class RepoStorage:
+@@ -67,6 +68,47 @@ class RepoStorage:
          self._cache_enabled_repos = []
          self.quick_enable_disable = {}
  
@@ -157261,7 +158583,14 @@ index 3793bad..3cbbe25 100644
 +        for repo in self.listEnabled():
 +            if repo.cache:
 +                continue
-+            if repo._async and repo._commonLoadRepoXML(repo):
++            try:
++                dl = repo._async and repo._commonLoadRepoXML(repo)
++            except Errors.RepoError, e:
++                if not repo.skip_if_unavailable:
++                    raise
++                self.disableRepo(repo.id)
++                dl = False
++            if dl:
 +                mdtypes = repo._mdpolicy2mdtypes()
 +                downloading = repo._commonRetrieveDataMD_list(mdtypes)
 +                repos.append((repo, downloading, [False]))
@@ -157286,7 +158615,7 @@ index 3793bad..3cbbe25 100644
      def doSetup(self, thisrepo = None):
          
          self.ayum.plugins.run('prereposetup')
-@@ -89,6 +124,7 @@ class RepoStorage:
+@@ -89,6 +131,7 @@ class RepoStorage:
                  self.disableRepo(repo.id)
                  
          self._setup = True
@@ -157294,7 +158623,7 @@ index 3793bad..3cbbe25 100644
          self.ayum.plugins.run('postreposetup')
          
      def __str__(self):
-@@ -223,8 +259,9 @@ class RepoStorage:
+@@ -223,8 +266,9 @@ class RepoStorage:
          
          self._cachedir = cachedir
          for repo in self.repos.values():
@@ -157306,7 +158635,7 @@ index 3793bad..3cbbe25 100644
  
  
      def setProgressBar(self, obj):
-@@ -288,6 +325,16 @@ class RepoStorage:
+@@ -288,6 +332,16 @@ class RepoStorage:
          else:
              data = [ mdtype ]
           
@@ -157324,7 +158653,7 @@ index 3793bad..3cbbe25 100644
              sack = repo.getPackageSack()
              try:
 diff --git a/yum/rpmsack.py b/yum/rpmsack.py
-index e289a7a..ed8e3d1 100644
+index e289a7a..a4da4ab 100644
 --- a/yum/rpmsack.py
 +++ b/yum/rpmsack.py
 @@ -48,6 +48,17 @@ def _open_no_umask(*args):
@@ -157364,6 +158693,15 @@ index e289a7a..ed8e3d1 100644
                  continue
  
              pkg = pkg[0]
+@@ -616,7 +628,7 @@ class RPMDBPackageSack(PackageSackBase):
+             for hdr, idx in self._get_packages():
+                 if self._match_repattern(rpats, hdr, ignore_case):
+                     self._makePackageObject(hdr, idx)
+-            self._completely_loaded = patterns is None
++            self._completely_loaded = rpats is None
+ 
+         pkgobjlist = self._idx2pkg.values()
+         # Remove gpg-pubkeys, as no sane callers expects/likes them...
 @@ -993,7 +1005,7 @@ class RPMDBPackageSack(PackageSackBase):
              return
  
@@ -157530,7 +158868,7 @@ index 8a6f6f3..ba929de 100644
          if len(self.filelistsdb) == 0:
              # grab repo object from primarydb and force filelists population in this sack using repo
 diff --git a/yum/transactioninfo.py b/yum/transactioninfo.py
-index 4d89d83..b584338 100644
+index 4d89d83..e7377bf 100644
 --- a/yum/transactioninfo.py
 +++ b/yum/transactioninfo.py
 @@ -87,7 +87,8 @@ class TransactionData:
@@ -157543,7 +158881,16 @@ index 4d89d83..b584338 100644
          self.pkgSackPackages = 0
          self.localSack = PackageSack()
          self._inSack = GetProvReqOnlyPackageSack()
-@@ -105,6 +106,9 @@ class TransactionData:
+@@ -95,6 +96,8 @@ class TransactionData:
+         # lists of txmbrs in their states - just placeholders
+         self.instgroups = []
+         self.removedgroups = []
++        self.instenvironments = []
++        self.removedenvironments = []
+         self.removed = []
+         self.installed = []
+         self.updated = []
+@@ -105,6 +108,9 @@ class TransactionData:
          self.reinstalled = []
          self.downgraded = []
          self.failed = []
@@ -157553,7 +158900,7 @@ index 4d89d83..b584338 100644
          
      def __len__(self):
          return len(self.pkgdict)
-@@ -115,6 +119,18 @@ class TransactionData:
+@@ -115,6 +121,18 @@ class TransactionData:
          else:
              return iter(self.getMembers())
  
@@ -157572,7 +158919,7 @@ index 4d89d83..b584338 100644
      def debugprint(self, msg):
          if self.debug:
              print msg
-@@ -208,7 +224,9 @@ class TransactionData:
+@@ -208,7 +226,9 @@ class TransactionData:
                  txmbrs = self.matchNaevr(na[0], na[1])
  
          if not txmbrs:
@@ -157583,7 +158930,46 @@ index 4d89d83..b584338 100644
                  pkgs = []
              else:
                  pkgs = self.pkgSack.returnPackages(patterns=[pattern])
-@@ -547,9 +565,10 @@ class TransactionData:
+@@ -334,6 +354,8 @@ class TransactionData:
+            
+         self.instgroups = []
+         self.removedgroups = []
++        self.instenvironments = []
++        self.removedenvironments = []
+         self.removed = []
+         self.installed = []
+         self.updated = []
+@@ -365,6 +387,10 @@ class TransactionData:
+                     for g in txmbr.groups:
+                         if g not in self.instgroups:
+                             self.instgroups.append(g)
++                if txmbr.environments:
++                    for evg in txmbr.environments:
++                        if evg not in self.instenvironments:
++                            self.instenvironments.append(evg)
+                 if txmbr.isDep:
+                     self.depinstalled.append(txmbr)
+                 else:
+@@ -377,6 +403,9 @@ class TransactionData:
+                 for g in txmbr.groups:
+                     if g not in self.instgroups:
+                         self.removedgroups.append(g)
++                for evg in txmbr.environments:
++                    if evg not in self.instenvironments:
++                        self.removedenvironments.append(evg)
+                 if txmbr.isDep:
+                     self.depremoved.append(txmbr)
+                 else:
+@@ -402,6 +431,8 @@ class TransactionData:
+         self.depremoved.sort()
+         self.instgroups.sort()
+         self.removedgroups.sort()
++        self.instenvironments.sort()
++        self.removedenvironments.sort()
+         self.reinstalled.sort()
+         self.downgraded.sort()
+         self.failed.sort()
+@@ -547,9 +578,10 @@ class TransactionData:
          return txmbr
  
  
@@ -157596,7 +158982,7 @@ index 4d89d83..b584338 100644
  
      def getNewProvides(self, name, flag=None, version=(None, None, None)):
          """return dict { packages -> list of matching provides }
-@@ -619,6 +638,12 @@ class TransactionData:
+@@ -619,6 +651,12 @@ class TransactionData:
          """ Return a simple version for the future rpmdb. Works like
              rpmdb.simpleVersion(main_only=True)[0], but for the state the rpmdb
              will be in after the transaction. """
@@ -157609,7 +158995,7 @@ index 4d89d83..b584338 100644
          pkgs = self.rpmdb.returnPackages()
          _reinstalled_pkgtups = {}
          for txmbr in self.getMembersWithState(None, TS_INSTALL_STATES):
-@@ -658,6 +683,7 @@ class TransactionData:
+@@ -658,6 +696,7 @@ class TransactionData:
  
          self.rpmdb.transactionCachePackageChecksums(pkg_checksum_tups)
  
@@ -157617,6 +159003,22 @@ index 4d89d83..b584338 100644
          return main
      
      def findObsoletedByThisMember(self, txmbr):
+@@ -752,6 +791,7 @@ class TransactionMember:
+         self.downgraded_by = []
+         self.reinstall = False
+         self.groups = [] # groups it's in
++        self.environments = [] # Env. groups it's in
+         self._poattr = ['pkgtup', 'repoid', 'name', 'arch', 'epoch', 'version',
+                         'release']
+ 
+@@ -825,5 +865,7 @@ class TransactionMember:
+                 
+         if self.groups:
+             msg += "  groups: %s\n" % ' '.join(self.groups)
++        if self.environments:
++            msg += "  environments: %s\n" % ' '.join(self.environments)
+ 
+         return msg
 diff --git a/yum/update_md.py b/yum/update_md.py
 index 2cb1acb..7da6a08 100644
 --- a/yum/update_md.py
@@ -157637,7 +159039,7 @@ index 2cb1acb..7da6a08 100644
          self._md[item] = val
  
 diff --git a/yum/yumRepo.py b/yum/yumRepo.py
-index e5e9ece..14f6d5f 100644
+index e5e9ece..35182d3 100644
 --- a/yum/yumRepo.py
 +++ b/yum/yumRepo.py
 @@ -20,10 +20,12 @@ import time
@@ -157687,33 +159089,44 @@ index e5e9ece..14f6d5f 100644
      def populate(self, repo, mdtype='metadata', callback=None, cacheonly=0):
          if mdtype == 'all':
              data = ['metadata', 'filelists', 'otherdata']
-@@ -162,6 +184,25 @@ class YumPackageSack(packageSack.PackageSack):
+@@ -138,8 +160,6 @@ class YumPackageSack(packageSack.PackageSack):
+                 if item in self.added[repo]:
+                     continue
+ 
+-            db_fn = None
+-
+             if item == 'metadata':
+                 mydbtype = 'primary_db'
+                 mymdtype = 'primary'
+@@ -162,25 +182,37 @@ class YumPackageSack(packageSack.PackageSack):
                  continue
  
              if self._check_db_version(repo, mydbtype):
+-                # see if we have the uncompressed db and check it's checksum vs the openchecksum
+-                # if not download the compressed file
+-                # decompress it
+-                # unlink it
 +                #  Use gen decompression on DB files. Keeps exactly what we
 +                # downloaded in the download dir.
-+
+ 
 +                # Backwards compat. ... try the old uncompressed version first.
-+                db_un_fn = self._check_uncompressed_db(repo, mydbtype)
-+                if not db_un_fn:
+                 db_un_fn = self._check_uncompressed_db(repo, mydbtype)
+                 if not db_un_fn:
 +                    db_un_fn = self._check_uncompressed_db_gen(repo, mydbtype)
 +
 +                if not db_un_fn:
-+                    db_fn = repo._retrieveMD(mydbtype)
-+                    if db_fn:
+                     db_fn = repo._retrieveMD(mydbtype)
+                     if db_fn:
+-                        if not repo.cache:
+-                            db_un_fn = misc.decompress(db_fn)
+-                            misc.unlink_f(db_fn)
+-                            db_un_fn = self._check_uncompressed_db(repo, mydbtype)
 +                        db_un_fn = self._check_uncompressed_db_gen(repo,
 +                                                                   mydbtype)
 +                    if not db_un_fn: # Shouldn't happen?
 +                        raise URLGrabError(-1, 'Check uncompressed DB failed')
-+
-+                dobj = repo.cacheHandler.open_database(db_un_fn)
-+
-+            elif self._check_db_version(repo, mydbtype):
-                 # see if we have the uncompressed db and check it's checksum vs the openchecksum
-                 # if not download the compressed file
-                 # decompress it
-@@ -180,7 +221,17 @@ class YumPackageSack(packageSack.PackageSack):
+ 
+                 dobj = repo.cacheHandler.open_database(db_un_fn)
  
              else:
                  repo._xml2sqlite_local = True
@@ -157723,7 +159136,7 @@ index e5e9ece..14f6d5f 100644
 +                #  Use generated dir. and handle compression types metadata
 +                # parser doesn't understand.
 +                gen = mymdtype + '.xml'
-+                ret = misc.repo_gen_decompress(xml, gen)
++                ret = misc.repo_gen_decompress(xml, gen, cached=repo.cache)
 +                if not ret:
 +                    raise URLGrabError(-1, 'Decompress DB failed')
 +                xml = ret
@@ -157731,7 +159144,7 @@ index e5e9ece..14f6d5f 100644
                  xmldata = repo.repoXML.getData(mymdtype)
                  (ctype, csum) = xmldata.checksum
                  dobj = repo_cache_function(xml, csum)
-@@ -193,6 +244,24 @@ class YumPackageSack(packageSack.PackageSack):
+@@ -193,6 +225,25 @@ class YumPackageSack(packageSack.PackageSack):
          # get rid of all this stuff we don't need now
          del repo.cacheHandler
  
@@ -157748,7 +159161,8 @@ index e5e9ece..14f6d5f 100644
 +                             check_can_fail=fast, fast=fast):
 +            return None
 +
-+        ret = misc.repo_gen_decompress(compressed_fn, db_un_fn)
++        ret = misc.repo_gen_decompress(compressed_fn, db_un_fn,
++                                       cached=repo.cache)
 +        if ret:
 +            return self._check_uncompressed_db_fn(repo, mdtype, ret)
 +        return None
@@ -157756,7 +159170,7 @@ index e5e9ece..14f6d5f 100644
      def _check_uncompressed_db(self, repo, mdtype):
          """return file name of uncompressed db is good, None if not"""
          mydbdata = repo.repoXML.getData(mdtype)
-@@ -201,9 +270,11 @@ class YumPackageSack(packageSack.PackageSack):
+@@ -201,9 +252,11 @@ class YumPackageSack(packageSack.PackageSack):
          compressed_fn = repo.cachedir + '/' + fname
          db_un_fn = misc.decompress(compressed_fn, fn_only=True)
  
@@ -157769,7 +159183,16 @@ index e5e9ece..14f6d5f 100644
          if os.path.exists(db_un_fn):
              if skip_old_DBMD_check and repo._using_old_MD:
                  return db_un_fn
-@@ -285,6 +356,7 @@ class YumRepository(Repository, config.RepoConf):
+@@ -260,7 +313,7 @@ class YumRepository(Repository, config.RepoConf):
+         self.copy_local = 0
+         # holder for stuff we've grabbed
+         self.retrieved = { 'primary':0, 'filelists':0, 'other':0, 'group':0,
+-                           'updateinfo':0, 'prestodelta' : 0}
++                           'updateinfo':0}
+ 
+         # callbacks
+         self.callback = None  # for the grabber
+@@ -285,6 +338,7 @@ class YumRepository(Repository, config.RepoConf):
  
          self._grabfunc = None
          self._grab = None
@@ -157777,7 +159200,7 @@ index e5e9ece..14f6d5f 100644
  
      def __cmp__(self, other):
          """ Sort yum repos. by cost, and then by alphanumeric on their id. """
-@@ -431,25 +503,18 @@ class YumRepository(Repository, config.RepoConf):
+@@ -431,25 +485,18 @@ class YumRepository(Repository, config.RepoConf):
          self._proxy_dict = {} # zap it
          proxy_string = None
          empty = (None, '_none_', '')
@@ -157811,7 +159234,7 @@ index e5e9ece..14f6d5f 100644
  
          if proxy_string is not None:
              self._proxy_dict['http'] = proxy_string
-@@ -488,8 +553,20 @@ class YumRepository(Repository, config.RepoConf):
+@@ -488,8 +535,20 @@ class YumRepository(Repository, config.RepoConf):
                                      copy_local=self.copy_local,
                                      reget='simple',
                                      **ugopts)
@@ -157833,7 +159256,7 @@ index e5e9ece..14f6d5f 100644
                               failure_callback=self.mirror_failure_obj)
  
      def _default_grabopts(self, cache=True):
-@@ -499,6 +576,7 @@ class YumRepository(Repository, config.RepoConf):
+@@ -499,6 +558,7 @@ class YumRepository(Repository, config.RepoConf):
                   'throttle': self.throttle,
                   'proxies': self.proxy_dict,
                   'timeout': self.timeout,
@@ -157841,22 +159264,16 @@ index e5e9ece..14f6d5f 100644
                   'http_headers': tuple(self.__headersListFromDict(cache=cache)),
                   'ssl_verify_peer': self.sslverify,
                   'ssl_verify_host': self.sslverify,
-@@ -531,12 +609,11 @@ class YumRepository(Repository, config.RepoConf):
-         if os.path.exists(dpath) and os.path.isdir(dpath):
-             return
- 
--        if self.cache:
--            raise Errors.RepoError, "Cannot access repository dir %s" % dpath
--
-         try:
-             os.makedirs(dpath, mode=0755)
-         except OSError, e:
-+            if self.cache and e.errno == errno.EACCES:
-+                raise Errors.RepoError, "Cannot access repository dir %s" % dpath
-             msg = "%s: %s %s: %s" % ("Error making cache directory",
-                                      dpath, "error was", e)
-             raise Errors.RepoError, msg
-@@ -751,7 +828,7 @@ class YumRepository(Repository, config.RepoConf):
+@@ -714,7 +774,7 @@ class YumRepository(Repository, config.RepoConf):
+             local = self.metalink_filename + '.tmp'
+             if not self._metalinkCurrent():
+                 url = misc.to_utf8(self.metalink)
+-                ugopts = self._default_grabopts()
++                ugopts = self._default_grabopts(cache=self.http_caching=='all')
+                 try:
+                     ug = URLGrabber(progress_obj = self.callback, **ugopts)
+                     result = ug.urlgrab(url, local, text=self.id + "/metalink")
+@@ -751,7 +811,7 @@ class YumRepository(Repository, config.RepoConf):
  
      def _getFile(self, url=None, relative=None, local=None, start=None, end=None,
              copy_local=None, checkfunc=None, text=None, reget='simple', 
@@ -157865,7 +159282,7 @@ index e5e9ece..14f6d5f 100644
          """retrieve file from the mirrorgroup for the repo
             relative to local, optionally get range from
             start to end, also optionally retrieve from a specific baseurl"""
-@@ -796,6 +873,16 @@ class YumRepository(Repository, config.RepoConf):
+@@ -796,6 +856,16 @@ class YumRepository(Repository, config.RepoConf):
              except Errors.MediaError, e:
                  verbose_logger.log(logginglevels.DEBUG_2, "Error getting package from media; falling back to url %s" %(e,))
  
@@ -157882,7 +159299,7 @@ index e5e9ece..14f6d5f 100644
          if url and scheme != "media":
              ugopts = self._default_grabopts(cache=cache)
              ug = URLGrabber(progress_obj = self.callback,
-@@ -835,7 +922,8 @@ class YumRepository(Repository, config.RepoConf):
+@@ -835,7 +905,8 @@ class YumRepository(Repository, config.RepoConf):
                                             reget = reget,
                                             checkfunc=checkfunc,
                                             http_headers=headers,
@@ -157892,7 +159309,7 @@ index e5e9ece..14f6d5f 100644
                                             )
              except URLGrabError, e:
                  errstr = "failure: %s from %s: %s" % (relative, self.id, e)
-@@ -847,7 +935,7 @@ class YumRepository(Repository, config.RepoConf):
+@@ -847,7 +918,7 @@ class YumRepository(Repository, config.RepoConf):
          return result
      __get = _getFile
  
@@ -157901,15 +159318,35 @@ index e5e9ece..14f6d5f 100644
          remote = package.relativepath
          local = package.localPkg()
          basepath = package.basepath
-@@ -864,6 +952,7 @@ class YumRepository(Repository, config.RepoConf):
+@@ -857,15 +928,26 @@ class YumRepository(Repository, config.RepoConf):
+                 return local
+             misc.unlink_f(local)
+ 
+-        return self._getFile(url=basepath,
++        if checkfunc is None:
++            checkfunc = (package.verifyLocalPkg, (), {})
++
++        ret = self._getFile(url=basepath,
+                         relative=remote,
+                         local=local,
+                         checkfunc=checkfunc,
                          text=text,
                          cache=cache,
                          size=package.size,
 +                        **kwargs
                          )
  
++        if not package.verifyLocalPkg(): # Don't return as "success" when bad.
++            msg = "Downloaded package %s, from %s, but it was invalid."
++            msg = msg % (package, pacakge.repo.id)
++            raise Errors.RepoError, msg
++
++        return ret
++
      def getHeader(self, package, checkfunc = None, reget = 'simple',
-@@ -1020,7 +1109,7 @@ class YumRepository(Repository, config.RepoConf):
+             cache = True):
+ 
+@@ -1020,7 +1102,7 @@ class YumRepository(Repository, config.RepoConf):
              if grab_can_fail:
                  return None
              raise Errors.RepoError, 'Error downloading file %s: %s' % (local, e)
@@ -157918,7 +159355,7 @@ index e5e9ece..14f6d5f 100644
              misc.unlink_f(tfname)
              if grab_can_fail:
                  return None
-@@ -1260,6 +1349,9 @@ class YumRepository(Repository, config.RepoConf):
+@@ -1260,6 +1342,9 @@ class YumRepository(Repository, config.RepoConf):
          return True
  
      def _check_db_version(self, mdtype, repoXML=None):
@@ -157928,7 +159365,7 @@ index e5e9ece..14f6d5f 100644
          if repoXML is None:
              repoXML = self.repoXML
          if mdtype in repoXML.repoData:
-@@ -1277,11 +1369,11 @@ class YumRepository(Repository, config.RepoConf):
+@@ -1277,11 +1362,11 @@ class YumRepository(Repository, config.RepoConf):
              return None
  
          if not file_check:
@@ -157943,7 +159380,7 @@ index e5e9ece..14f6d5f 100644
              if not os.path.exists(local):
                  local = misc.decompress(local, fn_only=True)
                  compressed = True
-@@ -1302,6 +1394,17 @@ class YumRepository(Repository, config.RepoConf):
+@@ -1302,6 +1387,17 @@ class YumRepository(Repository, config.RepoConf):
              into the delete list, this means metadata can change filename
              without us leaking it. """
  
@@ -157961,7 +159398,22 @@ index e5e9ece..14f6d5f 100644
          def _mdtype_eq(omdtype, odata, nmdtype, ndata):
              """ Check if two returns from _get_mdtype_data() are equal. """
              if ndata is None:
-@@ -1333,8 +1436,7 @@ class YumRepository(Repository, config.RepoConf):
+@@ -1321,6 +1417,14 @@ class YumRepository(Repository, config.RepoConf):
+             return True
+ 
+         all_mdtypes = self.retrieved.keys()
++        # Add in any extra stuff we don't know about.
++        for mdtype in self.repoXML.fileTypes():
++            if mdtype in all_mdtypes:
++                continue
++            if mdtype in ('primary_db', 'filelists_db', 'other_db'):
++                continue
++            all_mdtypes.append(mdtype)
++
+         if mdtypes is None:
+             mdtypes = all_mdtypes
+ 
+@@ -1333,8 +1437,7 @@ class YumRepository(Repository, config.RepoConf):
  
          # Inited twice atm. ... sue me
          self._oldRepoMDData['new_MD_files'] = []
@@ -157971,7 +159423,7 @@ index e5e9ece..14f6d5f 100644
          for mdtype in all_mdtypes:
              (nmdtype, ndata) = self._get_mdtype_data(mdtype)
  
-@@ -1371,43 +1473,16 @@ class YumRepository(Repository, config.RepoConf):
+@@ -1371,43 +1474,16 @@ class YumRepository(Repository, config.RepoConf):
              # No old repomd data, but we might still have uncompressed MD
              if self._groupCheckDataMDValid(ndata, nmdtype, mdtype):
                  continue
@@ -158020,7 +159472,7 @@ index e5e9ece..14f6d5f 100644
  
      def _groupLoadRepoXML(self, text=None, mdtypes=None):
          """ Retrieve the new repomd.xml from the repository, then check it
-@@ -1421,7 +1496,7 @@ class YumRepository(Repository, config.RepoConf):
+@@ -1421,7 +1497,7 @@ class YumRepository(Repository, config.RepoConf):
              self._commonRetrieveDataMD(mdtypes)
  
      def _mdpolicy2mdtypes(self):
@@ -158029,7 +159481,7 @@ index e5e9ece..14f6d5f 100644
                       'group:primary' : ['primary'],
                       'group:small'   : ["primary", "updateinfo"],
                       'group:main'    : ["primary", "group", "filelists",
-@@ -1436,6 +1511,7 @@ class YumRepository(Repository, config.RepoConf):
+@@ -1436,6 +1512,7 @@ class YumRepository(Repository, config.RepoConf):
          if not mdtypes or 'group:all' in mdtypes:
              mdtypes = None
          else:
@@ -158037,7 +159489,7 @@ index e5e9ece..14f6d5f 100644
              mdtypes = sorted(list(mdtypes))
          return mdtypes
  
-@@ -1451,12 +1527,7 @@ class YumRepository(Repository, config.RepoConf):
+@@ -1451,12 +1528,7 @@ class YumRepository(Repository, config.RepoConf):
      def _getRepoXML(self):
          if self._repoXML:
              return self._repoXML
@@ -158051,7 +159503,7 @@ index e5e9ece..14f6d5f 100644
          return self._repoXML
  
  
-@@ -1514,7 +1585,7 @@ class YumRepository(Repository, config.RepoConf):
+@@ -1514,7 +1586,7 @@ class YumRepository(Repository, config.RepoConf):
          return self._checkMD(fn, mdtype, openchecksum)
  
      def _checkMD(self, fn, mdtype, openchecksum=False,
@@ -158060,7 +159512,7 @@ index e5e9ece..14f6d5f 100644
          """ Internal function, use .checkMD() from outside yum. """
  
          thisdata = data # So the argument name is nicer
-@@ -1537,6 +1608,18 @@ class YumRepository(Repository, config.RepoConf):
+@@ -1537,6 +1609,18 @@ class YumRepository(Repository, config.RepoConf):
          if size is not None:
              size = int(size)
  
@@ -158079,7 +159531,7 @@ index e5e9ece..14f6d5f 100644
          try: # get the local checksum
              l_csum = self._checksum(r_ctype, file, datasize=size)
          except Errors.RepoError, e:
-@@ -1551,15 +1634,13 @@ class YumRepository(Repository, config.RepoConf):
+@@ -1551,15 +1635,13 @@ class YumRepository(Repository, config.RepoConf):
                  return None
              raise URLGrabError(-1, 'Metadata file does not match checksum')
  
@@ -158096,29 +159548,9 @@ index e5e9ece..14f6d5f 100644
          """ Internal function, use .retrieveMD() from outside yum. """
          #  Note that this can raise Errors.RepoMDError if mdtype doesn't exist
          # for this repo.
-@@ -1575,6 +1656,12 @@ class YumRepository(Repository, config.RepoConf):
-             # got it, move along
-             return local
+@@ -1597,7 +1679,9 @@ class YumRepository(Repository, config.RepoConf):
+                 return local # it's the same return the local one
  
-+        if (os.path.exists(local) or
-+            self._preload_md_from_system_cache(os.path.basename(local))):
-+            if self._checkMD(local, mdtype, check_can_fail=True):
-+                self.retrieved[mdtype] = 1
-+                return local # it's the same return the local one
-+
-         if self.cache == 1:
-             if os.path.exists(local):
-                 try:
-@@ -1590,14 +1677,10 @@ class YumRepository(Repository, config.RepoConf):
-                     "Caching enabled but no local cache of %s from %s" % (local,
-                            self)
- 
--        if (os.path.exists(local) or
--            self._preload_md_from_system_cache(os.path.basename(local))):
--            if self._checkMD(local, mdtype, check_can_fail=True):
--                self.retrieved[mdtype] = 1
--                return local # it's the same return the local one
--
          try:
 -            checkfunc = (self.checkMD, (mdtype,), {})
 +            def checkfunc(obj):
@@ -158127,7 +159559,7 @@ index e5e9ece..14f6d5f 100644
              text = "%s/%s" % (self.id, mdtype)
              if thisdata.size is None:
                  reget = None
-@@ -1613,8 +1696,9 @@ class YumRepository(Repository, config.RepoConf):
+@@ -1613,8 +1697,9 @@ class YumRepository(Repository, config.RepoConf):
                                    checkfunc=checkfunc, 
                                    text=text,
                                    cache=self.http_caching == 'all',
@@ -158139,7 +159571,7 @@ index e5e9ece..14f6d5f 100644
              if retrieve_can_fail:
                  return None
              raise
-@@ -1624,7 +1708,6 @@ class YumRepository(Repository, config.RepoConf):
+@@ -1624,7 +1709,6 @@ class YumRepository(Repository, config.RepoConf):
              raise Errors.RepoError, \
                  "Could not retrieve %s matching remote checksum from %s" % (local, self)
          else:
@@ -158147,8 +159579,36 @@ index e5e9ece..14f6d5f 100644
              return local
  
  
+@@ -1646,9 +1730,16 @@ class YumRepository(Repository, config.RepoConf):
+ 
+     def getGroups(self):
+         """gets groups and returns group file path for the repository, if there
+-           is none it returns None"""
++           is none or retrieve/decompress fails, it returns None"""
+         if 'group_gz' in self.repoXML.fileTypes():
+-            return self._retrieveMD('group_gz', retrieve_can_fail=True)
++            fn = self._retrieveMD('group_gz', retrieve_can_fail=True)
++            if fn:
++                try:
++                    fn = misc.repo_gen_decompress(fn, 'comps.xml')
++                except IOError, e:
++                    logger.warning(e)
++                    fn = None
++            return fn
+         return self._retrieveMD('group', retrieve_can_fail=True)
+ 
+     def setCallback(self, callback):
+@@ -1681,7 +1772,7 @@ class YumRepository(Repository, config.RepoConf):
+                 print "Could not read mirrorlist %s, error was \n%s" %(url, e)
+                 content = []
+             for line in content:
+-                if re.match('\s*(#|$)', line):
++                if not re.match('\w+://\S+\s*$', line):
+                     continue
+                 mirror = line.rstrip() # no more trailing \n's
+                 mirror = mirror.replace('$ARCH', '$BASEARCH')
 diff --git a/yumcommands.py b/yumcommands.py
-index 4dcbea7..bc30bd4 100644
+index 4dcbea7..52c3127 100644
 --- a/yumcommands.py
 +++ b/yumcommands.py
 @@ -29,7 +29,7 @@ import operator
@@ -158666,7 +160126,7 @@ index 4dcbea7..bc30bd4 100644
                                                   '=' : clar, 'not in' : clai})
              rep = base.listPkgs(ypl.extras, _('Extra Packages'), basecmd,
                                  columns=columns)
-@@ -389,45 +635,121 @@ class InfoCommand(YumCommand):
+@@ -389,45 +635,144 @@ class InfoCommand(YumCommand):
              return 0, []
  
      def needTs(self, base, basecmd, extcmds):
@@ -158711,12 +160171,15 @@ index 4dcbea7..bc30bd4 100644
 +
          
      def getNames(self):
+-        return ['erase', 'remove']
 +        """Return a list containing the names of this command.  This
 +        command can be called from the command line by using any of these names.
 +
 +        :return: a list containing the names of this command
 +        """
-         return ['erase', 'remove']
++        return ['erase', 'remove', 'autoremove',
++                'erase-n', 'erase-na', 'erase-nevra',
++                'remove-n', 'remove-na', 'remove-nevra']
  
      def getUsage(self):
 +        """Return a usage string for this command.
@@ -158743,6 +160206,8 @@ index 4dcbea7..bc30bd4 100644
 +        :param extcmds: the command line arguments passed to *basecmd*
 +        """
          checkRootUID(base)
++        if basecmd == 'autoremove':
++            return
          checkPackageArg(base, basecmd, extcmds)
  
      def doCommand(self, base, basecmd, extcmds):
@@ -158759,12 +160224,32 @@ index 4dcbea7..bc30bd4 100644
 +            1 = we've errored, exit with error string
 +            2 = we've got work yet to do, onto the next stage
 +        """
++
++        pos = False
++        if basecmd == 'autoremove':
++            #  We have to alter this, as it's used in resolving stage. Which
++            # sucks. Just be careful in "yum shell".
++            base.conf.clean_requirements_on_remove = True
++
++            if not extcmds:
++                pos = True
++                extcmds = []
++                for pkg in sorted(base.rpmdb.returnLeafNodes()):
++                    if 'reason' not in pkg.yumdb_info:
++                        continue
++                    if pkg.yumdb_info.reason != 'dep':
++                        continue
++                    extcmds.append(pkg)
++
          self.doneCommand(base, _("Setting up Remove Process"))
          try:
-             return base.erasePkgs(extcmds)
+-            return base.erasePkgs(extcmds)
++            ret = base.erasePkgs(extcmds, pos=pos, basecmd=basecmd)
          except yum.Errors.YumBaseError, e:
 -            return 1, [str(e)]
-+            return 1, [exception2msg(e)]
++            ret = (1, [exception2msg(e)])
++
++        return ret
  
      def needTs(self, base, basecmd, extcmds):
 +        """Return whether a transaction set must be set up before this
@@ -158789,7 +160274,7 @@ index 4dcbea7..bc30bd4 100644
          return True
  
   
-@@ -442,12 +764,25 @@ class GroupsCommand(YumCommand):
+@@ -442,12 +787,25 @@ class GroupsCommand(YumCommand):
                         'groupinfo'    : 'info'}
  
      def getNames(self):
@@ -158815,7 +160300,7 @@ index 4dcbea7..bc30bd4 100644
          return _("Display, or use, the groups information")
      
      def _grp_setup_doCommand(self, base):
-@@ -459,7 +794,7 @@ class GroupsCommand(YumCommand):
+@@ -459,7 +817,7 @@ class GroupsCommand(YumCommand):
          except yum.Errors.GroupsError:
              return 1, [_('No Groups on which to run command')]
          except yum.Errors.YumBaseError, e:
@@ -158824,7 +160309,7 @@ index 4dcbea7..bc30bd4 100644
  
      def _grp_cmd(self, basecmd, extcmds):
          if basecmd in self.direct_commands:
-@@ -470,6 +805,10 @@ class GroupsCommand(YumCommand):
+@@ -470,6 +828,10 @@ class GroupsCommand(YumCommand):
          else:
              cmd = 'summary'
  
@@ -158835,7 +160320,7 @@ index 4dcbea7..bc30bd4 100644
          remap = {'update' : 'upgrade',
                   'erase' : 'remove',
                   'mark-erase' : 'mark-remove',
-@@ -479,32 +818,70 @@ class GroupsCommand(YumCommand):
+@@ -479,32 +841,76 @@ class GroupsCommand(YumCommand):
          return cmd, extcmds
  
      def doCheck(self, base, basecmd, extcmds):
@@ -158860,12 +160345,18 @@ index 4dcbea7..bc30bd4 100644
 +            ocmds_arg = ('mark-install', 'mark-remove',
 +                         'mark-packages', 'mark-packages-force',
 +                         'unmark-packages',
-+                         'mark-packages-sync', 'mark-packages-sync-force')
++                         'mark-packages-sync', 'mark-packages-sync-force',
++                         'mark-groups', 'mark-groups-force',
++                         'unmark-groups',
++                         'mark-groups-sync', 'mark-groups-sync-force')
 +
 +            ocmds_all = ('mark-install', 'mark-remove', 'mark-convert',
 +                         'mark-packages', 'mark-packages-force',
 +                         'unmark-packages',
-+                         'mark-packages-sync', 'mark-packages-sync-force')
++                         'mark-packages-sync', 'mark-packages-sync-force',
++                         'mark-groups', 'mark-groups-force',
++                         'unmark-groups',
++                         'mark-groups-sync', 'mark-groups-sync-force')
 +
 +        if cmd in ('install', 'remove', 'info') or cmd in ocmds_arg:
              checkGroupArg(base, cmd, extcmds)
@@ -158916,23 +160407,28 @@ index 4dcbea7..bc30bd4 100644
          cmd, extcmds = self._grp_cmd(basecmd, extcmds)
  
          self._grp_setup_doCommand(base)
-@@ -524,39 +901,195 @@ class GroupsCommand(YumCommand):
+@@ -524,39 +930,258 @@ class GroupsCommand(YumCommand):
              if cmd == 'remove':
                  return base.removeGroups(extcmds)
  
 +            if cmd == 'mark-install':
-+                for strng in extcmds:
-+                    for group in base.comps.return_groups(strng):
-+                        base.igroups.add_group(group.groupid, group.packages)
++                gRG = base._groupReturnGroups(extcmds,ignore_case=False)
++                igrps, grps, ievgrps, evgrps = gRG
++                for evgrp in evgrps:
++                    base.igroups.add_environment(evgrp.environmentid,
++                                                 evgrp.allgroups)
++                for grp in grps:
++                    base.igroups.add_group(grp.groupid, grp.packages)
 +                base.igroups.save()
 +                return 0, ['Marked install: ' + ','.join(extcmds)]
 +
 +            if cmd in ('mark-packages', 'mark-packages-force'):
 +                if len(extcmds) < 2:
 +                    return 1, ['No group or package given']
-+                igrps, grps = base._groupReturnGroups([extcmds[0]],
-+                                                      ignore_case=False)
-+                if igrps is not None and len(igrps) != 1:
++                gRG = base._groupReturnGroups([extcmds[0]],
++                                              ignore_case=False)
++                igrps, grps, ievgrps, evgrps = gRG
++                if igrps is None or len(igrps) != 1:
 +                    return 1, ['No group matched']
 +                grp = igrps[0]
 +                force = cmd == 'mark-packages-force'
@@ -158952,7 +160448,8 @@ index 4dcbea7..bc30bd4 100644
 +                return 0, ['UnMarked packages: ' + ','.join(extcmds)]
 +
 +            if cmd in ('mark-packages-sync', 'mark-packages-sync-force'):
-+                igrps, grps = base._groupReturnGroups(extcmds,ignore_case=False)
++                gRG = base._groupReturnGroups(extcmds,ignore_case=False)
++                igrps, grps, ievgrps, evgrps = gRG
 +                if not igrps:
 +                    return 1, ['No group matched']
 +                force = cmd == 'mark-packages-sync-force'
@@ -158966,6 +160463,60 @@ index 4dcbea7..bc30bd4 100644
 +                else:
 +                    return 0, ['Marked packages-sync: ' + ','.join(extcmds)]
 +
++            if cmd in ('mark-groups', 'mark-groups-force'):
++                if len(extcmds) < 2:
++                    return 1, ['No environment or group given']
++                gRG = base._groupReturnGroups([extcmds[0]],
++                                              ignore_case=False)
++                igrps, grps, ievgrps, evgrps = gRG
++                if ievgrps is None or len(ievgrps) != 1:
++                    return 1, ['No environment matched']
++                evgrp = ievgrps[0]
++                force = cmd == 'mark-groups-force'
++                gRG = base._groupReturnGroups(extcmds[1:], ignore_case=False)
++                for grp in gRG[1]:
++                    # Packages full or empty?
++                    self.igroups.add_group(grp.groupid,
++                                           grp.packages, ievgrp)
++                if force:
++                    for grp in gRG[0]:
++                        grp.environment = evgrp.evgid
++                        base.igroups.changed = True
++                base.igroups.save()
++                return 0, ['Marked groups: ' + ','.join(extcmds[1:])]
++
++            if cmd == 'unmark-groups':
++                gRG = base._groupReturnGroups([extcmds[0]],
++                                              ignore_case=False)
++                igrps, grps, ievgrps, evgrps = gRG
++                if igrps is None:
++                    return 1, ['No groups matched']
++                for grp in igrps:
++                    grp.environment = None
++                    base.igroups.changed = True
++                base.igroups.save()
++                return 0, ['UnMarked groups: ' + ','.join(extcmds)]
++
++            if cmd in ('mark-groups-sync', 'mark-groups-sync-force'):
++                gRG = base._groupReturnGroups(extcmds,ignore_case=False)
++                igrps, grps, ievgrps, evgrps = gRG
++                if not ievgrps:
++                    return 1, ['No environment matched']
++                force = cmd == 'mark-groups-sync-force'
++                for evgrp in ievgrps:
++                    grp_names = ",".join(sorted(evgrp.grp_names))
++                    for grp in base.igroups.return_groups(grp_names):
++                        if not force and grp.environment is not None:
++                            continue
++                        grp.environment = evgrp.evgid
++                        base.igroups.changed = True
++                base.igroups.save()
++                if force:
++                    return 0, ['Marked groups-sync-force: '+','.join(extcmds)]
++                else:
++                    return 0, ['Marked groups-sync: ' + ','.join(extcmds)]
++
++            # FIXME: This doesn't do environment groups atm.
 +            if cmd == 'mark-convert':
 +                # Convert old style info. into groups as objects.
 +
@@ -159015,9 +160566,12 @@ index 4dcbea7..bc30bd4 100644
 +                return 0, ['Converted old style groups to objects.']
 +
 +            if cmd == 'mark-remove':
-+                for strng in extcmds:
-+                    for group in base.comps.return_groups(strng):
-+                        base.igroups.del_group(group.groupid)
++                gRG = base._groupReturnGroups(extcmds,ignore_case=False)
++                igrps, grps, ievgrps, evgrps = gRG
++                for evgrp in ievgrps:
++                    base.igroups.del_environment(evgrp.evgid)
++                for grp in igrps:
++                    base.igroups.del_group(grp.gid)
 +                base.igroups.save()
 +                return 0, ['Marked remove: ' + ','.join(extcmds)]
 +
@@ -159114,7 +160668,7 @@ index 4dcbea7..bc30bd4 100644
          base.logger.debug(_("Making cache files for all metadata files."))
          base.logger.debug(_("This may take a while depending on the speed of this computer"))
          try:
-@@ -565,81 +1098,204 @@ class MakeCacheCommand(YumCommand):
+@@ -565,81 +1190,216 @@ class MakeCacheCommand(YumCommand):
                  repo.mdpolicy = "group:all"
              base.doRepoSetup(dosack=0)
              base.repos.doSetup()
@@ -159130,6 +160684,18 @@ index 4dcbea7..bc30bd4 100644
 -            base.repos.populateSack(mdtype='otherdata', cacheonly=1)
 +            base.repos.populateSack(mdtype='all', cacheonly=1)
  
++            # Now decompress stuff, so that -C works, sigh.
++            fname_map = {'group_gz'   : 'groups.xml',
++                         'pkgtags'    : 'pkgtags.sqlite',
++                         'updateinfo' : 'updateinfo.xml',
++                         }
++            for repo in base.repos.listEnabled():
++                for MD in repo.repoXML.fileTypes():
++                    if MD not in fname_map:
++                        continue
++                    misc.repo_gen_decompress(repo.retrieveMD(MD),
++                                             fname_map[MD],
++                                             cached=repo.cache)
  
          except yum.Errors.YumBaseError, e:
 -            return 1, [str(e)]
@@ -159326,7 +160892,7 @@ index 4dcbea7..bc30bd4 100644
          obscmds = ['obsoletes'] + extcmds
          base.extcmds.insert(0, 'updates')
          result = 0
-@@ -676,161 +1332,437 @@ class CheckUpdateCommand(YumCommand):
+@@ -676,161 +1436,437 @@ class CheckUpdateCommand(YumCommand):
                                                columns=columns)
                  result = 100
          except yum.Errors.YumBaseError, e:
@@ -159772,7 +161338,7 @@ index 4dcbea7..bc30bd4 100644
          def _repo_size(repo):
              ret = 0
              for pkg in repo.sack.returnPackages():
-@@ -866,6 +1798,13 @@ class RepoListCommand(YumCommand):
+@@ -866,6 +1902,13 @@ class RepoListCommand(YumCommand):
              except yum.Errors.RepoError:
                  if verbose:
                      raise
@@ -159786,7 +161352,7 @@ index 4dcbea7..bc30bd4 100644
  
          repos = base.repos.repos.values()
          repos.sort()
-@@ -924,111 +1863,108 @@ class RepoListCommand(YumCommand):
+@@ -924,111 +1967,108 @@ class RepoListCommand(YumCommand):
                  ui_enabled = dhibeg + _('disabled') + hiend
                  ui_endis_wid = utf8_width(_('disabled'))
  
@@ -159991,7 +161557,7 @@ index 4dcbea7..bc30bd4 100644
  
          if not verbose and cols:
              #  Work out the first (id) and last (enabled/disalbed/count),
-@@ -1088,21 +2024,54 @@ class RepoListCommand(YumCommand):
+@@ -1088,21 +2128,54 @@ class RepoListCommand(YumCommand):
          return 0, ['repolist: ' +to_unicode(locale.format("%d", tot_num, True))]
  
      def needTs(self, base, basecmd, extcmds):
@@ -160046,7 +161612,7 @@ index 4dcbea7..bc30bd4 100644
          if len(extcmds) == 0:
              base.usage()
              raise cli.CliError
-@@ -1147,28 +2116,85 @@ class HelpCommand(YumCommand):
+@@ -1147,28 +2220,85 @@ class HelpCommand(YumCommand):
          return help_output
  
      def doCommand(self, base, basecmd, extcmds):
@@ -160132,7 +161698,7 @@ index 4dcbea7..bc30bd4 100644
          self.doneCommand(base, _("Setting up Reinstall Process"))
          try:
              return base.reinstallPkgs(extcmds)
-@@ -1177,49 +2203,139 @@ class ReInstallCommand(YumCommand):
+@@ -1177,49 +2307,139 @@ class ReInstallCommand(YumCommand):
              return 1, [to_unicode(e)]
  
      def getSummary(self):
@@ -160273,7 +161839,7 @@ index 4dcbea7..bc30bd4 100644
          vcmd = 'installed'
          if extcmds:
              vcmd = extcmds[0]
-@@ -1308,7 +2424,7 @@ class VersionCommand(YumCommand):
+@@ -1308,7 +2528,7 @@ class VersionCommand(YumCommand):
                                       str(data[2][grp])))
                          _append_repos(cols, data[3][grp])
              except yum.Errors.YumBaseError, e:
@@ -160282,7 +161848,7 @@ index 4dcbea7..bc30bd4 100644
          if vcmd in ('available', 'all', 'group-available', 'group-all'):
              try:
                  data = base.pkgSack.simpleVersion(not verbose, groups=groups)
-@@ -1327,7 +2443,7 @@ class VersionCommand(YumCommand):
+@@ -1327,7 +2547,7 @@ class VersionCommand(YumCommand):
                          if verbose:
                              _append_repos(cols, data[3][grp])
              except yum.Errors.YumBaseError, e:
@@ -160291,7 +161857,7 @@ index 4dcbea7..bc30bd4 100644
  
          data = {'rid' : {}, 'ver' : {}}
          for (rid, ver) in cols:
-@@ -1344,6 +2460,14 @@ class VersionCommand(YumCommand):
+@@ -1344,6 +2564,14 @@ class VersionCommand(YumCommand):
          return 0, ['version']
  
      def needTs(self, base, basecmd, extcmds):
@@ -160306,7 +161872,7 @@ index 4dcbea7..bc30bd4 100644
          vcmd = 'installed'
          if extcmds:
              vcmd = extcmds[0]
-@@ -1354,23 +2478,62 @@ class VersionCommand(YumCommand):
+@@ -1354,23 +2582,62 @@ class VersionCommand(YumCommand):
  
  
  class HistoryCommand(YumCommand):
@@ -160370,7 +161936,7 @@ index 4dcbea7..bc30bd4 100644
              return 2, ["Repeating transaction %u" % (old.tid,)]
  
      def _hcmd_undo(self, base, extcmds):
-@@ -1426,12 +2589,57 @@ class HistoryCommand(YumCommand):
+@@ -1426,12 +2693,57 @@ class HistoryCommand(YumCommand):
      def _hcmd_new(self, base, extcmds):
          base.history._create_db_file()
  
@@ -160429,7 +161995,7 @@ index 4dcbea7..bc30bd4 100644
          if extcmds and extcmds[0] not in cmds:
              base.logger.critical(_('Invalid history sub-command, use: %s.'),
                                   ", ".join(cmds))
-@@ -1444,6 +2652,19 @@ class HistoryCommand(YumCommand):
+@@ -1444,6 +2756,19 @@ class HistoryCommand(YumCommand):
              raise cli.CliError
  
      def doCommand(self, base, basecmd, extcmds):
@@ -160449,7 +162015,7 @@ index 4dcbea7..bc30bd4 100644
          vcmd = 'list'
          if extcmds:
              vcmd = extcmds[0]
-@@ -1468,12 +2689,26 @@ class HistoryCommand(YumCommand):
+@@ -1468,12 +2793,26 @@ class HistoryCommand(YumCommand):
              ret = self._hcmd_rollback(base, extcmds)
          elif vcmd == 'new':
              ret = self._hcmd_new(base, extcmds)
@@ -160476,7 +162042,7 @@ index 4dcbea7..bc30bd4 100644
          vcmd = 'list'
          if extcmds:
              vcmd = extcmds[0]
-@@ -1481,16 +2716,46 @@ class HistoryCommand(YumCommand):
+@@ -1481,16 +2820,46 @@ class HistoryCommand(YumCommand):
  
  
  class CheckRpmdbCommand(YumCommand):
@@ -160523,7 +162089,7 @@ index 4dcbea7..bc30bd4 100644
          chkcmd = 'all'
          if extcmds:
              chkcmd = extcmds
-@@ -1505,19 +2770,57 @@ class CheckRpmdbCommand(YumCommand):
+@@ -1505,19 +2874,57 @@ class CheckRpmdbCommand(YumCommand):
          return rc, ['%s %s' % (basecmd, chkcmd)]
  
      def needTs(self, base, basecmd, extcmds):
@@ -160581,7 +162147,7 @@ index 4dcbea7..bc30bd4 100644
          if not extcmds:
              base.logger.critical(_("No saved transaction file specified."))
              raise cli.CliError
-@@ -1533,5 +2836,13 @@ class LoadTransactionCommand(YumCommand):
+@@ -1533,5 +2940,13 @@ class LoadTransactionCommand(YumCommand):
  
  
      def needTs(self, base, basecmd, extcmds):


More information about the scm-commits mailing list