[Blends-commit] [SCM] website branch, master, updated. b15eaf3fb4badb12446ff68cc4f2b2e942cfddf6

Petter Reinholdtsen pere at hungry.com
Sat Feb 6 20:26:26 UTC 2016


The following commit has been merged in the master branch:
commit b15eaf3fb4badb12446ff68cc4f2b2e942cfddf6
Author: Petter Reinholdtsen <pere at hungry.com>
Date:   Sat Feb 6 21:26:19 2016 +0100

    Add script using debtags and screenshots to create web page.

diff --git a/webtools/generate-debtags-field-list b/webtools/generate-debtags-field-list
new file mode 100755
index 0000000..37e2c69
--- /dev/null
+++ b/webtools/generate-debtags-field-list
@@ -0,0 +1,61 @@
+#!/usr/bin/python
+#
+# Generate web page listing screen shots of all packages with a given tag.
+# Migrated from http://debian-edu.alioth.debian.org/cgi-bin/edu-debtags.cgi
+
+from psycopg2 import connect
+from re import split, sub
+
+keytag = "use::learning"
+
+query = """
+SELECT package, tag from debtags
+  WHERE tag like 'field::%%'
+    AND package IN (SELECT package FROM debtags
+                      WHERE tag = '%s'
+                        AND package IN (SELECT package FROM debtags
+                                         WHERE tag = 'role::program' and
+                                               package in (select package from debtags
+                                                           where tag = 'interface::x11')))
+  ORDER BY tag, package;
+""" % keytag
+
+conn = connect(database='udd', port=5452, host='public-udd-mirror.xvm.mit.edu',
+               user='public-udd-mirror', password='public-udd-mirror')
+cur = conn.cursor()
+cur.execute(query)
+rows = cur.fetchall()
+cur.close()
+conn.close()
+
+print """
+<html>
+<head>
+<title>%s debtagged software</title>
+</head>
+<body>
+<h1>%s debtagged software</h1>
+
+<p>Packages tagged %s, role::program and interface::x11.
+Please <a href="http://debtags.debian.net/">add debtags</a> if a program
+are missing in the list, and <a href="http://screenshots.debian.net/">add
+screenshots</a> if no-one did so already.</p>
+""" % (keytag, keytag, keytag)
+
+lastfieldtag = None
+for row in rows:
+    (package, fieldtag) = row
+    if lastfieldtag != fieldtag:
+        if lastfieldtag is not None:
+            print "</p>"
+        print "<strong>%s</strong>" % fieldtag
+        print "<p>"
+        lastfieldtag = fieldtag
+    print "<a href=\"http://packages.debian.org/search?searchon=names&exact=1&suite=all&section=all&keywords=%s\"><img src=\"http://screenshots.debian.net/thumbnail/%s\"></a>" % (package, package)
+if lastfieldtag is not None:
+    print "</p>"
+    
+print """
+</body>
+</html>
+"""

-- 
Static and dynamic websites for Debian Pure Blends



More information about the Blends-commit mailing list