Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 341293
Collapse All | Expand All

(-)a/bin/glsa-check (-7 / +10 lines)
Lines 358-364 if mode == "mail": Link Here
358
		import portage_mail
358
		import portage_mail
359
359
360
	import socket
360
	import socket
361
	from io import StringIO
361
	from io import BytesIO
362
	try:
362
	try:
363
		from email.mime.text import MIMEText
363
		from email.mime.text import MIMEText
364
	except ImportError:
364
	except ImportError:
Lines 380-390 if mode == "mail": Link Here
380
	mysubject = "[glsa-check] Summary for %s" % socket.getfqdn()
380
	mysubject = "[glsa-check] Summary for %s" % socket.getfqdn()
381
381
382
	# need a file object for summarylist()
382
	# need a file object for summarylist()
383
	myfd = StringIO()
383
	myfd = BytesIO()
384
	myfd.write("GLSA Summary report for host %s\n" % socket.getfqdn())
384
	line = "GLSA Summary report for host %s\n" % socket.getfqdn()
385
	myfd.write("(Command was: %s)\n\n" % " ".join(sys.argv))
385
	myfd.write(line.encode("utf-8"))
386
	line = "(Command was: %s)\n\n" % " ".join(sys.argv)
387
	myfd.write(line.encode("utf-8"))
386
	summarylist(glsalist, fd1=myfd, fd2=myfd)
388
	summarylist(glsalist, fd1=myfd, fd2=myfd)
387
	summary = str(myfd.getvalue())
389
	summary = myfd.getvalue().decode("utf-8")
388
	myfd.close()
390
	myfd.close()
389
391
390
	myattachments = []
392
	myattachments = []
Lines 395-403 if mode == "mail": Link Here
395
			if verbose:
397
			if verbose:
396
				sys.stderr.write(("invalid GLSA: %s (error message was: %s)\n" % (myid, e)))
398
				sys.stderr.write(("invalid GLSA: %s (error message was: %s)\n" % (myid, e)))
397
			continue
399
			continue
398
		myfd = StringIO()
400
		myfd = BytesIO()
399
		myglsa.dump(outstream=myfd)
401
		myglsa.dump(outstream=myfd)
400
		myattachments.append(MIMEText(str(myfd.getvalue()), _charset="utf8"))
402
		attachment = myfd.getvalue().decode("utf-8")
403
		myattachments.append(MIMEText(attachment, _charset="utf8"))
401
		myfd.close()
404
		myfd.close()
402
405
403
	if glsalist or not quiet:
406
	if glsalist or not quiet:
(-)a/pym/gentoolkit/glsa/__init__.py (-1 / +1 lines)
Lines 622-627 class Glsa: Link Here
622
		@param	outfile: Stream that should be used for writing
622
		@param	outfile: Stream that should be used for writing
623
						 (defaults to sys.stdout)
623
						 (defaults to sys.stdout)
624
		"""
624
		"""
625
		outstream = getattr(outstream, "buffer", outstream)
625
		outstream = codecs.getwriter(encoding)(outstream)
626
		outstream = codecs.getwriter(encoding)(outstream)
626
		width = int(self.config["PRINTWIDTH"])
627
		width = int(self.config["PRINTWIDTH"])
627
		outstream.write(center("GLSA %s: \n%s" % (self.nr, self.title), width)+"\n")
628
		outstream.write(center("GLSA %s: \n%s" % (self.nr, self.title), width)+"\n")
628
- 

Return to bug 341293