summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHanno Böck <hanno@gentoo.org>2011-09-04 10:26:35 +0000
committerHanno Böck <hanno@gentoo.org>2011-09-04 10:26:35 +0000
commit1423fc670a4a8bb50d5009349e6fb1a226d4922a (patch)
tree8b02a772445508e07e3a81b7e3c334ef71996f5f /net-im/pymsn-t
parentfix bug reference (diff)
downloadgentoo-2-1423fc670a4a8bb50d5009349e6fb1a226d4922a.tar.gz
gentoo-2-1423fc670a4a8bb50d5009349e6fb1a226d4922a.tar.bz2
gentoo-2-1423fc670a4a8bb50d5009349e6fb1a226d4922a.zip
pymsn-t: fix deprecations in python and init-script, port to eapi 3
(Portage version: 2.1.10.13/cvs/Linux x86_64)
Diffstat (limited to 'net-im/pymsn-t')
-rw-r--r--net-im/pymsn-t/ChangeLog11
-rw-r--r--net-im/pymsn-t/files/pymsn-t-0.11.3-use-non-deprecated-hashlib.patch163
-rw-r--r--net-im/pymsn-t/files/pymsn-t-initd23
-rw-r--r--net-im/pymsn-t/pymsn-t-0.11.3-r3.ebuild72
4 files changed, 267 insertions, 2 deletions
diff --git a/net-im/pymsn-t/ChangeLog b/net-im/pymsn-t/ChangeLog
index 47cc7eb0a5dc..ab8c357bcd20 100644
--- a/net-im/pymsn-t/ChangeLog
+++ b/net-im/pymsn-t/ChangeLog
@@ -1,6 +1,13 @@
# ChangeLog for net-im/pymsn-t
-# Copyright 1999-2010 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/net-im/pymsn-t/ChangeLog,v 1.20 2010/07/06 16:08:47 arfrever Exp $
+# Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/net-im/pymsn-t/ChangeLog,v 1.21 2011/09/04 10:26:35 hanno Exp $
+
+*pymsn-t-0.11.3-r3 (04 Sep 2011)
+
+ 04 Sep 2011; Hanno Boeck <hanno@gentoo.org> +pymsn-t-0.11.3-r3.ebuild,
+ +files/pymsn-t-0.11.3-use-non-deprecated-hashlib.patch, +files/pymsn-t-initd:
+ Add patch for python 2.6/2.7 warnings, remove deprecated chuid from init
+ script, port to EAPI 3.
06 Jul 2010; Arfrever Frehtes Taifersar Arahesis <arfrever@gentoo.org>
pymsn-t-0.11.3.ebuild, pymsn-t-0.11.3-r1.ebuild, pymsn-t-0.11.3-r2.ebuild:
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 000000000000..f02d83fff08c
--- /dev/null
+++ b/net-im/pymsn-t/files/pymsn-t-0.11.3-use-non-deprecated-hashlib.patch
@@ -0,0 +1,163 @@
+From 87d6eac62671152c318ea2cb839a748b06723ee2 Mon Sep 17 00:00:00 2001
+From: Matthew W. S. Bell <matthew@bells23.org.uk>
+Date: Sat, 12 Feb 2011 19:44:18 +0000
+Subject: [PATCH 2/4] Use newer (non-deprecataed) hashlib module, if available.
+
+---
+ src/avatar.py | 9 +++++++--
+ src/legacy/msn/msn.py | 11 +++++++----
+ src/legacy/msn/msnp11chl.py | 8 ++++++--
+ src/utils.py | 12 ++++++------
+ src/xdb.py | 8 ++++++--
+ 5 files changed, 32 insertions(+), 16 deletions(-)
+
+diff --git a/src/avatar.py b/src/avatar.py
+index b9f7dfc..3aa0a3c 100644
+--- a/src/avatar.py
++++ b/src/avatar.py
+@@ -6,7 +6,12 @@ from debug import LogEvent, INFO, WARN, ERROR
+ 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 @@ def parsePhotoEl(photo):
+ 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 --git a/src/legacy/msn/msn.py b/src/legacy/msn/msn.py
+index cd36aa8..e27e973 100644
+--- a/src/legacy/msn/msn.py
++++ b/src/legacy/msn/msn.py
+@@ -106,9 +106,12 @@ from twisted.words.xish.domish import parseText, unescapeFromXml
+
+
+ # System imports
+-import types, operator, os, sys, base64, random, struct, random, sha, base64, StringIO, array, codecs, binascii
++import types, operator, os, sys, base64, random, struct, random, base64, StringIO, array, codecs, binascii
+ from urllib import quote, unquote
+-
++try:
++ from hashlib import sha1
++except ImportError:
++ from sha import sha as sha1
+
+ MSN_PROTOCOL_VERSION = "MSNP11" # protocol version
+ MSN_PORT = 1863 # default dispatch server port
+@@ -490,7 +493,7 @@ class MSNObject:
+ self.type = 3
+ self.location = "TMP" + str(random.randint(1000,9999))
+ self.friendly = "AAA="
+- self.sha1d = b64enc(sha.sha(imageData).digest())
++ self.sha1d = b64enc(sha1(imageData).digest())
+ self.makeText()
+
+ def setNull(self):
+@@ -518,7 +521,7 @@ class MSNObject:
+ h.append(self.friendly)
+ h.append("SHA1D")
+ h.append(self.sha1d)
+- sha1c = b64enc(sha.sha("".join(h)).digest())
++ sha1c = b64enc(sha1("".join(h)).digest())
+ self.text = '<msnobj Creator="%s" Size="%s" Type="%s" Location="%s" Friendly="%s" SHA1D="%s" SHA1C="%s"/>' % (self.creator, str(self.size), str(self.type), self.location, self.friendly, self.sha1d, sha1c)
+
+ def parse(self, s):
+diff --git a/src/legacy/msn/msnp11chl.py b/src/legacy/msn/msnp11chl.py
+index bbf4c4d..9368df0 100644
+--- a/src/legacy/msn/msnp11chl.py
++++ b/src/legacy/msn/msnp11chl.py
+@@ -1,16 +1,20 @@
+ # Copyright 2005 James Bunton <james@delx.cjb.net>
+ # 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("<llll", md5digest)
+diff --git a/src/utils.py b/src/utils.py
+index cb73ea3..88110ae 100644
+--- a/src/utils.py
++++ b/src/utils.py
+@@ -1,17 +1,17 @@
+ # Copyright 2004-2005 James Bunton <james@delx.cjb.net>
+ # 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 --git a/src/xdb.py b/src/xdb.py
+index a3e3b5d..bd48582 100644
+--- a/src/xdb.py
++++ b/src/xdb.py
+@@ -6,9 +6,13 @@ from debug import LogEvent, INFO, WARN
+ 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 @@ def mangle(file):
+ return file.replace("@", "%")
+
+ def makeHash(file):
+- return md5.md5(file).hexdigest()[0:3]
++ return md5(file).hexdigest()[0:3]
+
+
+ class XDB:
+--
+1.7.2.3
+
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 000000000000..7a04be03d3a5
--- /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 000000000000..2f1a18fdd9db
--- /dev/null
+++ b/net-im/pymsn-t/pymsn-t-0.11.3-r3.ebuild
@@ -0,0 +1,72 @@
+# 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/pymsn-t-0.11.3-r3.ebuild,v 1.1 2011/09/04 10:26:35 hanno Exp $
+
+EAPI="3"
+
+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-2.5.0
+ >=dev-python/twisted-words-0.5.0
+ >=dev-python/twisted-web-0.7.0
+ >=dev-python/imaging-1.1"
+
+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"
+}
+
+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:<!-- <spooldir>[^\<]*</spooldir> -->:<spooldir>/var/spool/jabber</spooldir>:" \
+ /etc/jabber/${PN}.xml
+ dosed \
+ "s:<pid>[^\<]*</pid>:<pid>/var/run/jabber/${PN}.pid</pid>:" \
+ /etc/jabber/${PN}.xml
+ dosed \
+ "s:<host>[^\<]*</host>:<host>example.org</host>:" \
+ /etc/jabber/${PN}.xml
+ dosed \
+ "s:<jid>msn</jid>:<jid>msn.example.org</jid>:" \
+ /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}
+}