commit:     f1b097e71432eeacb0d7b38a0e65c8f7da3b4227
Author:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Wed Apr 11 19:57:21 2018 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Wed Apr 11 20:04:17 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f1b097e7

kde-plasma/plasma-workspace: Fix bbc weather dataengine

See also:
https://mail.kde.org/pipermail/kde-distro-packagers/2018-March/000311.html

Package-Manager: Portage-2.3.28, Repoman-2.3.9

 .../plasma-workspace-5.12.4-bbc-weather.patch      | 174 +++++++++++++++++++++
 .../plasma-workspace-5.12.4-r1.ebuild              | 174 +++++++++++++++++++++
 2 files changed, 348 insertions(+)

diff --git 
a/kde-plasma/plasma-workspace/files/plasma-workspace-5.12.4-bbc-weather.patch 
b/kde-plasma/plasma-workspace/files/plasma-workspace-5.12.4-bbc-weather.patch
new file mode 100644
index 00000000000..829a50477d8
--- /dev/null
+++ 
b/kde-plasma/plasma-workspace/files/plasma-workspace-5.12.4-bbc-weather.patch
@@ -0,0 +1,174 @@
+From 558a29efc4c9f055799d23ee6c75464e24489e5a Mon Sep 17 00:00:00 2001
+From: "Friedrich W. H. Kossebau" <kosse...@kde.org>
+Date: Fri, 30 Mar 2018 17:10:32 +0200
+Subject: [weather dataengine] Fix BBC provider to adapt to change RSS feed
+
+Summary:
+The urls of the BBC weather feeds seem to have changed, resulting in the
+dataengine to use no longer existing urls.
+
+I could not find the change documented somewhere and also do not know about
+a contact person with BBC, so done based on examples on website, trial &
+error.
+There are some data issues visible in the new data feeds, so chance is the
+feeds might see more rework and might break things again. But without any
+contract or formal agreement we can just play catch-up.
+
+BUG: 392510
+
+Test Plan:
+Existing configured weather applets using a location from a BBC weather
+service work again.
+Newly configured weather applets using a BBC weather service also work.
+
+Reviewers: #plasma, jriddell, cfeck
+
+Reviewed By: cfeck
+
+Subscribers: cfeck, plasma-devel
+
+Tags: #plasma
+
+Differential Revision: https://phabricator.kde.org/D11808
+---
+ dataengines/weather/ions/bbcukmet/ion_bbcukmet.cpp | 47 +++++++++++++---------
+ dataengines/weather/ions/bbcukmet/ion_bbcukmet.h   |  4 +-
+ 2 files changed, 31 insertions(+), 20 deletions(-)
+
+diff --git a/dataengines/weather/ions/bbcukmet/ion_bbcukmet.cpp 
b/dataengines/weather/ions/bbcukmet/ion_bbcukmet.cpp
+index 6acaa9b..fcf0bae 100644
+--- a/dataengines/weather/ions/bbcukmet/ion_bbcukmet.cpp
++++ b/dataengines/weather/ions/bbcukmet/ion_bbcukmet.cpp
+@@ -266,7 +266,19 @@ bool UKMETIon::updateIonSource(const QString& source)
+                 setData(source, QStringLiteral("validate"), 
QStringLiteral("bbcukmet|malformed"));
+                 return true;
+             }
+-            m_place[QStringLiteral("bbcukmet|") +sourceAction[2]].XMLurl = 
sourceAction[3];
++
++            XMLMapInfo& place = m_place[QStringLiteral("bbcukmet|") + 
sourceAction[2]];
++
++            // backward compatibility after rss feed url change in 2018/03
++            place.sourceExtraArg = sourceAction[3];
++            if 
(place.sourceExtraArg.startsWith(QLatin1String("http://open.live.bbc.co.uk/";))) 
{
++                // Old data source id stored the full (now outdated) 
observation feed url
++                // 
http://open.live.bbc.co.uk/weather/feeds/en/STATIOID/observations.rss
++                // as extra argument, so extract the id from that
++                place.stationId = 
place.sourceExtraArg.section(QLatin1Char('/'), -2, -2);
++            } else {
++                place.stationId = place.sourceExtraArg;
++            }
+             getXMLData(sourceAction[0] + QLatin1Char('|') + sourceAction[2]);
+             return true;
+         }
+@@ -288,7 +300,7 @@ void UKMETIon::getXMLData(const QString& source)
+         }
+     }
+ 
+-    const QUrl url(m_place[source].XMLurl);
++    const QUrl 
url(QStringLiteral("https://weather-broker-cdn.api.bbci.co.uk/en/observation/rss/";)
 + m_place[source].stationId);
+ 
+     KIO::TransferJob* getJob = KIO::get(url, KIO::Reload, 
KIO::HideProgressInfo);
+     getJob->addMetaData(QStringLiteral("cookies"), QStringLiteral("none")); 
// Disable displaying cookies
+@@ -328,13 +340,8 @@ void UKMETIon::findPlace(const QString& place, const 
QString& source)
+ void UKMETIon::getFiveDayForecast(const QString& source)
+ {
+     XMLMapInfo& place = m_place[source];
+-    QUrl xmlMap(place.forecastHTMLUrl);
+-
+-    const QString stationID = xmlMap.path().section(QLatin1Char('/'), -1);
+-
+-    place.XMLforecastURL = 
QStringLiteral("http://open.live.bbc.co.uk/weather/feeds/en/";) + stationID + 
QStringLiteral("/3dayforecast.rss") + xmlMap.query();
+ 
+-    const QUrl url(place.XMLforecastURL);
++    const QUrl 
url(QStringLiteral("https://weather-broker-cdn.api.bbci.co.uk/en/forecast/rss/3day/";)
 + place.stationId);
+ 
+     KIO::TransferJob* getJob = KIO::get(url, KIO::Reload, 
KIO::HideProgressInfo);
+     getJob->addMetaData(QStringLiteral("cookies"), QStringLiteral("none")); 
// Disable displaying cookies
+@@ -362,8 +369,6 @@ void UKMETIon::readSearchHTMLData(const QString& source, 
const QByteArray& html)
+             const QString fullName = 
result.value(QStringLiteral("fullName")).toString();
+ 
+             if (!id.isEmpty() && !fullName.isEmpty()) {
+-                const QString url = 
QStringLiteral("http://open.live.bbc.co.uk/weather/feeds/en/";) + id + 
QStringLiteral("/observations.rss");
+-
+                 QString tmp = QStringLiteral("bbcukmet|") + fullName;
+ 
+                 // Duplicate places can exist
+@@ -372,7 +377,7 @@ void UKMETIon::readSearchHTMLData(const QString& source, 
const QByteArray& html)
+                     counter++;
+                 }
+                 XMLMapInfo& place = m_place[tmp];
+-                place.XMLurl = url;
++                place.stationId = id;
+                 place.place = fullName;
+                 m_locations.append(tmp);
+             }
+@@ -561,6 +566,9 @@ void UKMETIon::parseWeatherForecast(const QString& source, 
QXmlStreamReader& xml
+         if (xml.isStartElement()) {
+             if (elementName == QLatin1String("item")) {
+                 parseFiveDayForecast(source, xml);
++            } else if (elementName == QLatin1String("link") &&
++                       xml.namespaceUri().isEmpty()) {
++                m_place[source].forecastHTMLUrl = xml.readElementText();
+             } else {
+                 parseUnknownElement(xml);
+             }
+@@ -644,9 +652,6 @@ void UKMETIon::parseWeatherObservation(const QString& 
source, WeatherData& data,
+                     }
+                 }
+ 
+-            } else if (elementName == QLatin1String("link")) {
+-                m_place[source].forecastHTMLUrl = xml.readElementText();
+-
+             } else if (elementName == QLatin1String("description")) {
+                 QString observeString = xml.readElementText();
+                 const QStringList observeData = 
observeString.split(QLatin1Char(':'));
+@@ -871,7 +876,7 @@ void UKMETIon::validate(const QString& source)
+     QString placeList;
+     for (const QString& place : qAsConst(m_locations)) {
+         const QString p = place.section(QLatin1Char('|'), 1, 1);
+-        placeList.append(QStringLiteral("|place|") + p + 
QStringLiteral("|extra|") + m_place[place].XMLurl);
++        placeList.append(QStringLiteral("|place|") + p + 
QStringLiteral("|extra|") + m_place[place].stationId);
+     }
+     if (m_locations.count() > 1) {
+         setData(source, QStringLiteral("validate"),
+@@ -897,12 +902,18 @@ void UKMETIon::updateWeather(const QString& source)
+     QString weatherSource = source;
+     // TODO: why the replacement here instead of just a new string?
+     weatherSource.replace(QStringLiteral("bbcukmet|"), 
QStringLiteral("bbcukmet|weather|"));
+-    weatherSource.append(QLatin1Char('|') + place.XMLurl);
++    weatherSource.append(QLatin1Char('|') + place.sourceExtraArg);
+ 
+     Plasma::DataEngine::Data data;
+ 
+-    data.insert(QStringLiteral("Place"), weatherData.stationName);
+-    data.insert(QStringLiteral("Station"), weatherData.stationName);
++    // work-around for buggy observation RSS feed missing the station name
++    QString stationName = weatherData.stationName;
++    if (stationName.isEmpty() || stationName == QLatin1String(",")) {
++        stationName = source.section(QLatin1Char('|'), 1, 1);
++    }
++
++    data.insert(QStringLiteral("Place"), stationName);
++    data.insert(QStringLiteral("Station"), stationName);
+     if (weatherData.observationDateTime.isValid()) {
+         data.insert(QStringLiteral("Observation Timestamp"), 
weatherData.observationDateTime);
+     }
+diff --git a/dataengines/weather/ions/bbcukmet/ion_bbcukmet.h 
b/dataengines/weather/ions/bbcukmet/ion_bbcukmet.h
+index a1026f4..d9d3ad3 100644
+--- a/dataengines/weather/ions/bbcukmet/ion_bbcukmet.h
++++ b/dataengines/weather/ions/bbcukmet/ion_bbcukmet.h
+@@ -155,10 +155,10 @@ private:
+ 
+ private:
+     struct XMLMapInfo {
++        QString stationId;
+         QString place;
+-        QString XMLurl;
+         QString forecastHTMLUrl;
+-        QString XMLforecastURL;
++        QString sourceExtraArg;
+     };
+ 
+     // Key dicts
+-- 
+cgit v0.11.2

diff --git a/kde-plasma/plasma-workspace/plasma-workspace-5.12.4-r1.ebuild 
b/kde-plasma/plasma-workspace/plasma-workspace-5.12.4-r1.ebuild
new file mode 100644
index 00000000000..6ed2c658078
--- /dev/null
+++ b/kde-plasma/plasma-workspace/plasma-workspace-5.12.4-r1.ebuild
@@ -0,0 +1,174 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+KDE_HANDBOOK="forceoptional"
+KDE_TEST="forceoptional"
+VIRTUALX_REQUIRED="test"
+inherit kde5 qmake-utils
+
+DESCRIPTION="KDE Plasma workspace"
+KEYWORDS="~amd64 ~arm ~arm64 ~x86"
+IUSE="appstream +calendar geolocation gps prison qalculate +semantic-desktop 
systemd"
+
+REQUIRED_USE="gps? ( geolocation )"
+
+COMMON_DEPEND="
+       $(add_frameworks_dep kactivities)
+       $(add_frameworks_dep kauth)
+       $(add_frameworks_dep kbookmarks)
+       $(add_frameworks_dep kcompletion)
+       $(add_frameworks_dep kconfig)
+       $(add_frameworks_dep kconfigwidgets)
+       $(add_frameworks_dep kcoreaddons)
+       $(add_frameworks_dep kcrash)
+       $(add_frameworks_dep kdbusaddons)
+       $(add_frameworks_dep kdeclarative)
+       $(add_frameworks_dep kdelibs4support)
+       $(add_frameworks_dep kglobalaccel)
+       $(add_frameworks_dep kguiaddons)
+       $(add_frameworks_dep ki18n)
+       $(add_frameworks_dep kiconthemes)
+       $(add_frameworks_dep kidletime)
+       $(add_frameworks_dep kio)
+       $(add_frameworks_dep kitemmodels)
+       $(add_frameworks_dep kitemviews)
+       $(add_frameworks_dep kjobwidgets)
+       $(add_frameworks_dep kjs)
+       $(add_frameworks_dep kjsembed)
+       $(add_frameworks_dep knewstuff)
+       $(add_frameworks_dep knotifications)
+       $(add_frameworks_dep knotifyconfig)
+       $(add_frameworks_dep kpackage)
+       $(add_frameworks_dep krunner)
+       $(add_frameworks_dep kservice)
+       $(add_frameworks_dep ktexteditor)
+       $(add_frameworks_dep ktextwidgets)
+       $(add_frameworks_dep kwallet)
+       $(add_frameworks_dep kwayland)
+       $(add_frameworks_dep kwidgetsaddons)
+       $(add_frameworks_dep kwindowsystem)
+       $(add_frameworks_dep kxmlgui)
+       $(add_frameworks_dep plasma)
+       $(add_frameworks_dep solid)
+       $(add_plasma_dep kscreenlocker)
+       $(add_plasma_dep kwin)
+       $(add_plasma_dep libksysguard)
+       $(add_qt_dep qtdbus)
+       $(add_qt_dep qtdeclarative 'widgets')
+       $(add_qt_dep qtgui 'jpeg')
+       $(add_qt_dep qtnetwork)
+       $(add_qt_dep qtscript)
+       $(add_qt_dep qtsql)
+       $(add_qt_dep qtwidgets)
+       $(add_qt_dep qtx11extras)
+       $(add_qt_dep qtxml)
+       media-libs/phonon[qt5(+)]
+       sys-libs/zlib
+       x11-libs/libICE
+       x11-libs/libSM
+       x11-libs/libX11
+       x11-libs/libXau
+       x11-libs/libxcb
+       x11-libs/libXfixes
+       x11-libs/libXrender
+       x11-libs/libXtst
+       x11-libs/xcb-util
+       x11-libs/xcb-util-image
+       appstream? ( dev-libs/appstream[qt5] )
+       calendar? ( $(add_frameworks_dep kholidays) )
+       geolocation? ( $(add_frameworks_dep networkmanager-qt) )
+       gps? ( sci-geosciences/gpsd )
+       prison? ( $(add_frameworks_dep prison) )
+       qalculate? ( sci-libs/libqalculate:= )
+       semantic-desktop? ( $(add_frameworks_dep baloo) )
+"
+RDEPEND="${COMMON_DEPEND}
+       $(add_frameworks_dep kded)
+       $(add_frameworks_dep kdesu)
+       $(add_kdeapps_dep kio-extras)
+       $(add_plasma_dep kde-cli-tools)
+       $(add_plasma_dep ksysguard)
+       $(add_plasma_dep milou)
+       $(add_plasma_dep plasma-integration)
+       $(add_qt_dep qdbus)
+       $(add_qt_dep qtgraphicaleffects)
+       $(add_qt_dep qtpaths)
+       $(add_qt_dep qtquickcontrols 'widgets')
+       app-text/iso-codes
+       x11-apps/mkfontdir
+       x11-apps/xmessage
+       x11-apps/xprop
+       x11-apps/xrdb
+       x11-apps/xset
+       x11-apps/xsetroot
+       systemd? ( sys-apps/dbus[user-session] )
+       !systemd? ( sys-apps/dbus )
+       !dev-libs/xembed-sni-proxy
+       !kde-plasma/freespacenotifier:4
+       !kde-plasma/libtaskmanager:4
+       !kde-plasma/kcminit:4
+       !kde-plasma/kdebase-startkde:4
+       !kde-plasma/klipper:4
+       !kde-plasma/krunner:4
+       !kde-plasma/ksmserver:4
+       !kde-plasma/ksplash:4
+       !kde-plasma/plasma-workspace:4
+"
+DEPEND="${COMMON_DEPEND}
+       $(add_qt_dep qtconcurrent)
+       x11-proto/xproto
+"
+
+PATCHES=(
+       "${FILESDIR}/${PN}-5.4-startkde-script.patch"
+       "${FILESDIR}/${PN}-5.10-startplasmacompositor-script.patch"
+       "${FILESDIR}/${PN}-5.10.4-unused-dep.patch"
+       "${FILESDIR}/${P}-bbc-weather.patch"
+)
+
+RESTRICT+=" test"
+
+src_prepare() {
+       kde5_src_prepare
+
+       sed -e "s|\`qtpaths|\`$(qt5_get_bindir)/qtpaths|" \
+               -i startkde/startkde.cmake startkde/startplasmacompositor.cmake 
|| die
+}
+
+src_configure() {
+       local mycmakeargs=(
+               $(cmake-utils_use_find_package appstream AppStreamQt)
+               $(cmake-utils_use_find_package calendar KF5Holidays)
+               $(cmake-utils_use_find_package geolocation KF5NetworkManagerQt)
+               $(cmake-utils_use_find_package prison KF5Prison)
+               $(cmake-utils_use_find_package qalculate Qalculate)
+               $(cmake-utils_use_find_package semantic-desktop KF5Baloo)
+       )
+
+       use gps && mycmakeargs+=( $(cmake-utils_use_find_package gps libgps) )
+
+       kde5_src_configure
+}
+
+src_install() {
+       kde5_src_install
+
+       # startup and shutdown scripts
+       insinto /etc/plasma/startup
+       doins "${FILESDIR}/10-agent-startup.sh"
+
+       insinto /etc/plasma/shutdown
+       doins "${FILESDIR}/10-agent-shutdown.sh"
+}
+
+pkg_postinst () {
+       kde5_pkg_postinst
+
+       echo
+       elog "To enable gpg-agent and/or ssh-agent in Plasma sessions,"
+       elog "edit ${EPREFIX}/etc/plasma/startup/10-agent-startup.sh and"
+       elog "${EPREFIX}/etc/plasma/shutdown/10-agent-shutdown.sh"
+       echo
+}

Reply via email to