From de4890c8a0c829185f5d3093463ce6abbc550f95 Mon Sep 17 00:00:00 2001 From: Manuel Friedli Date: Mon, 9 Sep 2013 08:33:50 +0000 Subject: [PATCH] add patched version for twisted-12.3 --- net-im/pymsn-t/Manifest | 9 ++ .../files/pymsn-t-0.11.3-delete-reactor.patch | 10 ++ .../pymsn-t-0.11.3-protocol-version.patch | 12 ++ .../files/pymsn-t-0.11.3-remove-pid.patch | 41 +++++ ...ymsn-t-0.11.3-twisted-12.3-daemonize.patch | 11 ++ .../files/pymsn-t-0.11.3-unexpected-xfr.patch | 44 ++++++ ...-t-0.11.3-use-non-deprecated-hashlib.patch | 142 ++++++++++++++++++ net-im/pymsn-t/files/pymsn-t-initd | 23 +++ net-im/pymsn-t/pymsn-t-0.11.3-r3.ebuild | 79 ++++++++++ 9 files changed, 371 insertions(+) create mode 100644 net-im/pymsn-t/Manifest create mode 100644 net-im/pymsn-t/files/pymsn-t-0.11.3-delete-reactor.patch create mode 100644 net-im/pymsn-t/files/pymsn-t-0.11.3-protocol-version.patch create mode 100644 net-im/pymsn-t/files/pymsn-t-0.11.3-remove-pid.patch create mode 100644 net-im/pymsn-t/files/pymsn-t-0.11.3-twisted-12.3-daemonize.patch create mode 100644 net-im/pymsn-t/files/pymsn-t-0.11.3-unexpected-xfr.patch create mode 100644 net-im/pymsn-t/files/pymsn-t-0.11.3-use-non-deprecated-hashlib.patch create mode 100644 net-im/pymsn-t/files/pymsn-t-initd create mode 100644 net-im/pymsn-t/pymsn-t-0.11.3-r3.ebuild diff --git a/net-im/pymsn-t/Manifest b/net-im/pymsn-t/Manifest new file mode 100644 index 0000000..ce3d35a --- /dev/null +++ b/net-im/pymsn-t/Manifest @@ -0,0 +1,9 @@ +AUX pymsn-t-0.11.3-delete-reactor.patch 361 SHA256 d989d06d9e94f1a2786dfa51e1cf715e4dc0db95583b08ce606b555aef017bae SHA512 5d94633a614138d760bea4447038d99e7177eb96d44d00b2a496c0773dace54780eb0050b9f179bb5039cbf8b26be67462ac5acd631aac856f4e88393ac40755 WHIRLPOOL 7f326b8e2fd0379144b4d44a2d0fd5b6fd7b2ead06da22726c17d1b93336d4d914835fe7c12e754475f9847891b2d91a7db16f32cf1ccc0eb4362e54b2bffbe1 +AUX pymsn-t-0.11.3-protocol-version.patch 609 SHA256 008aedc95f1c2020a156d941c74784ca1385f12426342885fa7ff8474365b5a3 SHA512 ea5b4956d4b848f8d637b36069e2bec0b6bfdba94aabcaecf83388d2806ec740b789440f00dff93e3b091379c8bf3953268f4fd94a86c211bb48a4fa2fd9174e WHIRLPOOL 6cdb67433e196201db21877b0c3431fc97feaf61f61e3491df6986fe3467d657c5da8bfdb51cdf81429b6fb21e18dc833984e8d74c6382d5a69033e8a51a6270 +AUX pymsn-t-0.11.3-remove-pid.patch 1173 SHA256 b4a09f2af01f752a2703d14204cb954a0641afedb1be391f1b9f6f980b234845 SHA512 b151e827b62e49b4d91966a2019d26cad8076a335dd263a3bb00f13b8bfb4bddcf9c5f7d0683d14a967e67f469ad2ff540b10c2c1ffc4f8ebef94a4feb26e0d5 WHIRLPOOL 56a1c85f9d78e3171484a17de8eb0e2151e42aecb43f282c8c097f09912ceaecb3b99bc3ef9776409b798a27ba09c85ab9b0237b2494a51c1ca90f6edf710e16 +AUX pymsn-t-0.11.3-twisted-12.3-daemonize.patch 324 SHA256 770e860d6224ceb8c65299928b14767d1966155685d895cc04d2b31c9f7544fd SHA512 08b8d8d4efc1b7c6213bc49173246401b8186d46cb6081cc9793e1a2eed204546c1753608875d1a605805fd832623989ba1cdac2cc178cab124bcff6fc9ffe8e WHIRLPOOL fc508c9706d9fd479479f1b4fc7e2bc9419da85ef27bbb125fc4e32201a28a20d3c1996b3ff98eeac32764a1f152800c479afd051731521bd4ea1b2bb006ae35 +AUX pymsn-t-0.11.3-unexpected-xfr.patch 1984 SHA256 0407e9e69684275b11d404e77e9b70e694e461d4c9891ee3c7d79717999a84e9 SHA512 5ab2b6a577ff835338724add6befb4394a2f85ba521a3dad543d501980ef3b7cb1a930a966b2b898166e7473972da624d683072f2e3f687991e07ebaa4157195 WHIRLPOOL c9323c1c51776e4e0d8fc6b18d635c693ee0a7825bb624d0d41532819862a1553501655360b682ac1c0b4eb1004cc5564b7267f4cb4435f0fc7db8c81a2268e6 +AUX pymsn-t-0.11.3-use-non-deprecated-hashlib.patch 4605 SHA256 12004937d29e090e147ddd8f7aa5ae7e615a5df27c4db6a7b28824859937dd27 SHA512 7ec0f9f4c111ab2a43b9bf4ad1a5cb1b07174d0e3063cdbe86961a72a535c231d5f3f972b43e492afa8ebc7af32d27884d40a39a8a227187f3bf5cadb17272b6 WHIRLPOOL f51aad356f9350bfb47ec88b4447c63345d0ff01ae91ab587182bec60398e1b26bbb3e6cdf6b90036dea620fabc4a732de4408bb16c0cdd80c6197667a1e56b8 +AUX pymsn-t-initd 670 SHA256 557dc37a1c51b03188623e3b4fd0329eea87ee4428bb397439359656daa3d431 SHA512 683089271c42556db2e2b817ad469a1a4b1ebd687279233178f28f56c542f00a4679fd8cd9430664c9bdd2e670e4f86f5682a6cf7621a31b773254043c6e8f27 WHIRLPOOL acdda704c13bb71fecd97f4e49ce242f285c269a7ff9ad590a4b3157a4739420985e44824a31ed345a0a3bc6d41b27d6a25883c1ff730c4d26caacfd8896fb3c +DIST pymsnt-0.11.3.tar.gz 162549 SHA256 777195feb6a70b683d691c54269099d319747fad7195cca36d86df366360ce2c SHA512 57ed58c51ddaceb877e22c0703f59299fd1e75add6de9b6d937025a12f9ea669c24c8de70a5995500101a0537dd3549676df475d87df63ec29d6c773a2a31563 WHIRLPOOL f5af4d65f6e8d193ecef07739c29b30e841f4f7fb32c972a9c58e6550700da3c0ae3fdfa3bb9d077e7369b05f0582ab305f76c593c6457d43fa5455caa7386bb +EBUILD pymsn-t-0.11.3-r3.ebuild 2132 SHA256 59a70aaf53039c15d17125bdac55dd796528ffc08ebc14c629263dc3b8153a0b SHA512 5264473f449b4e7942602e6a5de4c17b739ad249ed8f0b0b15d6bb62df66fc5e8496ca6e1b4259eebd2b0e78b7122d804bc837a42673b7ca91323f943075279d WHIRLPOOL 21940c6569a539c0518cc70c4e0d191e47ba0aa2706856590d70104939364b94ff227bbf60d29d5673e7efbb317af1e0eb37674c5cc8bb80424c2d93bc468509 diff --git a/net-im/pymsn-t/files/pymsn-t-0.11.3-delete-reactor.patch b/net-im/pymsn-t/files/pymsn-t-0.11.3-delete-reactor.patch new file mode 100644 index 0000000..19ad24f --- /dev/null +++ b/net-im/pymsn-t/files/pymsn-t-0.11.3-delete-reactor.patch @@ -0,0 +1,10 @@ +--- pymsn-t/src/main.py 2008-09-19 10:53:30.000000000 +0200 ++++ pymsn-t/src/main.py 2008-09-19 10:55:55.000000000 +0200 +@@ -72,7 +72,6 @@ + + if config.reactor: + # They picked their own reactor. Lets install it. +- del sys.modules["twisted.internet.reactor"] + if config.reactor == "epoll": + from twisted.internet import epollreactor + epollreactor.install() diff --git a/net-im/pymsn-t/files/pymsn-t-0.11.3-protocol-version.patch b/net-im/pymsn-t/files/pymsn-t-0.11.3-protocol-version.patch new file mode 100644 index 0000000..ffb6ae8 --- /dev/null +++ b/net-im/pymsn-t/files/pymsn-t-0.11.3-protocol-version.patch @@ -0,0 +1,12 @@ +diff -a -u -d -r pymsnt.a/src/legacy/msn/msn.py pymsnt.b/src/legacy/msn/msn.py +--- pymsnt.a/src/legacy/msn/msn.py 2008-02-08 16:55:07.000000000 +0300 ++++ pymsnt.b/src/legacy/msn/msn.py 2008-08-05 20:40:46.000000000 +0400 +@@ -110,7 +110,7 @@ + from urllib import quote, unquote + + +-MSN_PROTOCOL_VERSION = "MSNP11 CVR0" # protocol version ++MSN_PROTOCOL_VERSION = "MSNP11" # protocol version + MSN_PORT = 1863 # default dispatch server port + MSN_MAX_MESSAGE = 1664 # max message length + MSN_CVR_STR = "0x040c winnt 5.1 i386 MSNMSGR 7.0.0777 msmsgs" diff --git a/net-im/pymsn-t/files/pymsn-t-0.11.3-remove-pid.patch b/net-im/pymsn-t/files/pymsn-t-0.11.3-remove-pid.patch new file mode 100644 index 0000000..fb85d04 --- /dev/null +++ b/net-im/pymsn-t/files/pymsn-t-0.11.3-remove-pid.patch @@ -0,0 +1,41 @@ +--- pymsn-t/src/main.py 2008-04-04 17:45:43.000000000 +0400 ++++ pymsn-t/src/main.py 2008-08-05 17:44:17.000000000 +0400 +@@ -91,6 +91,7 @@ + from twisted.words.xish.domish import Element + from twisted.words.protocols.jabber import component + from twisted.words.protocols.jabber.jid import internJID ++from twisted.python import log + + from debug import LogEvent, INFO, WARN, ERROR + +@@ -352,13 +353,29 @@ + pf = open(config.pid, "w") + pf.write("%s\n" % pid) + pf.close() ++ ++ def removePID(self, pidfile): ++ # Remove a PID file ++ if not pidfile: ++ return ++ try: ++ os.unlink(pidfile) ++ except OSError, e: ++ if e.errno == errno.EACCES or e.errno == errno.EPERM: ++ log.msg("Warning: No permission to delete pid file") ++ else: ++ log.msg("Failed to unlink PID file:") ++ log.deferr() ++ except: ++ log.msg("Failed to unlink PID file:") ++ log.deferr() + + def shuttingDown(self): + self.transportSvc.removeMe() + # Keep the transport running for another 3 seconds + def cb(ignored=None): + if config.pid: +- twistd.removePID(config.pid) ++ self.removePID(config.pid) + d = Deferred() + d.addCallback(cb) + reactor.callLater(3.0, d.callback, None) diff --git a/net-im/pymsn-t/files/pymsn-t-0.11.3-twisted-12.3-daemonize.patch b/net-im/pymsn-t/files/pymsn-t-0.11.3-twisted-12.3-daemonize.patch new file mode 100644 index 0000000..705150a --- /dev/null +++ b/net-im/pymsn-t/files/pymsn-t-0.11.3-twisted-12.3-daemonize.patch @@ -0,0 +1,11 @@ +--- src/main.py~ 2008-02-08 14:55:07.000000000 +0100 ++++ src/main.py 2013-09-09 10:29:35.003933282 +0200 +@@ -328,7 +328,7 @@ + + # Daemonise the process and write the PID file + if config.background and os.name == "posix": +- twistd.daemonize() ++ twistd.daemonize(reactor, os) + if config.pid: + self.writePID() + diff --git a/net-im/pymsn-t/files/pymsn-t-0.11.3-unexpected-xfr.patch b/net-im/pymsn-t/files/pymsn-t-0.11.3-unexpected-xfr.patch new file mode 100644 index 0000000..7d93d97 --- /dev/null +++ b/net-im/pymsn-t/files/pymsn-t-0.11.3-unexpected-xfr.patch @@ -0,0 +1,44 @@ +--- pymsn-t/src/legacy/glue.py 2008-09-19 10:53:30.000000000 +0200 ++++ pymsn-t/src/legacy/glue.py 2008-09-19 10:52:38.000000000 +0200 +@@ -379,7 +379,13 @@ + self.session.removeMe() + + def connectionLost(self, reason): +- LogEvent(INFO, self.jabberID) ++ LogEvent(INFO, self.jabberID) ++ # If we got a second referral, don't really log out but let the next NS ++ # try to log us in ++ if reason.type == error.ConnectionDone and self.gotadditionalXFR != 0: ++ LogEvent(INFO, self.ident) ++ self.gotadditionalXFR = 0 ++ return + if reason.type != error.ConnectionDone: + text = lang.get(self.session.lang).msnDisconnected % reason + self.session.sendMessage(to=self.jabberID, fro=config.jid, body=text) +--- pymsn-t/src/legacy/msn/msn.py 2008-09-19 10:53:30.000000000 +0200 ++++ pymsn-t/src/legacy/msn/msn.py 2008-09-19 10:52:38.000000000 +0200 +@@ -1347,7 +1347,9 @@ + port = MSN_PORT + + if not self._fireCallback(id, host, int(port), params[4]): +- raise MSNProtocolError, "Got XFR (referral) that I didn't ask for .. should this happen?" # debug ++ #raise MSNProtocolError, "Got XFR (referral) that I didn't ask for .. should this happen?" # debug ++ self.factory.msncon.gotadditionalXFR = 1 ++ self.factory.msncon.connectors.append(reactor.connectTCP(host, int(port), self.factory, bindAddress=(self.factory.msncon.BINDADDRESS, 0))) + + def handle_RNG(self, params): + checkParamLen(len(params), 6, 'RNG') +--- pymsn-t/src/legacy/msn/msnw.py 2008-09-19 10:53:30.000000000 +0200 ++++ pymsn-t/src/legacy/msn/msnw.py 2008-09-19 10:52:38.000000000 +0200 +@@ -67,8 +67,9 @@ + LogEvent(INFO, self.ident) + + def _gotNotificationReferral(self, (host, port)): +- self.timeout.cancel() +- self.timeout = None ++ if self.timeout != None: ++ self.timeout.cancel() ++ self.timeout = None + # Create the NotificationClient + self.notificationFactory = msn.NotificationFactory() + self.notificationFactory.userHandle = self.username diff --git a/net-im/pymsn-t/files/pymsn-t-0.11.3-use-non-deprecated-hashlib.patch b/net-im/pymsn-t/files/pymsn-t-0.11.3-use-non-deprecated-hashlib.patch new file mode 100644 index 0000000..a45b110 --- /dev/null +++ b/net-im/pymsn-t/files/pymsn-t-0.11.3-use-non-deprecated-hashlib.patch @@ -0,0 +1,142 @@ +diff -Naur pymsnt-0.11.3/src/avatar.py pymsnt-0.11.3-1/src/avatar.py +--- pymsnt-0.11.3/src/avatar.py 2008-02-08 14:55:07.000000000 +0100 ++++ pymsnt-0.11.3-1/src/avatar.py 2011-09-04 13:40:02.350321866 +0200 +@@ -6,7 +6,12 @@ + from twisted.internet import reactor + from twisted.words.xish.domish import Element + +-import sha, base64, os, os.path ++import base64, os, os.path ++ ++try: ++ from hashlib import sha1 ++except ImportError: ++ from sha import sha as sha1 + + import utils + import config +@@ -34,7 +39,7 @@ + class Avatar: + """ Represents an Avatar. Does not store the image in memory. """ + def __init__(self, imageData, avatarCache): +- self.__imageHash = sha.sha(imageData).hexdigest() ++ self.__imageHash = sha1(imageData).hexdigest() + self.__avatarCache = avatarCache + + def getImageHash(self): +diff -Naur pymsnt-0.11.3/src/legacy/msn/msnp11chl.py pymsnt-0.11.3-1/src/legacy/msn/msnp11chl.py +--- pymsnt-0.11.3/src/legacy/msn/msnp11chl.py 2008-02-08 14:55:07.000000000 +0100 ++++ pymsnt-0.11.3-1/src/legacy/msn/msnp11chl.py 2011-09-04 13:40:02.351321854 +0200 +@@ -1,16 +1,20 @@ + # Copyright 2005 James Bunton + # Licensed for distribution under the GPL version 2, check COPYING for details + +-import md5 + import struct + ++try: ++ from hashlib import md5 ++except ImportError: ++ from md5 import md5 ++ + MSNP11_PRODUCT_ID = "PROD0090YUAUV{2B" + MSNP11_PRODUCT_KEY = "YMM8C_H7KCQ2S_KL" + MSNP11_MAGIC_NUM = 0x0E79A9C1 + + + def doChallenge(chlData): +- md5digest = md5.md5(chlData + MSNP11_PRODUCT_KEY).digest() ++ md5digest = md5(chlData + MSNP11_PRODUCT_KEY).digest() + + # Make array of md5 string ints + md5Ints = struct.unpack(" + # Licensed for distribution under the GPL version 2, check COPYING for details + ++try: ++ from hashlib import sha1 ++except ImportError: ++ from sha import sha as sha1 + ++def socks5Hash(sid, initiator, target): ++ return sha1("%s%s%s" % (sid, initiator, target)).hexdigest() + + def getLang(el): + return el.getAttribute((u'http://www.w3.org/XML/1998/namespace', u'lang')) + +- +-import sha +-def socks5Hash(sid, initiator, target): +- return sha.new("%s%s%s" % (sid, initiator, target)).hexdigest() +- +- + import urllib + import os.path + def getURLBits(url, assumedType=None): +diff -Naur pymsnt-0.11.3/src/xdb.py pymsnt-0.11.3-1/src/xdb.py +--- pymsnt-0.11.3/src/xdb.py 2008-02-08 14:55:07.000000000 +0100 ++++ pymsnt-0.11.3-1/src/xdb.py 2011-09-04 13:40:02.351321854 +0200 +@@ -6,9 +6,13 @@ + import os + import os.path + import shutil +-import md5 + import config + ++try: ++ from hashlib import md5 ++except ImportError: ++ from md5 import md5 ++ + X = os.path.sep + SPOOL_UMASK = 0077 + +@@ -23,7 +27,7 @@ + return file.replace("@", "%") + + def makeHash(file): +- return md5.md5(file).hexdigest()[0:3] ++ return md5(file).hexdigest()[0:3] + + + class XDB: diff --git a/net-im/pymsn-t/files/pymsn-t-initd b/net-im/pymsn-t/files/pymsn-t-initd new file mode 100644 index 0000000..7a04be0 --- /dev/null +++ b/net-im/pymsn-t/files/pymsn-t-initd @@ -0,0 +1,23 @@ +#!/sbin/runscript +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-im/pymsn-t/files/pymsn-t-initd,v 1.1 2011/09/04 10:26:35 hanno Exp $ + +depend() { + need net + use jabber-server +} + +start() { + ebegin "Starting MSN Jabber Transport" + start-stop-daemon --start --pidfile /var/run/jabber/pymsn-t.pid -u jabber -g jabber \ + --exec /usr/bin/python INSPATH/pymsn-t.py -- \ + -b -c /etc/jabber/pymsn-t.xml -l /var/log/jabber/pymsn-t.log + eend $? +} + +stop() { + ebegin "Stopping MSN Jabber Transport" + start-stop-daemon --stop --quiet --pidfile /var/run/jabber/pymsn-t.pid + eend $? +} diff --git a/net-im/pymsn-t/pymsn-t-0.11.3-r3.ebuild b/net-im/pymsn-t/pymsn-t-0.11.3-r3.ebuild new file mode 100644 index 0000000..7228282 --- /dev/null +++ b/net-im/pymsn-t/pymsn-t-0.11.3-r3.ebuild @@ -0,0 +1,79 @@ +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-im/pymsn-t/pymsn-t-0.11.3-r3.ebuild,v 1.5 2013/08/03 09:45:38 mgorny Exp $ + +EAPI="3" +PYTHON_DEPEND="2" + +inherit eutils multilib python + +MY_PN="pymsnt" +S=${WORKDIR}/${MY_PN}-${PV} +DESCRIPTION="Python based jabber transport for MSN" +HOMEPAGE="http://msn-transport.jabberstudio.org/" +SRC_URI="http://msn-transport.jabberstudio.org/tarballs/${MY_PN}-${PV}.tar.gz" +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="amd64 ~ppc x86" +IUSE="" + +DEPEND="net-im/jabber-base" +RDEPEND="${DEPEND} + >=dev-python/twisted-core-2.5.0 + >=dev-python/twisted-words-0.5.0 + >=dev-python/twisted-web-0.7.0 + >=dev-python/imaging-1.1" + +pkg_setup() { + python_set_active_version 2 + python_pkg_setup +} + +src_prepare() { + epatch "${FILESDIR}/${P}-protocol-version.patch" + epatch "${FILESDIR}/${P}-unexpected-xfr.patch" + epatch "${FILESDIR}/${P}-remove-pid.patch" + epatch "${FILESDIR}/${P}-delete-reactor.patch" + epatch "${FILESDIR}/${P}-use-non-deprecated-hashlib.patch" + epatch "${FILESDIR}/${P}-twisted-12.3-daemonize.patch" +} + +src_install() { + local inspath + + inspath=$(python_get_sitedir)/${PN} + insinto ${inspath} + doins -r data src + newins PyMSNt.py ${PN}.py + + insinto /etc/jabber + newins config-example.xml ${PN}.xml + fperms 600 /etc/jabber/${PN}.xml + fowners jabber:jabber /etc/jabber/${PN}.xml + dosed \ + "s::/var/spool/jabber:" \ + /etc/jabber/${PN}.xml + dosed \ + "s:[^\<]*:/var/run/jabber/${PN}.pid:" \ + /etc/jabber/${PN}.xml + dosed \ + "s:[^\<]*:example.org:" \ + /etc/jabber/${PN}.xml + dosed \ + "s:msn:msn.example.org:" \ + /etc/jabber/${PN}.xml + + newinitd "${FILESDIR}/${PN}-initd" ${PN} + dosed "s:INSPATH:${inspath}:" /etc/init.d/${PN} +} + +pkg_postinst() { + python_mod_optimize ${PN} + + elog "A sample configuration file has been installed in /etc/jabber/${PN}.xml." + elog "Please edit it and the configuration of your Jabber server to match." +} + +pkg_postrm() { + python_mod_cleanup ${PN} +}