From e21453143818389060bf0bd6cfa627c11a63ede5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Fri, 11 Aug 2017 05:41:14 +0200 Subject: New upstream release; refresh patches --- debian/changelog | 5 +- debian/patches/0100-config.diff | 81 +++++++++++++------------- debian/patches/0105-try_mail.diff | 68 +++++++++++----------- debian/patches/0110-syslog.diff | 118 ++++++++++++++------------------------ 4 files changed, 119 insertions(+), 153 deletions(-) diff --git a/debian/changelog b/debian/changelog index 18767a8..63449fb 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,7 @@ -mwc (1.7.6-1) UNRELEASED; urgency=medium +mwc (1.8.2-1) UNRELEASED; urgency=medium - * New upstream release. + * New upstream release (Closes: #862004). + + Refresh patches. * Renumbering patches. * debian/patches/0105-try_mail.diff: - Replace undefined printf with print (Closes: #860494). diff --git a/debian/patches/0100-config.diff b/debian/patches/0100-config.diff index ce4dba7..8529874 100644 --- a/debian/patches/0100-config.diff +++ b/debian/patches/0100-config.diff @@ -5,47 +5,6 @@ Author: Jörg Frings-Fürst Last-Update: 2014-05-12 --- This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ -Index: trunk/mwc.py -=================================================================== ---- trunk.orig/mwc.py -+++ trunk/mwc.py -@@ -319,7 +319,7 @@ def pollWebsites(): - - if __name__ == "__main__": - -- configMod = 'config' -+ configMod = '/etc/mwc/mwc-config' - dryrun = None - - try: -@@ -335,9 +335,24 @@ if __name__ == "__main__": - configMod = arg - elif opt in ('-d', '--dry-run'): - dryrun = arg -- -- config = importlib.import_module(configMod) -- -+ # -+ # add code to load config from nonsystem path -+ # and change to datadir -+ # -+ try: -+ path = os.path.dirname(configMod) -+ fullname = os.path.basename(configMod) -+ sys.path.append(path) -+ config = importlib.import_module(fullname) -+ except: -+ print('Error: loading config') -+ sys.exit(2) -+ try: -+ os.chdir(config.datadir) -+ except: -+ print('Error: datadir not found') -+ sys.exit(3) -+ - if dryrun: - for site in config.sites: - if site['shortname'] == dryrun: Index: trunk/config_template.py =================================================================== --- trunk.orig/config_template.py @@ -56,7 +15,7 @@ Index: trunk/config_template.py # Copyright: (2013-2014) Michael Till Beck # License: GPL-2.0+ -@@ -46,11 +44,11 @@ sender = 'me@mymail.com' +@@ -47,11 +45,11 @@ sender = 'me@mymail.com' smtphost = 'mysmtpprovider.com' useTLS = True smtpport = 587 @@ -113,3 +72,41 @@ Index: trunk/mwcfeedserver.py +except KeyboardInterrupt: + pass +httpd.server_close() +Index: trunk/mwc.py +=================================================================== +--- trunk.orig/mwc.py ++++ trunk/mwc.py +@@ -334,7 +334,7 @@ def pollWebsites(): + + if __name__ == "__main__": + +- configMod = 'config' ++ configMod = '/etc/mwc/mwc-config' + dryrun = None + + try: +@@ -351,7 +351,23 @@ if __name__ == "__main__": + elif opt in ('-d', '--dry-run'): + dryrun = arg + +- config = importlib.import_module(configMod) ++ # ++ # add code to load config from nonsystem path ++ # and change to datadir ++ # ++ try: ++ path = os.path.dirname(configMod) ++ fullname = os.path.basename(configMod) ++ sys.path.append(path) ++ config = importlib.import_module(fullname) ++ except: ++ print('Error: loading config') ++ sys.exit(2) ++ try: ++ os.chdir(config.datadir) ++ except: ++ print('Error: datadir not found') ++ sys.exit(3) + + if dryrun: + for site in config.sites: diff --git a/debian/patches/0105-try_mail.diff b/debian/patches/0105-try_mail.diff index d390b6d..bc62ef1 100644 --- a/debian/patches/0105-try_mail.diff +++ b/debian/patches/0105-try_mail.diff @@ -12,41 +12,41 @@ Index: trunk/mwc.py =================================================================== --- trunk.orig/mwc.py +++ trunk/mwc.py -@@ -225,16 +225,27 @@ def sendmail(receiver, subject, content, - mail['Subject'] = Header(subject, defaultEncoding) +@@ -232,16 +232,28 @@ def sendmail(receiver, subject, content, + mail['Subject'] = Header(subject, defaultEncoding) - # initialize session once, not each time this method gets called -- if mailsession is None: -- mailsession = smtplib.SMTP(config.smtphost, config.smtpport) -- if config.useTLS: -- mailsession.ehlo() -- mailsession.starttls() -- if config.smtpusername is not None: -- mailsession.login(config.smtpusername, config.smtppwd) + # initialize session once, not each time this method gets called +- if mailsession is None: +- mailsession = smtplib.SMTP(config.smtphost, config.smtpport) +- if config.useTLS: +- mailsession.ehlo() +- mailsession.starttls() +- if config.smtpusername is not None: +- mailsession.login(config.smtpusername, config.smtppwd) - -- mailsession.sendmail(config.sender, receiver.split(','), mail.as_string()) -- -+ # -+ # add try / except to open mailsession -+ # -+ try: -+ if mailsession is None: -+ mailsession = smtplib.SMTP(config.smtphost, config.smtpport) -+ if config.useTLS: -+ mailsession.ehlo() -+ mailsession.starttls() -+ mailsession.login(config.smtpusername, config.smtppwd) -+ # -+ # add try / except to send mail -+ # -+ except: -+ print('Error: Open smtp-session') -+ exit(4) -+ try: -+ mailsession.sendmail(config.sender, receiver.split(','), mail.as_string()) -+ except: -+ print('Error: sendmail') -+ exit(5) +- mailsession.sendmail(config.sender, receiver.split(','), mail.as_string()) + ++ # ++ # add try / except to open mailsession ++ # ++ try: ++ if mailsession is None: ++ mailsession = smtplib.SMTP(config.smtphost, config.smtpport) ++ if config.useTLS: ++ mailsession.ehlo() ++ mailsession.starttls() ++ mailsession.login(config.smtpusername, config.smtppwd) ++ # ++ # add try / except to send mail ++ # ++ except: ++ print('Error: Open smtp-session') ++ exit(4) ++ try: ++ mailsession.sendmail(config.sender, receiver.split(','), mail.as_string()) ++ except: ++ print('Error: sendmail') ++ exit(5) # returns a list of all content that is stored locally for a specific site - def getFileContents(shortname): + def getStoredHashes(shortname): diff --git a/debian/patches/0110-syslog.diff b/debian/patches/0110-syslog.diff index 12d629d..bd61d81 100644 --- a/debian/patches/0110-syslog.diff +++ b/debian/patches/0110-syslog.diff @@ -8,7 +8,7 @@ Index: trunk/mwc.py =================================================================== --- trunk.orig/mwc.py +++ trunk/mwc.py -@@ -19,6 +19,7 @@ import os +@@ -21,6 +21,7 @@ import os import sys import getopt import traceback @@ -16,81 +16,49 @@ Index: trunk/mwc.py import subprocess -@@ -227,25 +228,28 @@ def sendmail(receiver, subject, content, - # initialize session once, not each time this method gets called - # - # add try / except to open mailsession -- # -+ # -+ - try: -- if mailsession is None: -- mailsession = smtplib.SMTP(config.smtphost, config.smtpport) -- if config.useTLS: -- mailsession.ehlo() -- mailsession.starttls() -- mailsession.login(config.smtpusername, config.smtppwd) -- # -+ if mailsession is None: -+ mailsession = smtplib.SMTP(config.smtphost, config.smtpport) -+ if config.useTLS: -+ mailsession.ehlo() -+ mailsession.starttls() -+ mailsession.login(config.smtpusername, config.smtppwd) -+ except: -+ print('Error: Open smtp-session') -+ syslog.syslog(syslog.LOG_ERR, 'can not open smtp session') -+ exit(4) -+ # - # add try / except to send mail - # -+ try: -+ mailsession.sendmail(config.sender, receiver.split(','), mail.as_string()) - except: -- print('Error: Open smtp-session') -- exit(4) -- try: -- mailsession.sendmail(config.sender, receiver.split(','), mail.as_string()) -- except: -- print('Error: sendmail') -- exit(5) -+ print('Error: sendmail') -+ syslog.syslog(syslog.LOG_ERR, 'error on sendmail') -+ exit(5) +@@ -248,11 +249,13 @@ def sendmail(receiver, subject, content, + # + except: + print('Error: Open smtp-session') ++ syslog.syslog(syslog.LOG_ERR, 'can not open smtp session') + exit(4) + try: + mailsession.sendmail(config.sender, receiver.split(','), mail.as_string()) + except: + print('Error: sendmail') ++ syslog.syslog(syslog.LOG_ERR, 'error on sendmail') + exit(5) # returns a list of all content that is stored locally for a specific site - def getFileContents(shortname): -@@ -332,7 +336,11 @@ if __name__ == "__main__": +@@ -349,6 +352,11 @@ if __name__ == "__main__": + configMod = '/etc/mwc/mwc-config' + dryrun = None - configMod = '/etc/mwc/mwc-config' - dryrun = None -- -+ -+ # -+ # add syslog open -+ # -+ syslog.openlog() - try: - opts, args = getopt.getopt(sys.argv[1:], 'hc:d:', ['help', 'config=', 'dry-run=']) - except getopt.GetoptError: -@@ -357,11 +365,13 @@ if __name__ == "__main__": - config = importlib.import_module(fullname) - except: - print('Error: loading config') -+ syslog.syslog(syslog.LOG_ERR, 'can not found / load mwc-config') - sys.exit(2) - try: - os.chdir(config.datadir) - except: - print('Error: datadir not found') -+ syslog.syslog(syslog.LOG_ERR, 'datadir not found') - sys.exit(3) - - if dryrun: -@@ -383,3 +393,5 @@ if __name__ == "__main__": - mailsession.quit() - mailsession = None ++ # ++ # add syslog open ++ # ++ syslog.openlog() ++ + try: + opts, args = getopt.getopt(sys.argv[1:], 'hc:d:', ['help', 'config=', 'dry-run=']) + except getopt.GetoptError: +@@ -374,11 +382,13 @@ if __name__ == "__main__": + config = importlib.import_module(fullname) + except: + print('Error: loading config') ++ syslog.syslog(syslog.LOG_ERR, 'can not found / load mwc-config') + sys.exit(2) + try: + os.chdir(config.datadir) + except: + print('Error: datadir not found') ++ syslog.syslog(syslog.LOG_ERR, 'datadir not found') + sys.exit(3) -+ syslog.closelog() -+ -\ No newline at end of file + if dryrun: +@@ -400,3 +410,5 @@ if __name__ == "__main__": + if mailsession: + mailsession.quit() + mailsession = None ++ ++ syslog.closelog() -- cgit v1.2.3