rpms/bittorrent/devel bittorrent-4.4.0-bencode-float.patch, NONE, 1.1 bittorrent-4.4.0-keyerror.patch, NONE, 1.1 bittorrent.spec, 1.48, 1.49
Paul Howarth
pghmcfc at fedoraproject.org
Mon Apr 6 14:33:39 UTC 2009
Author: pghmcfc
Update of /cvs/pkgs/rpms/bittorrent/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv10829
Modified Files:
bittorrent.spec
Added Files:
bittorrent-4.4.0-bencode-float.patch
bittorrent-4.4.0-keyerror.patch
Log Message:
- Add support for floating point values in bencode (#451496), resolving
tracebacks with KeyError: <type 'float'>
(thanks to Oleg Aprotskiy for the patch)
- Don't apply format string patch; it serves no purpose really
- Fix for KeyError: 'max_incomplete' in tracker (#451496)
- Define RPM macros in global context in spec file
bittorrent-4.4.0-bencode-float.patch:
--- NEW FILE bittorrent-4.4.0-bencode-float.patch ---
diff -ur BitTorrent-4.4.0.orig/BitTorrent/bencode.py BitTorrent-4.4.0/BitTorrent/bencode.py
--- BitTorrent-4.4.0.orig/BitTorrent/bencode.py 2006-01-31 20:16:33.000000000 +0000
+++ BitTorrent-4.4.0/BitTorrent/bencode.py 2009-04-03 13:54:12.000000000 +0100
@@ -14,6 +14,8 @@
from BitTorrent import BTFailure
+import string
+
def decode_int(x, f):
f += 1
newf = x.index('e', f)
@@ -25,6 +27,23 @@
raise ValueError
return (n, newf+1)
+def assert_finite(n):
+ """Raises ValueError if n is NaN or infinite."""
+
+ valid_chars = '0123456789.-+eE'
+ if repr(n).translate(string.maketrans('',''), valid_chars) != '':
+ raise ValueError('encountered NaN or infinite')
+
+def decode_float(x, f):
+ f += 1
+ newf = x.index('e', f)
+ try:
+ n = float(x[f:newf].replace('E', 'e'))
+ assert_finite(n)
+ except (OverflowError, ValueError):
+ raise ValueError('encountered NaN or infinite')
+ return (n, newf+1)
+
def decode_string(x, f):
colon = x.index(':', f)
n = int(x[f:colon])
@@ -55,6 +74,7 @@
decode_func['l'] = decode_list
decode_func['d'] = decode_dict
decode_func['i'] = decode_int
+decode_func['f'] = decode_float
decode_func['0'] = decode_string
decode_func['1'] = decode_string
decode_func['2'] = decode_string
@@ -75,7 +95,7 @@
raise BTFailure, _("invalid bencoded value (data after valid prefix)")
return r
-from types import StringType, IntType, LongType, DictType, ListType, TupleType
+from types import StringType, IntType, LongType, DictType, ListType, TupleType, FloatType
class Bencached(object):
@@ -91,6 +111,10 @@
def encode_int(x, r):
r.extend(('i', str(x), 'e'))
+def encode_float(x, r):
+ assert_finite(x)
+ r.extend(('f', repr(x).replace('e', 'E'), 'e'))
+
def encode_bool(x, r):
if x:
encode_int(1, r)
@@ -119,6 +143,7 @@
encode_func[Bencached] = encode_bencached
encode_func[IntType] = encode_int
encode_func[LongType] = encode_int
+encode_func[FloatType] = encode_float
encode_func[StringType] = encode_string
encode_func[ListType] = encode_list
encode_func[TupleType] = encode_list
bittorrent-4.4.0-keyerror.patch:
--- NEW FILE bittorrent-4.4.0-keyerror.patch ---
--- BitTorrent-4.4.0/BitTorrent/track.py 2009-04-06 14:00:39.000000000 +0100
+++ BitTorrent-4.4.0/BitTorrent/track.py 2009-04-06 14:01:22.000000000 +0100
@@ -107,6 +107,8 @@
_("scrape access allowed (can be none, specific or full)")),
('max_give', 200,
_("maximum number of peers to give with any one request")),
+ ('max_incomplete', 100,
+ _("max number of outgoing incomplete connections")),
('twisted', -1,
_("Use Twisted network libraries for network connections. 1 means use twisted, 0 means do not use twisted, -1 means autodetect, and prefer twisted")),
('pid', '/var/run/bittorrent-tracker.pid',
Index: bittorrent.spec
===================================================================
RCS file: /cvs/pkgs/rpms/bittorrent/devel/bittorrent.spec,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -r1.48 -r1.49
--- bittorrent.spec 1 Mar 2009 13:21:17 -0000 1.48
+++ bittorrent.spec 6 Apr 2009 14:33:09 -0000 1.49
@@ -1,15 +1,15 @@
# A few useful macros
-%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
-%define desktopvendor fedora
-%define bt_dir %{_localstatedir}/lib/bittorrent
-%define bt_datadir %{bt_dir}/data
-%define bt_statedir %{bt_dir}/state
-%define pkidir %{_sysconfdir}/pki
+%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
+%global desktopvendor fedora
+%global bt_dir %{_localstatedir}/lib/bittorrent
+%global bt_datadir %{bt_dir}/data
+%global bt_statedir %{bt_dir}/state
+%global pkidir %{_sysconfdir}/pki
Summary: BitTorrent swarming network file transfer tool
Name: bittorrent
Version: 4.4.0
-Release: 10%{?dist}
+Release: 11%{?dist}
Group: Applications/Internet
License: BitTorrent
URL: http://www.bittorrent.com/
@@ -27,6 +27,8 @@
Patch5: bittorrent-4.4.0-fastresume.patch
Patch6: bittorrent-4.4.0-syntax.patch
Patch7: bittorrent-4.4.0-formatstrings.patch
+Patch8: bittorrent-4.4.0-bencode-float.patch
+Patch9: bittorrent-4.4.0-keyerror.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
BuildRequires: python-devel >= 2.4.0, desktop-file-utils, gettext
@@ -96,7 +98,17 @@
%patch6 -p1 -b .syntax
# Fix format strings that can't be properly translated
+# Not much point doing this really as translations don't work anyway and
+# it doesn't prevent the build itself from working
+%if 0
%patch7 -p1 -b .strings
+%endif
+
+# Add bencode support for floating point values (#451496)
+%patch8 -p1 -b .float
+
+# Fix keyerror on tracker (#451496)
+%patch9 -p1 -b .keyerror
# Update icon
%{__sed} -i -e 's,bittorrent\.png,%{_datadir}/pixmaps/bittorrent-%{version}/logo/bittorrent_48.png,' \
@@ -237,6 +249,14 @@
%{_datadir}/applications/%{desktopvendor}-bittorrent.desktop
%changelog
+* Mon Apr 6 2009 Paul Howarth <paul at city-fan.org> 4.4.0-11
+- Add support for floating point values in bencode (#451496), resolving
+ tracebacks with KeyError: <type 'float'>
+ (thanks to Oleg Aprotskiy for the patch)
+- Don't apply format string patch; it serves no purpose really
+- Fix for KeyError: 'max_incomplete' in tracker (#451496)
+- Define RPM macros in global context in spec file
+
* Tue Feb 24 2009 Paul Howarth <paul at city-fan.org> 4.4.0-10
- Fix syntax issues causing failure to build for Fedora 11
- Update format strings to enable re-ordering of parameters in translations
More information about the fedora-extras-commits
mailing list