Skip to content
Commits on Source (6)
......@@ -9,6 +9,8 @@ import json
import os.path
import functools
import html as HTML
from enum import Enum
from collections import namedtuple
from .const import (
ARCHS,
......@@ -39,6 +41,28 @@ def lazyproperty(fn):
return _lazy
class Status(Enum):
"""
Values of the tuple:
name: computer-friendly name yet readable by humans. Used in paths, db, …
spokenstatus: to be used in human-oriented strings
icon: file name of the icon representing the status
"""
_status = namedtuple('Status', 'name, spokenstatus, icon')
REPRODUCIBLE = _status('reproducible', 'reproducible', 'weather-clear.png')
FTBFS = _status('FTBFS', 'FTBFS', 'weather-storm.png')
FTBR = _status('FTBR', 'unreproducible', 'weather-showers-scattered.png')
E404 = _status('E404', '404', 'weather-severe-alert.png')
DEPWAIT = _status('depwait', 'depwait', 'weather-snow.png')
NFU = _status('NFU', 'not for us', 'weather-few-clouds-night.png')
UNTESTED = _status('untested', 'untested', 'weather-clear-night.png')
BLACKLISTED = _status('blacklisted', 'blacklisted', 'error.png')
@classmethod
def get(cls, name):
return cls[name.upper()]
class Bug:
def __init__(self, bug):
self.bug = bug
......
This diff is collapsed.
......@@ -11,9 +11,9 @@
from string import Template
from sqlalchemy import select, func, cast, Integer, and_, bindparam
from rblib import query_db, db_table, get_status_icon
from rblib import query_db, db_table
from rblib.confparse import log
from rblib.models import Package
from rblib.models import Package, Status
from rblib.utils import convert_into_hms_string
from rblib.html import tab, create_main_navigation, write_html_page
from reproducible_html_indexes import build_leading_text_section
......@@ -29,12 +29,12 @@ sources = db_table('sources')
schedule = db_table('schedule')
stats_build = db_table('stats_build')
def convert_into_status_html(status):
if status != 'None':
status, icon, spokenstatus = get_status_icon(status)
return status + ' <img src="/static/' + icon +'" alt="' + status + '" title="' + status + '"/>'
else:
def convert_into_status_html(statusname):
if statusname == 'None':
return ''
status = Status.get(statusname)
return '{n} <img src="/static/{icon}" alt="{n}" title="{n}" />'.format(
n=status.value.name, icon=status.value.icon)
def generate_schedule(arch):
......
......@@ -31,8 +31,8 @@ from rblib.const import (
NOTES_PATH, NOTES_URI,
DBDTXT_PATH, DBDTXT_URI,
DBD_PATH, DBD_URI,
DIFFS_PATH, DIFFS_URI,
LOGS_PATH, LOGS_URI,
# DIFFS_PATH, DIFFS_URI,
# LOGS_PATH, LOGS_URI,
)
......@@ -291,7 +291,7 @@ def gen_history_page(package, arch=None):
context = {}
try:
head = package.history[0]
package.history[0] # we don't care about the actual value, it jst need to exist
except IndexError:
context['arch'] = arch
else:
......
......@@ -19,10 +19,10 @@ from datetime import datetime, timedelta
from subprocess import check_call
from collections import OrderedDict
from rblib import query_db, get_status_icon
from rblib import query_db
from rblib.bugs import Bugs
from rblib.confparse import log
from rblib.models import Package
from rblib.models import Package, Status
from rblib.utils import create_temp_file
from rblib.html import create_main_navigation, write_html_page, gen_status_link_icon
from rblib.const import (
......@@ -244,12 +244,14 @@ def create_pkgset_page_and_graphs(suite, arch, stats, pkgset_name):
for (status, cutename, description) in status_cutename_descriptions:
icon_html = ''
if status == 'rest':
for s in ['depwait', 'blacklisted', 'NFU', 'E404']:
s, icon, spokenstatus = get_status_icon(s)
icon_html += gen_status_link_icon(s, None, icon, suite, arch)
for x in ['depwait', 'blacklisted', 'NFU', 'E404']:
s = Status.get(x)
icon_html += gen_status_link_icon(
s.value.name, None, s.value.icon, suite, arch)
else:
status, icon, spokenstatus = get_status_icon(status)
icon_html = gen_status_link_icon(status, None, icon, suite, arch)
s = Status.get(status)
icon_html += gen_status_link_icon(
s.value.name, None, s.value.icon, suite, arch)
details_context = {
'icon_html': icon_html,
......