[yum-commits] 2 commits - repoquery.py yum-utils.spec

skvidal at osuosl.org skvidal at osuosl.org
Tue Oct 26 21:28:06 UTC 2010


 repoquery.py   |   38 ++++++++++++++++++++++++--------------
 yum-utils.spec |    3 ++-
 2 files changed, 26 insertions(+), 15 deletions(-)

New commits:
commit 1d4edaf2d9e2b9969a3f40925ee438b14a07e09d
Author: Seth Vidal <skvidal at fedoraproject.org>
Date:   Tue Oct 26 17:27:43 2010 -0400

    add 3.2.29 requirement for repoquery --search

diff --git a/yum-utils.spec b/yum-utils.spec
index ddb346d..0a74242 100644
--- a/yum-utils.spec
+++ b/yum-utils.spec
@@ -8,9 +8,10 @@ Source: http://yum.baseurl.org/download/yum-utils/%{name}-%{version}.tar.gz
 URL: http://yum.baseurl.org/download/yum-utils/
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildArch: noarch
-Requires: python >= 2.4 , yum >= 3.2.27
+Requires: python >= 2.4 , yum >= 3.2.29
 BuildRequires: python >= 2.4
 
+
 %description
 yum-utils is a collection of utilities and examples for the yum package
 manager. It includes utilities by different authors that make yum easier and
commit 8e27e5e8e85dd785159800480f29edfc3a888215
Author: Seth Vidal <skvidal at fedoraproject.org>
Date:   Tue Oct 26 17:26:38 2010 -0400

    - fix repoquery for the bizarre empty results and the traceback on bad input
    - also needs a fix for yum 3.2.29 in the searchGenerator :(

diff --git a/repoquery.py b/repoquery.py
index d57602b..f5490e1 100755
--- a/repoquery.py
+++ b/repoquery.py
@@ -757,18 +757,21 @@ class YumBaseQuery(yum.YumBase):
         pkgs = []
         fields = self.options.searchfields
         if not fields:
-            fields = ['name', 'summary', 'description', 'url']
-        
-        matching = self.searchGenerator(fields, terms, keys=True)
+            fields = ['name', 'summary']
+        try:
+            matching = self.searchGenerator(fields, terms, searchtags=False)
         
-        for (po, keys, matched_value) in matching:
-            if isinstance(po, yum.packages.YumInstalledPackage):
-                if self.options.pkgnarrow not in ('all', 'installed', 'extras'):
-                    continue
-            if isinstance(po, yum.sqlitesack.YumAvailablePackageSqlite):
-                if self.options.pkgnarrow not in ('all', 'available', 'repos'):
-                    continue
-            pkgs.append(po)
+            for (po, matched_value) in matching:
+                if isinstance(po, yum.packages.YumInstalledPackage):
+                    if self.options.pkgnarrow not in ('all', 'installed', 'extras'):
+                        continue
+                if isinstance(po, yum.sqlitesack.YumAvailablePackageSqlite):
+                    if self.options.pkgnarrow not in ('all', 'available', 'repos'):
+                        continue
+                pkgs.append(po)
+
+        except (yum.Errors.RepoError,ValueError), e:
+            raise queryError("Could not run search: %s" % e)
         
         return self.queryPkgFactory(pkgs)
         
@@ -784,8 +787,12 @@ class YumBaseQuery(yum.YumBase):
                     print to_unicode('  @%s' % group)
             pkgs = []
         elif self.options.search:
-            pkgs = self.yum_search(items)
-
+            plain_pkgs = False
+            pkgs = []
+            try:
+                pkgs = self.yum_search(items)
+            except queryError, e:
+                self.logger.error(e)
         else:
             if self.options.srpm:
                 pkgs = self.matchSrcPkgs(items)
@@ -1030,7 +1037,7 @@ def main(args):
                       dest="tree_what_requires",
                       help="list recursive what requires, in tree form")
     parser.add_option("--search", action="store_true",
-                      dest="search",
+                      dest="search", default=False,
                       help="Use yum's search to return pkgs")
     parser.add_option("--search-fields", action="append", dest="searchfields",
                       default=[],
@@ -1125,6 +1132,9 @@ def main(args):
         archlist = getArchList()
         archlist.append('src')
 
+    if opts.searchfields:
+        opts.search = True
+        
     repoq = YumBaseQuery(pkgops, sackops, opts)
 
     # silence initialisation junk from modules etc unless verbose mode


More information about the Yum-commits mailing list