[Yum-devel] [PATCH 1/2] do globs on provides in 'yum install'. BZ 770137.

Zdenek Pavlas zpavlas at redhat.com
Wed Jan 4 10:43:03 UTC 2012


> As the comment says, searchAll() is cracky in more than one way...

Got rid of that.

> ...aka. searchProvides(). Both are implemented in rpmsack too,
> *sigh* ... I wonder if '*.desktop' will give different answers.

yum install '*.desktop' didn't work at all, with searchProvides()
it does (and does not touch rpmsack until actually depsolving).

commit 4379a599f837638a1b0d91bbda861265f60dc4c9
Author: Zdeněk Pavlas <zpavlas at redhat.com>
Date:   Mon Jan 2 16:32:44 2012 +0100

    do globs on provides in 'yum install'. BZ 770137.
    
    - use searchProvides() as it support globs
    - remove some dead code, reduce branching
    - remove the last user of searchAll()

diff --git a/yum/__init__.py b/yum/__init__.py
index eee1461..9584de0 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -2985,7 +2985,7 @@ class YumBase(depsolve.Depsolve):
                 where = self.returnPackagesByDep(arg)
             else:
                 usedDepString = False
-                where = self.pkgSack.searchAll(arg, False)
+                where = self.pkgSack.searchProvides(arg)
             self.verbose_logger.log(logginglevels.DEBUG_1,
                P_('Searching %d package', 'Searching %d packages', len(where)), len(where))
             
@@ -3851,20 +3851,12 @@ class YumBase(depsolve.Depsolve):
                     self.verbose_logger.debug(_('Checking for virtual provide or file-provide for %s'), 
                         arg)
 
-                    try:
-                        mypkgs = self.returnPackagesByDep(arg)
-                    except yum.Errors.YumBaseError, e:
-                        self.logger.critical(_('No Match for argument: %s') % to_unicode(arg))
-                    else:
-                        # install MTA* == fail, because provides don't do globs
-                        # install /usr/kerberos/bin/* == success (and we want
-                        #                                all of the pkgs)
-                        if mypkgs and not misc.re_glob(arg):
-                            mypkgs = self.bestPackagesFromList(mypkgs,
-                                                               single_name=True)
-                        if mypkgs:
-                            pkgs.extend(mypkgs)
-                        
+                    mypkgs = self.pkgSack.searchProvides(arg)
+                    if not misc.re_glob(arg):
+                        # install /usr/kerberos/bin/* == want all pkgs
+                        mypkgs = self.bestPackagesFromList(mypkgs, single_name=True)
+                    pkgs.extend(mypkgs)
+
             else:
                 nevra_dict = self._nevra_kwarg_parse(kwargs)
 


More information about the Yum-devel mailing list