[Qa-jenkins-scm] [jenkins.debian.net] 01/02: reproducible: common: add link_package() which given a package name/suite/arch returns html
Holger Levsen
holger at moszumanska.debian.org
Sun Apr 12 23:11:38 UTC 2015
This is an automated email from the git hooks/post-receive script.
holger pushed a commit to branch master
in repository jenkins.debian.net.
commit fa32d9912c0e378a83d4a17befe2ecb0863e6713
Author: Mattia Rizzolo <mattia at mapreri.org>
Date: Sun Apr 12 20:35:20 2015 +0200
reproducible: common: add link_package() which given a package name/suite/arch returns html
---
bin/reproducible_common.py | 30 +++++++++++++++++++++++++++++-
1 file changed, 29 insertions(+), 1 deletion(-)
diff --git a/bin/reproducible_common.py b/bin/reproducible_common.py
index 8d3e5a6..fcd554f 100755
--- a/bin/reproducible_common.py
+++ b/bin/reproducible_common.py
@@ -12,14 +12,16 @@
import os
import re
import sys
+import json
import errno
import sqlite3
import logging
import argparse
import datetime
import psycopg2
-from traceback import print_exception
+import html as HTML
from string import Template
+from traceback import print_exception
DEBUG = False
QUIET = False
@@ -327,6 +329,32 @@ def package_has_notes(package):
return False
+def link_package(package, suite, arch, bugs={}):
+ url = RB_PKG_URI + '/' + suite + '/' + arch + '/' + package + '.html'
+ query = 'SELECT n.issues, n.bugs, n.comments ' + \
+ 'FROM notes AS n JOIN sources AS s ON s.id=n.package_id ' + \
+ 'WHERE s.name="{pkg}" AND s.suite="{suite}" ' + \
+ 'AND s.architecture="{arch}"'
+ try:
+ notes = query_db(query.format(pkg=package, suite=suite, arch=arch))[0]
+ except IndexError: # no notes for this package
+ html = '<a href="' + url + '" class="package">' + package + '</a>'
+ else:
+ title = ''
+ for issue in json.loads(notes[0]):
+ title += issue + '\n'
+ for bug in json.loads(notes[1]):
+ title += '#' + str(bug) + '\n'
+ if notes[2]:
+ title += notes[2]
+ title = HTML.escape(title.strip())
+ html = '<a href="' + url + '" class="noted" title="' + title + \
+ '">' + package + '</a>'
+ finally:
+ html += get_trailing_icon(package, bugs)
+ return html
+
+
def join_status_icon(status, package=None, version=None):
table = {'reproducible' : 'weather-clear.png',
'FTBFS': 'weather-storm.png',
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/qa/jenkins.debian.net.git
More information about the Qa-jenkins-scm
mailing list