From a30cea39bd7a23bf05615aa133e145cc8eabb62d Mon Sep 17 00:00:00 2001 From: Rex Dieter Date: Sat, 21 Apr 2012 09:18:22 -0500 Subject: [PATCH] more work on wakeups, kudos to Martin Kho (#752564) --- apper-0.7.1-wakeups-2.patch | 127 ++++++++++++++++++++++++++++++++++++ apper.spec | 12 +++- 2 files changed, 138 insertions(+), 1 deletion(-) create mode 100644 apper-0.7.1-wakeups-2.patch diff --git a/apper-0.7.1-wakeups-2.patch b/apper-0.7.1-wakeups-2.patch new file mode 100644 index 0000000..14631e4 --- /dev/null +++ b/apper-0.7.1-wakeups-2.patch @@ -0,0 +1,127 @@ +diff -Nur apper-0.7.1.orig/apperd/apperd.cpp apper-0.7.1/apperd/apperd.cpp +--- apper-0.7.1.orig/apperd/apperd.cpp 2012-04-21 13:58:06.814615920 +0200 ++++ apper-0.7.1/apperd/apperd.cpp 2012-04-21 14:09:00.559485569 +0200 +@@ -56,6 +56,19 @@ + connect(m_qtimer, SIGNAL(timeout()), this, SLOT(poll())); + m_qtimer->start(FIVE_MIN); + ++ // Make sure we know is Sentinel is running ++ QDBusServiceWatcher *watcher; ++ watcher = new QDBusServiceWatcher(QLatin1String("org.kde.ApperSentinel"), ++ QDBusConnection::sessionBus(), ++ QDBusServiceWatcher::WatchForOwnerChange, ++ this); ++ connect(watcher, SIGNAL(serviceOwnerChanged(QString,QString,QString)), ++ this, SLOT(serviceOwnerChanged(QString,QString,QString))); ++ ++ // Check if Sentinel is running ++ m_sentinelIsRunning = nameHasOwner(QLatin1String("org.kde.ApperSentinel"), ++ QDBusConnection::sessionBus()); ++ + // Watch for TransactionListChanged so we start sentinel + QDBusConnection::systemBus().connect(QLatin1String(""), + QLatin1String(""), +@@ -81,19 +94,6 @@ + connect(confWatch, SIGNAL(deleted(QString)), this, SLOT(configFileChanged())); + confWatch->startScan(); + +- // Make sure we know is Sentinel is running +- QDBusServiceWatcher *watcher; +- watcher = new QDBusServiceWatcher(QLatin1String("org.kde.ApperSentinel"), +- QDBusConnection::sessionBus(), +- QDBusServiceWatcher::WatchForOwnerChange, +- this); +- connect(watcher, SIGNAL(serviceOwnerChanged(QString,QString,QString)), +- this, SLOT(serviceOwnerChanged(QString,QString,QString))); +- +- // Check if Sentinel is running +- m_sentinelIsRunning = nameHasOwner(QLatin1String("org.kde.ApperSentinel"), +- QDBusConnection::sessionBus()); +- + // if PackageKit is running check to see if there are running transactons already + if (!m_sentinelIsRunning && nameHasOwner(QLatin1String("org.freedesktop.PackageKit"), + QDBusConnection::systemBus())) { +@@ -116,28 +116,30 @@ + + void ApperD::poll() + { +- if (m_lastRefreshCache.isNull()) { +- // This value wasn't set +- // convert this to QDateTime +- m_lastRefreshCache = getTimeSinceRefreshCache(); +- } +- +- // If check for updates is active +- if (m_refreshCacheInterval != Enum::Never) { +- uint maxTime = QDateTime::currentDateTime().toTime_t() - m_refreshCacheInterval; +- // If lastRefreshCache is null it means that the cache was never refreshed +- if (m_lastRefreshCache.isNull() || m_lastRefreshCache.toTime_t() < maxTime) { +- callApperSentinel(QLatin1String("RefreshAndUpdate")); ++ if (!m_sentinelIsRunning) { ++ if (m_lastRefreshCache.isNull()) { ++ // This value wasn't set ++ // convert this to QDateTime ++ m_lastRefreshCache = getTimeSinceRefreshCache(); ++ } + +- // Invalidate the last time the cache was refreshed +- m_lastRefreshCache = QDateTime(); ++ // If check for updates is active ++ if (m_refreshCacheInterval != Enum::Never) { ++ uint maxTime = QDateTime::currentDateTime().toTime_t() - m_refreshCacheInterval; ++ // If lastRefreshCache is null it means that the cache was never refreshed ++ if (m_lastRefreshCache.isNull() || m_lastRefreshCache.toTime_t() < maxTime) { ++ callApperSentinel(QLatin1String("RefreshAndUpdate")); ++ ++ // Invalidate the last time the cache was refreshed ++ m_lastRefreshCache = QDateTime(); ++ } + } +- } + +- // display or update the system +- if (!m_showedUpdates) { +- m_showedUpdates = true; // don't do that so often +- callApperSentinel(QLatin1String("Update")); ++ // display or update the system ++ if (!m_showedUpdates) { ++ m_showedUpdates = true; // don't do that so often ++ callApperSentinel(QLatin1String("Update")); ++ } + } + } + +@@ -162,20 +164,25 @@ + message << static_cast(0); + QDBusConnection::sessionBus().send(message); + } +- +- if (tids.isEmpty()) { +- // update the last time the cache was refreshed +- // TODO PackageKit should emit a property change for this +- m_lastRefreshCache = getTimeSinceRefreshCache(); +- } ++// revert this part of patch .wakeups because it, for me unknown reason, ++// 'blocks' doing updates. Martin Kho ++/* ++ * if (tids.isEmpty()) { ++ * // update the last time the cache was refreshed ++ * // TODO PackageKit should emit a property change for this ++ * m_lastRefreshCache = getTimeSinceRefreshCache(); ++ * } ++ */ + } + + void ApperD::updatesChanged() + { + // - update time since last refresh + // - reset showed updates to display this change +- getTimeSinceRefreshCache(); +- m_showedUpdates = false; ++ if (!m_sentinelIsRunning) { ++ getTimeSinceRefreshCache(); ++ m_showedUpdates = false; ++ } + } + + void ApperD::serviceOwnerChanged(const QString &serviceName, const QString &oldOwner, const QString &newOwner) diff --git a/apper.spec b/apper.spec index a091963..32d1a37 100644 --- a/apper.spec +++ b/apper.spec @@ -5,7 +5,7 @@ Name: apper Version: 0.7.1 -Release: 2%{?dist} +Release: 3%{?dist} Summary: KDE interface for PackageKit License: GPLv2+ @@ -17,6 +17,12 @@ Source0: https://launchpad.net/apper/0.7/%{version}/+download/apper-%{version}.t %endif URL: http://kde-apps.org/content/show.php/Apper?content=84745 +## upstreamable patches +# 752564 - Apper wakes up yumBackend.py every 5 to 10 minutes +# followup to patch101 below, fixes/works-around some other various +# related issues, and avoids a deadlock +Patch50: apper-0.7.1-wakeups-2.patch + ## upstream patches # 806508 - "Unsigned packages" popup constantly reappears Patch100: apper-0.7.1-untrusted.patch @@ -50,6 +56,7 @@ KDE interface for PackageKit. %patch100 -p1 -b .untrusted %patch101 -p1 -b .wakeups +%patch50 -p1 -b .wakeups-2 %build @@ -107,6 +114,9 @@ desktop-file-validate %{buildroot}%{_kde4_datadir}/applications/kde4/apper.deskt %changelog +* Sat Apr 21 2012 Rex Dieter 0.7.1-3 +- more work on wakeups, kudos to Martin Kho (#752564) + * Mon Apr 16 2012 Rex Dieter 0.7.1-2 - "Unsigned packages" popup constantly reappears (#806508) - Apper wakes up yumBackend.py every 5 to 10 minutes (#752564)