Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=frugalware-current.git;a=commitdiff;h=fb1bf8ecd068011ca4f3bf48ac5b6a359b62ba76

commit fb1bf8ecd068011ca4f3bf48ac5b6a359b62ba76
Author: Miklos Vajna <[EMAIL PROTECTED]>
Date:   Fri Dec 5 03:51:20 2008 +0100

btg-0.9.8-3-i686

* rebuild with boost and libtorrent-rasterbar

diff --git a/source/network-extra/btg/FrugalBuild 
b/source/network-extra/btg/FrugalBuild
index 760c1c2..027b9b0 100644
--- a/source/network-extra/btg/FrugalBuild
+++ b/source/network-extra/btg/FrugalBuild
@@ -4,21 +4,27 @@
pkgname=btg
pkgver=0.9.8
pkgextraver=
-pkgrel=2
+pkgrel=3
pkgdesc="Bittorrent client implemented in C++ and using the Rasterbar 
Libtorrent library."
Finclude berlios
-depends=('libboost-mt>=1.35.0' 'libtorrent-rasterbar>=0.13.1' 'gnutls' 
'dialog')
-makedepends=('boost>=1.35.0' 'asio')
+depends=('libboost-mt>=1.37.0' 'libtorrent-rasterbar>=0.14.1' 'gnutls' 
'dialog')
+makedepends=('boost>=1.37.0' 'asio')
groups=('network-extra')
archs=('i686' 'x86_64')
-sha1sums=('07af091edf11a2fdaf95ef6f4242342ee7ca5468')
+source=($source datetime.patch svn456.patch svn470.patch svn477.patch)
+sha1sums=('07af091edf11a2fdaf95ef6f4242342ee7ca5468' \
+          '282765938ac7db61098a9bc3eb4516e7f5f2dc66' \
+          '97fa0273b35532aebf818b4d6b58e852139d6fb8' \
+          '0f233fde35ca25ce6c3b31bad662bb5bb891b24f' \
+          '58fbf06f512d2dc928d2fd581ab7cb49dc61d73a')

build()
{
Fcd $pkgname-$pkgver
-       Fsed 'libtorrent >= 0.12' 'libtorrent-rasterbar >= 0.13' 
m4/btg_rblibtorrent_check.m4
+       Fpatchall
+       Fsed 'libtorrent >= 0.12' 'libtorrent-rasterbar >= 0.14' 
m4/btg_rblibtorrent_check.m4
sh autogen.sh || return 1
-       Fbuild \
+       Fmake \
--with-boost-iostreams=mt \
--with-boost-filesystem=mt \
--with-boost-date-time=mt \
@@ -30,6 +36,7 @@ build()
--enable-upnp \
--enable-event-callback \
--with-rblibtorrent=/usr
+       Fmakeinstall
}

# optimization OK
diff --git a/source/network-extra/btg/datetime.patch 
b/source/network-extra/btg/datetime.patch
new file mode 100644
index 0000000..87e1401
--- /dev/null
+++ b/source/network-extra/btg/datetime.patch
@@ -0,0 +1,28 @@
+libtool: link: g++ -march=i686 -mtune=generic -O2 -pipe -fno-strict-aliasing 
-DNDEBUG -I/usr/include -I/usr/include -DBTG_DEBUG=0 
-DBTG_OPTION_SAVESESSIONS=1 -DBTG_OPTION_EVENTCALLBACK=1 -DBTG_OPTION_UPNP=1 
-DBTG_OPTION_USECYBERLINK=0 -DBTG_REV=TRUNK -DBTG_INTERNAL_XMLRPC=1 -march=i686 
-mtune=generic -O2 -pipe -fno-strict-aliasing -Wl,--hash-style=both -o 
.libs/btgpasswd btgpasswd-arg.o btgpasswd-btgpasswd.o btgpasswd-dconfig.o  
-L/usr/lib ../../bcore/.libs/libbtgcore.so /usr/lib/libtorrent-rasterbar.so 
-lssl -lcrypto -lboost_iostreams-mt /usr/lib/libgnutls.so -lz 
/usr/lib/libtasn1.so /usr/lib/libgcrypt.so /usr/lib/libgpg-error.so 
-lboost_program_options-mt -lboost_thread-mt -lboost_filesystem-mt 
-lboost_system-mt ./.libs/libauth.a ../../external/ini/.libs/libini.a 
/usr/lib/libstdc++.so -lm -pthread -Wl,-rpath -Wl,/usr/lib/btg
+btgpasswd-btgpasswd.o: In function `std::basic_string<char, 
std::char_traits<char>, std::allocator<char> > 
boost::posix_time::to_simple_string_type<char>(boost::posix_time::ptime)':
+btgpasswd.cpp:(.text._ZN5boost10posix_time21to_simple_string_typeIcEESbIT_St11char_traitsIS2_ESaIS2_EENS0_5ptimeE[std::basic_string<char,
 std::char_traits<char>, std::allocator<char> > 
boost::posix_time::to_simple_string_type<char>(boost::posix_time::ptime)]+0x39c):
 undefined reference to `boost::gregorian::greg_month::as_short_string() const'
+collect2: ld returned 1 exit status
+make[3]: *** [btgpasswd] Error 1
+make[3]: Leaving directory `/var/tmp/fst/src/btg-0.9.8/daemon/auth'
+make[2]: *** [all-recursive] Error 1
+make[2]: Leaving directory `/var/tmp/fst/src/btg-0.9.8/daemon'
+make[1]: *** [all-recursive] Error 1
+make[1]: Leaving directory `/var/tmp/fst/src/btg-0.9.8'
+make: *** [all] Error 2
+
+This should fix the above error.
+
+diff --git a/bcore/Makefile.am b/bcore/Makefile.am
+index 17afeee..a3c6717 100644
+--- a/bcore/Makefile.am
++++ b/bcore/Makefile.am
+@@ -131,7 +131,8 @@ urlstatus.cpp
+
+ libbtgcore_la_LIBADD = @XMLRPC_LDFLAGS@ @LIBTORRENT_LIBS@ 
@BOOST_IOSTREAMS_LIB@ \
+ @LIBGNUTLS_LIBS@ @BOOST_PROGRAM_OPTIONS_LIB@ \
[EMAIL PROTECTED]@ @BOOST_FILESYSTEM_LIB@ @BOOST_SYSTEM_LIB@
[EMAIL PROTECTED]@ @BOOST_FILESYSTEM_LIB@ @BOOST_SYSTEM_LIB@ \
[EMAIL PROTECTED]@
+
+ if BUILDINTERNALXMLRPC
+   libbtgcore_la_LIBADD += $(top_builddir)/external/xmlrpc-epi/src/libxmlrpc.la
diff --git a/source/network-extra/btg/svn456.patch 
b/source/network-extra/btg/svn456.patch
new file mode 100644
index 0000000..0c56ecf
--- /dev/null
+++ b/source/network-extra/btg/svn456.patch
@@ -0,0 +1,408 @@
+Index: configure.in
+===================================================================
+--- configure.in       (revision 455)
++++ configure.in       (revision 456)
+@@ -7,7 +7,7 @@
+ AC_INIT(bcore/project.h)
+ AC_CANONICAL_SYSTEM
+
+-AM_INIT_AUTOMAKE(btg, 0.9.8)
++AM_INIT_AUTOMAKE(btg, 0.9.9)
+
+ BTG_BUILD="$VER_CURRENT.$VER_REVISION"
+ AC_SUBST(BTG_BUILD)
+Index: daemon/context.cpp
+===================================================================
+--- daemon/context.cpp (revision 455)
++++ daemon/context.cpp (revision 456)
+@@ -474,7 +474,7 @@
+          // tempDir_ + projectDefaults::sPATH_SEPARATOR() +
+          std::string fileTrackFilename = _torrent_filename;
+
+-         // Add torrent name to filetracker
++         // Add torrent name to filetracker.
+          if (!filetrack_->add(tempDir_, fileTrackFilename))
+             {
+                status = Context::ERR_EXISTS;
+@@ -488,8 +488,11 @@
+          libtorrent::entry torrent_entry;
+
+          // Prepend tempDir_ to filename.
+-         std::string targetPath = tempDir_ + 
projectDefaults::sPATH_SEPARATOR() + _torrent_filename;
++         std::string targetPath = tempDir_ +
++            projectDefaults::sPATH_SEPARATOR() +
++            _torrent_filename;
+
++#if BTG_LT_0_12 || BTG_LT_0_13
+          // Read the file:
+          try
+             {
+@@ -503,10 +506,9 @@
+             }
+          catch (std::exception& e)
+             {
+-               BTG_MNOTICE(logWrapper(), "libtorrent exception: " << 
e.what());
++
+                status = Context::ERR_LIBTORRENT;
+             }
+-
+          if (status != Context::ERR_OK)
+             {
+                // remove it from filetrack
+@@ -514,6 +516,10 @@
+                BTG_MEXIT(logWrapper(), "add", status);
+                return status;
+             }
++#elif BTG_LT_0_14
++         status = Context::ERR_OK;
++#endif
++
+ #if BTG_LT_0_12
+          libtorrent::torrent_info tinfo;
+          if (!entryToInfo(torrent_entry, tinfo))
+@@ -525,15 +531,17 @@
+          bool gotInfo = true;
+          try
+             {
+-               tinfo.reset(new libtorrent::torrent_info(torrent_entry));
++               boost::filesystem::path targetFilename(targetPath);
++               BTG_MNOTICE(logWrapper(), "Attempt to get info from '" << 
targetPath << "'");
++               tinfo.reset(new libtorrent::torrent_info(targetFilename));
+             }
+          catch (std::exception& e)
+             {
++               BTG_MNOTICE(logWrapper(), "libtorrent exception (torrent_info 
constructor): " << e.what());
+                gotInfo = false;
+             }
+
+          if (!gotInfo)
+-            // if (!entryToInfo(torrent_entry, tinfo))
+ #endif
+             {
+                // Unable to convert the entry to a torrent info.
+@@ -546,6 +554,7 @@
+             }
+
+          std::vector<std::string> contained_files;
++#if BTG_LT_0_12 || BTG_LT_0_13
+          if (!entryToFiles(torrent_entry, contained_files))
+             {
+                filetrack_->remove(tempDir_, fileTrackFilename);
+@@ -553,7 +562,15 @@
+                BTG_MEXIT(logWrapper(), "add", status);
+                return status;
+             }
+-
++#elif BTG_LT_0_14
++         if (!torrentInfoToFiles(*tinfo, contained_files))
++            {
++               filetrack_->remove(tempDir_, fileTrackFilename);
++               status = Context::ERR_LIBTORRENT;
++               BTG_MEXIT(logWrapper(), "add", status);
++               return status;
++            }
++#endif
+          btg_assert(contained_files.size() >= 1,
+                     logWrapper(),
+                     "entryToFiles must return at least one file");
+@@ -600,28 +617,45 @@
+                      std::string fastResumeFileName = tempDir_ + 
projectDefaults::sPATH_SEPARATOR() + _torrent_filename + fastResumeFileNameEnd;
+                      std::ifstream in(fastResumeFileName.c_str(), 
std::ios_base::binary);
+                      in.unsetf(std::ios_base::skipws);
+-
++#if (BTG_LT_0_12 || BTG_LT_0_13)
+                      libtorrent::entry fastResumeEntry;
+-
++#elif BTG_LT_0_14
++                     std::vector<char>* resumeData       = new 
std::vector<char>;
++#endif
+                      try
+                         {
++#if (BTG_LT_0_12 || BTG_LT_0_13)
+                            fastResumeEntry = libtorrent::bdecode(
+                                                                  
std::istream_iterator<char>(in),
+                                                                  
std::istream_iterator<char>()
+                                                                  );
++#elif BTG_LT_0_14
++                           std::copy(std::istream_iterator<char>(in),
++                                     std::istream_iterator<char>(),
++                                     std::back_inserter(*resumeData));
++#endif
+                         }
+                      catch (std::exception& e)
+                         {
+                            BTG_MNOTICE(logWrapper(), "libtorrent exception: " 
<< e.what());
+                            status = Context::ERR_LIBTORRENT;
+                         }
++
+                      if (status == Context::ERR_OK)
+                         {
+                            BTG_MNOTICE(logWrapper(), "using fast resume for 
'" << _torrent_filename << "'");
+ #if BTG_LT_0_12
+                            handle = 
torrent_session->add_torrent(torrent_entry, dataPath, fastResumeEntry);
+-#elif (BTG_LT_0_13 || BTG_LT_0_14)
++#elif BTG_LT_0_13
+                            handle = torrent_session->add_torrent(tinfo, 
dataPath, fastResumeEntry);
++#elif BTG_LT_0_14
++                           libtorrent::add_torrent_params atp;
++                           atp.name        = 0; // "default name";
++                           atp.ti.swap(tinfo);
++                           atp.save_path   = dataPath;
++                           atp.resume_data = resumeData;
++
++                           handle          = 
torrent_session->add_torrent(atp);
+ #endif
+
+                         }
+@@ -630,8 +664,15 @@
+                   {
+ #if BTG_LT_0_12
+                      handle = torrent_session->add_torrent(torrent_entry, 
dataPath);
+-#elif (BTG_LT_0_13 || BTG_LT_0_14)
++#elif BTG_LT_0_13
+                      handle = torrent_session->add_torrent(tinfo, dataPath);
++#elif BTG_LT_0_14
++                     libtorrent::add_torrent_params atp;
++                     atp.name      = 0; // "default name";
++                     atp.ti.swap(tinfo);
++                     atp.save_path = dataPath;
++
++                     handle        = torrent_session->add_torrent(atp);
+ #endif
+                   }
+             }
+@@ -2065,7 +2106,7 @@
+             {
+                torrentInfo* ti = tii->second;
+                libtorrent::torrent_status status = ti->handle.status();
+-
++
+                if (status.state == libtorrent::torrent_status::downloading)
+                   {
+                      ti->download_counter++;
+Index: daemon/context_alert.cpp
+===================================================================
+--- daemon/context_alert.cpp   (revision 455)
++++ daemon/context_alert.cpp   (revision 456)
+@@ -142,7 +142,13 @@
+                            verboseFlag_, "Tracker alert: filename '" <<
+                            filename << "', status = " <<
+                            _alert->status_code << ", message '" <<
+-                           _alert->msg() << "'");
++#if BTG_LT_0_14
++                           _alert->message()
++#else
++                           _alert->msg()
++#endif
++                           << "'");
++
+                ti->trackerStatus.invalidate();
+                // Handle alerts which have some undefined status code.
+                if (_alert->status_code != trackerStatus::undefined)
+@@ -154,7 +160,14 @@
+                      ti->trackerStatus.setStatus(trackerStatus::warning);
+                   }
+                ti->trackerStatus.setSerial(ti->serial);
+-               ti->trackerStatus.setMessage(_alert->msg());
++               ti->trackerStatus.setMessage(
++#if BTG_LT_0_14
++                                            _alert->message()
++#else
++                                            _alert->msg()
++#endif
++               );
++
+                ti->serial++;
+
+                if (ti->serial > trackerStatus::MAX_SERIAL)
+@@ -200,13 +213,26 @@
+          if (getIdFromHandle(_alert->handle, torrent_id, ti))
+             {
+                getFilename(torrent_id, filename);
++               VERBOSE_LOG(logWrapper(), verboseFlag_, "Tracker warning 
alert: filename '" <<
++                           filename << "', message '" <<
++#if BTG_LT_0_14
++                           _alert->message()
++#else
++                           _alert->msg()
++#endif
++                           << "'");
+
+-               VERBOSE_LOG(logWrapper(), verboseFlag_, "Tracker warning 
alert: filename '" <<
+-                           filename << "', message '" << _alert->msg() << 
"'");
+                ti->trackerStatus.invalidate();
+                ti->trackerStatus.setStatus(trackerStatus::warning);
+                ti->trackerStatus.setSerial(ti->serial);
+-               ti->trackerStatus.setMessage(_alert->msg());
++               ti->trackerStatus.setMessage(
++#if BTG_LT_0_14
++               _alert->message()
++#else
++               _alert->msg()
++#endif
++               );
++
+                ti->serial++;
+
+                if (ti->serial > trackerStatus::MAX_SERIAL)
+@@ -270,7 +296,13 @@
+                   else
+                      {
+                         // Log other alerts.
+-                        BTG_NOTICE(logWrapper(), "Alert: " << alert->msg() << 
" (" << typeid(*alert).name() << ")");
++                        BTG_NOTICE(logWrapper(), "Alert: " <<
++#if BTG_LT_0_14
++                                   alert->message()
++#else
++                                   alert->msg()
++#endif
++                                   << " (" << typeid(*alert).name() << ")");
+                      }
+                }
+          }
+Index: daemon/context_file.cpp
+===================================================================
+--- daemon/context_file.cpp    (revision 455)
++++ daemon/context_file.cpp    (revision 456)
+@@ -292,13 +292,13 @@
+               iter++)
+             {
+                libtorrent::file_entry const& fe = *iter;
+-
++
+                // The full path.
+                boost::filesystem::path file_path = fe.path;
+-
++
+                // Only the file name.
+                std::string filename = file_path.leaf();
+-
++
+                // Get the first directory name, if it exists.
+                if (!file_path.branch_path().empty())
+                   {
+@@ -334,7 +334,7 @@
+
+                BTG_MNOTICE(logWrapper(), "Using directory '" << 
file_path.string() << "'");
+                BTG_MNOTICE(logWrapper(), "Checking file '" << filename << 
"'");
+-
++
+                try
+                   {
+                      if (find_file(boost::filesystem::path(file_path), 
filename))
+@@ -591,7 +591,46 @@
+
+          return status;
+       }
++#if BTG_LT_0_14
++      bool Context::torrentInfoToFiles(libtorrent::torrent_info const& _tinfo,
++                                       std::vector<std::string> & _output) 
const
++      {
++         BTG_MENTER(logWrapper(), "torrentInfoToFiles", "");
+
++         bool status = true;
++         try
++            {
++               libtorrent::torrent_info::file_iterator iter;
++
++               for (iter = _tinfo.begin_files();
++                    iter != _tinfo.end_files();
++                    iter++)
++                  {
++                     libtorrent::file_entry const& fe = *iter;
++                     BTG_MNOTICE(logWrapper(), fe.path.string());
++
++                     _output.push_back(fe.path.string());
++                  }
++            }
++         catch (std::exception& e)
++            {
++               BTG_ERROR_LOG(logWrapper(), "libtorrent exception 
(torrentInfoToFiles): " << e.what() );
++               status = false;
++            }
++
++         if (_output.size() == 0)
++         {
++            // Torrents with no files are not ok.
++            BTG_ERROR_LOG(logWrapper(), "torrentInfoToFiles, attempt to load 
torrent with no files in it.");
++            status = false;
++         }
++
++         BTG_MEXIT(logWrapper(), "torrentInfoToFiles", status);
++         return status;
++      }
++#endif
++
++#if BTG_LT_0_12 || BTG_LT_0_13
+       bool Context::entryToFiles(libtorrent::entry const& _input,
+                                  std::vector<std::string> & _output) const
+       {
+@@ -615,13 +654,14 @@
+             }
+          catch (std::exception& e)
+             {
+-               BTG_ERROR_LOG(logWrapper(), "libtorrent exception: " << 
e.what() );
++               BTG_ERROR_LOG(logWrapper(), "libtorrent exception 
(entryToFiles): " << e.what() );
+                status = false;
+             }
+
+          BTG_MEXIT(logWrapper(), "entryToFiles", status);
+          return status;
+       }
++#endif
+
+ #if (BTG_LT_0_14)
+       void Context::bitfieldToVector(libtorrent::bitfield const& _input,
+Index: daemon/context.h
+===================================================================
+--- daemon/context.h   (revision 455)
++++ daemon/context.h   (revision 456)
+@@ -660,12 +660,17 @@
+ #if (BTG_LT_0_12 || BTG_LT_0_13)
+                bool entryToInfo(libtorrent::entry const& _input,
+                                 libtorrent::torrent_info & _output) const;
+-#endif
++
+                /// Convert an entry to a list of contained files.
+                /// @return True - converted. False - conversion failed.
+                bool entryToFiles(libtorrent::entry const& _input,
+                                  std::vector<std::string> & _output) const;
++#endif
+
++#if BTG_LT_0_14
++               bool torrentInfoToFiles(libtorrent::torrent_info const& _tinfo,
++                                       std::vector<std::string> & _output) 
const;
++#endif
+                /// Find out if data of a torrent is present in the seed dir.
+                /// @param [in] _torrent_info Torrent info.
+                /// @return True - data is present, false otherwise.
+Index: setup.sh
+===================================================================
+--- setup.sh   (revision 455)
++++ setup.sh   (revision 456)
+@@ -128,14 +128,19 @@
+   svn)
+     # Libtorrent from SVN uses boost 1.3.5, where asio is included.
+     CXXFLAGS_pkgconfig=`export PKG_CONFIG_PATH=/$ROOT/$1/lib/pkgconfig; 
pkg-config --cflags libtorrent`
+-    export CXXFLAGS="$CXXFLAGS -I/pack/boost-1.35.0/include 
$CXXFLAGS_pkgconfig"
+-    export LDFLAGS="$LDFLAGS -L/pack/boost-1.35.0/lib"
+-    export LD_LIBRARY_PATH=/pack/boost-1.35.0/lib
+-    export LIBTORRENT_CFLAGS="-I$ROOT/svn/include 
-I$ROOT/svn/include/libtorrent" && \
+-    export LIBTORRENT_LIBS="-L$ROOT/svn/lib -ltorrent" && \
++    export LIBTORRENT_CFLAGS="-I$ROOT/$1/include 
-I$ROOT/$1/include/libtorrent" && \
++    export LIBTORRENT_LIBS="-L$ROOT/$1/lib -ltorrent-rasterbar" && \
+     echo "Using $CONFIGURE";
+-    $CONFIGURE --with-rblibtorrent=$ROOT/svn
++    $CONFIGURE --with-rblibtorrent=$ROOT/$1
+     ;;
++  svn-debug)
++    # Libtorrent from SVN uses boost 1.3.5, where asio is included.
++    CXXFLAGS_pkgconfig=`export PKG_CONFIG_PATH=/$ROOT/$1/lib/pkgconfig; 
pkg-config --cflags libtorrent`
++    export LIBTORRENT_CFLAGS="-I$ROOT/$1/include 
-I$ROOT/$1/include/libtorrent" && \
++    export LIBTORRENT_LIBS="-L$ROOT/$1/lib -ltorrent-rasterbar" && \
++    echo "Using $CONFIGURE";
++    $CONFIGURE --with-rblibtorrent=$ROOT/$1
++    ;;
+   system)
+     # Use libtorrent installed system wide.
+     $CONFIGURE
diff --git a/source/network-extra/btg/svn470.patch 
b/source/network-extra/btg/svn470.patch
new file mode 100644
index 0000000..0773f2d
--- /dev/null
+++ b/source/network-extra/btg/svn470.patch
@@ -0,0 +1,139 @@
+Index: bcore/externalization/xmlrpc.cpp
+===================================================================
+--- bcore/externalization/xmlrpc.cpp   (revision 469)
++++ bcore/externalization/xmlrpc.cpp   (revision 470)
+@@ -222,8 +222,8 @@
+
+          void XMLRPC::getBuffer(dBuffer & _buffer)
+          {
+-            char* buff;
+-            int   buffsize;
++            char* buff     = 0;
++            int   buffsize = 0;
+
+             XMLRPC_REQUEST_OUTPUT_OPTIONS opt = 
XMLRPC_RequestGetOutputOptions(xmlrpc_request);
+
+Index: bcore/transport/tcpipbase.cpp
+===================================================================
+--- bcore/transport/tcpipbase.cpp      (revision 469)
++++ bcore/transport/tcpipbase.cpp      (revision 470)
+@@ -142,6 +142,7 @@
+             }
+
+          t_byteP message = new t_byte[message_size];
++         memset(message, 0, message_size);
+
+          if (message == 0)
+             {
+Index: daemon/daemonhandler.cpp
+===================================================================
+--- daemon/daemonhandler.cpp   (revision 469)
++++ daemon/daemonhandler.cpp   (revision 470)
+@@ -1281,6 +1281,7 @@
+             }
+
+          delete _command;
++         _command = 0;
+
+          BTG_MNOTICE(logWrapper(), "data (out): " << sendBuffer_.size() << " 
bytes");
+
+Index: daemon/context.cpp
+===================================================================
+--- daemon/context.cpp (revision 469)
++++ daemon/context.cpp (revision 470)
+@@ -62,6 +62,10 @@
+ #include <libtorrent/extensions/ut_pex.hpp>
+ #endif
+
++#if BTG_LT_0_14
++#include <libtorrent/alert.hpp>
++#endif
++
+ namespace btg
+ {
+    namespace daemon
+@@ -220,11 +224,20 @@
+
+                this->setNormalHttpSettings();
+
+-               // From the libtorrent manual.
+-               // Events that can be considered normal, but still deserves
+-               // an event. This could be a piece hash that fails.
++#if (BTG_LT_0_12 || BTG_LT_0_13)
+                torrent_session->set_severity_level(libtorrent::alert::info);
++#elif BTG_LT_0_14
++               {
++                  int amask =
++                     libtorrent::alert::error_notification |
++                     libtorrent::alert::port_mapping_notification |
++                     libtorrent::alert::tracker_notification |
++                     libtorrent::alert::status_notification |
++                     libtorrent::alert::progress_notification;
+
++                  torrent_session->set_alert_mask(amask);
++               }
++#endif
+                setPeerIdFromConfig();
+             }
+       }
+@@ -1186,7 +1199,11 @@
+             case libtorrent::torrent_status::checking_files:
+                ts = Status::ts_checking;
+                break;
++#if (BTG_LT_0_12) || (BTG_LT_0_13)
+             case libtorrent::torrent_status::connecting_to_tracker:
++#elif BTG_LT_0_14
++            case libtorrent::torrent_status::downloading_metadata:
++#endif
+                ts = Status::ts_connecting;
+                break;
+             case libtorrent::torrent_status::downloading:
+@@ -1815,7 +1832,11 @@
+             {
+             case libtorrent::torrent_status::queued_for_checking:
+             case libtorrent::torrent_status::checking_files:
++#if (BTG_LT_0_12) || (BTG_LT_0_13)
+             case libtorrent::torrent_status::connecting_to_tracker:
++#elif BTG_LT_0_14
++            case libtorrent::torrent_status::downloading_metadata:
++#endif
+             case libtorrent::torrent_status::downloading:
+                if (!moveToWorkingDir(_torrent_id))
+                   {
+@@ -1965,8 +1986,11 @@
+
+          // Get the status from libtorrent:
+          libtorrent::torrent_status status = ti->handle.status();
+-
++#if (BTG_LT_0_12) || (BTG_LT_0_13)
+          if ((status.state == 
libtorrent::torrent_status::connecting_to_tracker)
++#elif BTG_LT_0_14
++         if ((status.state == 
libtorrent::torrent_status::downloading_metadata)
++#endif
+              ||
+              (status.state == libtorrent::torrent_status::downloading)
+              ||
+Index: daemon/context_file.cpp
+===================================================================
+--- daemon/context_file.cpp    (revision 469)
++++ daemon/context_file.cpp    (revision 470)
+@@ -521,6 +521,7 @@
+             {
+                torrentInfo *ti       = tii->second;
+
++#if (BTG_LT_0_12 || BTG_LT_0_13)
+                // Get the fast resume data.
+                libtorrent::entry torrent_entry = 
ti->handle.write_resume_data();
+
+@@ -559,6 +560,11 @@
+
+                BTG_MNOTICE(logWrapper(), "wrote fast resume data for '" << 
filename << "'");
+                out.close();
++#elif BTG_LT_0_14
++               // The actual writting is done using a callback.
++               // TODO: implement this!
++               ti->handle.save_resume_data();
++#endif
+             }
+
+          op_status = true;
diff --git a/source/network-extra/btg/svn477.patch 
b/source/network-extra/btg/svn477.patch
new file mode 100644
index 0000000..63f7f42
--- /dev/null
+++ b/source/network-extra/btg/svn477.patch
@@ -0,0 +1,114 @@
+Index: daemon/context.cpp
+===================================================================
+--- daemon/context.cpp (revision 476)
++++ daemon/context.cpp (revision 477)
+@@ -546,7 +546,19 @@
+             {
+                boost::filesystem::path targetFilename(targetPath);
+                BTG_MNOTICE(logWrapper(), "Attempt to get info from '" << 
targetPath << "'");
+-               tinfo.reset(new libtorrent::torrent_info(targetFilename));
++
++               std::vector<char> contents;
++               if (libtorrent::load_file(targetFilename, contents) == 0)
++                  {
++                     BTG_MNOTICE(logWrapper(), "Loaded " << targetFilename << 
" into buffer, size " << contents.size() << " bytes.");
++                  }
++               else
++                  {
++                     BTG_MNOTICE(logWrapper(), "Failed to load " << 
targetFilename << " into buffer.");
++                     gotInfo = false;
++                  }
++
++               tinfo.reset(new libtorrent::torrent_info(&contents[0], 
contents.size()));
+             }
+          catch (std::exception& e)
+             {
+@@ -742,7 +754,7 @@
+                filetrack_->remove(tempDir_, fileTrackFilename);
+             }
+
+-         BTG_MEXIT(logWrapper(), "add", "");
++         BTG_MEXIT(logWrapper(), "add", toString(status));
+          return status;
+       }
+
+@@ -774,7 +786,7 @@
+                BTG_ERROR_LOG(logWrapper(), "Attempt to write '" << targetPath 
<< "' failed");
+             }
+
+-         BTG_MEXIT(logWrapper(), "add", status);
++         BTG_MEXIT(logWrapper(), "add", toString(status));
+          return status;
+       }
+
+@@ -2553,6 +2565,27 @@
+
+          filter_->set(*torrent_session);
+       }
++
++      std::string Context::toString(addResult const _addresult) const
++      {
++         std::string s;
++         switch(_addresult)
++            {
++            case ERR_UNDEFINED:
++               s = "ERR_UNDEFINED";
++               break;
++            case ERR_OK:
++               s = "ERR_OK";
++               break;
++            case ERR_EXISTS:
++               s = "ERR_EXISTS";
++               break;
++            case ERR_LIBTORRENT:
++               s = "ERR_LIBTORRENT";
++               break;
++            }
++         return s;
++      }
+
+       Context::~Context()
+       {
+Index: daemon/context_file.cpp
+===================================================================
+--- daemon/context_file.cpp    (revision 476)
++++ daemon/context_file.cpp    (revision 477)
+@@ -30,6 +30,8 @@
+ #include <libtorrent/identify_client.hpp>
+ #include <algorithm>
+
++#include <boost/version.hpp>
++
+ namespace btg
+ {
+    namespace daemon
+@@ -264,7 +266,14 @@
+                            return true;
+                         }
+                   }
+-               else if (itr->leaf() == file_name) // see below
++
++#if BOOST_VERSION > 103500
++               // 1.36.x and so on.
++               else if (itr->filename() == file_name) // see below
++#else
++               // Below 1.35.x.
++               else if (itr->path() == file_name) // see below
++#endif
+                   {
+                      BTG_MEXIT(logWrapper(), "find_file", true);
+                      return true;
+Index: daemon/context.h
+===================================================================
+--- daemon/context.h   (revision 476)
++++ daemon/context.h   (revision 477)
+@@ -707,6 +707,9 @@
+                /// Set peer ID (read from configuration, converting it
+                /// to a format used by libtorrent).
+                void setPeerIdFromConfig();
++
++               std::string toString(addResult const _addresult) const;
++
+ #if (BTG_LT_0_14)
+                /// Convert a libtorrent bitfield into a vector of bits.
+                ///
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to