diff options
author | Mattia Rizzolo <mattia@mapreri.org> | 2015-01-10 02:35:16 +0100 |
---|---|---|
committer | Holger Levsen <holger@layer-acht.org> | 2015-01-11 00:39:20 +0000 |
commit | 5308658941a56579d5e41af55ac993b6132c01d6 (patch) | |
tree | 43299e0d7973f57212d176ad0772a6fe857c70e5 | |
parent | c16305b50186dae520a2cf08912d9446cc917763 (diff) | |
download | jenkins.debian.net-5308658941a56579d5e41af55ac993b6132c01d6.tar.xz |
reproducible: common.py: add join_status_icon()
-rwxr-xr-x | bin/reproducible_common.py | 24 |
1 files changed, 24 insertions, 0 deletions
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]) |