summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorValerie R Young <spectranaut@riseup.net>2016-07-25 15:53:25 -0400
committerHolger Levsen <holger@layer-acht.org>2016-07-26 06:59:31 -0400
commitc343ba988c2b2cd3dbdedede2f615a682e486aea (patch)
tree4127a0df046aef7e6f9249100fc4c048cd3b685f
parentf1237c7a9b89768a4ce005ede78d25e8661e4625 (diff)
downloadjenkins.debian.net-c343ba988c2b2cd3dbdedede2f615a682e486aea.tar.xz
reproducible debian: add versioning to css style sheets
Signed-off-by: Holger Levsen <holger@layer-acht.org>
-rwxr-xr-xbin/reproducible_common.py11
-rw-r--r--bin/templates/basic_page.mustache2
2 files changed, 11 insertions, 2 deletions
diff --git a/bin/reproducible_common.py b/bin/reproducible_common.py
index 1c2df8ea..dd67f467 100755
--- a/bin/reproducible_common.py
+++ b/bin/reproducible_common.py
@@ -17,8 +17,9 @@ import csv
import json
import errno
import atexit
-import sqlite3
+import hashlib
import logging
+import sqlite3
import argparse
import pystache
import psycopg2
@@ -54,6 +55,7 @@ TEMP_PATH="/tmp/reproducible"
REPRODUCIBLE_JSON = BASE + '/reproducible.json'
REPRODUCIBLE_TRACKER_JSON = BASE + '/reproducible-tracker.json'
REPRODUCIBLE_DB = '/var/lib/jenkins/reproducible.db'
+REPRODUCIBLE_STYLES = BASE +'/static/style.css'
DEBIAN_URI = '/debian'
DBD_URI = '/debian/dbd'
@@ -145,6 +147,12 @@ if args.ignore_missing_files:
tab = ' '
+# take a SHA1 of the css page for style version
+hasher = hashlib.sha1()
+with open(REPRODUCIBLE_STYLES, 'rb') as f:
+ hasher.update(f.read())
+REPRODUCIBLE_STYLE_SHA1 = hasher.hexdigest()
+
# Templates used for creating package pages
renderer = pystache.Renderer()
status_icon_link_template = renderer.load_template(
@@ -316,6 +324,7 @@ def write_html_page(title, body, destfile, no_header=False, style_note=False,
'navigation_html': left_nav_html,
'main_header': title if not no_header else "",
'main_html': body,
+ 'style_dot_css_sha1sum': REPRODUCIBLE_STYLE_SHA1,
}
html = renderer.render(basic_page_template, context)
diff --git a/bin/templates/basic_page.mustache b/bin/templates/basic_page.mustache
index 0263a3a2..c84f95b9 100644
--- a/bin/templates/basic_page.mustache
+++ b/bin/templates/basic_page.mustache
@@ -4,7 +4,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width" />
{{{meta_refresh}}}
- <link href="/static/style.css" type="text/css" rel="stylesheet" />
+ <link href="/static/style.css?v={{style_dot_css_sha1sum}}" type="text/css" rel="stylesheet" />
<title>{{page_title}}</title>
</head>
<body class="wrapper">