[Yum-devel] [PATCH] Fix SQLite names-only simplePkgList.

Ville Skyttä ville.skytta at iki.fi
Fri Oct 23 16:08:12 UTC 2009


On Friday 23 October 2009, James Antill wrote:
> On Fri, 2009-10-23 at 16:57 +0300, Ville Skyttä wrote:
> > ---
> >  yum/sqlitesack.py |    3 +++
> >  1 files changed, 3 insertions(+), 0 deletions(-)
> >
> > diff --git a/yum/sqlitesack.py b/yum/sqlitesack.py
> > index 332f3bb..bb2d856 100644
> > --- a/yum/sqlitesack.py
> > +++ b/yum/sqlitesack.py
> > @@ -1616,6 +1616,9 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack):
> >          # Haven't loaded everything, so _just_ get the pkgtups...
> >          data = self._setupPkgObjList(repoid, patterns, ignore_case)
> >          (need_full, patterns, fields, names) = data
> > +        if names:
> > +            return self.searchNames(patterns)
> > +
> >          for (repo, x) in self._yieldSQLDataList(repoid, patterns,
> > fields, ignore_case):
> >              # NOTE: Can't unexclude things...
> 
>  This can't work as simplePkgList() returns a list of pkgtup, not a list
> of package objects. Now, in theory, you could do:
> 
> 
> +        if names:
> +            return [pkg.pkgtup for pkg in self.searchNames(patterns)]
> +

Ok, curiously both of the above approaches work for my test case, see below.

> ...except this isn't an obvious win, because creating package objects
> are one of the most expensive things to do ... and to balance that the
> win we get from using searchNames() is if we can
> call ._packagesByName(). And we already check for pkgobjlist, so the
> only real gain is with ._pkgnames_loaded.

FWIW, I'm not looking for any other win with this patch than to get "repoquery 
--pkgnarrow=extras" to not traceback.  Currently I get (both yum and yum-utils 
at their bleeding edge, but happens with latest F-11 released packages too):

$ ./repoquery.py --pkgnarrow=extras python3
Traceback (most recent call last):
  File "./repoquery.py", line 857, in <module>
    main(sys.argv)
  File "./repoquery.py", line 853, in main
    repoq.runQuery(regexs)
  File "./repoquery.py", line 495, in runQuery
    pkgs = self.matchPkgs(items)
  File "./repoquery.py", line 475, in matchPkgs
    pkgs = self.returnPkgList(patterns=items)
  File "./repoquery.py", line 433, in returnPkgList
    ygh = self.doPackageLists(what, **kwargs)
  File "/home/scop/cvs/yum/yum/__init__.py", line 1839, in doPackageLists
    ignore_case=ic)
  File "/home/scop/cvs/yum/yum/packageSack.py", line 525, in simplePkgList
    patterns, ignore_case)
  File "/home/scop/cvs/yum/yum/packageSack.py", line 575, in 
_computeAggregateListResult
    sackResult = apply(method, args)
  File "/home/scop/cvs/yum/yum/sqlitesack.py", line 1620, in simplePkgList
    ignore_case):
  File "/home/scop/cvs/yum/yum/sqlitesack.py", line 1527, in _yieldSQLDataList
    for (pattern, rest) in patterns:
ValueError: too many values to unpack


More information about the Yum-devel mailing list