# checksum.py -- Checksum the P4DTI sources to detect changes
# Gareth Rees, Ravenbrook Limited, 2001-03-05.
# $Id: //info.ravenbrook.com/project/p4dti/branch/2001-04-20/migrate-bugzilla/code/replicator/checksum.py#1 $
#
# See "Perforce Defect Tracking Integration Architecture"
# for the architecture of the integration;
# "Replicator design" for the design of the
# replicator; and "Replicator classes in Python"
# for the class organization of the
# replicator.
#
# Copyright 2000 Ravenbrook Limited. This document is provided "as is",
# without any express or implied warranty. In no event will the authors
# be held liable for any damages arising from the use of this document.
# You may make and distribute copies and derivative works of this
# document provided that (1) you do not charge a fee for this document or
# for its distribution, and (2) you retain as they appear all copyright
# and licence notices and document history entries, and (3) you append
# descriptions of your modifications to the document history.
import md5
# We produced this by running p4 files "*.py" and ignoring deleted files,
# removed test files like "replicator_test.py", also files that people are
# supposed to change, namely config.py, example_trigger.py, and
# migrate_teamtrack.py.
files = [
'bugzilla.py',
'check.py',
'checksum.py',
'check_config.py',
'configure_bugzilla.py',
'configure_teamtrack.py',
'dt_bugzilla.py',
'dt_teamtrack.py',
'init.py',
'logger.py',
'p4.py',
'refresh.py',
'replicator.py',
'run.py',
'stacktrace.py',
]
# Python 1.5.2 doesn't have md5.hexdigest(), so we do it ourselves:
def hexify(s):
result = ""
for c in s:
result = result + ("%02x" % ord(c))
return result
cs = md5.new()
for file in files:
cs.update(open(file, 'r').read())
print hexify(cs.digest())
# B. Document History
#
# 2001-03-05 GDR Created.
#
# 2001-03-07 NB Made it work on Python 1.5.2.
#
# 2001-03-29 RB Corrected title, description, and creation date.