summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattia Rizzolo <mattia@mapreri.org>2015-02-16 23:17:59 +0100
committerHolger Levsen <holger@layer-acht.org>2015-02-18 12:08:57 +0100
commit679885d7b4c5e0c60b9ae3f09ea1ef6fc654111b (patch)
treeb305ae550faad16a1e98236f115b20996696ccef
parent7b8a1d4b706ee25c53da720cb85152f3d20cadbf (diff)
downloadjenkins.debian.net-679885d7b4c5e0c60b9ae3f09ea1ef6fc654111b.tar.xz
reproducible: html_indexes: catch ZeroDivisionError while calculating percentage
-rwxr-xr-xbin/reproducible_html_indexes.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/bin/reproducible_html_indexes.py b/bin/reproducible_html_indexes.py
index 9847781a..a0f18fab 100755
--- a/bin/reproducible_html_indexes.py
+++ b/bin/reproducible_html_indexes.py
@@ -240,8 +240,13 @@ pages = {
def build_leading_text_section(section, rows):
html = '<p>\n' + tab
total = len(rows)
- percent = round(((total/count_total)*100), 1) # count_total is
- try: # defined in common
+ try:
+ percent = round(((total/count_total)*100), 1) # count_total is
+ except ZeroDivisionError: # defined in common
+ log.error('Looks like there are either no tested package or no ' + \
+ 'packages available at all. Maybe it\'s a new database?')
+ percent = 0.0
+ try:
html += '<a href="' + section['icon_link'] + '" target="_parent">'
no_icon_link = False
except KeyError: