[csw-devel] SF.net SVN: gar:[17292] csw/mgar/gar/v2/lib/web/pkgdb_web.py
wahwah at users.sourceforge.net
wahwah at users.sourceforge.net
Sun Mar 4 15:56:21 CET 2012
Revision: 17292
http://gar.svn.sourceforge.net/gar/?rev=17292&view=rev
Author: wahwah
Date: 2012-03-04 14:56:21 +0000 (Sun, 04 Mar 2012)
Log Message:
-----------
pkgdb: Resolve a basename to packages
The same query that checkpkg does when looking for shared libraries.
Modified Paths:
--------------
csw/mgar/gar/v2/lib/web/pkgdb_web.py
Modified: csw/mgar/gar/v2/lib/web/pkgdb_web.py
===================================================================
--- csw/mgar/gar/v2/lib/web/pkgdb_web.py 2012-03-04 14:55:52 UTC (rev 17291)
+++ csw/mgar/gar/v2/lib/web/pkgdb_web.py 2012-03-04 14:56:21 UTC (rev 17292)
@@ -38,6 +38,8 @@
r'/rest/catalogs/([^/]+)/(sparc|i386)/(SunOS[^/]+)/', 'Catalogs',
r'/rest/catalogs/([^/]+)/(sparc|i386)/(SunOS[^/]+)/pkgname-by-filename',
'PkgnameByFilename',
+ r'/rest/catalogs/([^/]+)/(sparc|i386)/(SunOS[^/]+)/pkgnames-and-paths-by-basename',
+ 'PkgnamesAndPathsByBasename',
# Query by catalog release, arch, OS release and catalogname
r'/rest/catalogs/([^/]+)/(sparc|i386)/(SunOS[^/]+)/catalognames/([^/]+)/', 'Srv4ByCatAndCatalogname',
r'/rest/catalogs/([^/]+)/(sparc|i386)/(SunOS[^/]+)/pkgnames/([^/]+)/', 'Srv4ByCatAndPkgname',
@@ -308,6 +310,28 @@
raise web.notfound()
+class PkgnamesAndPathsByBasename(object):
+ def GET(self, catrel, arch, osrel):
+ ConnectToDatabase()
+ user_data = web.input()
+ basename = user_data.basename
+ send_filename = (
+ '%s-%s-%s-%s-packages.txt'
+ % (catrel, arch, osrel, basename.replace('/', '-')))
+ db_catalog = checkpkg_lib.Catalog()
+ try:
+ data = db_catalog.GetPathsAndPkgnamesByBasename(
+ basename, osrel, arch, catrel)
+ web.header(
+ 'Content-type',
+ 'application/x-vnd.opencsw.pkg;type=pkgname-list')
+ web.header('Content-Disposition',
+ 'attachment; filename=%s' % send_filename)
+ return json.dumps(data)
+ except sqlobject.main.SQLObjectNotFound, e:
+ raise web.notfound()
+
+
class RestSrv4Detail(object):
def GET(self, 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