From 5308658941a56579d5e41af55ac993b6132c01d6 Mon Sep 17 00:00:00 2001 From: Mattia Rizzolo Date: Sat, 10 Jan 2015 02:35:16 +0100 Subject: reproducible: common.py: add join_status_icon() --- bin/reproducible_common.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'bin/reproducible_common.py') diff --git a/bin/reproducible_common.py b/bin/reproducible_common.py index d2ab8047..205203fd 100755 --- a/bin/reproducible_common.py +++ b/bin/reproducible_common.py @@ -202,6 +202,30 @@ def query_db(query): cursor.execute(query) return cursor.fetchall() +def join_status_icon(status, package=None, version=None): + table = {'reproducible' : 'weather-clear.png', + 'FTBFS': 'weather-storm.png', + 'FTBR' : 'weather-showers.png', + 'FTBR_with_buildinfo': 'weather-showers-scattered.png', + '404': 'weather-severe-alert.png', + 'not for us': 'weather-few-clouds-night.png', + 'not_for_us': 'weather-few-clouds-night.png', + 'blacklisted': 'error.png'} + if status == 'unreproducible': + if os.access(BUILDINFO_PATH + '/' + str(package) + '_' + str(version) + '_amd64.buildinfo', os.R_OK): + status = 'FTBR_with_buildinfo' + else: + status = 'FTBR' + log.debug('Linking status ⇔ icon. package: ' + str(package) + ' @ ' + + str(version) + ' status: ' + status) + try: + return (status, table[status]) + except KeyError: + log.error('Status of package ' + package + ' (' + status + + ') not recognized') + return (status, '') + + # do the db querying conn = init_conn() amount = int(query_db('SELECT count(name) FROM sources')[0][0]) -- cgit v1.2.3-54-g00ecf