[Piuparts-commits] [piuparts] 10/20: p-r: include md5 sum of content in the html pages

Holger Levsen holger at moszumanska.debian.org
Sat Nov 23 20:23:34 UTC 2013


This is an automated email from the git hooks/post-receive script.

holger pushed a commit to branch develop
in repository piuparts.

commit c53fce5331512af44a1f16f808c9c7dccfa1a551
Author: Andreas Beckmann <anbe at debian.org>
Date:   Sat Nov 9 19:34:54 2013 +0100

    p-r: include md5 sum of content in the html pages
    
    hashing skips the volatile elements md5sum, timestamp, piuparts version
    
    Signed-off-by: Andreas Beckmann <anbe at debian.org>
---
 piuparts-report.py | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/piuparts-report.py b/piuparts-report.py
index 1ff9504..43200b6 100644
--- a/piuparts-report.py
+++ b/piuparts-report.py
@@ -36,6 +36,7 @@ import shutil
 import re
 import string
 import yaml
+import hashlib
 
 # if python-rpy2 ain't installed, we don't draw fancy graphs
 try:
@@ -56,6 +57,7 @@ PIUPARTS_VERSION = "__PIUPARTS_VERSION__"
 
 HTML_HEADER = """
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<!-- $content_md5 -->
  <html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   <!-- Generated by piuparts-report $piuparts_version -->
   <title>
@@ -611,6 +613,13 @@ def write_template_html(filename, body, mapping={}):
     htmlpage = string.Template(header + body + footer)
     mapping = mapping.copy()
     mapping.update({
+        "content_md5": "",
+        "piuparts_version": "",
+        "time": "",
+        })
+    content_md5 = hashlib.md5(htmlpage.safe_substitute(mapping)).hexdigest()
+    mapping.update({
+        "content_md5": content_md5,
         "piuparts_version": PIUPARTS_VERSION,
         "time": time.strftime("%Y-%m-%d %H:%M %Z"),
         })

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/piuparts/piuparts.git



More information about the Piuparts-commits mailing list