From 5cb2f7c9574c7380f4ef4280b836ea9c231856d3 Mon Sep 17 00:00:00 2001 From: Eric Hameleers Date: Sat, 11 May 2019 15:17:12 +0200 Subject: ktorrent: embed a local copy of the GeoIP database The online version of GeoIP has been discontinued in favor of a new API. The ktorrent code has not been updated for the new API and therefore the program spits out a download error for geoip.dat everytime it starts. By embedding a local copy of the database, a download is not attempted and the error is gone. --- kde/build/ktorrent | 1 + kde/patch/ktorrent.patch | 3 ++ kde/patch/ktorrent/geoip.dat.gz | Bin 0 -> 710752 bytes .../ktorrent.use.package.geoip.database.diff | 38 +++++++++++++++++++++ kde/post-install/ktorrent.post-install | 4 +++ 5 files changed, 46 insertions(+) create mode 100644 kde/build/ktorrent create mode 100644 kde/patch/ktorrent.patch create mode 100644 kde/patch/ktorrent/geoip.dat.gz create mode 100644 kde/patch/ktorrent/ktorrent.use.package.geoip.database.diff create mode 100644 kde/post-install/ktorrent.post-install (limited to 'kde') diff --git a/kde/build/ktorrent b/kde/build/ktorrent new file mode 100644 index 0000000..0cfbf08 --- /dev/null +++ b/kde/build/ktorrent @@ -0,0 +1 @@ +2 diff --git a/kde/patch/ktorrent.patch b/kde/patch/ktorrent.patch new file mode 100644 index 0000000..123f3af --- /dev/null +++ b/kde/patch/ktorrent.patch @@ -0,0 +1,3 @@ +# Embed a copy of the GeoIP database since the download link no longer works. +cat $CWD/patch/ktorrent/ktorrent.use.package.geoip.database.diff | patch -p1 --verbose || { touch ${SLACK_KDE_BUILD_DIR}/${PKGNAME}.failed ; continue ; } + diff --git a/kde/patch/ktorrent/geoip.dat.gz b/kde/patch/ktorrent/geoip.dat.gz new file mode 100644 index 0000000..8281193 Binary files /dev/null and b/kde/patch/ktorrent/geoip.dat.gz differ diff --git a/kde/patch/ktorrent/ktorrent.use.package.geoip.database.diff b/kde/patch/ktorrent/ktorrent.use.package.geoip.database.diff new file mode 100644 index 0000000..e55e5ce --- /dev/null +++ b/kde/patch/ktorrent/ktorrent.use.package.geoip.database.diff @@ -0,0 +1,38 @@ +diff -uar ktorrent-5.1.1.orig/plugins/infowidget/geoipmanager.cpp ktorrent-5.1.1/plugins/infowidget/geoipmanager.cpp +--- ktorrent-5.1.1.orig/plugins/infowidget/geoipmanager.cpp 2018-08-31 01:37:04.000000000 +0200 ++++ ktorrent-5.1.1/plugins/infowidget/geoipmanager.cpp 2019-05-11 14:32:39.599297006 +0200 +@@ -42,7 +42,7 @@ + #ifdef USE_SYSTEM_GEOIP + geo_ip = GeoIP_open_type(GEOIP_COUNTRY_EDITION, GEOIP_STANDARD); + #else +- geoip_data_file = QStandardPaths::locate(QStandardPaths::AppDataLocation, QStringLiteral("geoip.dat")); ++ geoip_data_file = QStringLiteral("/usr/share/apps/ktorrent/GeoIP/geoip.dat"); + if (geoip_data_file.isEmpty()) + geoip_data_file = QStandardPaths::locate(QStandardPaths::AppDataLocation, QStringLiteral("GeoIP.dat")); + +@@ -57,12 +57,6 @@ + { + QFileInfo fi(geoip_data_file); + QDateTime now = QDateTime::currentDateTime(); +- if (fi.lastModified().daysTo(now) >= 30) +- { +- // if the last time the geoip file was modified, was more then +- // 30 days ago, redownload it +- downloadDataBase(); +- } + } + } + #endif +@@ -107,12 +101,6 @@ + + void GeoIPManager::downloadDataBase() + { +-#ifndef USE_SYSTEM_GEOIP +- Out(SYS_INW | LOG_NOTICE) << "Downloading GeoIP database: " << geoip_url << endl; +- download_destination = kt::DataDir(CreateIfNotExists) + geoip_url.fileName(); +- KIO::CopyJob* job = KIO::copy(geoip_url, QUrl::fromLocalFile(download_destination), KIO::Overwrite | KIO::HideProgressInfo); +- connect(job, &KIO::CopyJob::result, this, &GeoIPManager::databaseDownloadFinished); +-#endif + } + + void GeoIPManager::databaseDownloadFinished(KJob* job) diff --git a/kde/post-install/ktorrent.post-install b/kde/post-install/ktorrent.post-install new file mode 100644 index 0000000..7e0c130 --- /dev/null +++ b/kde/post-install/ktorrent.post-install @@ -0,0 +1,4 @@ +# Install a private copy of the GeoIP database, now that the online version +# has been discontinued: +mkdir -p $PKG/usr/share/apps/ktorrent/GeoIP +zcat $CWD/patch/ktorrent/geoip.dat.gz > $PKG/usr/share/apps/ktorrent/GeoIP/geoip.dat -- cgit v1.2.3