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

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Fri Dec 17 11:54:59 CET 2010


Revision: 11983
          http://gar.svn.sourceforge.net/gar/?rev=11983&view=rev
Author:   wahwah
Date:     2010-12-17 10:54:59 +0000 (Fri, 17 Dec 2010)

Log Message:
-----------
pkgdb: show basename libfoo.so.1 support

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-17 09:57:30 UTC (rev 11982)
+++ csw/mgar/gar/v2/lib/python/pkgdb.py	2010-12-17 10:54:59 UTC (rev 11983)
@@ -44,6 +44,7 @@
        %prog show pkg <pkgname> [ ... ]
        %prog gen-html <md5sum> [ ... ]
        %prog pkg search <catalogname>
+       %prog show basename [options] <filename>
 
 
 Examples:
@@ -294,6 +295,15 @@
                     help="Turn on debugging messages")
   parser.add_option("-t", "--pkg-review-template", dest="pkg_review_template",
                     help="A Cheetah template used for package review reports.")
+  parser.add_option("-r", "--os-release", dest="osrel",
+                    default="SunOS5.9",
+                    help="E.g. SunOS5.9")
+  parser.add_option("-a", "--arch", dest="arch",
+                    default="sparc",
+                    help="'i386' or 'sparc'")
+  parser.add_option("-c", "--catalog-release", dest="catrel",
+                    default="current",
+                    help="E.g. current, unstable, testing, stable")
   options, args = parser.parse_args()
   if options.debug:
     logging.basicConfig(level=logging.DEBUG)
@@ -429,6 +439,13 @@
     ci = CatalogImporter(debug=options.debug)
     catrel, base_dir = args
     ci.SyncFromCatalogTree(catrel, base_dir)
+  elif (command, subcommand) == ('show', 'basename'):
+    db_catalog = checkpkg_lib.Catalog()
+    for arg in args:
+      pkgs_by_path = db_catalog.GetPathsAndPkgnamesByBasename(
+          arg, options.osrel, options.arch, options.catrel)
+      for file_path in pkgs_by_path:
+        print os.path.join(file_path, arg), ", ".join(pkgs_by_path[file_path])
   else:
     raise UsageError("Command unrecognized: %s" % command)
 


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