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

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Wed Dec 15 16:25:20 CET 2010


Revision: 11959
          http://gar.svn.sourceforge.net/gar/?rev=11959&view=rev
Author:   wahwah
Date:     2010-12-15 15:25:20 +0000 (Wed, 15 Dec 2010)

Log Message:
-----------
pkgdb: Allow to search for multiple catalog names

Extend 'pkgdb pkg search' format to allow multiple arguments.

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	2010-12-15 14:58:11 UTC (rev 11958)
+++ csw/mgar/gar/v2/lib/python/pkgdb.py	2010-12-15 15:25:20 UTC (rev 11959)
@@ -406,17 +406,17 @@
     importer.ImportFromFile(infile_fd, show_progress=True)
   elif (command, subcommand) == ('pkg', 'search'):
     logging.debug("Searching for %s", args)
-    if len(args) != 1:
+    if len(args) < 1:
       logging.fatal("Wrong number of arguments: %s", len(args))
       raise SystemExit
-    catalogname = args[0]
-    res = m.Srv4FileStats.select(
-        sqlobject.AND(
-          m.Srv4FileStats.q.catalogname.contains(catalogname),
-          m.Srv4FileStats.q.use_to_generate_catalogs==True)
-        ).orderBy("catalogname")
-    for sqo_srv4 in res:
-      print "%s %s" % (sqo_srv4.basename, sqo_srv4.md5_sum)
+    for catalogname in args:
+      res = m.Srv4FileStats.select(
+          sqlobject.AND(
+            m.Srv4FileStats.q.catalogname.contains(catalogname),
+            m.Srv4FileStats.q.use_to_generate_catalogs==True)
+          ).orderBy("catalogname")
+      for sqo_srv4 in res:
+        print "%s %s" % (sqo_srv4.basename, sqo_srv4.md5_sum)
   elif command == 'sync-cat-from-file':
     if len(args) != 4:
       raise UsageError("Wrong number of arguments, see usage.")


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