[Collab-qa-commits] r1579 - udd/web/cgi-bin
Sandro Tosi
morph at alioth.debian.org
Fri Sep 18 19:52:12 UTC 2009
Author: morph
Date: 2009-09-18 19:52:12 +0000 (Fri, 18 Sep 2009)
New Revision: 1579
Added:
udd/web/cgi-bin/source_higher_version_ubuntu_than_debian.py
Log:
add CGI for packages with higher version in Ubuntu
Added: udd/web/cgi-bin/source_higher_version_ubuntu_than_debian.py
===================================================================
--- udd/web/cgi-bin/source_higher_version_ubuntu_than_debian.py (rev 0)
+++ udd/web/cgi-bin/source_higher_version_ubuntu_than_debian.py 2009-09-18 19:52:12 UTC (rev 1579)
@@ -0,0 +1,48 @@
+#!/usr/bin/python
+#
+# Author: Sandro Tosi <morph at debian.org>
+# Date: 2009-09-18
+# Copyright: Copyright (C) 2009 Sandro Tosi <morph at debian.org>
+# License: Public Domain
+#
+# Extract from UDD the source packages both in Debian and Ubuntu with higher
+# version in Ubuntu than in Debian
+
+# module to access PostgreSQL databases
+import psycopg2
+
+# connect to UDD database
+conn = psycopg2.connect(database="udd", port=5441, host="localhost", user="guest")
+
+# prepare a cursor
+cur = conn.cursor()
+
+# this is the query we'll be making
+query = """
+select debian.source, debian.version, ubuntu.version
+ from (select source, max(version) as version from sources group by 1) debian,
+ (select source, max(version) as version from ubuntu_sources group by 1) ubuntu
+ where debian.source = ubuntu.source
+ and debian.version < ubuntu.version
+ order by 1"""
+
+# execute the query
+cur.execute(query)
+
+# retrieve the whole result set
+data = cur.fetchall()
+
+# close cursor and connection
+cur.close()
+conn.close()
+
+# print results
+
+# heading
+print "Source packages with a higher version in Ubuntu than in Debian\n"
+print "%30s %25s %25s" % ('Source Package Name', 'Debian Version', 'Ubuntu Version')
+print "-"*82
+
+# actual data
+for row in data:
+ print "%30s %25s %25s" % row
More information about the Collab-qa-commits
mailing list