summaryrefslogtreecommitdiffstats
path: root/debian/patches
diff options
context:
space:
mode:
Diffstat (limited to 'debian/patches')
-rw-r--r--debian/patches/0001-dfsg.patch22
-rw-r--r--debian/patches/0005-author-name.patch21
-rw-r--r--debian/patches/0006-alias-service.patch18
-rw-r--r--debian/patches/0007-irkerhook-git.patch28
-rw-r--r--debian/patches/0008-user-service.patch39
-rw-r--r--debian/patches/0009-env-service.patch28
-rw-r--r--debian/patches/0010-fix_ioerror_exception.patch33
-rw-r--r--debian/patches/0011-Import-upstream-tweaks-to-irkerd.service.patch23
-rw-r--r--debian/patches/0011-Update-irkerhook.py-to-work-under-python-3.patch230
-rw-r--r--debian/patches/0012-Drop-sorted-from-event_handler.patch25
-rw-r--r--debian/patches/0013-Fix-incorrect-name-in-Makefile.patch23
-rw-r--r--debian/patches/series11
12 files changed, 501 insertions, 0 deletions
diff --git a/debian/patches/0001-dfsg.patch b/debian/patches/0001-dfsg.patch
new file mode 100644
index 0000000..fafc040
--- /dev/null
+++ b/debian/patches/0001-dfsg.patch
@@ -0,0 +1,22 @@
+From: Daniel Baumann <mail@daniel-baumann.ch>
+Date: Sun, 13 May 2018 15:07:57 +0200
+Subject: Removing logo (no origin known and no source available)
+
+---
+ Makefile | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index ce8a1de..fc6ac7f 100644
+--- a/Makefile
++++ b/Makefile
+@@ -92,8 +92,7 @@ SOURCES = \
+
+ EXTRA_DIST = \
+ org.catb.irkerd.plist \
+- irkerd.service \
+- irker-logo.png
++ irkerd.service
+
+ version:
+ @echo $(VERS)
diff --git a/debian/patches/0005-author-name.patch b/debian/patches/0005-author-name.patch
new file mode 100644
index 0000000..2df8644
--- /dev/null
+++ b/debian/patches/0005-author-name.patch
@@ -0,0 +1,21 @@
+From: Daniel Baumann <mail@daniel-baumann.ch>
+Date: Sun, 13 May 2018 15:07:57 +0200
+Subject: Use author_name instead of author in Git notifications.
+
+---
+ irkerhook.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/irkerhook.py b/irkerhook.py
+index 9768eac..8bf46f8 100755
+--- a/irkerhook.py
++++ b/irkerhook.py
+@@ -298,7 +298,7 @@ class GitExtractor(GenericExtractor):
+ # Might be be nice to ship the full email address, if not
+ # for spammers' address harvesters - getting this wrong
+ # would make the freenode #commits channel into harvester heaven.
+- commit.author = commit.mail.split("@")[0]
++ commit.author = commit.author_name
+ commit.author_date, commit.commit_date = \
+ do("git log -1 '--pretty=format:%ai|%ci' " + shellquote(commit.commit)).split("|")
+ return commit
diff --git a/debian/patches/0006-alias-service.patch b/debian/patches/0006-alias-service.patch
new file mode 100644
index 0000000..858773f
--- /dev/null
+++ b/debian/patches/0006-alias-service.patch
@@ -0,0 +1,18 @@
+From: Neil Muller <drnlmuller+debian@gmail.com>
+Date: Sun, 13 May 2018 15:07:57 +0200
+Subject: Add an alias to the upstream service file so the sysinit and systemd
+
+scripts play nicely together.
+---
+ irkerd.service | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/irkerd.service b/irkerd.service
+index d19378b..74e9126 100644
+--- a/irkerd.service
++++ b/irkerd.service
+@@ -10,3 +10,4 @@ ExecStart=/usr/bin/irkerd
+
+ [Install]
+ WantedBy=multi-user.target
++Alias=irker.service
diff --git a/debian/patches/0007-irkerhook-git.patch b/debian/patches/0007-irkerhook-git.patch
new file mode 100644
index 0000000..058ad58
--- /dev/null
+++ b/debian/patches/0007-irkerhook-git.patch
@@ -0,0 +1,28 @@
+From: Neil Muller <drnlmuller+debian@gmail.com>
+Date: Sun, 13 May 2018 15:07:57 +0200
+Subject: Add description for the irkerhook-git helper script.
+
+The debian packages add a irkerhook-git helper script, which simplifies
+the most common use case for irkerhook with git. This patch mentions the
+helper script in the irkerhook manpage.
+Last-Update: 2016-03-15
+---
+ irkerhook.xml | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/irkerhook.xml b/irkerhook.xml
+index 2f068d2..efb4bc1 100644
+--- a/irkerhook.xml
++++ b/irkerhook.xml
+@@ -217,6 +217,11 @@ while read old new refname; do
+ done
+ </programlisting>
+
++<para>For convenience, this is implemented by the irkerhook-git
++helper script. This script will complain about some common configuration
++isssues. For simplicity, irkerhook-git does not support all the
++options of irkerhook.py, and is thus not suitable for all applications.</para>
++
+ <para>Preferences may be set in the repo <filename>config</filename>
+ file in an [irker] section. Here is an example of what that can look
+ like:</para>
diff --git a/debian/patches/0008-user-service.patch b/debian/patches/0008-user-service.patch
new file mode 100644
index 0000000..06b6530
--- /dev/null
+++ b/debian/patches/0008-user-service.patch
@@ -0,0 +1,39 @@
+From: Python Applications Packaging Team
+ <python-apps-team@lists.alioth.debian.org>
+Date: Sun, 13 May 2018 15:07:57 +0200
+Subject: user-service
+MIME-Version: 1.0
+Content-Type: text/plain; charset="utf-8"
+Content-Transfer-Encoding: 8bit
+
+commit 1980b7cb4239463b581579cc39480774d3e2d2fe
+Author: Antoine Beaupré <anarcat@debian.org>
+Date: Mon Sep 12 12:01:44 2016 -0400
+
+ run daemon as the irker user (Close: #832758)
+
+ this is an improvement upon the default .service file. it requires a
+ irker user to be created, something which is automatically handled by
+ the debian package, but should be handled by other distributions when
+ deploying the .service file.
+
+ there are obvious dangers in running irkerd as root: a compromise
+ would be catastrophic, and since it runs on public servers that are
+ traditionnally pretty hostile (IRC), it seems critical that rights of
+ the daemon be limited.
+---
+ irkerd.service | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/irkerd.service b/irkerd.service
+index 74e9126..2318f54 100644
+--- a/irkerd.service
++++ b/irkerd.service
+@@ -7,6 +7,7 @@ Requires=network.target
+
+ [Service]
+ ExecStart=/usr/bin/irkerd
++User=irker
+
+ [Install]
+ WantedBy=multi-user.target
diff --git a/debian/patches/0009-env-service.patch b/debian/patches/0009-env-service.patch
new file mode 100644
index 0000000..70a0dc7
--- /dev/null
+++ b/debian/patches/0009-env-service.patch
@@ -0,0 +1,28 @@
+From: Python Applications Packaging Team
+ <python-apps-team@lists.alioth.debian.org>
+Date: Sun, 13 May 2018 15:07:57 +0200
+Subject: env-service
+
+ Properly import environment from /etc/defaults (Closes: #832322)
+
+ This fixes a regression in the systemd unit, which doesn't support
+ the equivalent /etc/default/irker configuration supported by the
+ sysvinit startup scripts.
+---
+ irkerd.service | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/irkerd.service b/irkerd.service
+index 2318f54..a9a6675 100644
+--- a/irkerd.service
++++ b/irkerd.service
+@@ -6,7 +6,8 @@ Description=irker daemon
+ Requires=network.target
+
+ [Service]
+-ExecStart=/usr/bin/irkerd
++EnvironmentFile=-/etc/default/irker
++ExecStart=/usr/bin/irkerd $IRKER_OPTIONS
+ User=irker
+
+ [Install]
diff --git a/debian/patches/0010-fix_ioerror_exception.patch b/debian/patches/0010-fix_ioerror_exception.patch
new file mode 100644
index 0000000..f9bfcee
--- /dev/null
+++ b/debian/patches/0010-fix_ioerror_exception.patch
@@ -0,0 +1,33 @@
+From: Neil Muller <drnlmuller+debian@gmail.com>
+Date: Sun, 13 May 2018 15:09:55 +0200
+Subject: Only HTTPError has a code attribute
+
+This would cause irker to crash in case we get a URLError instead of HTTPError,
+for example.
+
+Patch-Name: 0010-fix_ioerror_exception.patch
+Forwarded: https://gitlab.com/esr/irker/merge_requests/14
+---
+ irkerhook.py | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/irkerhook.py b/irkerhook.py
+index 8bf46f8..d32b742 100755
+--- a/irkerhook.py
++++ b/irkerhook.py
+@@ -95,12 +95,14 @@ class Commit:
+ self.url = webview
+ else:
+ self.url = webview
+- except IOError as e:
++ except urllib2.HTTPError as e:
+ if e.code == 401:
+ # Authentication error, so we assume the view is valid
+ self.url = webview
+ else:
+ self.url = ""
++ except IOError:
++ self.url = ""
+ res = self.template % self.__dict__
+ return unicode(res, 'UTF-8') if not isinstance(res, unicode) else res
+
diff --git a/debian/patches/0011-Import-upstream-tweaks-to-irkerd.service.patch b/debian/patches/0011-Import-upstream-tweaks-to-irkerd.service.patch
new file mode 100644
index 0000000..9330079
--- /dev/null
+++ b/debian/patches/0011-Import-upstream-tweaks-to-irkerd.service.patch
@@ -0,0 +1,23 @@
+From: Neil Muller <drnlmuller+debian@gmail.com>
+Date: Sun, 13 May 2018 17:17:29 +0200
+Subject: Import upstream tweaks to irkerd.service
+
+---
+ irkerd.service | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/irkerd.service b/irkerd.service
+index a9a6675..dbdc058 100644
+--- a/irkerd.service
++++ b/irkerd.service
+@@ -2,8 +2,9 @@
+ # Distributed under the terms of the BSD LICENSE
+
+ [Unit]
+-Description=irker daemon
++Description=Internet Relay Chat (IRC) notification daemon
+ Requires=network.target
++Documentation=man:irkerd(8) man:irkerhook(1) man:irk(1)
+
+ [Service]
+ EnvironmentFile=-/etc/default/irker
diff --git a/debian/patches/0011-Update-irkerhook.py-to-work-under-python-3.patch b/debian/patches/0011-Update-irkerhook.py-to-work-under-python-3.patch
new file mode 100644
index 0000000..65ad25e
--- /dev/null
+++ b/debian/patches/0011-Update-irkerhook.py-to-work-under-python-3.patch
@@ -0,0 +1,230 @@
+From: Neil Muller <drnlmuller+debian@gmail.com>
+Date: Sun, 13 May 2018 15:11:50 +0200
+Subject: Update irkerhook.py to work under python 3.
+
+This allows irkerhook.py to be used in a python 3 only setup.
+Due to the state of mercurial's python 3 support, irkerhook.py
+only supports git and svn repositories when used with python 3.
+
+Patch-Name: 0011-irkerhook_python3_support.patch
+Forwarded: https://gitlab.com/esr/irker/merge_requests/19
+---
+ irkerhook.py | 65 ++++++++++++++++++++++++++++++++++++++++++-----------------
+ irkerhook.xml | 3 +++
+ 2 files changed, 49 insertions(+), 19 deletions(-)
+
+diff --git a/irkerhook.py b/irkerhook.py
+index d32b742..fdc8d91 100755
+--- a/irkerhook.py
++++ b/irkerhook.py
+@@ -18,12 +18,14 @@
+ # does not override it.
+ #
+ # SPDX-License-Identifier: BSD-2-Clause
++from __future__ import print_function, absolute_import
++
+ default_server = "localhost"
+ IRKER_PORT = 6659
+
+ # The default service used to turn your web-view URL into a tinyurl so it
+ # will take up less space on the IRC notification line.
+-default_tinyifier = "http://tinyurl.com/api-create.php?url="
++default_tinyifier = u"http://tinyurl.com/api-create.php?url="
+
+ # Map magic urlprefix values to actual URL prefixes.
+ urlprefixmap = {
+@@ -33,7 +35,7 @@ urlprefixmap = {
+ }
+
+ # By default, ship to the freenode #commits list
+-default_channels = "irc://chat.freenode.net/#commits"
++default_channels = u"irc://chat.freenode.net/#commits"
+
+ #
+ # No user-serviceable parts below this line:
+@@ -41,14 +43,25 @@ default_channels = "irc://chat.freenode.net/#commits"
+
+ version = "2.17"
+
+-import os, sys, socket, urllib2, subprocess, locale, datetime, re
++import os, sys, socket, subprocess, locale, datetime, re
+ from pipes import quote as shellquote
+
++try:
++ from urllib2 import urlopen, HTTPError
++except ImportError:
++ from urllib.error import HTTPError
++ from urllib.request import urlopen
++
+ try:
+ import simplejson as json # Faster, also makes us Python-2.5-compatible
+ except ImportError:
+ import json
+
++if sys.version_info.major == 2:
++ string_type = unicode
++else:
++ string_type = str
++
+ try:
+ getstatusoutput = subprocess.getstatusoutput
+ except AttributeError:
+@@ -56,7 +69,10 @@ except AttributeError:
+ getstatusoutput = commands.getstatusoutput
+
+ def do(command):
+- return unicode(getstatusoutput(command)[1], locale.getlocale()[1] or 'UTF-8').encode(locale.getlocale()[1] or 'UTF-8')
++ if sys.version_info.major == 2:
++ return string_type(getstatusoutput(command)[1], locale.getlocale()[1] or 'UTF-8')
++ else:
++ return getstatusoutput(command)[1]
+
+ class Commit:
+ def __init__(self, extractor, commit):
+@@ -72,7 +88,14 @@ class Commit:
+ self.author_date = None
+ self.commit_date = None
+ self.__dict__.update(extractor.__dict__)
+- def __unicode__(self):
++
++ if sys.version_info.major == 2:
++ # Convert __str__ to __unicode__ for python 2
++ self.__unicode__ = self.__str__
++ # Not really needed, but maybe useful for debugging
++ self.__str__ = lambda x: x.__unicode__().encode('utf-8')
++
++ def __str__(self):
+ "Produce a notification string from this commit."
+ if self.urlprefix.lower() == "none":
+ self.url = ""
+@@ -81,12 +104,12 @@ class Commit:
+ webview = (urlprefix % self.__dict__) + self.commit
+ try:
+ # See it the url is accessible
+- res = urllib2.urlopen(webview)
++ res = urlopen(webview)
+ if self.tinyifier and self.tinyifier.lower() != "none":
+ try:
+ # Didn't get a retrieval error on the web
+ # view, so try to tinyify a reference to it.
+- self.url = urllib2.urlopen(self.tinyifier + webview).read()
++ self.url = urlopen(self.tinyifier + webview).read()
+ try:
+ self.url = self.url.decode('UTF-8')
+ except UnicodeError:
+@@ -95,7 +118,7 @@ class Commit:
+ self.url = webview
+ else:
+ self.url = webview
+- except urllib2.HTTPError as e:
++ except HTTPError as e:
+ if e.code == 401:
+ # Authentication error, so we assume the view is valid
+ self.url = webview
+@@ -104,7 +127,7 @@ class Commit:
+ except IOError:
+ self.url = ""
+ res = self.template % self.__dict__
+- return unicode(res, 'UTF-8') if not isinstance(res, unicode) else res
++ return string_type(res, 'UTF-8') if not isinstance(res, string_type) else res
+
+ class GenericExtractor:
+ "Generic class for encapsulating data from a VCS."
+@@ -239,10 +262,10 @@ class GitExtractor(GenericExtractor):
+ self.channels = do("git config --get irker.channels")
+ self.email = do("git config --get irker.email")
+ self.tcp = do("git config --bool --get irker.tcp")
+- self.template = do("git config --get irker.template") or '%(bold)s%(project)s:%(reset)s %(green)s%(author)s%(reset)s %(repo)s:%(yellow)s%(branch)s%(reset)s * %(bold)s%(rev)s%(reset)s / %(bold)s%(files)s%(reset)s: %(logmsg)s %(brown)s%(url)s%(reset)s'
++ self.template = do("git config --get irker.template") or u'%(bold)s%(project)s:%(reset)s %(green)s%(author)s%(reset)s %(repo)s:%(yellow)s%(branch)s%(reset)s * %(bold)s%(rev)s%(reset)s / %(bold)s%(files)s%(reset)s: %(logmsg)s %(brown)s%(url)s%(reset)s'
+ self.tinyifier = do("git config --get irker.tinyifier") or default_tinyifier
+ self.color = do("git config --get irker.color")
+- self.urlprefix = do("git config --get irker.urlprefix") or "gitweb"
++ self.urlprefix = do("git config --get irker.urlprefix") or u"gitweb"
+ self.cialike = do("git config --get irker.cialike")
+ self.filtercmd = do("git config --get irker.filtercmd")
+ # These are git-specific
+@@ -434,6 +457,10 @@ extractors = [GitExtractor, HgExtractor, SvnExtractor]
+
+ # VCS-dependent code ends here
+
++def convert_message(message):
++ """Convert the message to bytes to send to the socket"""
++ return message.encode(locale.getlocale()[1] or 'UTF-8') + b'\n'
++
+ def ship(extractor, commit, debug):
+ "Ship a notification for the specified commit."
+ metadata = extractor.commit_factory(commit)
+@@ -441,7 +468,7 @@ def ship(extractor, commit, debug):
+ # This is where we apply filtering
+ if extractor.filtercmd:
+ cmd = '%s %s' % (shellquote(extractor.filtercmd),
+- shellquote(json.dumps(metadata.__dict__)))
++ shellquote(json.dumps(metadata.__dict__)))
+ data = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE).stdout.read()
+ try:
+ metadata.__dict__.update(json.loads(data))
+@@ -466,10 +493,10 @@ def ship(extractor, commit, debug):
+ # purposes the commit text is more important. If it's still too long
+ # there's nothing much can be done other than ship it expecting the IRC
+ # server to truncate.
+- privmsg = unicode(metadata)
++ privmsg = string_type(metadata)
+ if len(privmsg) > 510:
+ metadata.files = ""
+- privmsg = unicode(metadata)
++ privmsg = string_type(metadata)
+
+ # Anti-spamming guard. It's deliberate that we get maxchannels not from
+ # the user-filtered metadata but from the extractor data - means repo
+@@ -481,7 +508,7 @@ def ship(extractor, commit, debug):
+ # Ready to ship.
+ message = json.dumps({"to": channels, "privmsg": privmsg})
+ if debug:
+- print message
++ print(message)
+ elif channels:
+ try:
+ if extractor.email:
+@@ -503,16 +530,16 @@ Subject: irker json
+ try:
+ sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+ sock.connect((extractor.server or default_server, IRKER_PORT))
+- sock.sendall(message + "\n")
++ sock.sendall(convert_message(message))
+ finally:
+ sock.close()
+ else:
+ try:
+ sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
+- sock.sendto(message + "\n", (extractor.server or default_server, IRKER_PORT))
++ sock.sendto(convert_message(message), (extractor.server or default_server, IRKER_PORT))
+ finally:
+ sock.close()
+- except socket.error, e:
++ except socket.error as e:
+ sys.stderr.write("%s\n" % e)
+
+ if __name__ == "__main__":
+@@ -523,7 +550,7 @@ if __name__ == "__main__":
+ if arg == '-n':
+ notify = False
+ elif arg == '-V':
+- print "irkerhook.py: version", version
++ print("irkerhook.py: version", version)
+ sys.exit(0)
+ elif arg.startswith("--repository="):
+ repository = arg[13:]
+diff --git a/irkerhook.xml b/irkerhook.xml
+index efb4bc1..2160166 100644
+--- a/irkerhook.xml
++++ b/irkerhook.xml
+@@ -174,6 +174,9 @@ are available as %() substitutions.</para>
+ </varlistentry>
+ </variablelist>
+
++<para>irkerhook.py will run under both python 2 and python 3, but it does
++not support mercurial repositories under python 3 yet.</para>
++
+ <refsect2 id="git"><title>git</title>
+
+ <para>Under git, the normal way to invoke this hook (from within the
diff --git a/debian/patches/0012-Drop-sorted-from-event_handler.patch b/debian/patches/0012-Drop-sorted-from-event_handler.patch
new file mode 100644
index 0000000..3d8c20d
--- /dev/null
+++ b/debian/patches/0012-Drop-sorted-from-event_handler.patch
@@ -0,0 +1,25 @@
+From: Neil Muller <drnlmuller+debian@gmail.com>
+Date: Sun, 13 May 2018 15:14:57 +0200
+Subject: Drop sorted() from event_handler.
+
+This allows irkerd to run correctly under python 3.
+
+Forwarded: https://gitlab.com/esr/irker/merge_requests/18
+Patch-Name: 0012-fix-irkerd-sorted.patch
+---
+ irkerd | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/irkerd b/irkerd
+index 24abf08..2eca1d9 100755
+--- a/irkerd
++++ b/irkerd
+@@ -197,7 +197,7 @@ class IRCClient():
+ def handle_event(self, connection, event):
+ with self.mutex:
+ h = self.event_handlers
+- th = sorted(h.get("all_events", []) + h.get(event.type, []))
++ th = h.get("all_events", []) + h.get(event.type, [])
+ for handler in th:
+ handler(connection, event)
+
diff --git a/debian/patches/0013-Fix-incorrect-name-in-Makefile.patch b/debian/patches/0013-Fix-incorrect-name-in-Makefile.patch
new file mode 100644
index 0000000..57b08e0
--- /dev/null
+++ b/debian/patches/0013-Fix-incorrect-name-in-Makefile.patch
@@ -0,0 +1,23 @@
+From: Neil Muller <drnlmuller+debian@gmail.com>
+Date: Sun, 13 May 2018 15:20:45 +0200
+Subject: Fix incorrect name in Makefile.
+
+Forwarded: https://gitlab.com/esr/irker/merge_requests/17
+Patch-Name: 0013-fix-wrong-name-in-makefile
+---
+ Makefile | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Makefile b/Makefile
+index fc6ac7f..6bd2052 100644
+--- a/Makefile
++++ b/Makefile
+@@ -24,7 +24,7 @@ irkerhook.html: irkerhook.xml
+ irk.1: irk.xml
+ xmlto man irk.xml
+ irk.html: irk.xml
+- xmlto html-nochunks irkerhook.xml
++ xmlto html-nochunks irk.xml
+
+ install.html: install.txt
+ asciidoc -o install.html install.txt
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..5f7c665
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1,11 @@
+0001-dfsg.patch
+0005-author-name.patch
+0006-alias-service.patch
+0007-irkerhook-git.patch
+0008-user-service.patch
+0009-env-service.patch
+0010-fix_ioerror_exception.patch
+0011-Update-irkerhook.py-to-work-under-python-3.patch
+0012-Drop-sorted-from-event_handler.patch
+0013-Fix-incorrect-name-in-Makefile.patch
+0011-Import-upstream-tweaks-to-irkerd.service.patch