summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlastair Tse <liquidx@gentoo.org>2006-02-06 22:25:05 +0000
committerAlastair Tse <liquidx@gentoo.org>2006-02-06 22:25:05 +0000
commitbf4889bf73367eb586d6204813cb99ba95703e93 (patch)
tree647a712573628593f2aa0a08a870cfdb5abc0e16 /dev-python/pyzor
parentAdd patches from debian (diff)
downloadhistorical-bf4889bf73367eb586d6204813cb99ba95703e93.tar.gz
historical-bf4889bf73367eb586d6204813cb99ba95703e93.tar.bz2
historical-bf4889bf73367eb586d6204813cb99ba95703e93.zip
including patches that are apparently essential for this to even work. (#120370)
Package-Manager: portage-2.1_pre3-r1
Diffstat (limited to 'dev-python/pyzor')
-rw-r--r--dev-python/pyzor/ChangeLog10
-rw-r--r--dev-python/pyzor/Manifest27
-rw-r--r--dev-python/pyzor/files/debian_mbox.patch373
-rw-r--r--dev-python/pyzor/files/digest-pyzor-0.4.0-r21
-rw-r--r--dev-python/pyzor/files/handle_unknown_encodings.patch96
-rw-r--r--dev-python/pyzor/files/unknown_type.patch12
-rw-r--r--dev-python/pyzor/pyzor-0.4.0-r2.ebuild39
7 files changed, 540 insertions, 18 deletions
diff --git a/dev-python/pyzor/ChangeLog b/dev-python/pyzor/ChangeLog
index fd54fba25047..ac8cce794666 100644
--- a/dev-python/pyzor/ChangeLog
+++ b/dev-python/pyzor/ChangeLog
@@ -1,6 +1,14 @@
# ChangeLog for dev-python/pyzor
# Copyright 2002-2006 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/dev-python/pyzor/ChangeLog,v 1.15 2006/01/31 19:34:37 agriffis Exp $
+# $Header: /var/cvsroot/gentoo-x86/dev-python/pyzor/ChangeLog,v 1.16 2006/02/06 22:25:05 liquidx Exp $
+
+*pyzor-0.4.0-r2 (06 Feb 2006)
+
+ 06 Feb 2006; Alastair Tse <liquidx@gentoo.org> +files/debian_mbox.patch,
+ +files/handle_unknown_encodings.patch, +files/unknown_type.patch,
+ +pyzor-0.4.0-r2.ebuild:
+ including patches that are apparently essential for this to even work.
+ (#120370)
31 Jan 2006; Aron Griffis <agriffis@gentoo.org> pyzor-0.4.0-r1.ebuild:
Mark 0.4.0-r1 stable on alpha
diff --git a/dev-python/pyzor/Manifest b/dev-python/pyzor/Manifest
index 5ede0917df7d..469d5ef21b0f 100644
--- a/dev-python/pyzor/Manifest
+++ b/dev-python/pyzor/Manifest
@@ -1,28 +1,21 @@
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
-MD5 64258178170b77e27c83974bad575524 ChangeLog 1750
-RMD160 5ea1980465c414e235aee922c9b6b7e58eab8312 ChangeLog 1750
-SHA256 36e4e6e3122f3f27f72893fbb38c32fb1218eb5e45a2e2e94f22fa22e821e290 ChangeLog 1750
+MD5 36aa6c24d0c37064a602e9816e3f71ea ChangeLog 2035
+MD5 883d7b506158bac65ae416cfbbb30736 files/debian_mbox.patch 11250
MD5 3f779e11cd93d820e75567bf24ab2e37 files/digest-pyzor-0.4.0 63
-RMD160 e67bc32cb016a2bc495f4ab99155ce8957b0110b files/digest-pyzor-0.4.0 63
-SHA256 95d3780ce06a3a1744df3111bd206fda0209bd4c257d7ec5fdac72dfc4c77e93 files/digest-pyzor-0.4.0 63
MD5 3f779e11cd93d820e75567bf24ab2e37 files/digest-pyzor-0.4.0-r1 63
-RMD160 e67bc32cb016a2bc495f4ab99155ce8957b0110b files/digest-pyzor-0.4.0-r1 63
-SHA256 95d3780ce06a3a1744df3111bd206fda0209bd4c257d7ec5fdac72dfc4c77e93 files/digest-pyzor-0.4.0-r1 63
+MD5 3f779e11cd93d820e75567bf24ab2e37 files/digest-pyzor-0.4.0-r2 63
+MD5 82dccdcfa0df0b39e37c784a84c3d1a4 files/handle_unknown_encodings.patch 3216
+MD5 6e1a6983f5565656d563fb0d89bf45a9 files/unknown_type.patch 472
MD5 71c4638c9c88af75b58e5f5cb54fe008 metadata.xml 159
-RMD160 900a8c55d7a7d2f6312594769aaf941bf9e99c7f metadata.xml 159
-SHA256 9f01104d3484792496faff4805eed0ecea2352a897151f3397d49a13800037b4 metadata.xml 159
MD5 27c4e241c491a3ce40991657e49c5a7d pyzor-0.4.0-r1.ebuild 846
-RMD160 a8a8b6a95149efa277884054d4bb020d4a3e1968 pyzor-0.4.0-r1.ebuild 846
-SHA256 87df88ae227a9511a93bb7f70aeaaf34a681c782e4ea669a95b4432efdde114d pyzor-0.4.0-r1.ebuild 846
+MD5 70a5b5d9378db281b30d1c9b7075a725 pyzor-0.4.0-r2.ebuild 1017
MD5 3c170e1cf94bfddbe3588e4b6e231510 pyzor-0.4.0.ebuild 656
-RMD160 cfb0dffbcba45550bce44d3e6da75d1c40b53338 pyzor-0.4.0.ebuild 656
-SHA256 1d73587173c5ab19ef220619d6a2574fbffff43a54d0177ff3f051ad53afc199 pyzor-0.4.0.ebuild 656
-----BEGIN PGP SIGNATURE-----
-Version: GnuPG v1.4.1 (GNU/Linux)
+Version: GnuPG v1.4.2 (GNU/Linux)
-iD8DBQFD4+WXJrHF4yAQTrARAoIrAJ0Y6AfhhUZTfCNe5DSyzCo+7I3BogCgujGP
-urQYLazJABnbOPp7KhPhJMY=
-=Ym/7
+iD4DBQFD58zO9ZFPrqoILX8RAhFYAJ97E0WUt81IRAAngYrwPAco3DEgZwCY0/1n
+bE1S4jGUhHu7+8Ql9g8FpA==
+=oSqO
-----END PGP SIGNATURE-----
diff --git a/dev-python/pyzor/files/debian_mbox.patch b/dev-python/pyzor/files/debian_mbox.patch
new file mode 100644
index 000000000000..fdfb939489df
--- /dev/null
+++ b/dev-python/pyzor/files/debian_mbox.patch
@@ -0,0 +1,373 @@
+--- lib/pyzor/client.py Sun Sep 8 22:37:15 2002
++++ lib/pyzor/client.py Wed Apr 13 17:08:42 2005
+@@ -8,6 +8,7 @@
+ import getopt
+ import tempfile
+ import mimetools
++import multifile
+ import sha
+
+ import pyzor
+@@ -58,11 +57,6 @@
+ self.send(msg, address)
+ return self.read_response(msg.get_thread())
+
+- def shutdown(self, address):
+- msg = ShutdownRequest()
+- self.send(msg, address)
+- return self.read_response(msg.get_thread())
+-
+ def build_socket(self):
+ self.socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
+
+@@ -132,39 +126,50 @@
+
+ def run(self):
+ debug = 0
+- (options, args) = getopt.getopt(sys.argv[1:], 'dh:', ['homedir='])
+- if len(args) < 1:
+- self.usage()
+-
+ specified_homedir = None
++ options = None
++ log = None
++
++ try:
++ (options, args) = getopt.getopt(sys.argv[1:], 'd', ['homedir=', 'log'])
++ except getopt.GetoptError:
++ self.usage()
++
++ if len(args) < 1:
++ self.usage()
+
+ for (o, v) in options:
+ if o == '-d':
+ debug = 1
+- elif o == '-h':
+- self.usage()
+ elif o == '--homedir':
+ specified_homedir = v
++ elif o == '--log':
++ log = 1
+
+ self.output = Output(debug=debug)
+-
+ homedir = pyzor.get_homedir(specified_homedir)
+-
++
++ if log:
++ sys.stderr = open(homedir + "/pyzor.log", 'a')
++ sys.stderr.write("\npyzor[" + repr (os.getpid()) + "]:\n")
++
+ config = pyzor.Config(homedir)
+ config.add_section('client')
+
+- defaults = {'ServersFile': 'servers',
++ defaults = {'ServersFile': 'servers',
+ 'DiscoverServersURL': ServerList.inform_url,
+- 'AccountsFile' : 'accounts',
++ 'AccountsFile': 'accounts',
++ 'Timeout': str(Client.timeout),
+ }
+
+ for k, v in defaults.items():
+ config.set('client', k, v)
+-
++
+ config.read(os.path.join(homedir, 'config'))
+
+ servers_fn = config.get_filename('client', 'ServersFile')
+-
++ Client.timeout = config.getint('client', 'Timeout')
++
+ if not os.path.exists(homedir):
+ os.mkdir(homedir)
+
+@@ -197,10 +202,13 @@
+ def usage(self, s=None):
+ if s is not None:
+ sys.stderr.write("%s\n" % s)
+- sys.stderr.write("""usage: %s [-d] [--homedir dir] command [cmd_opts]
++ sys.stderr.write("""
++usage: %s [-d] [--homedir dir] command [cmd_opts]
+ command is one of: check, report, discover, ping, digest, predigest,
+- genkey, shutdown
++ genkey
++
+ Data is read on standard input (stdin).
++
+ """
+ % sys.argv[0])
+ sys.exit(2)
+@@ -208,9 +216,9 @@
+
+
+ def ping(self, args):
+- getopt.getopt(args[1:], '')
+-
+- if len(args) > 1:
++ try:
++ getopt.getopt(args[1:], '')
++ except getopt.GetoptError:
+ self.usage("%s does not take any non-option arguments" % args[0])
+
+ runner = ClientRunner(self.client.ping)
+@@ -221,30 +229,23 @@
+ return runner.all_ok
+
+
+- def shutdown(self, args):
+- (opts, args2) = getopt.getopt(args[1:], '')
+-
+- if len(args2) > 1:
++ def info(self, args):
++ try:
++ (options, args2) = getopt.getopt(args[1:], '', ['mbox'])
++ except getopt.GetoptError:
+ self.usage("%s does not take any non-option arguments" % args[0])
+
+- runner = ClientRunner(self.client.shutdown)
++ do_mbox = 'msg'
+
+- for arg in args2:
+- server = Address.from_str(arg)
+- runner.run(server, (server,))
+-
+- return runner.all_ok
+-
+-
+- def info(self, args):
+- getopt.getopt(args[1:], '')
+-
+- if len(args) > 1:
+- self.usage("%s does not take any non-option arguments" % args[0])
++ for (o, v) in options:
++ if o == '--mbox':
++ do_mbox = 'mbox'
+
+ runner = InfoClientRunner(self.client.info)
+
+- for digest in FileDigester(sys.stdin, self.digest_spec):
++ for digest in get_input_handler(sys.stdin, self.digest_spec, do_mbox):
++ if digest is None:
++ continue
+ for server in self.servers:
+ response = runner.run(server, (digest, server))
+
+@@ -252,34 +253,45 @@
+
+
+ def check(self, args):
+- getopt.getopt(args[1:], '')
+-
+- if len(args) > 1:
++ try:
++ (options, args2) = getopt.getopt(args[1:], '', ['mbox'])
++ except getopt.GetoptError:
+ self.usage("%s does not take any non-option arguments" % args[0])
+
++ do_mbox = 'msg'
++
++ for (o, v) in options:
++ if o == '--mbox':
++ do_mbox = 'mbox'
++
+ runner = CheckClientRunner(self.client.check)
+
+- for digest in FileDigester(sys.stdin, self.digest_spec):
++ for digest in get_input_handler(sys.stdin, self.digest_spec, do_mbox):
++ if digest is None:
++ continue
+ for server in self.servers:
+- response = runner.run(server, (digest, server))
++ runner.run(server, (digest, server))
+
+ return (runner.found_hit and not runner.whitelisted)
+
+
+ def report(self, args):
+- (options, args2) = getopt.getopt(args[1:], '', ['mbox'])
+- do_mbox = False
+-
+- if len(args2) > 1:
++ try:
++ (options, args2) = getopt.getopt(args[1:], '', ['mbox'])
++ except getopt.GetoptError:
+ self.usage("%s does not take any non-option arguments" % args[0])
+
++ do_mbox = 'msg'
++
+ for (o, v) in options:
+ if o == '--mbox':
+- do_mbox = True
++ do_mbox = 'mbox'
+
+ all_ok = True
+
+- for digest in FileDigester(sys.stdin, self.digest_spec, do_mbox):
++ for digest in get_input_handler(sys.stdin, self.digest_spec, do_mbox):
++ if digest is None:
++ continue
+ if not self.send_digest(digest, self.digest_spec,
+ self.client.report):
+ all_ok = False
+@@ -302,20 +314,22 @@
+
+
+ def whitelist(self, args):
+- (options, args2) = getopt.getopt(args[1:], '', ['mbox'])
+-
+- if len(args2) > 1:
++ try:
++ (options, args2) = getopt.getopt(args[1:], '', ['mbox'])
++ except getopt.GetoptError:
+ self.usage("%s does not take any non-option arguments" % args[0])
+
+- do_mbox = False
++ do_mbox = 'msg'
+
+ for (o, v) in options:
+ if o == '--mbox':
+- do_mbox = True
++ do_mbox = 'mbox'
+
+ all_ok = True
+
+- for digest in FileDigester(sys.stdin, self.digest_spec, do_mbox):
++ for digest in get_input_handler(sys.stdin, self.digest_spec, do_mbox):
++ if digest is None:
++ continue
+ if not self.send_digest(digest, self.digest_spec,
+ self.client.whitelist):
+ all_ok = False
+@@ -324,28 +338,29 @@
+
+
+ def digest(self, args):
+- (options, args2) = getopt.getopt(args[1:], '', ['mbox'])
+-
+- if len(args2) > 1:
++ try:
++ (options, args2) = getopt.getopt(args[1:], '', ['mbox'])
++ except getopt.GetoptError:
+ self.usage("%s does not take any non-option arguments" % args[0])
+
+-
+- do_mbox = False
++ do_mbox = 'msg'
+
+ for (o, v) in options:
+ if o == '--mbox':
+- do_mbox = True
++ do_mbox = 'mbox'
+
+- for digest in FileDigester(sys.stdin, self.digest_spec, do_mbox):
++ for digest in get_input_handler(sys.stdin, self.digest_spec, do_mbox):
++ if digest is None:
++ continue
+ sys.stdout.write("%s\n" % digest)
+
+ return True
+
+
+ def print_digested(self, args):
+- getopt.getopt(args[1:], '')
+-
+- if len(args) > 1:
++ try:
++ getopt.getopt(args[1:], '')
++ except getopt.GetoptError:
+ self.usage("%s does not take any non-option arguments" % args[0])
+
+ def loop():
+@@ -358,9 +373,9 @@
+ return True
+
+ def genkey(self, args):
+- getopt.getopt(args[1:], '')
+-
+- if len(args) > 1:
++ try:
++ getopt.getopt(args[1:], '')
++ except getopt.GetoptError:
+ self.usage("%s does not take any non-option arguments" % args[0])
+
+ import getpass
+@@ -414,7 +429,6 @@
+ 'report': report,
+ 'ping' : ping,
+ 'genkey': genkey,
+- 'shutdown': shutdown,
+ 'info': info,
+ 'whitelist': whitelist,
+ 'digest': digest,
+@@ -608,31 +622,37 @@
+
+
+
+-class FileDigester(BasicIterator):
+- __slots__ = ['digester']
+-
+- def __init__(self, fp, spec, mbox=False):
+- self.digester = iter(get_file_digester(fp, spec, mbox))
+- self.output = pyzor.Output()
+-
+- def next(self):
+- digest = self.digester.next()
+- self.output.debug("calculated digest: %s" % digest)
+- return digest
+-
+-
+-
+-def get_file_digester(fp, spec, mbox, seekable=False):
++def get_input_handler(fp, spec, style='msg', seekable=False):
+ """Return an object that can be iterated over
+ to get all the digests from fp according to spec.
+ mbox is a boolean"""
+- if mbox:
++ if style == 'msg':
++ return filter(lambda x: x is not None,
++ (DataDigester(rfc822BodyCleaner(fp),
++ spec, seekable).get_digest(),)
++ )
++
++ elif style =='mbox':
+ return MailboxDigester(fp, spec)
+
+- return (DataDigester(rfc822BodyCleaner(fp),
+- spec, seekable).get_digest(),)
++ elif style == 'digests':
++ return JustDigestsIterator(fp)
++
++ raise ValueError, "unknown input style"
+
+
++class JustDigestsIterator(BasicIterator):
++ __slots__ = ['fp']
++
++ def __init__(self, fp):
++ self.fp = fp
++
++ def next(self):
++ l = fp.readline()
++ if not l:
++ raise StopIteration
++ return l.rstrip()
++
+
+ class MailboxDigester(BasicIterator):
+ __slots__ = ['mbox', 'digest_spec', 'seekable']
+@@ -645,7 +665,12 @@
+ self.seekable = seekable
+
+ def next(self):
+- next_msg = self.mbox.next()
++ try:
++ next_msg = self.mbox.next()
++ except IOError:
++ print "Error: Please feed mailbox files in on stdin, i.e."
++ print " pyzor digest --mbox < my_mbox_file"
++ next_msg = None
+ if next_msg is None:
+ raise StopIteration
+ return DataDigester(next_msg, self.digest_spec,
diff --git a/dev-python/pyzor/files/digest-pyzor-0.4.0-r2 b/dev-python/pyzor/files/digest-pyzor-0.4.0-r2
new file mode 100644
index 000000000000..37fbd8982f69
--- /dev/null
+++ b/dev-python/pyzor/files/digest-pyzor-0.4.0-r2
@@ -0,0 +1 @@
+MD5 ee7afe4cc9d419bce5f29250a01c4374 pyzor-0.4.0.tar.bz2 41764
diff --git a/dev-python/pyzor/files/handle_unknown_encodings.patch b/dev-python/pyzor/files/handle_unknown_encodings.patch
new file mode 100644
index 000000000000..fa0b5c9fcca2
--- /dev/null
+++ b/dev-python/pyzor/files/handle_unknown_encodings.patch
@@ -0,0 +1,96 @@
+--- lib/pyzor/client.py Sun Sep 8 22:37:15 2002
++++ lib/pyzor/client.py Wed Aug 3 10:58:03 2005
+@@ -466,7 +470,7 @@
+
+ (fp, offsets) = self.get_line_offsets(fp)
+
+- # did we get an empty file?
++ # did we get an empty (parsed output)file?
+ if len(offsets) == 0:
+ return
+
+@@ -662,39 +666,66 @@
+ self.multifile = None
+ self.curfile = None
+
++ # Check if we got a mail or not. Set type to binary if there is no 'From:' header and
++ # type text/plain with encoding 7bit. 7bit is passed trough anyway so nobody cares.
++ if (not msg.has_key("From") and self.type == 'text' and msg.subtype == 'plain' and msg.getencoding() == '7bit'):
++ self.type = 'binary';
++
+ if self.type == 'text':
+ encoding = msg.getencoding()
+- if encoding == '7bit':
+- self.curfile = msg.fp
+- else:
+- self.curfile = tempfile.TemporaryFile()
+- mimetools.decode(msg.fp, self.curfile, encoding)
+- self.curfile.seek(0)
+-
++ self.curfile = msg.fp
++ if encoding != '7bit':
++ # fix bad encoding name
++ if encoding == '8bits':
++ encoding = '8bit'
++ try:
++ newcurfile = tempfile.TemporaryFile()
++ mimetools.decode(msg.fp, newcurfile, encoding)
++ newcurfile.seek(0)
++ self.curfile = newcurfile
++ except:
++ # ignore encoding on errors, pass msg as is
++ pass
++
+ elif self.type == 'multipart':
+ import multifile
+ self.multifile = multifile.MultiFile(msg.fp, seekable=False)
+ self.multifile.push(msg.getparam('boundary'))
+- self.multifile.next()
+- self.curfile = self.__class__(self.multifile)
+-
++ try:
++ self.multifile.next()
++ self.curfile = self.__class__(self.multifile)
++ except:
++ #
++ # Catch multipart decoding errors
++ #
++ fp.seek(0)
++ self.curfile = fp
++ self.type = 'binary'
+
+ if self.type == 'text' or self.type == 'multipart':
+ assert self.curfile is not None
++ elif self.type == 'binary':
++ try:
++ fp.seek(0)
++ except:
++ pass
++ self.curfile = fp
+ else:
+ assert self.curfile is None
+
+
+ def readline(self):
+ l = ''
+- if self.type in ('text', 'multipart'):
+- l = self.curfile.readline()
+-
+- if self.type == 'multipart' and not l and self.multifile.next():
+- self.curfile = self.__class__(self.multifile)
+- # recursion. Could get messy if
+- # we get a bunch of empty multifile parts
+- l = self.readline()
++ try:
++ if self.type in ('text', 'multipart', 'binary'):
++ l = self.curfile.readline()
++ if self.type == 'multipart' and not l and self.multifile.next():
++ self.curfile = self.__class__(self.multifile)
++ # recursion. Could get messy if
++ # we get a bunch of empty multifile parts
++ l = self.readline()
++ except (TypeError, multifile.Error):
++ pass
+ return l
+
+
diff --git a/dev-python/pyzor/files/unknown_type.patch b/dev-python/pyzor/files/unknown_type.patch
new file mode 100644
index 000000000000..8591be0d7066
--- /dev/null
+++ b/dev-python/pyzor/files/unknown_type.patch
@@ -0,0 +1,12 @@
+--- lib/pyzor/client.py Tue Aug 23 14:53:09 2005
++++ lib/pyzor/client.py Tue Aug 23 14:51:36 2005
+@@ -693,6 +692,9 @@
+ # type text/plain with encoding 7bit. 7bit is passed trough anyway so nobody cares.
+ if (not msg.has_key("From") and self.type == 'text' and msg.subtype == 'plain' and msg.getencoding() == '7bit'):
+ self.type = 'binary';
++
++ if self.type is '':
++ self.type = 'text';
+
+ if self.type == 'text':
+ encoding = msg.getencoding()
diff --git a/dev-python/pyzor/pyzor-0.4.0-r2.ebuild b/dev-python/pyzor/pyzor-0.4.0-r2.ebuild
new file mode 100644
index 000000000000..4dc18dbd3c0f
--- /dev/null
+++ b/dev-python/pyzor/pyzor-0.4.0-r2.ebuild
@@ -0,0 +1,39 @@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-python/pyzor/pyzor-0.4.0-r2.ebuild,v 1.1 2006/02/06 22:25:05 liquidx Exp $
+
+inherit distutils
+
+DESCRIPTION="Pyzor is a distributed, collaborative spam detection and filtering network"
+HOMEPAGE="http://pyzor.sourceforge.net/"
+SRC_URI="mirror://sourceforge/pyzor/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~ppc ~ppc64 ~sparc ~x86"
+IUSE=""
+
+DEPEND="virtual/python
+ sys-libs/gdbm"
+
+src_unpack() {
+ unpack ${A}
+ cd ${S}
+ epatch ${FILESDIR}/debian_mbox.patch
+ epatch ${FILESDIR}/handle_unknown_encodings.patch
+ epatch ${FILESDIR}/unknown_type.patch
+}
+
+src_install () {
+ mydoc="INSTALL NEWS PKG-INFO THANKS UPGRADING"
+ distutils_src_install
+ dohtml docs/usage.html
+ rm -rf ${D}/usr/share/doc/pyzor
+ fperms 755 /usr/bin/pyzor*
+ dodir /usr/sbin
+ mv ${D}/usr/bin/pyzord ${D}/usr/sbin/
+}
+
+pkg_postinst() {
+ ewarn "/usr/bin/pyzord has been moved to /usr/sbin"
+}