From c343ba988c2b2cd3dbdedede2f615a682e486aea Mon Sep 17 00:00:00 2001 From: Valerie R Young Date: Mon, 25 Jul 2016 15:53:25 -0400 Subject: reproducible debian: add versioning to css style sheets Signed-off-by: Holger Levsen --- bin/reproducible_common.py | 11 ++++++++++- bin/templates/basic_page.mustache | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'bin') 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_refresh}}} - + {{page_title}} -- cgit v1.2.3-54-g00ecf