[yum-commits] Branch 'yum-3_2_X' - 4 commits - cli.py output.py test/testbase.py yum/config.py yum/__init__.py

James Antill james at osuosl.org
Mon Nov 29 22:25:57 UTC 2010


 cli.py           |   56 ++++++++++++++++++++++++++++++++-----------------------
 output.py        |    2 +
 test/testbase.py |    1 
 yum/__init__.py  |   37 ++++++++++++++++++++++++++++++++++++
 yum/config.py    |    1 
 5 files changed, 74 insertions(+), 23 deletions(-)

New commits:
commit 77fe6a02083b8015018973ba04a8d676a615ff0d
Merge: 9ff481b... ae4fea7...
Author: James Antill <james at and.org>
Date:   Mon Nov 29 17:25:49 2010 -0500

    Merge branch 'groups-language-split' into yum-3_2_X
    
    * groups-language-split:
      Split "Language groups" out from normal groups, using langonly. BZ 652750.

commit 9ff481b21d665b259b2621ac74d091e308a8515d
Author: James Antill <james at and.org>
Date:   Tue Nov 23 14:25:07 2010 -0500

    Warn on groupinstall with optional only pkgs (@web-development). BZ 655281

diff --git a/yum/__init__.py b/yum/__init__.py
index b4640bf..92fa0d0 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -2766,6 +2766,9 @@ class YumBase(depsolve.Depsolve):
             if 'optional' in package_types:
                 pkgs.extend(thisgroup.optional_packages)
 
+            if not pkgs:
+                self.logger.critical(_('Warning: Group %s does not have any packages.'), thisgroup.groupid)
+
             for pkg in pkgs:
                 self.verbose_logger.log(logginglevels.DEBUG_2,
                     _('Adding package %s from group %s'), pkg, thisgroup.groupid)
commit 299a8440e995da366b3d52cafb4986df5d19823c
Author: James Antill <james at and.org>
Date:   Tue Nov 23 13:56:59 2010 -0500

     Add protected_multilib config. option, which forces foo.i386 == foo.x86_64
    version wise.
    
     Note that this is kind of valid now, in that there is nothing
    technically wrong with having foo-1.i686 and foo-2.x86_64 installed.
    However _by far_ the most common case is for the user to not want this,
    but yum to solve for it, due to missing %{_isa} etc.
     Also "yum check duplicates" will flag it as an error already.

diff --git a/test/testbase.py b/test/testbase.py
index 4d7bd8d..d9e23f1 100644
--- a/test/testbase.py
+++ b/test/testbase.py
@@ -51,6 +51,7 @@ class FakeConf(object):
         self.uid = 0
         self.groupremove_leaf_only = False
         self.protected_packages = []
+        self.protected_multilib = False
         self.clean_requirements_on_remove = True
 
 class FakeSack:
diff --git a/yum/__init__.py b/yum/__init__.py
index a13ad96..b4640bf 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -961,6 +961,40 @@ class YumBase(depsolve.Depsolve):
         if self.tsInfo.pkgSack is not None: # rm Transactions don't have pkgSack
             self.tsInfo.pkgSack.dropCachedData()
 
+        txmbrs = []
+        if rescode == 2 and self.conf.protected_multilib and self.arch.multilib:
+            txmbrs = self.tsInfo.getMembersWithState(None, TS_INSTALL_STATES)
+        vers = {}
+        for txmbr in txmbrs:
+            #  In theory we could skip noarch packages here, but it's really
+            # fast and there are some edge cases where it'll help.
+            if txmbr.name not in vers:
+                vers[txmbr.name] = [txmbr.po]
+                continue
+            vers[txmbr.name].append(txmbr.po)
+
+        fine = []
+        xrestring = []
+        for pkgname in vers:
+            if len(vers[pkgname]) <= 1:
+                # We have to go govelling through the rpmdb data to get
+                for pkg in self.rpmdb.searchNames([pkgname]):
+                    if self.tsInfo.getMembersWithState(pkg.pkgtup,
+                                                       TS_REMOVE_STATES):
+                        continue
+                    vers[pkgname].append(pkg)
+
+            # If all the versions are equal, we should be fine.
+            first = vers[pkgname][0]
+            for other in vers[pkgname][1:]:
+                if first.verEQ(other):
+                    continue
+                msg = _('Protected multilib versions: %s != %s')
+                xrestring.append(msg % (first, other))
+        if xrestring:
+            rescode = 1
+            restring = xrestring
+
         #  This is a version of the old "protect-packages" plugin, it allows
         # you to erase duplicates and do remove+install.
         #  But we don't allow you to turn it off!:)
diff --git a/yum/config.py b/yum/config.py
index aecef44..14eb992 100644
--- a/yum/config.py
+++ b/yum/config.py
@@ -738,6 +738,7 @@ class YumConf(StartupConf):
 
     protected_packages = ListOption("yum, glob:/etc/yum/protected.d/*.conf",
                                     parse_default=True)
+    protected_multilib = BoolOption(True)
     exit_on_lock = BoolOption(False)
     
     loadts_ignoremissing = BoolOption(False)
commit ae4fea7921e03359e4b8f38e24beca8f964cf2ca
Author: James Antill <james at and.org>
Date:   Fri Nov 12 12:48:20 2010 -0500

    Split "Language groups" out from normal groups, using langonly. BZ 652750.

diff --git a/cli.py b/cli.py
index 0c5d8ed..36d1f03 100644
--- a/cli.py
+++ b/cli.py
@@ -1171,29 +1171,39 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
         installed, available = self.doGroupLists(uservisible=uservisible,
                                                  patterns=userlist)
         
-        if len(installed) > 0:
-            self.verbose_logger.log(yum.logginglevels.INFO_2,
-                _('Installed Groups:'))
-            for group in installed:
-                if self.verbose_logger.isEnabledFor(yum.logginglevels.DEBUG_3):
-                    self.verbose_logger.log(yum.logginglevels.INFO_2,
-                                            '   %s (%s)', group.ui_name,
-                                            group.groupid)
-                else:
-                    self.verbose_logger.log(yum.logginglevels.INFO_2,
-                                            '   %s', group.ui_name)
-        
-        if len(available) > 0:
-            self.verbose_logger.log(yum.logginglevels.INFO_2,
-                _('Available Groups:'))
-            for group in available:
-                if self.verbose_logger.isEnabledFor(yum.logginglevels.DEBUG_3):
-                    self.verbose_logger.log(yum.logginglevels.INFO_2,
-                                            '   %s (%s)', group.ui_name,
-                                            group.groupid)
-                else:
-                    self.verbose_logger.log(yum.logginglevels.INFO_2,
-                                            '   %s', group.ui_name)
+        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)
+
+        done = False
+        for group in installed:
+            if group.langonly: continue
+            _out_grp(_('Installed Groups:'), group)
+            done = True
+
+        done = False
+        for group in installed:
+            if not group.langonly: continue
+            _out_grp(_('Installed Language Groups:'), group)
+            done = True
+
+        done = False
+        for group in available:
+            if group.langonly: continue
+            _out_grp(_('Available Groups:'), group)
+            done = True
+
+        done = False
+        for group in available:
+            if not group.langonly: continue
+            _out_grp(_('Available Language Groups:'), group)
+            done = True
 
         return 0, [_('Done')]
     
diff --git a/output.py b/output.py
index 983924a..f99ab37 100755
--- a/output.py
+++ b/output.py
@@ -784,6 +784,8 @@ class YumOutput:
             pkg_names2pkgs = self._group_names2aipkgs(group.packages)
         if group.ui_description:
             print _(' Description: %s') % to_unicode(group.ui_description)
+        if group.langonly:
+            print _(' Language: %s') % group.langonly
 
         sections = ((_(' Mandatory Packages:'),   group.mandatory_packages),
                     (_(' Default Packages:'),     group.default_packages),


More information about the Yum-commits mailing list