qbittorrent: use libtorrent-rasterbar-devel

A patch from OpenSUSE makes qbittorrent work with our system
libtorrent-rasterbar-1.1.1. Thanks @asergi!
This commit is contained in:
Juergen Buchmueller 2016-12-19 14:52:28 +01:00
parent 0e0b900430
commit 6c34491f4a
2 changed files with 64 additions and 2 deletions

View File

@ -0,0 +1,62 @@
--- src/base/bittorrent/session.cpp
+++ src/base/bittorrent/session.cpp
@@ -45,6 +45,9 @@
#include <QTimer>
#include <cstdlib>
+#if LIBTORRENT_VERSION_NUM >= 10100 && LIBTORRENT_VERSION_NUM < 10102
+#include <sstream>
+#endif
#include <queue>
#include <vector>
@@ -194,6 +197,36 @@ namespace
template <typename T>
LowerLimited<T> lowerLimited(T limit, T ret) { return LowerLimited<T>(limit, ret); }
+
+#if LIBTORRENT_VERSION_NUM >= 10100 && LIBTORRENT_VERSION_NUM < 10102
+ std::string makeFingerprint(const char* peerId, int major, int minor, int revision, int tag)
+ {
+ Q_ASSERT(peerId);
+ Q_ASSERT(major >= 0);
+ Q_ASSERT(minor >= 0);
+ Q_ASSERT(revision >= 0);
+ Q_ASSERT(tag >= 0);
+ Q_ASSERT(std::strlen(peerId) == 2);
+
+ auto versionToChar = [](int v) -> char
+ {
+ if (v >= 0 && v < 10) return static_cast<char>('0' + v);
+ if (v >= 10) return static_cast<char>('A' + (v - 10));
+ Q_ASSERT(false);
+ return '0';
+ };
+
+ std::ostringstream buf;
+ buf << '-'
+ << peerId
+ << versionToChar(major)
+ << versionToChar(minor)
+ << versionToChar(revision)
+ << versionToChar(tag)
+ << '-';
+ return buf.str();
+ }
+#endif
}
// Session
@@ -334,7 +367,11 @@ Session::Session(QObject *parent)
dispatchAlerts(alertPtr.release());
});
#else
+#if LIBTORRENT_VERSION_NUM < 10102
+ std::string peerId = makeFingerprint(PEER_ID, VERSION_MAJOR, VERSION_MINOR, VERSION_BUGFIX, VERSION_BUILD);
+#else
std::string peerId = libt::generate_fingerprint(PEER_ID, VERSION_MAJOR, VERSION_MINOR, VERSION_BUGFIX, VERSION_BUILD);
+#endif
libt::settings_pack pack;
pack.set_int(libt::settings_pack::alert_mask, alertMask);
pack.set_str(libt::settings_pack::peer_fingerprint, peerId);

View File

@ -1,11 +1,11 @@
# Template file for 'qbittorrent' # Template file for 'qbittorrent'
pkgname=qbittorrent pkgname=qbittorrent
version=3.3.10 version=3.3.10
revision=1 revision=2
build_style=qmake build_style=qmake
hostmakedepends="automake libtool pkg-config qt5-qmake qt5-tools hostmakedepends="automake libtool pkg-config qt5-qmake qt5-tools
qt5-host-tools qt5-declarative-devel" qt5-host-tools qt5-declarative-devel"
makedepends="libtorrent-rasterbar-1.0-devel qt5-declarative-devel" makedepends="libtorrent-rasterbar-devel qt5-declarative-devel"
short_desc="Free software alternative to µtorrent" short_desc="Free software alternative to µtorrent"
maintainer="Jürgen Buchmüller <pullmoll@t-online.de>" maintainer="Jürgen Buchmüller <pullmoll@t-online.de>"
license="GPL-2" license="GPL-2"