[Qa-jenkins-scm] [jenkins.debian.net] 01/01: reproducible debian: add versioning to css style sheets
Holger Levsen
holger at layer-acht.org
Tue Jul 26 10:59:48 UTC 2016
This is an automated email from the git hooks/post-receive script.
holger pushed a commit to branch master
in repository jenkins.debian.net.
commit c343ba988c2b2cd3dbdedede2f615a682e486aea
Author: Valerie R Young <spectranaut at riseup.net>
Date: Mon Jul 25 15:53:25 2016 -0400
reproducible debian: add versioning to css style sheets
Signed-off-by: Holger Levsen <holger at layer-acht.org>
---
bin/reproducible_common.py | 11 ++++++++++-
bin/templates/basic_page.mustache | 2 +-
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/bin/reproducible_common.py b/bin/reproducible_common.py
index 1c2df8e..dd67f46 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 0263a3a..c84f95b 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">
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/qa/jenkins.debian.net.git
More information about the Qa-jenkins-scm
mailing list