diff options
author | Andreas Sturmlechner <asturm@gentoo.org> | 2021-10-02 15:30:51 +0200 |
---|---|---|
committer | Andreas Sturmlechner <asturm@gentoo.org> | 2021-10-02 15:35:06 +0200 |
commit | 686a75446fd2e7c96d88d939ca710adb6714ce42 (patch) | |
tree | 8b7bf4685ead9120f40ad1d57748adc22c323bd9 /kde-frameworks | |
parent | media-gfx/qimgv: drop duplicate eclass inherit from 1.0.2 (diff) | |
download | gentoo-686a75446fd2e7c96d88d939ca710adb6714ce42.tar.gz gentoo-686a75446fd2e7c96d88d939ca710adb6714ce42.tar.bz2 gentoo-686a75446fd2e7c96d88d939ca710adb6714ce42.zip |
kde-frameworks/knewstuff: Help upstream lower server utilization
See also:
https://mail.kde.org/pipermail/distributions/2021-October/001054.html
https://invent.kde.org/frameworks/knewstuff/-/merge_requests/142
Package-Manager: Portage-3.0.26, Repoman-3.0.3
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
Diffstat (limited to 'kde-frameworks')
-rw-r--r-- | kde-frameworks/knewstuff/files/knewstuff-5.86.0-include-user-agent-on-KNS-requests.patch | 58 | ||||
-rw-r--r-- | kde-frameworks/knewstuff/knewstuff-5.86.0-r2.ebuild | 54 |
2 files changed, 112 insertions, 0 deletions
diff --git a/kde-frameworks/knewstuff/files/knewstuff-5.86.0-include-user-agent-on-KNS-requests.patch b/kde-frameworks/knewstuff/files/knewstuff-5.86.0-include-user-agent-on-KNS-requests.patch new file mode 100644 index 000000000000..6252d28f7b93 --- /dev/null +++ b/kde-frameworks/knewstuff/files/knewstuff-5.86.0-include-user-agent-on-KNS-requests.patch @@ -0,0 +1,58 @@ +From f687c5abd0c5e9bd5a6688b6d9d50f2536b7d33d Mon Sep 17 00:00:00 2001 +From: Aleix Pol <aleixpol@kde.org> +Date: Fri, 24 Sep 2021 14:31:05 +0200 +Subject: [PATCH] Include a user agent on KNS requests + +--- + src/core/jobs/httpworker.cpp | 13 +++++++++++++ + 1 file changed, 13 insertions(+) + +diff --git a/src/core/jobs/httpworker.cpp b/src/core/jobs/httpworker.cpp +index 4c218b08..b81edd2d 100644 +--- a/src/core/jobs/httpworker.cpp ++++ b/src/core/jobs/httpworker.cpp +@@ -7,7 +7,9 @@ + #include "httpworker.h" + + #include "knewstuffcore_debug.h" ++#include "knewstuffcore_version.h" + ++#include <QCoreApplication> + #include <QFile> + #include <QMutex> + #include <QMutexLocker> +@@ -93,6 +95,15 @@ void HTTPWorker::setUrl(const QUrl &url) + d->source = url; + } + ++static void addUserAgent(QNetworkRequest &request) ++{ ++ QString agentHeader = QStringLiteral("KNewStuff/%1").arg(QLatin1String(KNEWSTUFFCORE_VERSION_STRING)); ++ if (QCoreApplication::instance()) { ++ agentHeader += QStringLiteral("-%1/%2").arg(QCoreApplication::instance()->applicationName(), QCoreApplication::instance()->applicationVersion()); ++ } ++ request.setHeader(QNetworkRequest::UserAgentHeader, agentHeader); ++} ++ + void HTTPWorker::startRequest() + { + if (d->reply) { +@@ -101,6 +112,7 @@ void HTTPWorker::startRequest() + } + + QNetworkRequest request(d->source); ++ addUserAgent(request); + d->reply = s_httpWorkerNAM->get(request); + connect(d->reply, &QNetworkReply::readyRead, this, &HTTPWorker::handleReadyRead); + connect(d->reply, &QNetworkReply::finished, this, &HTTPWorker::handleFinished); +@@ -144,6 +156,7 @@ void HTTPWorker::handleFinished() + << d->reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); + d->reply->deleteLater(); + QNetworkRequest request(d->redirectUrl); ++ addUserAgent(request); + d->reply = s_httpWorkerNAM->get(request); + connect(d->reply, &QNetworkReply::readyRead, this, &HTTPWorker::handleReadyRead); + connect(d->reply, &QNetworkReply::finished, this, &HTTPWorker::handleFinished); +-- +GitLab + diff --git a/kde-frameworks/knewstuff/knewstuff-5.86.0-r2.ebuild b/kde-frameworks/knewstuff/knewstuff-5.86.0-r2.ebuild new file mode 100644 index 000000000000..06de55295853 --- /dev/null +++ b/kde-frameworks/knewstuff/knewstuff-5.86.0-r2.ebuild @@ -0,0 +1,54 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +ECM_TEST="false" +PVCUT=$(ver_cut 1-2) +QTMIN=5.15.2 +inherit ecm kde.org + +DESCRIPTION="Framework for downloading and sharing additional application data" + +LICENSE="LGPL-2+" +KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~riscv ~x86" +IUSE="opds" + +DEPEND=" + >=dev-qt/qtdeclarative-${QTMIN}:5 + >=dev-qt/qtgui-${QTMIN}:5 + >=dev-qt/qtnetwork-${QTMIN}:5 + >=dev-qt/qtwidgets-${QTMIN}:5 + >=dev-qt/qtxml-${QTMIN}:5 + =kde-frameworks/attica-${PVCUT}*:5 + =kde-frameworks/karchive-${PVCUT}*:5 + =kde-frameworks/kcompletion-${PVCUT}*:5 + =kde-frameworks/kconfig-${PVCUT}*:5 + =kde-frameworks/kcoreaddons-${PVCUT}*:5 + =kde-frameworks/ki18n-${PVCUT}*:5 + =kde-frameworks/kiconthemes-${PVCUT}*:5 + =kde-frameworks/kio-${PVCUT}*:5 + =kde-frameworks/kitemviews-${PVCUT}*:5 + =kde-frameworks/kpackage-${PVCUT}*:5 + =kde-frameworks/kservice-${PVCUT}*:5 + =kde-frameworks/ktextwidgets-${PVCUT}*:5 + =kde-frameworks/kwidgetsaddons-${PVCUT}*:5 + =kde-frameworks/kxmlgui-${PVCUT}*:5 + opds? ( =kde-frameworks/syndication-${PVCUT}*:5 ) +" +RDEPEND="${DEPEND} + >=kde-frameworks/kirigami-${PVCUT}:5 +" + +PATCHES=( + "${FILESDIR}/${P}-fix-crash-in-DownloadWidget.patch" # KDE-bug 443025 + "${FILESDIR}/${P}-include-user-agent-on-KNS-requests.patch" +) + +src_configure() { + local mycmakeargs=( + $(cmake_use_find_package opds KF5Syndication) + ) + + ecm_src_configure +} |