diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2017-05-13 23:21:00 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2017-05-13 23:21:00 +0200 |
commit | 0a98a3f04c35d9899f1de559481d2cf2a4d2f458 (patch) | |
tree | 8f538c4a408123644cf8030b2ca0cf45b729df13 | |
parent | c9e3aa919f908fc244e13e563dd26606d8058262 (diff) |
some work with patches
-rw-r--r-- | debian/changelog | 2 | ||||
-rw-r--r-- | debian/patches/0100-config.diff | 20 | ||||
-rw-r--r-- | debian/patches/0105-try_mail.diff | 2 | ||||
-rw-r--r-- | debian/patches/0110-syslog.diff | 14 | ||||
-rw-r--r-- | debian/patches/0115-Add_header.patch | 58 |
5 files changed, 56 insertions, 40 deletions
diff --git a/debian/changelog b/debian/changelog index 3579037..d3e0b05 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,7 +5,7 @@ mwc (1.7.4-1) UNRELEASED; urgency=medium * debian/patches/0105-try_mail.diff: - Replace undefined printf with print (Closes: #860494). * New debian/patches/0115-Add_header.patch: - - Add header to fix missing User-agent und Access. + - Add missing Access header. * Rewrite debian/watch for archives without "v" in front of the version. * Bump Standards-Version to 3.9.8. * Bump compatlevel to 10 (no changes required): diff --git a/debian/patches/0100-config.diff b/debian/patches/0100-config.diff index 7ccca33..bb07520 100644 --- a/debian/patches/0100-config.diff +++ b/debian/patches/0100-config.diff @@ -7,9 +7,9 @@ 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 2014-09-18 14:47:28.315407312 +0200 -+++ trunk/mwc.py 2014-09-18 14:49:11.000000000 +0200 -@@ -305,7 +305,7 @@ +--- trunk.orig/mwc.py ++++ trunk/mwc.py +@@ -316,7 +316,7 @@ def pollWebsites(): if __name__ == "__main__": @@ -18,7 +18,7 @@ Index: trunk/mwc.py dryrun = None try: -@@ -321,9 +321,24 @@ +@@ -332,9 +332,24 @@ if __name__ == "__main__": configMod = arg elif opt in ('-d', '--dry-run'): dryrun = arg @@ -48,15 +48,15 @@ Index: trunk/mwc.py if site['shortname'] == dryrun: Index: trunk/config_template.py =================================================================== ---- trunk.orig/config_template.py 2014-09-18 14:47:28.315407312 +0200 -+++ trunk/config_template.py 2014-09-18 14:47:28.271406411 +0200 +--- trunk.orig/config_template.py ++++ trunk/config_template.py @@ -1,5 +1,3 @@ -import os.path - # Copyright: (2013-2014) Michael Till Beck <Debianguru@gmx.de> # License: GPL-2.0+ -@@ -44,11 +42,11 @@ +@@ -44,11 +42,11 @@ sender = 'me@mymail.com' smtphost = 'mysmtpprovider.com' useTLS = True smtpport = 587 @@ -72,8 +72,8 @@ Index: trunk/config_template.py rssfile = 'feed.xml' Index: trunk/mwcfeedserver.py =================================================================== ---- trunk.orig/mwcfeedserver.py 2014-09-18 14:47:28.315407312 +0200 -+++ trunk/mwcfeedserver.py 2014-09-18 14:49:24.125775123 +0200 +--- trunk.orig/mwcfeedserver.py ++++ trunk/mwcfeedserver.py @@ -6,6 +6,7 @@ import http.server import socketserver @@ -82,7 +82,7 @@ Index: trunk/mwcfeedserver.py import sys import getopt -@@ -31,13 +32,26 @@ +@@ -31,13 +32,26 @@ for opt, arg in opts: elif opt in ('-p', '--port'): port = int(arg) diff --git a/debian/patches/0105-try_mail.diff b/debian/patches/0105-try_mail.diff index 6e11916..b1b204b 100644 --- a/debian/patches/0105-try_mail.diff +++ b/debian/patches/0105-try_mail.diff @@ -12,7 +12,7 @@ Index: trunk/mwc.py =================================================================== --- trunk.orig/mwc.py +++ trunk/mwc.py -@@ -212,15 +212,27 @@ def sendmail(receiver, subject, content, +@@ -223,15 +223,27 @@ def sendmail(receiver, subject, content, mail['Subject'] = Header(subject, defaultEncoding) # initialize session once, not each time this method gets called diff --git a/debian/patches/0110-syslog.diff b/debian/patches/0110-syslog.diff index cffffb4..ceda4ae 100644 --- a/debian/patches/0110-syslog.diff +++ b/debian/patches/0110-syslog.diff @@ -6,9 +6,9 @@ Last-Update: 2014-05-22 This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ Index: trunk/mwc.py =================================================================== ---- trunk.orig/mwc.py 2014-09-18 14:47:28.427409601 +0200 -+++ trunk/mwc.py 2014-09-18 14:47:28.411409275 +0200 -@@ -19,6 +19,7 @@ +--- trunk.orig/mwc.py ++++ trunk/mwc.py +@@ -19,6 +19,7 @@ import os import sys import getopt import traceback @@ -16,7 +16,7 @@ Index: trunk/mwc.py import subprocess -@@ -214,25 +215,28 @@ +@@ -225,25 +226,28 @@ def sendmail(receiver, subject, content, # initialize session once, not each time this method gets called # # add try / except to open mailsession @@ -60,7 +60,7 @@ Index: trunk/mwc.py # returns a list of all content that is stored locally for a specific site def getFileContents(shortname): -@@ -319,7 +323,11 @@ +@@ -330,7 +334,11 @@ if __name__ == "__main__": configMod = '/etc/mwc/mwc-config' dryrun = None @@ -73,7 +73,7 @@ Index: trunk/mwc.py try: opts, args = getopt.getopt(sys.argv[1:], 'hc:d:', ['help', 'config=', 'dry-run=']) except getopt.GetoptError: -@@ -344,11 +352,13 @@ +@@ -355,11 +363,13 @@ if __name__ == "__main__": config = importlib.import_module(fullname) except: print('Error: loading config') @@ -87,7 +87,7 @@ Index: trunk/mwc.py sys.exit(3) if dryrun: -@@ -370,3 +380,5 @@ +@@ -381,3 +391,5 @@ if __name__ == "__main__": mailsession.quit() mailsession = None diff --git a/debian/patches/0115-Add_header.patch b/debian/patches/0115-Add_header.patch index b9fc54e..6ce0c15 100644 --- a/debian/patches/0115-Add_header.patch +++ b/debian/patches/0115-Add_header.patch @@ -1,4 +1,4 @@ -Description: Add Header User-agent and Accept +Description: Add Header Accept Author: Jörg Frings-Fürst <debian@jff-webhosting.net> Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=862004 Forwarded: https://github.com/Debianguru/MailWebsiteChanges/issues/11 @@ -9,26 +9,42 @@ Index: trunk/mwc.py =================================================================== --- trunk.orig/mwc.py +++ trunk/mwc.py -@@ -68,6 +68,8 @@ def parseSite(site): - contenttype = site.get('type', 'html') - contentregex = site.get('contentregex', '') - titleregex = site.get('titleregex', '') -+ UserAgent = site.get('User-agent', '') -+ Accept = site.get('Accept', '') - enc = site.get('encoding', defaultEncoding) +@@ -91,6 +91,8 @@ def parseSite(site): + req = urllib.request.Request(uri) + if 'user-agent' in site: + req.add_header('User-Agent', site['user-agent']) ++ if 'accept' in site: ++ req.add_header('Accept', site['accept']) + file = urllib.request.urlopen(req) - contentxpath = site.get('contentxpath', '') -@@ -86,7 +88,12 @@ def parseSite(site): - file = process.stdout - else: - # open website -- file = urllib.request.urlopen(uri) -+ req = urllib.request.Request(uri) -+ if UserAgent != '': -+ req.add_header('User-agent', UserAgent) -+ if Accept != '': -+ req.add_header('Accept', Accept) -+ file = urllib.request.urlopen(req) +Index: trunk/README.md +=================================================================== +--- trunk.orig/README.md ++++ trunk/README.md +@@ -59,7 +59,9 @@ sites = [ + * <b>user-agent</b> (optional) + Defines the user agent string, e.g., + 'user-agent': 'Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:49.0) Gecko/20100101 Firefox/49.0' +- ++ * <b>accept</b> (optional) ++ Defines the accept string, e.g., ++ 'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' + + * We collect some XPath/CSS snippets at this place: <a href="https://github.com/Debianguru/MailWebsiteChanges/wiki/snippets">Snippet collection</a> - please feel free to add your own definitions! + +Index: trunk/config_template.py +=================================================================== +--- trunk.orig/config_template.py ++++ trunk/config_template.py +@@ -12,7 +12,9 @@ sites = [ + 'contentxpath': '//div', + 'titleregex': '', + 'contentregex': '', +- 'encoding': 'utf-8'}, ++ 'encoding': 'utf-8', ++ 'user-agent': 'Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:49.0) Gecko/20100101 Firefox/49.0', ++ 'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'}, - if contenttype == 'text' or (contentxpath == '' and titlexpath == ''): + {'shortname': 'mywebsite2', + 'uri': 'http://www.mywebsite2.com/info', |