[Collab-qa-commits] r1707 - udd/web/cgi-bin

Lucas Nussbaum lucas at alioth.debian.org
Mon Mar 1 21:22:29 UTC 2010


Author: lucas
Date: 2010-03-01 21:22:25 +0000 (Mon, 01 Mar 2010)
New Revision: 1707

Added:
   udd/web/cgi-bin/pts-check.cgi
Log:
add pts-check.cgi

Added: udd/web/cgi-bin/pts-check.cgi
===================================================================
--- udd/web/cgi-bin/pts-check.cgi	                        (rev 0)
+++ udd/web/cgi-bin/pts-check.cgi	2010-03-01 21:22:25 UTC (rev 1707)
@@ -0,0 +1,61 @@
+#!/usr/bin/ruby -w
+require 'dbi'
+require 'cgi'
+
+puts "Content-type: text/html\n\n"
+
+puts <<-EOF
+<html>
+<html><head>
+<title>PTS subscription check</title>
+</head><body>
+EOF
+
+cgi = CGI::new
+
+if cgi.has_key?('email')
+allpkgs = cgi.has_key?('allpkgs')
+dbh = DBI::connect('DBI:Pg:dbname=udd;port=5441;host=localhost', 'guest')
+maint = dbh.select_all("select source from sources where distribution='debian' and release='sid' and maintainer_email=#{dbh.quote(cgi['email'])}").map { |e| e[0] }.uniq
+upload = dbh.select_all("select source from uploaders where distribution='debian' and release='sid' and email=#{dbh.quote(cgi['email'])}").map { |e| e[0] }.uniq
+pts = dbh.select_all("select source from pts_public where md5(lower(#{dbh.quote(cgi['email'])}))=email").map { |e| e[0] }
+puts "<h1>PTS subscriptions check for #{cgi['email']}</h1>"
+if (maint - pts).length > 0
+puts "Packages you maintain but are not subscribed to:<br/><ul>"
+(maint - pts).sort.each { |s| puts "<li><a href=\"http://packages.qa.debian.org/#{s}\">#{s}</a></li>" }
+puts "</ul>"
+end
+if (upload - pts).length > 0
+puts "Packages you are uploader for but are not subscribed to:<br/><ul>"
+(upload - pts).sort.each { |s| puts "<li><a href=\"http://packages.qa.debian.org/#{s}\">#{s}</a></li>" }
+puts "</ul>"
+end
+if (pts - (maint+upload)).length > 0
+puts "Packages you don't maintain or upload, and are subscribed to (that could be perfectly fine of course):<br/><ul>"
+(pts - (maint+upload)).sort.each { |s| puts "<li><a href=\"http://packages.qa.debian.org/#{s}\">#{s}</a></li>" }
+end
+puts "</ul>"
+
+if allpkgs
+puts "Packages you maintain and are subscribed to:<br/><ul>"
+(maint & pts).sort.each { |s| puts "<li><a href=\"http://packages.qa.debian.org/#{s}\">#{s}</a></li>" }
+puts "</ul>"
+puts "Packages you are uploader for and are subscribed to:<br/><ul>"
+(upload & pts).sort.each { |s| puts "<li><a href=\"http://packages.qa.debian.org/#{s}\">#{s}</a></li>" }
+puts "</ul>"
+end
+
+else
+puts <<-EOF
+
+<form method="get" ACTION="pts-check.cgi">
+Email to check: <input type="text" name="email" value="email" size="30"/>
+<input type="submit"/><br/>
+<input type="checkbox" name="allpkgs" value="1"/> Include information about packages you maintain or upload, and are subscribed to.
+</form>
+EOF
+end
+puts <<-EOF
+</body>
+</html>
+EOF


Property changes on: udd/web/cgi-bin/pts-check.cgi
___________________________________________________________________
Added: svn:executable
   + *




More information about the Collab-qa-commits mailing list