--- rtorrent-0.8.6.orig/debian/changelog
+++ rtorrent-0.8.6/debian/changelog
@@ -0,0 +1,478 @@
+rtorrent (0.8.6-1) unstable; urgency=low
+
+  * New upstream stable version.
+
+ -- Dmitry E. Oboukhov <unera@debian.org>  Tue, 29 Dec 2009 16:30:17 +0300
+
+rtorrent (0.8.5-2) unstable; urgency=low
+
+  * Add patch to fix crash by SCGI, closes: 541487, thanks for jdrexler.
+  * Standards-Version was bumped to 3.8.3 (no changes required).
+
+ -- Dmitry E. Oboukhov <unera@debian.org>  Sun, 16 Aug 2009 09:12:32 +0400
+
+rtorrent (0.8.5-1) unstable; urgency=low
+
+  [ Dmitry E. Oboukhov ]
+  * New upstream version.
+  * Upstream already contains fix-xmlrpc-utf8.patch, it has been removed.
+
+  [ Rogério Brito ]
+  * Update to unstable. Thanks to Dmitry.
+  * debian/control:
+    + update Standards-Version to 3.8.2 (no changes required).
+
+ -- Rogério Brito <rbrito@ime.usp.br>  Mon, 03 Aug 2009 13:18:04 -0300
+
+rtorrent (0.8.4+tit-4) unstable; urgency=low
+
+  * Putting myself as the maintainer. Jose told me that he is busy with
+    his duties and he is free to revert this change as he pleases.
+  * Ubuntu people: please contribute your changes! Please.
+  * debian/patches/*:
+    + refreshed.
+    + fixed compilation with gcc 4.4 for good. Closes: #504906.
+
+ -- Rogério Brito <rbrito@ime.usp.br>  Mon, 18 May 2009 23:53:09 -0300
+
+rtorrent (0.8.4+tit-3) unstable; urgency=low
+
+  * Fix "FTBFS with GCC 4.4": slightly modified patch based on Martin
+    Michlmayr's (Closes: #504906)
+
+ -- Rogério Brito <rbrito@ime.usp.br>  Fri, 15 May 2009 21:48:24 -0300
+
+rtorrent (0.8.4+tit-2) unstable; urgency=low
+
+  * Fixed build-depends for correctly building on alpha, amd64, etc.
+
+ -- Dmitry E. Oboukhov <unera@debian.org>  Sun, 10 May 2009 10:02:29 +0400
+
+rtorrent (0.8.4+tit-1) unstable; urgency=low
+
+  * Use Tar-in-tar build system (+tit suffix), now we can rebuild rtorrent
+  as many times as it is needed. Diff.gz will be clean.
+  * Fixed incorrect merge of previous upload (this version is really 0.8.4),
+    closes: 527882.
+
+ -- Dmitry E. Oboukhov <unera@debian.org>  Sat, 09 May 2009 20:11:35 +0400
+
+rtorrent (0.8.4-3) unstable; urgency=low
+
+  [ Rogério Brito ]
+  * debian/changelog:
+    + prepare an upload meant to unstable.
+  * debian/copyright:
+    + fix lintian warning regarding versionless link to GPL.
+  * debian/control:
+    + add myself as an uploader (discussed with Jose and Adeodato).
+    + accept Dmitry to the team of maintainers.
+    + word-wrap the build dependencies field (for more legibility).
+    + change XS-Vcs-* to Vcs-* headers.
+    + shortened the VCS-Browser url.
+    + add a suggests field with screen or dtach utilities.
+    + include information about DHT in the long description.
+    + include information about PEX in the long description.
+    + include information about superseeding in the long description.
+    + reword the long description to be less "marketese" and more
+      digestible for both experienced and new users.
+    + drop versioned depends on libxmlrpc-c3-dev (stable has it).
+    + include comment at the top of the file (policy 3.8.1 allows it).
+    + update Standards-Version to 3.8.1.
+  * debian/rules:
+    + add commented --as-needed linker option to reduce library dependencies.
+    + add -Wextra to produce more warnings and communicate to upstream.
+    + TODO: fix upstream makefile for generation of manpages from docbook.
+  * debian/README.source:
+    + add it, since Dmitry is including patches and policy requires it.
+
+  [ Dmitry E. Oboukhov ]
+  * debian/patches:
+    + added fix-xmlrpc-utf8.patch to resolve the problem of generation
+    incorrect XML, closes: #514527.
+  * debian/rules:
+    + uncommented include simple-patchsys.mk.
+
+ -- Rogério Brito <rbrito@ime.usp.br>  Fri, 08 May 2009 10:50:35 -0300
+
+rtorrent (0.8.4-2) experimental; urgency=low
+
+  * Collab-Maint upload (acked by Jose Luis).
+
+  * Format of some session files incompatibly changed in 0.8.x. Mention this
+    in NEWS.Debian, and provide a script from the rssdler project that can
+    convert those session files from the old format to the new format.
+
+  * Update changelog.gz symlink to point to libtorrent11 and not libtorrent10.
+
+ -- Adeodato Simó <dato@net.com.org.es>  Fri, 23 Jan 2009 11:26:32 +0100
+
+rtorrent (0.8.4-1) experimental; urgency=low
+
+  * New upstream release
+  * Updated B-P on libtorrent-dev to 0.12.4
+
+ -- Jose Luis Rivas <ghostbar38@gmail.com>  Wed, 19 Nov 2008 23:03:55 -0430
+
+rtorrent (0.8.3-1~b1) experimental; urgency=low
+
+  * New upstream release
+  * Removed Arnaud Andesi from Uploaders.
+  * Bumped to 3.8.0
+  * Removed XS- from Vcs fields and updated these fields.
+  * Deleted patches, now are supplied from upstream.
+  * Refreshed debian/copyright
+
+ -- Jose Luis Rivas <ghostbar38@gmail.com>  Wed, 19 Nov 2008 09:15:59 -0430
+
+rtorrent (0.8.2-1) experimental; urgency=low
+
+  * New upstream release.
+  * debian/patches/02_offbyone-xmlrpc_479807.patch:
+   + Fixed already upstream.
+  * debian/patches/01_rtorrent-gcc43.patch:
+   + This is fact does work perfectly, deleted old version for fixing build
+   with gcc4.3, replaced by this one.
+
+ -- Jose Luis Rivas <ghostbar38@gmail.com>  Thu, 08 May 2008 23:03:55 -0430
+
+rtorrent (0.7.9-2) unstable; urgency=low
+
+  * debian/patches/01_missing-libraries_474852.patch:
+   Fixes missing libraries, thanks to Bradley Smith. (Closes: #474852)
+  * debian/patches/02_offbyone-xmlrpc_479807.patch:
+   Fixes the off-by-one-error in xmlrpc. Thanks to David Härdeman
+   (Closes: 479807)
+
+ -- Jose Luis Rivas <ghostbar38@gmail.com>  Tue, 06 May 2008 16:40:06 -0430
+
+rtorrent (0.7.9-1) unstable; urgency=low
+
+  * debian/control:
+   + Specified minimum libxmlrpc-c3 version to >=1.06. (Closes: #449271)
+   + Build-depends on libtorrent updated to 0.11.9.
+  * debian/rules:
+   + Added `-fno-strict-aliasing`. (Closes: #453100)
+  * debian/control:
+   + Updated to Standards-Version 3.7.3, no modifications needed.
+  * New rtorrent.rc shipped is up-to-date. (Closes: #448998)
+
+ -- Jose Luis Rivas <ghostbar38@gmail.com>  Sun, 16 Dec 2007 19:48:29 -0430
+
+rtorrent (0.7.8-1) unstable; urgency=low
+
+  * New upstream version (Closes: #444706)
+  * debian/control:
+   + Added the Homepage header, deleted the Homepage from the description.
+   + Changed libncurses5-dev to libncursesw5-dev.
+   + Added xmlrpc-c3-dev as Build-Depend.
+  * Now don't depend on libssh2-0 but libssh2-1. (Closes: #443424)
+  * debian/rules:
+   + Added flag for supporting UTF-8 wide character. Thanks to
+   Paul TBBle Hampson <Paul.Hampson@Pobox.com>. (Closes: #395455)
+   + Added `--xmlrpc-c' to options this way XMLRPC is supported
+   (Closes: #443091, #444088)
+
+ -- Jose Luis Rivas <ghostbar38@gmail.com>  Wed, 12 Sep 2007 11:40:49 -0400
+
+rtorrent (0.7.7-1) unstable; urgency=low
+
+  * New upstream release. (Closes: #436460, #436451)
+  * Added a warning mechanism for low space-disk.(Closes: #362096)
+
+ -- Jose Luis Rivas <ghostbar38@gmail.com>  Thu, 16 Aug 2007 22:08:48 -0400
+
+rtorrent (0.7.5-1) unstable; urgency=low
+
+  * New upstream version
+  * Throttle settings aren't ignored according upstream (Closes: #383844)
+  * debian/control:
+   + Updated Build-Depend to libtorrent-dev (>=0.11.5) or doesn't build.
+
+ -- Jose Luis Rivas <ghostbar38@gmail.com>  Wed, 20 Jun 2007 20:27:01 -0400
+
+rtorrent (0.7.4-2) unstable; urgency=low
+
+  * debian/control:
+   + Updated build-depend from libcurl3 to libcurl4 (Closes: #423556)
+
+ -- Jose Luis Rivas <ghostbar38@gmail.com>  Sat, 12 May 2007 21:22:31 -0400
+
+rtorrent (0.7.4-1) unstable; urgency=low
+
+  [ Jose Luis Rivas ]
+  * New upstream version.
+  * debian/control:
+   + Updated libtorrent-dev dependancy to 0.11.4
+   + Added XS-Vcs-Bzr.
+   + Removed Build-Depend on quilt.
+  * debian/rules: 
+   + Removed patchsys-quilt.mk as it isn't needed anymore.
+
+  [ Arnaud Fontaine ]
+  * debian/copyright:
+    + Update copyright year.
+
+ -- Jose Luis Rivas <ghostbar38@gmail.com>  Wed, 18 Apr 2007 20:26:19 -0400
+
+rtorrent (0.7.3-1) unstable; urgency=low
+
+  * New upstream release.
+  * Linked ChangeLog to libtorrent ChangeLog instead of copying the same thing
+  in both packages, so patch from changelog have been removed.
+
+ -- Jose Luis Rivas <ghostbar38@gmail.com>  Mon, 26 Mar 2007 18:07:23 -0400
+
+rtorrent (0.7.2-1) unstable; urgency=low
+
+  * New upstream release
+
+ -- Jose Luis Rivas <ghostbar38@gmail.com>  Tue, 30 Jan 2007 13:34:31 -0400
+
+rtorrent (0.7.1-1) unstable; urgency=low
+
+  [ Jose Luis Rivas ]
+  * Created ChangeLog (closes: #388842 ).
+  * New upstream release (Closes: #404672).
+  * Fixed Changelog (closes: #388842).
+  * Fixed hashing after crash (closes: #348017).
+  * Updated build-dependency on libtorrent9-dev to libtorrent-dev.
+  * Changed debian/rules and erased option `-02`.
+
+  [ Arnaud Fontaine ]
+  * Switch to cdbs.
+  * debian/patches:
+    + Move upstream tarball modifications from diff.gz.
+  * debian/control:
+    + Add Homepage field.
+    + Fix the package description formatting.
+  * debian/compat:
+    + Update to debhelper 5.
+  * debian/copyright:
+    + Add the current maintainers.
+
+ -- Jose Luis Rivas <ghostbar38@gmail.com>  Sat, 30 Dec 2006 22:18:01 -0400
+
+rtorrent (0.6.4-1) unstable; urgency=low
+
+  * New upstream release.
+  * Updated dependency with new release of libtorrent.
+
+ -- Jose Luis Rivas <ghostbar38@gmail.com>  Fri, 27 Oct 2006 22:49:55 -0400
+
+rtorrent (0.6.3-1) unstable; urgency=low
+
+  * New upstream release.
+  * Changed build-dependency to libtorrent9-dev 0.10.3 from 0.10.1
+
+ -- Jose Luis Rivas <ghostbar38@gmail.com>  Thu, 19 Oct 2006 23:36:59 -0400
+
+rtorrent (0.6.2-2) unstable; urgency=low
+
+  * Removed `ibreadline5' from Build-Depends. (Closes: #389122)
+  * Added Arnaud as Co-maintainer.
+
+ -- Jose Luis Rivas <ghostbar38@gmail.com>  Tue, 26 Sep 2006 13:21:33 -0400
+
+rtorrent (0.6.2-1) unstable; urgency=low
+
+  * New upstream release.
+  * New maintainer. (Closes: #388538)
+  * Build-Depends updated to debhelper (>= 5.0.37.2).
+  * There's no more dependency on libtorrent8 since this changes to
+    libtorrent9. (Closes: #387859)
+  * Added Build dependency on `bc'. (Closes: #387690)
+  * Added Build dependency on `libreadline5'.
+
+ -- Jose Luis Rivas <ghostbar38@gmail.com>  Wed, 20 Sep 2006 17:57:39 -0400
+
+rtorrent (0.6.1-1) unstable; urgency=low
+
+  * New upstream release (closes: #383102, #382841, #383886, #378212).
+  * Build-Depends on libtorrent9-dev(>= 0.10.1).
+
+ -- Qingning Huo <qhuo@mayhq.co.uk>  Tue, 22 Aug 2006 21:02:53 +0100
+
+rtorrent (0.6.0-1) unstable; urgency=low
+
+  * New upstream release.
+  * Build-Depends on libtorrent7-dev(>= 0.10.0).
+
+ -- Qingning Huo <qhuo@mayhq.co.uk>  Sat, 15 Jul 2006 17:06:40 +0100
+
+rtorrent (0.5.3-1) unstable; urgency=low
+
+  * New upstream release.
+  * Build with g++-4.1. 
+
+ -- Qingning Huo <qhuo@mayhq.co.uk>  Mon, 26 Jun 2006 21:24:06 +0100
+
+rtorrent (0.5.1-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Qingning Huo <qhuo@mayhq.co.uk>  Wed, 10 May 2006 21:44:24 +0100
+
+rtorrent (0.5.0-1) unstable; urgency=low
+
+  * New upstream release.
+  * Build-Depends on libtorrent7-dev(>= 0.9.0).
+
+ -- Qingning Huo <qhuo@mayhq.co.uk>  Fri,  7 Apr 2006 06:40:48 +0100
+
+rtorrent (0.4.5-1) unstable; urgency=low
+
+  * New upstream release (Closes: #352222).
+
+ -- Qingning Huo <qhuo@mayhq.co.uk>  Thu,  9 Mar 2006 19:33:07 +0000
+
+rtorrent (0.4.4-1) unstable; urgency=low
+
+  * New upstream release (Closes: #352222).
+
+ -- Qingning Huo <qhuo@mayhq.co.uk>  Mon, 13 Feb 2006 21:30:04 +0000
+
+rtorrent (0.4.2-1) unstable; urgency=low
+
+  * New upstream release.
+  - Added the load, load_run, stop_untied and remove_untied options.
+  Now it is easy to watch a directory for new torrents
+  (Closes: #334661).
+  * Build with g++-3.4 for now. 
+
+ -- Qingning Huo <qhuo@mayhq.co.uk>  Thu, 12 Jan 2006 21:40:12 +0000
+
+rtorrent (0.4.1-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Qingning Huo <qhuo@mayhq.co.uk>  Wed, 28 Dec 2005 13:03:03 +0000
+
+rtorrent (0.4.0-1) unstable; urgency=low
+
+  * New upstream release.
+  * Build-Depends on libtorrent6-dev(>= 0.8.0).
+
+ -- Qingning Huo <qhuo@mayhq.co.uk>  Tue,  6 Dec 2005 22:14:48 +0000
+
+rtorrent (0.3.6-1) unstable; urgency=low
+
+  * New upstream release.
+  * Build-Depends on libtorrent5-dev(>= 0.7.6).
+
+ -- Qingning Huo <qhuo@mayhq.co.uk>  Tue, 18 Oct 2005 21:58:02 +0100
+
+rtorrent (0.3.5-2) unstable; urgency=low
+
+  * Update Build-Depends from libcurl3-dev to libcurl3-openssl-dev. 
+
+ -- Qingning Huo <qhuo@mayhq.co.uk>  Wed, 12 Oct 2005 23:10:51 +0100
+
+rtorrent (0.3.5-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Qingning Huo <qhuo@mayhq.co.uk>  Thu, 29 Sep 2005 20:02:20 +0100
+
+rtorrent (0.3.4-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Qingning Huo <qhuo@mayhq.co.uk>  Wed, 21 Sep 2005 21:42:49 +0100
+
+rtorrent (0.3.3-1) unstable; urgency=low
+
+  * New upstream release.
+  * Fix FSF address in debian/copyright.
+
+ -- Qingning Huo <qhuo@mayhq.co.uk>  Sun,  4 Sep 2005 15:41:08 +0100
+
+rtorrent (0.3.2-2) unstable; urgency=low
+
+  * Rebuild for libtorrent4 0.7.2-2. 
+
+ -- Qingning Huo <qhuo@mayhq.co.uk>  Mon, 22 Aug 2005 21:33:15 +0100
+
+rtorrent (0.3.2-1) unstable; urgency=low
+
+  * New upstream release.
+  * Build-Depends on libtorrent4-dev(>= 0.7.2) (Closes: #323671). 
+
+ -- Qingning Huo <qhuo@mayhq.co.uk>  Thu, 18 Aug 2005 21:30:27 +0100
+
+rtorrent (0.3.1-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Qingning Huo <qhuo@mayhq.co.uk>  Sun, 14 Aug 2005 11:44:40 +0100
+
+rtorrent (0.3.0-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Qingning Huo <qhuo@mayhq.co.uk>  Sun, 24 Jul 2005 21:57:26 +0100
+
+rtorrent (0.2.7-1) unstable; urgency=low
+
+  * New upstream release.
+  * Set Standards-Version to 3.6.2.
+
+ -- Qingning Huo <qhuo@mayhq.co.uk>  Sun, 10 Jul 2005 22:40:00 +0100
+
+rtorrent (0.2.6-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Qingning Huo <qhuo@mayhq.co.uk>  Tue, 28 Jun 2005 22:22:34 +0100
+
+rtorrent (0.2.5-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Qingning Huo <qhuo@mayhq.co.uk>  Thu, 16 Jun 2005 21:09:59 +0100
+
+rtorrent (0.2.4-1) unstable; urgency=low
+
+  * New upstream release:
+  - Add .rtorrent.rc support.
+
+ -- Qingning Huo <qhuo@mayhq.co.uk>  Sun, 12 Jun 2005 18:42:03 +0100
+
+rtorrent (0.2.3-1) unstable; urgency=low
+
+  * New upstream release.
+  * Build-Depends on libtorrent3-dev now.
+
+ -- Qingning Huo <qhuo@mayhq.co.uk>  Tue, 31 May 2005 22:08:15 +0100
+
+rtorrent (0.2.2-1) unstable; urgency=low
+
+  * New upstream release.
+  * Updated rtorrent.1 manpage. 
+
+ -- Qingning Huo <qhuo@mayhq.co.uk>  Mon,  9 May 2005 21:52:17 +0100
+
+rtorrent (0.2.1-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Qingning Huo <qhuo@mayhq.co.uk>  Mon, 25 Apr 2005 21:00:06 +0100
+
+rtorrent (0.2.0-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Qingning Huo <qhuo@mayhq.co.uk>  Sat, 23 Apr 2005 10:40:06 +0100
+
+rtorrent (0.1.4-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Qingning Huo <qhuo@mayhq.co.uk>  Thu, 31 Mar 2005 23:24:03 +0100
+
+rtorrent (0.1.3-1) unstable; urgency=low
+
+  * Initial Release (Closes: #298976).
+
+ -- Qingning Huo <qhuo@mayhq.co.uk>  Wed, 16 Mar 2005 22:31:36 +0000
+
--- rtorrent-0.8.6.orig/debian/compat
+++ rtorrent-0.8.6/debian/compat
@@ -0,0 +1 @@
+5
--- rtorrent-0.8.6.orig/debian/copyright
+++ rtorrent-0.8.6/debian/copyright
@@ -0,0 +1,51 @@
+Format-Specification:
+    http://wiki.debian.org/Proposals/CopyrightFormat?action=recall&rev=196
+Upstream-Author: Jari Sundell <jaris@ifi.uio.no>
+Packaged-By: Qingning Huo <qhuo@mayhq.co.uk>
+Upstream-Name: rTorrent
+Original-Source-Location: http://libtorrent.rakshasa.no/
+Original-Source-Command: uscan --force-download
+Original-Source-Depends: devscripts
+
+Files: *
+Copyright: © 2005-2007 Jari Sundell <jaris@ifi.uio.no>
+License: GPL-2+ with a special exception
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this package; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+
+ In addition, as a special exception, the copyright holders give
+ permission to link the code of portions of this program with the
+ OpenSSL library under certain conditions as described in each
+ individual source file, and distribute linked combinations
+ including the two.
+
+ You must obey the GNU General Public License in all respects for
+ all of the code used other than OpenSSL.  If you modify file(s)
+ with this exception, you may extend this exception to your version
+ of the file(s), but you are not obligated to do so.  If you do not
+ wish to do so, delete this exception statement from your version.
+ If you delete this exception statement from all source files in the
+ program, then also delete it here.
+
+Files: debian/*
+Copyright: © 2005-2006 Qingning Huo <qhuo@mayhq.co.uk>
+	   © 2006-2008 Jose Luis Rivas <ghostbar38@gmail.com>
+License: GPL-2+
+
+Files: fixSession080.py
+Copyright: © 2008 lostnihilist
+License: GPL-2
+
+On Debian GNU/Linux systems, the complete text of the GNU General
+Public License can be found in `/usr/share/common-licenses/GPL-2'.
--- rtorrent-0.8.6.orig/debian/README.source
+++ rtorrent-0.8.6/debian/README.source
@@ -0,0 +1,35 @@
+This package uses CDBS (and therefore simple-patchsys.mk) in order to 
+apply patches to the upstream source. Patches are stored in 
+debian/patches and their filenames usually end in .patch or .diff .
+For further details, see the man page for cdbs-edit-patch.
+
+All commands described below should be run from the top directory of the 
+package source tree, unless otherwise stated.
+
+ * To generate the fully patched source, in a form ready for
+   editing, that would be built to create Debian packages, run: 
+
+     make -f debian/rules apply-patches
+
+   Note: It has been proposed that, in future, this should happen 
+   automatically when you run dpkg-source -x on a CDBS 
+   simple-patchsys.mk source package.  However, this proposal has 
+   apparently not yet been implemented, so for now you have to do 
+   it yourself like this.
+
+ * To modify the source and save those modifications so that
+   they will be applied when building the package, pick a
+   suitably informative patch file name, for example
+   01_add_README.source_file.patch, and then run:
+
+     cdbs-edit-patch 01_add_README.source_file.patch
+
+   This will place you in a new shell in a temporary copy of the 
+   source tree.  Make your desired modifications to it, and then 
+   exit the shell to create the patch file containing them (this 
+   file will appear in debian/patches).
+
+ * To remove source modifications that are currently being
+   applied when building the package, run:
+
+     make -f debian/rules reverse-patches
--- rtorrent-0.8.6.orig/debian/rules
+++ rtorrent-0.8.6/debian/rules
@@ -0,0 +1,22 @@
+#!/usr/bin/make -f
+
+DEB_TAR_SRCDIR=rtorrent-0.8.6
+
+DEB_INSTALL_EXAMPLES_rtorrent=build-tree/$(DEB_TAR_SRCDIR)/doc/rtorrent.rc
+
+CPPFLAGS=-I/usr/include/ncursesw
+CFLAGS=-Wextra
+CXXFLAGS=-Wextra
+#LDFLAGS=-Wl,--as-needed
+
+include /usr/share/cdbs/1/rules/tarball.mk
+include /usr/share/cdbs/1/rules/debhelper.mk
+include /usr/share/cdbs/1/class/autotools.mk
+include /usr/share/cdbs/1/rules/simple-patchsys.mk
+
+DEB_OPT_FLAG = -fno-strict-aliasing
+DEB_COMPRESS_EXCLUDE = .py
+DEB_CONFIGURE_EXTRA_FLAGS += --with-xmlrpc-c
+
+clean::
+	rm -f *.cdbs-config_list
--- rtorrent-0.8.6.orig/debian/watch
+++ rtorrent-0.8.6/debian/watch
@@ -0,0 +1,3 @@
+version=3
+opts=dversionmangle=s/\+\w+\d*$// \
+	http://libtorrent.rakshasa.no/downloads/rtorrent-(.*)\.tar\.gz
--- rtorrent-0.8.6.orig/debian/NEWS
+++ rtorrent-0.8.6/debian/NEWS
@@ -0,0 +1,12 @@
+rtorrent (0.8.2-1) experimental; urgency=low
+
+  This version of rtorrent changes in an incompatible way the format of
+  session files for multi-file torrents. rtorrent does not include code
+  to upgrade the old files to the new format, but these packages include
+  a script to perform the upgrade. Please ensure rtorrent is not running
+  and do:
+
+    $ cd /usr/share/doc/rtorrent/examples
+    $ python fixSession080.py /path/to/your/session/directory
+
+ -- Adeodato Simó <dato@net.com.org.es>  Mon, 19 Jan 2009 18:11:19 +0100
--- rtorrent-0.8.6.orig/debian/dirs
+++ rtorrent-0.8.6/debian/dirs
@@ -0,0 +1 @@
+usr/bin
--- rtorrent-0.8.6.orig/debian/rtorrent.links
+++ rtorrent-0.8.6/debian/rtorrent.links
@@ -0,0 +1 @@
+usr/share/doc/libtorrent11/changelog.gz	usr/share/doc/rtorrent/changelog.gz
--- rtorrent-0.8.6.orig/debian/control
+++ rtorrent-0.8.6/debian/control
@@ -0,0 +1,39 @@
+# -*- coding: utf-8 -*-
+Source: rtorrent
+Section: net
+Priority: extra
+Maintainer: Rogério Brito <rbrito@ime.usp.br>
+DM-Upload-Allowed: yes
+Uploaders: Jose Luis Rivas <ghostbar@debian.org>,
+	   Dmitry E. Oboukhov <unera@debian.org>
+Build-Depends: debhelper (>= 5), cdbs, libtorrent-dev (>= 0.12.6),
+	       libsigc++-2.0-dev, libcurl4-openssl-dev, libncursesw5-dev,
+	       bc, libxmlrpc-c3-dev
+Standards-Version: 3.8.3
+Vcs-Git: git://git.debian.org/git/collab-maint/rtorrent.git
+Vcs-Browser: http://git.debian.org/?p=collab-maint/rtorrent.git
+Homepage: http://libtorrent.rakshasa.no/
+
+Package: rtorrent
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Suggests: screen | dtach
+Description: ncurses BitTorrent client based on LibTorrent from rakshasa
+ rtorrent is a BitTorrent client based on LibTorrent.  It uses ncurses
+ and aims to be a lean, yet powerful BitTorrent client, with features
+ similar to the most complex graphical clients.
+ .
+ Since it is a terminal application, it can be used with the "screen"/"dtach"
+ utility so that the user can conveniently logout from the system while keeping
+ the file transfers active.
+ .
+ Some of the features of rtorrent include:
+  * Use an URL or file path to add torrents at runtime
+  * Stop/delete/resume torrents
+  * Optionally loads/saves/deletes torrents automatically in a session
+    directory
+  * Safe fast resume support
+  * Detailed information about peers and the torrent
+  * Support for distributed hash tables (DHT)
+  * Support for peer-exchange (PEX)
+  * Support for initial seeding (Superseeding)
--- rtorrent-0.8.6.orig/debian/examples
+++ rtorrent-0.8.6/debian/examples
@@ -0,0 +1 @@
+debian/fixSession080.py
--- rtorrent-0.8.6.orig/debian/fixSession080.py
+++ rtorrent-0.8.6/debian/fixSession080.py
@@ -0,0 +1,159 @@
+#!/usr/bin/env python
+# This file was downloaded from:
+#   http://code.google.com/p/rssdler/source/browse/branches/fixSession080.py
+import getopt
+import os
+import sys
+
+from types import StringType, IntType, LongType, DictType, ListType, TupleType
+try: from types import BooleanType
+except ImportError: BooleanType = None
+
+helpMessage = """Fix the session files from rtorrent 0.7.* to 0.8.0
+  rTorrent stores its session files differently now. Unfortunately, code was not
+  implemented to make the transition as smooth as it could be. However, the 
+  change is minor enough that this script SHOULD reliably fix the issue. 
+  
+  To use, SHUTDOWN rTorrent, and BACKUP your session directories.
+  
+  python %s <session directory> [<other> <session> <dirs>]
+  
+  -h prints this message
+  -u will try to undo the previous run of this script. May not work. Some sanity check
+
+(C) 2008, Distributed under the GNU General Public License v2 by lostnihilist. 
+For full terms of this license, see: http://www.gnu.org/licenses/gpl-2.0.html
+  
+""" % sys.argv[0]
+
+# # # # # 
+# Torrent Handling from BitTorrent by Bram Cohen/Petru Paler
+def bdecode(x):
+        """This function decodes torrent data. 
+        It comes (modified) from the GPL Python BitTorrent implementation"""
+        def decode_int(x, f):
+            f += 1
+            newf = x.index('e', f)
+            try: n = int(x[f:newf])
+            except (OverflowError, ValueError):  n = long(x[f:newf])
+            if x[f] == '-':
+                if x[f + 1] == '0': raise ValueError
+            elif x[f] == '0' and newf != f+1:  raise ValueError
+            return (n, newf+1)
+        def decode_string(x, f):
+            colon = x.index(':', f)
+            try:  n = int(x[f:colon])
+            except (OverflowError, ValueError):  n = long(x[f:colon])
+            if x[f] == '0' and colon != f+1:  raise ValueError
+            colon += 1
+            return (x[colon:colon+n], colon+n)
+        def decode_list(x, f):
+            r, f = [], f+1
+            while x[f] != 'e':
+                v, f = decode_func[x[f]](x, f)
+                r.append(v)
+            return (r, f + 1)
+        def decode_dict(x, f):
+            r, f = {}, f+1
+            lastkey = None
+            while x[f] != 'e':
+                k, f = decode_string(x, f)
+                if lastkey >= k:   raise ValueError
+                lastkey = k
+                r[k], f = decode_func[x[f]](x, f)
+            return (r, f + 1)
+        decode_func = {
+          'l' : decode_list ,
+          'd' : decode_dict,
+          'i' : decode_int}
+        for i in range(10): decode_func[str(i)] = decode_string
+        if hasattr(x, 'read'): x = x.read()
+        try:  r, l = decode_func[x[0]](x, 0)
+        except (IndexError, KeyError):
+            try: 
+                x = open(x, 'r').read()
+                r, l = decode_func[x[0]](x,0)
+            except (OSError, IOError, IndexError, KeyError): raise ValueError
+        if l != len(x):  raise ValueError
+        return r
+
+def bencode(data=None,file=None):
+  "returns bencoded data, file may be name or descriptor, data encoded directly"
+  class Bencached(object):
+    __slots__ = ['bencoded']
+    def __init__(self, s):
+      self.bencoded = s
+
+  def encode_bencached(x,r): r.append(x.bencoded)
+  def encode_int(x, r): r.extend(('i', str(x), 'e'))
+  def encode_string(x, r): r.extend((str(len(x)), ':', x))
+  def encode_list(x, r):
+    r.append('l')
+    for i in x: encode_func[type(i)](i, r)
+    r.append('e')
+  def encode_dict(x,r):
+    r.append('d')
+    for k, v in sorted(list(x.items())):
+      r.extend((str(len(k)), ':', k))
+      encode_func[type(v)](v, r)
+    r.append('e')
+  encode_func = {}
+  encode_func[type(Bencached(0))] = encode_bencached
+  encode_func[IntType] = encode_func[LongType] = encode_int
+  encode_func[StringType] = encode_string
+  encode_func[ListType] = encode_func[TupleType] = encode_list
+  encode_func[DictType] = encode_dict
+  if BooleanType: encode_func[BooleanType] = encode_int
+  if file is not None:
+    if hasattr(file, 'read'): data = file.read()
+    else: data = open(file,'rb').read() # string or binary?
+  elif data is None: 
+    raise ValueError('must provide file (name or descriptor) or data')
+  x = data
+  r = []
+  encode_func[type(x)](x, r)
+  return ''.join(r)
+
+# # # # # 
+def parseArgs(args):
+  try: (argp, rest) =  getopt.gnu_getopt(args, "hu", ['help'])
+  except getopt.GetoptError: raise SystemExit(helpMessage)
+  if not rest: 
+    print helpMessage
+    raise SystemExit
+  if ('-u', '') in argp: action = 'undo'
+  else: action = 'do'
+  return rest, action
+
+def checkArgs(directories):
+  ln = len(directories) -1
+  for i, directory in enumerate(reversed(directories)):
+    if not os.path.isdir(directory): 
+      del directories[ln-i]
+      print >> sys.stderr, '%s is not a directory, will skip' % directory
+  return directories
+
+def getTorNames(dir):
+    return [os.path.join(dir, x) for x in os.listdir(dir) if x.endswith('.torrent')]
+  
+def main():
+  directories, action =  parseArgs(sys.argv[1:])
+  directories = checkArgs(directories)
+  for dir in directories:
+    for tor in getTorNames(dir):
+      tord = bdecode(tor)
+      if 'files' not in tord['info']: continue #single file torrent
+      if 'rtorrent' not in tord: 
+        print >> sys.stderr, "file %s appears to not be a session file" % tor
+        continue
+      if action == 'do':
+        tord['rtorrent']['directory'] = '%s/%s/' % (tord['rtorrent']['directory'].rstrip('/'),tord['info']['name'])
+      elif action =='undo':
+        dn, fn = os.path.split(tord['info']['name'].rstrip('/'))
+        if fn == tord['info']['name']: 
+          tord['rtorrent']['directory'] = '%s%s' % (dn, '/')
+      fdw = open(tor, 'w')
+      fdw.write(bencode(data=tord))
+      fdw.close()
+
+if __name__ == '__main__': main()
--- rtorrent-0.8.6.orig/debian/patches/fix_bitfield_crash.patch
+++ rtorrent-0.8.6/debian/patches/fix_bitfield_crash.patch
@@ -0,0 +1,15 @@
+# Fix crash when trying to call d.get_bitfield on a closed download. Ticket #1825.
+Index: rtorrent/src/command_download.cc
+===================================================================
+--- rtorrent/src/command_download.cc	(revision 1093)
++++ rtorrent/src/command_download.cc	(working copy)
+@@ -292,6 +292,9 @@
+ 
+ torrent::Object
+ retrieve_d_bitfield(core::Download* download) {
++  if (!download->download()->file_list()->is_open())
++    throw torrent::input_error("Cannot retrieve bitfield of closed download.");
++
+   const torrent::Bitfield* bitField = download->download()->file_list()->bitfield();
+ 
+   return torrent::Object(rak::transform_hex(bitField->begin(), bitField->end()));
--- rtorrent-0.8.6.orig/debian/patches/fix-gcc44-ftbfs.patch
+++ rtorrent-0.8.6/debian/patches/fix-gcc44-ftbfs.patch
@@ -0,0 +1,162 @@
+# Fix FTBFS with gcc 4.4.
+# Modified from a patch by Martin Michlmayr
+--- a/src/display/utils.h
++++ b/src/display/utils.h
+@@ -37,6 +37,7 @@
+ #ifndef RTORRENT_DISPLAY_UTILS_H
+ #define RTORRENT_DISPLAY_UTILS_H
+ 
++#include <cstdio>
+ #include <ctime>
+ #include <string>
+ 
+--- a/src/rpc/parse.cc
++++ b/src/rpc/parse.cc
+@@ -38,6 +38,7 @@
+ 
+ #include <cstring>
+ #include <locale>
++#include <cstdio>
+ #include <rak/path.h>
+ #include <torrent/exceptions.h>
+ 
+--- a/src/rpc/scgi_task.cc
++++ b/src/rpc/scgi_task.cc
+@@ -36,6 +36,7 @@
+ 
+ #include "config.h"
+ 
++#include <cstdio>
+ #include <rak/error_number.h>
+ #include <sys/types.h>
+ #include <sys/socket.h>
+--- a/src/utils/lockfile.cc
++++ b/src/utils/lockfile.cc
+@@ -39,6 +39,7 @@
+ #include <algorithm>
+ #include <cctype>
+ #include <cerrno>
++#include <cstdio>
+ #include <cstring>
+ #include <sstream>
+ #include <fcntl.h>
+--- a/src/command_network.cc
++++ b/src/command_network.cc
+@@ -36,6 +36,7 @@
+ 
+ #include "config.h"
+ 
++#include <cstdio>
+ #include <functional>
+ #include <rak/address_info.h>
+ #include <rak/path.h>
+--- a/src/command_ui.cc
++++ b/src/command_ui.cc
+@@ -36,6 +36,7 @@
+ 
+ #include "config.h"
+ 
++#include <cstdio>
+ #include <ctime>
+ #include <rak/functional.h>
+ #include <rak/functional_fun.h>
+--- a/src/command_download.cc
++++ b/src/command_download.cc
+@@ -36,6 +36,7 @@
+ 
+ #include "config.h"
+ 
++#include <cstdio>
+ #include <functional>
+ #include <unistd.h>
+ #include <rak/file_stat.h>
+--- a/src/command_dynamic.cc
++++ b/src/command_dynamic.cc
+@@ -36,6 +36,7 @@
+ 
+ #include "config.h"
+ 
++#include <cstdio>
+ #include <algorithm>
+ 
+ #include "globals.h"
+--- a/src/command_events.cc
++++ b/src/command_events.cc
+@@ -36,6 +36,7 @@
+ 
+ #include "config.h"
+ 
++#include <cstdio>
+ #include <functional>
+ #include <rak/file_stat.h>
+ #include <rak/path.h>
+--- a/src/command_file.cc
++++ b/src/command_file.cc
+@@ -36,6 +36,7 @@
+ 
+ #include "config.h"
+ 
++#include <cstdio>
+ #include <rak/error_number.h>
+ #include <rak/path.h>
+ #include <torrent/data/file.h>
+--- a/src/command_helpers.cc
++++ b/src/command_helpers.cc
+@@ -36,6 +36,7 @@
+ 
+ #include "config.h"
+ 
++#include <cstdio>
+ #include <torrent/exceptions.h>
+ 
+ #include "rpc/command_slot.h"
+--- a/src/command_local.cc
++++ b/src/command_local.cc
+@@ -36,6 +36,7 @@
+ 
+ #include "config.h"
+ 
++#include <cstdio>
+ #include <fcntl.h>
+ #include <functional>
+ #include <unistd.h>
+--- a/src/command_object.cc
++++ b/src/command_object.cc
+@@ -36,6 +36,7 @@
+ 
+ #include "config.h"
+ 
++#include <cstdio>
+ #include <algorithm>
+ 
+ #include "globals.h"
+--- a/src/command_peer.cc
++++ b/src/command_peer.cc
+@@ -36,6 +36,7 @@
+ 
+ #include "config.h"
+ 
++#include <cstdio>
+ #include <rak/error_number.h>
+ #include <rak/path.h>
+ #include <rak/socket_address.h>
+--- a/src/command_scheduler.cc
++++ b/src/command_scheduler.cc
+@@ -36,6 +36,7 @@
+ 
+ #include "config.h"
+ 
++#include <cstdio>
+ #include "core/manager.h"
+ #include "core/download_list.h"
+ #include "rpc/command_variable.h"
+--- a/src/command_tracker.cc
++++ b/src/command_tracker.cc
+@@ -36,6 +36,7 @@
+ 
+ #include "config.h"
+ 
++#include <cstdio>
+ #include <rak/error_number.h>
+ #include <torrent/tracker.h>
+ 
