[yum-commits] 6 commits - cli.py docs/yum.8 Makefile yum/comps.py yum/depsolve.py yum/__init__.py yummain.py yum/repos.py

James Antill james at osuosl.org
Wed Aug 28 20:52:10 UTC 2013


 Makefile        |    1 
 cli.py          |   10 +--------
 docs/yum.8      |    2 -
 yum/__init__.py |   42 ++++++++++++++++++++-------------------
 yum/comps.py    |   16 ++++++++++++++
 yum/depsolve.py |    6 +----
 yum/repos.py    |    2 +
 yummain.py      |   60 ++++++++++++++++++++++++++++++++++++++++++++------------
 8 files changed, 92 insertions(+), 47 deletions(-)

New commits:
commit 158160d411ba3cd1bd30fb6e4b8c3a84495cf26a
Author: James Antill <james at and.org>
Date:   Wed Aug 28 16:48:56 2013 -0400

    Use new comps. mock objects to re-integrate group removal. BZ 996866.

diff --git a/cli.py b/cli.py
index 7fa638b..8358c55 100755
--- a/cli.py
+++ b/cli.py
@@ -1953,10 +1953,7 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
 
             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)
+                groups = self.comps.return_environments(group_string)
                 if not groups:
                     self.logger.critical(_('No environment named %s exists'), group_string)
             for group in groups:
@@ -1969,10 +1966,7 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
 
             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)
+                groups = self.comps.return_groups(group_string)
                 if not groups:
                     self.logger.critical(_('No group named %s exists'), group_string)
             for group in groups:
diff --git a/yum/__init__.py b/yum/__init__.py
index 3da94b1..a43f493 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -3658,10 +3658,7 @@ much more problems).
         """
         txmbrs_used = []
 
-        if self.conf.group_command == 'objects':
-            thesegroups = self.igroups.return_groups(grpid)
-        else:
-            thesegroups = self.comps.return_groups(grpid)
+        thesegroups = self.comps.return_groups(grpid)
         if not thesegroups:
             raise Errors.GroupsError, _("No Group named %s exists") % to_unicode(grpid)
 
@@ -3670,12 +3667,8 @@ much more problems).
 
             thisgroup.toremove = True
 
-            if self.conf.group_command == 'objects':
-                pkgs = thisgroup.pkg_names
-                gid  = thisgroup.gid
-            else:
-                pkgs = thisgroup.packages
-                gid  = thisgroup.groupid
+            pkgs = thisgroup.packages
+            gid  = thisgroup.groupid
 
             for pkg in pkgs:
                 if pkg in igroup_data and igroup_data[pkg] != 'installed':
@@ -3728,22 +3721,15 @@ much more problems).
         """
         txmbrs_used = []
 
-        if self.conf.group_command == 'objects':
-            thesegroups = self.igroups.return_environments(evgrpid)
-        else:
-            thesegroups = self.comps.return_environments(evgrpid)
+        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
+            grps  = thisgroup.allgroups
+            evgid = thisgroup.environmentid
 
             for grp in grps:
                 if grp in igroup_data and igroup_data[grp] != 'installed':
commit eb786e97ad0cbee6fce43993c7c757c613bbadd9
Author: James Antill <james at and.org>
Date:   Tue Aug 27 17:09:20 2013 -0400

    Add "weak" comps. groups, for installed groups. For comps.return_groups().

diff --git a/yum/__init__.py b/yum/__init__.py
index 7a5332b..3da94b1 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -920,6 +920,21 @@ class YumBase(depsolve.Depsolve):
         overwrite = self.conf.overwrite_groups
         self._comps = comps.Comps(overwrite_groups = overwrite)
 
+        if self.conf.group_command == 'objects':
+            #  Add the ids for installed groups/envs as though sys is a repo.
+            # makes everything easier (comps.return_groups() etc. works)...
+            self._comps.compscount += 1
+            for gid in self.igroups.groups:
+                grp = comps.Group()
+                grp.name = grp.groupid = gid
+                grp._weak = True
+                self._comps.add_group(grp)
+            for evgid in self.igroups.environments:
+                env = comps.Environment()
+                env.name = env.environmentid = evgid
+                env._weak = True
+                self._comps.add_environment(env)
+
         for repo in reposWithGroups:
             if repo.groups_added: # already added the groups from this repo
                 continue
@@ -4435,6 +4450,7 @@ much more problems).
         try: comps = self.comps
         except yum.Errors.GroupsError, e:
             # No Groups Available in any repository?
+            # This also means no installed groups, when using objects.
             self.logger.warning(e)
             return tx_return
 
diff --git a/yum/comps.py b/yum/comps.py
index af79a55..706e2a4 100755
--- a/yum/comps.py
+++ b/yum/comps.py
@@ -124,6 +124,8 @@ class Group(CompsObj):
         self.installed = False
         self.toremove = False
 
+        self._weak = False
+
         if elem:
             self.parse(elem)
 
@@ -301,6 +303,8 @@ class Environment(CompsObj):
         self._options = {}
         self._defaultoptions = {}
 
+        self._weak = False
+
         if elem:
             self.parse(elem)
 
@@ -385,7 +389,7 @@ class Environment(CompsObj):
                     self._defaultoptions[optionid] = 1
 
     def add(self, obj):
-        """Add another category object to this object"""
+        """Add another environment object to this object"""
 
         for grp in obj.groups:
             self._groups[grp] = 1
@@ -765,6 +769,11 @@ class Comps(object):
     def add_group(self, group):
         if group.groupid in self._groups:
             thatgroup = self._groups[group.groupid]
+            if thatgroup._weak:
+                # If what we had was weak, use this one and merge the weak one.
+                tmp = group
+                group = thatgroup
+                thatgroup = self._groups[group.groupid] = tmp
             thatgroup.add(group)
         else:
             self._groups[group.groupid] = group
@@ -772,6 +781,11 @@ class Comps(object):
     def add_environment(self, environment):
         if environment.environmentid in self._environments:
             env = self._environments[environment.environmentid]
+            if env._weak:
+                # If what we had was weak, use this one and merge the weak one.
+                tmp = environment
+                environment = env
+                env = self._environments[environment.environmentid] = tmp
             env.add(environment)
         else:
             self._environments[environment.environmentid] = environment
commit cf47b025b12ad53bd99a6091d48822003d5e95be
Author: James Antill <james at and.org>
Date:   Tue Aug 27 17:07:45 2013 -0400

    Add msg. to help users deal with RepoError failures. BZ 867389

diff --git a/yum/repos.py b/yum/repos.py
index 67ef1e4..5d6bc99 100644
--- a/yum/repos.py
+++ b/yum/repos.py
@@ -88,6 +88,7 @@ class RepoStorage:
                 dl = repo._async and repo._commonLoadRepoXML(repo)
             except Errors.RepoError, e:
                 if not repo.skip_if_unavailable:
+                    e.repo = repo
                     raise
                 self.disableRepo(repo.id)
                 dl = False
@@ -385,6 +386,7 @@ class RepoStorage:
                 if mdtype in ['all', 'metadata'] and repo.skip_if_unavailable:
                     self.disableRepo(repo.id)
                 else:
+                    e.repo = repo
                     raise
             else:
                 self.pkgSack.addSack(repo.id, sack)
diff --git a/yummain.py b/yummain.py
index 95c4cd0..2535d65 100755
--- a/yummain.py
+++ b/yummain.py
@@ -68,6 +68,51 @@ def main(args):
         if unlock(): return 200
         return 1
 
+    def exRepoError(e):
+        # For RepoErrors ... help out by forcing new repodata next time.
+        base.cleanExpireCache()
+
+        msg = _("""\
+ One of the configured repositories failed (%(repo)s), and yum doesn't have
+enough cached data to continue. At this point the only safe thing yum can do
+is fail.
+ There are a few ways to work "fix" this:
+
+     1. Contact the upstream for the repository and get them to fix the problem.
+
+     2. Reconfigure the baseurl/etc. for the repository, to point to a working
+        upstream. This is most often useful if you are using a newer
+        distribution release than is supported by the repository (and the
+        packages for the previous distribution release still work).
+
+     3. Disable the repository, so yum won't use it by default. Yum will then
+        just ignore the repository until you permanently enable it again or use
+        --enablerepo for temporary usage:
+
+            yum-config-manager --disable %(repoid)s
+
+     4. Configure the failing repository to be skipped, if it is unavailable.
+        Note that yum will try to contact the repo. when it runs most commands,
+        so will have to try and fail each time (and thus. yum will be be much
+        slower). If it is a very temporary problem though, this is often a nice
+        compromise:
+
+            yum-config-manager --save --setopt=skip_if_unavailable=true %(repoid)s
+""")
+
+        repoui = _('Unknown')
+        repoid = _('<repoid>')
+        if hasattr(e, 'repo'):
+            repoid = e.repo.id
+            repoui = e.repo.name
+
+        msg = msg % {'repoid' : repoid, 'repo' : repoui}
+
+        logger.critical('\n\n%s\n%s', msg, exception2msg(e))
+
+        if unlock(): return 200
+        return 1
+
     def unlock():
         try:
             base.closeRpmDB()
@@ -130,10 +175,7 @@ def main(args):
     except plugins.PluginYumExit, e:
         return exPluginExit(e)
     except Errors.RepoError, e:
-        result = 1
-        resultmsgs = [exception2msg(e)]
-        # For RepoErrors ... help out by forcing new repodata next time.
-        base.cleanExpireCache()
+        return exRepoError(e)
     except Errors.YumBaseError, e:
         result = 1
         resultmsgs = [exception2msg(e)]
@@ -176,10 +218,7 @@ def main(args):
     except plugins.PluginYumExit, e:
         return exPluginExit(e)
     except Errors.RepoError, e:
-        result = 1
-        resultmsgs = [exception2msg(e)]
-        # For RepoErrors ... help out by forcing new repodata next time.
-        base.cleanExpireCache()
+        return exRepoError(e)
     except Errors.YumBaseError, e:
         result = 1
         resultmsgs = [exception2msg(e)]
@@ -223,10 +262,7 @@ def main(args):
     except plugins.PluginYumExit, e:
         return exPluginExit(e)
     except Errors.RepoError, e:
-        result = 1
-        resultmsgs = [exception2msg(e)]
-        # For RepoErrors ... help out by forcing new repodata next time.
-        base.cleanExpireCache()
+        return exRepoError(e)
     except Errors.YumBaseError, e:
         return exFatal(e)
     except KeyboardInterrupt:
commit ac0fa4efe2d97c0fbecb11e9524c73f177dfab47
Author: James Antill <james at and.org>
Date:   Tue Aug 27 12:06:07 2013 -0400

    Skip check-po-yes-no now, as we always allow english. BZ 983525.

diff --git a/Makefile b/Makefile
index 9e1d7af..f203c4d 100644
--- a/Makefile
+++ b/Makefile
@@ -83,7 +83,6 @@ doccheck:
 
 test:
 	@nosetests -i ".*test" test
-	- at test/check-po-yes-no.py
 	cd po; make test
 
 test-skipbroken:
commit 174118bde8eb3adb7dc07380bf4008f1d8147ef4
Author: James Antill <james at and.org>
Date:   Tue Aug 27 12:01:54 2013 -0400

    Give msgs about install/trans. obsoletes a higher priority. BZ 991080

diff --git a/yum/depsolve.py b/yum/depsolve.py
index dcfd05a..7002205 100644
--- a/yum/depsolve.py
+++ b/yum/depsolve.py
@@ -1343,8 +1343,7 @@ class Depsolve(object):
                     if po.obsoletedBy([otxmbr.po]): # Loops, hope for rpm.
                         continue
                     msg = _('Removing %s due to obsoletes from installed %s')
-                    self.verbose_logger.log(logginglevels.DEBUG_1,
-                                            msg, otxmbr, po)
+                    self.verbose_logger.warning(msg, otxmbr, po)
                     _do_obs(otxmbr)
                     ret = True
 
@@ -1368,8 +1367,7 @@ class Depsolve(object):
                         # Have to deal with loops! Hope rpm behaves too.
                         continue
                     msg = _('Removing %s due to obsoletes from %s')
-                    self.verbose_logger.log(logginglevels.DEBUG_1,
-                                            msg, otxmbr, txmbr)
+                    self.verbose_logger.warning(msg, otxmbr, txmbr)
                     _do_obs(otxmbr)
                     ret = True
 
commit 682f5f2cf4dc207a56765892c86e3a34b55ae094
Author: James Antill <james at and.org>
Date:   Tue Aug 27 11:47:07 2013 -0400

    Remove reference to yum-security man page, add yum-langpacks. BZ 984863.

diff --git a/docs/yum.8 b/docs/yum.8
index 1bb756e..1885e15 100644
--- a/docs/yum.8
+++ b/docs/yum.8
@@ -1001,7 +1001,7 @@ configuration options.
 .I yum-complete-transaction (1)
 .I yumdownloader (1)
 .I yum-utils (1)
-.I yum-security (8)
+.I yum-langpacks (1)
 http://yum.baseurl.org/
 http://yum.baseurl.org/wiki/Faq
 yum search yum


More information about the Yum-commits mailing list