Skip to content

Commit

Permalink
Fix gzip compression for TinderboxMailNotifier
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris AtLee committed Aug 4, 2010
1 parent 67a997d commit ed58695
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions master/buildbot/status/tinderbox.py
Expand Up @@ -10,7 +10,7 @@
from buildbot.status.builder import SUCCESS, WARNINGS
from buildbot.steps.shell import WithProperties

import zlib, bz2, base64, re
import gzip, bz2, base64, re, cStringIO

# TODO: docs, maybe a test of some sort just to make sure it actually imports
# and can format email without raising an exception.
Expand Down Expand Up @@ -205,6 +205,7 @@ def buildMessage(self, name, build, results):
# Make sure that shortText is a regular string, so that bad
# data in the logs don't generate UnicodeDecodeErrors
shortText = "%s\n" % ' '.join(bs.getText()).encode('ascii', 'replace')

# ignore steps that haven't happened
if not re.match(".*[^\s].*", shortText):
continue
Expand Down Expand Up @@ -239,7 +240,11 @@ def buildMessage(self, name, build, results):
tinderboxLogs = base64.encodestring(cLog)
logEncoding = "base64"
elif self.logCompression == "gzip":
cLog = zlib.compress(tinderboxLogs)
cLog = cStringIO.StringIO()
gz = gzip.GzipFile(mode="w", fileobj=cLog)
gz.write(tinderboxLogs)
gz.close()
cLog = cLog.getvalue()
tinderboxLogs = base64.encodestring(cLog)
logEncoding = "base64"

Expand Down

0 comments on commit ed58695

Please sign in to comment.