diff options
author | Florian Weimer <fw@deneb.enyo.de> | 2011-01-14 21:28:24 +0000 |
---|---|---|
committer | Florian Weimer <fw@deneb.enyo.de> | 2011-01-14 21:28:24 +0000 |
commit | 78f681c5d411581f8042679cc8157ef595715f97 (patch) | |
tree | ae7aa90e46386ff30c5c82e02d817e6c37af930f /lib/python/bugs.py | |
parent | 007c3bf8475a9cdfb102b16f6161fe792dcb5880 (diff) |
lib/python/bugs.py: switch to hash-based temporary names
Thanks to Stefan Fritsch for the suggestion.
git-svn-id: svn+ssh://svn.debian.org/svn/secure-testing@15860 e39458fd-73e7-0310-bf30-c45bca0a0e42
Diffstat (limited to 'lib/python/bugs.py')
-rw-r--r-- | lib/python/bugs.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/python/bugs.py b/lib/python/bugs.py index b3edb0b4ee..22c406f39c 100644 --- a/lib/python/bugs.py +++ b/lib/python/bugs.py @@ -18,6 +18,7 @@ import debian_support import re import types +import hashlib class Urgency(debian_support.PseudoEnum): pass @@ -396,6 +397,14 @@ class BugRejectedCVE(Bug): def cveStatus(self): return 'REJECTED' +def temp_bug_name(bug_number, description): + """Build a unique temporary name from the bug number and a + truncated hash of the description.""" + digest = hashlib.md5() + digest.update(description) + hexdigest = digest.hexdigest()[0:6].upper() + return 'TEMP-%07d-%s' % (bug_number, hexdigest) + class FileBase(debian_support.PackageFile): re_non_ascii = re.compile(r'.*([^\n\t -~]).*') re_empty = re.compile(r'^(?:\s*$|--)') @@ -709,7 +718,7 @@ class FileBase(debian_support.PackageFile): break if first_bug: break - record_name = 'TEMP-%07d-%06d' % (first_bug, first_lineno) + record_name = temp_bug_name(first_bug, description) yield self.finishBug(Bug(self.file.name, first_lineno, date, record_name, description, comments, notes=pkg_notes, xref=xref)) |