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

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Mon Dec 20 12:59:44 CET 2010


Revision: 12038
          http://gar.svn.sourceforge.net/gar/?rev=12038&view=rev
Author:   wahwah
Date:     2010-12-20 11:59:44 +0000 (Mon, 20 Dec 2010)

Log Message:
-----------
pkgdb: Add 'show files' support

It lists all files in a given srv4 file, identified by an md5 sum.

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-20 11:59:13 UTC (rev 12037)
+++ csw/mgar/gar/v2/lib/python/pkgdb.py	2010-12-20 11:59:44 UTC (rev 12038)
@@ -47,6 +47,7 @@
        %prog gen-html <md5sum> [ ... ]
        %prog pkg search <catalogname>
        %prog show basename [options] <filename>
+       %prog show files <md5-sum>
 
 
 Examples:
@@ -466,6 +467,19 @@
     )
     for obj in res:
       print obj.basename, obj.md5_sum
+  elif (command, subcommand) == ('show', 'files'):
+    md5_sum = args[0]
+    join = [
+        sqlbuilder.INNERJOINOn(None,
+          m.Srv4FileStats,
+          m.CswFile.q.srv4_file==m.Srv4FileStats.q.id),
+    ]
+    res = m.CswFile.select(
+        m.Srv4FileStats.q.md5_sum==md5_sum,
+        join=join,
+    )
+    for obj in res:
+      print os.path.join(obj.path, obj.basename)
   elif (command, subcommand) == ('show', 'basename'):
     db_catalog = checkpkg_lib.Catalog()
     for arg in args:


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