more work on wakeups, kudos to Martin Kho (#752564)
This commit is contained in:
parent
93b510ae05
commit
a30cea39bd
2 changed files with 138 additions and 1 deletions
127
apper-0.7.1-wakeups-2.patch
Normal file
127
apper-0.7.1-wakeups-2.patch
Normal file
|
|
@ -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<uint>(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)
|
||||
12
apper.spec
12
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 <rdieter@fedoraproject.org> 0.7.1-3
|
||||
- more work on wakeups, kudos to Martin Kho (#752564)
|
||||
|
||||
* Mon Apr 16 2012 Rex Dieter <rdieter@fedoraproject.org> 0.7.1-2
|
||||
- "Unsigned packages" popup constantly reappears (#806508)
|
||||
- Apper wakes up yumBackend.py every 5 to 10 minutes (#752564)
|
||||
|
|
|
|||
Reference in a new issue