[Yum-devel] [patch] SqliteSack.whatProvides/Requires

James Bowes jbowes at redhat.com
Wed Apr 25 17:56:17 UTC 2007


Some comments on the patch:

Florian Festi wrote:
> ------------------------------------------------------------------------
> 
> ? anaconda.prof.0
> Index: rpmUtils/miscutils.py
> ===================================================================
> RCS file: /cvsroot/yum/cvs/yum/rpmUtils/miscutils.py,v
> retrieving revision 1.21
> diff -u -r1.21 miscutils.py
> --- rpmUtils/miscutils.py	7 Apr 2007 18:23:15 -0000	1.21
> +++ rpmUtils/miscutils.py	25 Apr 2007 16:16:29 -0000
> @@ -155,6 +155,68 @@
>              return 1
>      return 0
>  
> +def rangeCompare(reqtuple, provtuple):

Could this share any code with the existing rangeCheck?

> ===================================================================
> RCS file: /cvsroot/yum/cvs/yum/yum/sqlitesack.py,v
> retrieving revision 1.96
> diff -u -r1.96 sqlitesack.py
> --- yum/sqlitesack.py	24 Apr 2007 21:13:06 -0000	1.96
> +++ yum/sqlitesack.py	25 Apr 2007 16:16:30 -0000
> @@ -413,6 +414,62 @@
>                  pkgs.append(ob)
>          
>          return pkgs
> +
> +
> +    def _search(self, prcotype, name, flags, version):
> +        if flags == 0:
> +            flags = None
> +        if type(version) in (str, type(None), unicode):
> +            req = (name, flags, rpmUtils.miscutils.stringToVersion(
> +                version))
> +        elif type(version) in (tuple, list): # would this ever be a list?
> +            req = (name, flags, version)
> +
> +        result = [ ]
> +        
> +        for (rep,cache) in self.primarydb.items():
> +            cur = cache.cursor()
> +            executeSQL(cur, "select packages.*, %s.name as n, %s.flags as f, "
> +                       "%s.epoch as e, %s.version as v, %s.release as r "
> +                       "from %s,packages "
> +                       "where %s.name = ? and "
> +                       "%s.pkgKey=packages.pkgKey" %
> +                       ((prcotype,) * 8),
> +                       (name,))
> +            for x in cur:
> +                val = (x[-5], x[-4], x[-3:])
> +                if rpmUtils.miscutils.rangeCompare(req, val):
> +                    result.append(self.pc(rep,x))

I think there is a missing check for if self._excluded here.

It would also be neat if _search and searchPrco could share some code, too.

-James

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 251 bytes
Desc: OpenPGP digital signature
Url : http://lists.baseurl.org/pipermail/yum-devel/attachments/20070425/48aba58b/attachment.pgp 


More information about the Yum-devel mailing list