[csw-devel] SF.net SVN: gar:[12242] csw/mgar/gar/v2/lib/python/pkgdb.py

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Fri Jan 7 23:00:00 CET 2011


Revision: 12242
          http://gar.svn.sourceforge.net/gar/?rev=12242&view=rev
Author:   wahwah
Date:     2011-01-07 22:00:00 +0000 (Fri, 07 Jan 2011)

Log Message:
-----------
pkgdb: pkg search shows packages from catalogs

When searching for packages using 'pkgdb pkg search', show packages registered
in catalogs only.  By default it's SunOS5.9, sparc, current.

Modified Paths:
--------------
    csw/mgar/gar/v2/lib/python/pkgdb.py

Modified: csw/mgar/gar/v2/lib/python/pkgdb.py
===================================================================
--- csw/mgar/gar/v2/lib/python/pkgdb.py	2011-01-07 21:56:19 UTC (rev 12241)
+++ csw/mgar/gar/v2/lib/python/pkgdb.py	2011-01-07 22:00:00 UTC (rev 12242)
@@ -459,14 +459,26 @@
     importer.ImportFromFile(infile_fd, show_progress=True)
   elif (command, subcommand) == ('pkg', 'search'):
     logging.debug("Searching for %s", args)
+    sqo_osrel = m.OsRelease.selectBy(short_name=options.osrel).getOne()
+    sqo_arch = m.Architecture.selectBy(name=options.arch).getOne()
+    sqo_catrel = m.CatalogRelease.selectBy(name=options.catrel).getOne()
     if len(args) < 1:
       logging.fatal("Wrong number of arguments: %s", len(args))
       raise SystemExit
     for catalogname in args:
+      join = [
+          sqlbuilder.INNERJOINOn(None,
+            m.Srv4FileInCatalog,
+            m.Srv4FileInCatalog.q.srv4file==m.Srv4FileStats.q.id),
+      ]
       res = m.Srv4FileStats.select(
           sqlobject.AND(
+            m.Srv4FileInCatalog.q.osrel==sqo_osrel,
+            m.Srv4FileInCatalog.q.arch==sqo_arch,
+            m.Srv4FileInCatalog.q.catrel==sqo_catrel,
             m.Srv4FileStats.q.catalogname.contains(catalogname),
-            m.Srv4FileStats.q.use_to_generate_catalogs==True)
+            m.Srv4FileStats.q.use_to_generate_catalogs==True),
+            join=join,
           ).orderBy("catalogname")
       for sqo_srv4 in res:
         print "%s %s" % (sqo_srv4.basename, sqo_srv4.md5_sum)


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.


More information about the devel mailing list