extras-repoclosure rc-report.py,1.51,1.52
Michael Schwendt
mschwendt at fedoraproject.org
Thu Oct 2 09:51:42 UTC 2008
Author: mschwendt
Update of /cvs/fedora/extras-repoclosure
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv14021
Modified Files:
rc-report.py
Log Message:
Newer Yum changes pkg id from 'name - EVR.arch' to 'name-EVR.arch'.
Support this in addition to the old style on EL.
Add option 'tls' to 'Mail' section for STARTTLS support.
Index: rc-report.py
===================================================================
RCS file: /cvs/fedora/extras-repoclosure/rc-report.py,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -r1.51 -r1.52
--- rc-report.py 17 Apr 2008 14:46:59 -0000 1.51
+++ rc-report.py 2 Oct 2008 09:51:41 -0000 1.52
@@ -19,6 +19,7 @@
Mail = {
'server' : "localhost",
+ 'tls' : False,
'user' : "",
'passwd' : "",
'maxsize' : 39*1024,
@@ -29,7 +30,7 @@
class BrokenDep:
def __init__(self):
- self.pkgid = None # 'name - EVR.arch'
+ self.pkgid = None # 'name-EVR.arch'
self.repoid = None # e.g. 'fedora-core-6-i386'
self.srp_mname = None
self.age = '' # e.g. '(14 days)'
@@ -42,11 +43,10 @@
self.report = []
def GetRequires(self):
- pkgid2 = self.pkgid.replace(' ','')
r = []
for line in self.report:
if len(line) and not line.isspace() and not line.startswith('package: ') and line.find('unresolved deps:') < 0:
- r.append( ' '+pkgid2+' requires '+line.lstrip() )
+ r.append( ' '+self.pkgid+' requires '+line.lstrip() )
return '\n'.join(r)
@@ -166,9 +166,10 @@
for v in ['server','user','passwd','from','replyto','subject']:
if config.has_option('Mail',v):
Mail[v] = config.get('Mail',v)
- if config.has_option('Mail','maxsize'):
- Mail['maxsize'] = config.getint('Mail','maxsize')
-
+ if config.has_option('Mail','maxsize'):
+ Mail['maxsize'] = config.getint('Mail','maxsize')
+ if config.has_option('Mail','tls'):
+ Mail['tls'] = config.getboolean('Mail','tls')
except (ConfigParser.NoSectionError, ConfigParser.NoOptionError), e:
print 'Configuration file error:', e
@@ -220,11 +221,15 @@
continue
elif inbody and line.startswith('package: '):
- w = line.rstrip().split(' ')
- repoid = w[5]
b = BrokenDep()
- b.pkgid = w[1]+' - '+w[3] # name - EVR.arch
- b.repoid = repoid
+ w = line.rstrip().split(' ')
+ if len(w)==6:
+ b.repoid = w[5]
+ b.pkgid = w[1]+' - '+w[3] # name - EVR.arch
+ b.pkgid = b.pkgid.replace(' ','')
+ else:
+ b.repoid = w[3]
+ b.pkgid = w[1] # name-EVR.arch
b.srpm_name = srpm_name
brokendeps.append(b)
@@ -319,13 +324,19 @@
# Mail init.
if domail:
- srv = smtplib.SMTP( Mail['server'] )
- if ( len(Mail['user']) and len(Mail['passwd']) ):
- try:
+ try:
+ srv = smtplib.SMTP( Mail['server'] )
+ #srv.set_debuglevel(1)
+ if (Mail['tls']):
+ srv.ehlo()
+ srv.starttls()
+ srv.ehlo()
+ if ( len(Mail['user']) and len(Mail['passwd']) ):
srv.login( Mail['user'], Mail['passwd'] )
- except smtplib.SMTPException:
- print 'ERROR: mailserver login failed'
- sys.exit(-1)
+ except smtplib.SMTPException, e:
+ print 'ERROR: mailserver login failed'
+ print e
+ sys.exit(-1)
# Mail reports to owners.
for toaddr,(new,body) in reports.iteritems():
More information about the scm-commits
mailing list