[apper] 20121002git snapshot

Rex Dieter rdieter at fedoraproject.org
Tue Oct 2 18:57:08 UTC 2012


commit a2379acb6d8fa9467d7a5401dc35687e621ccea5
Author: Rex Dieter <rdieter at fedoraproject.org>
Date:   Tue Oct 2 13:57:20 2012 -0500

    20121002git snapshot
    
    - initial systemd_inhibit support (#830181)
    - displays wrong warning when no updates are available (#851864)

 apper-0.8.0-systemd_inhibit.patch |   96 +++++++++++++++++++++++++++++++++++++
 apper.spec                        |   29 +++++++++--
 2 files changed, 119 insertions(+), 6 deletions(-)
---
diff --git a/apper-0.8.0-systemd_inhibit.patch b/apper-0.8.0-systemd_inhibit.patch
new file mode 100644
index 0000000..0c2cade
--- /dev/null
+++ b/apper-0.8.0-systemd_inhibit.patch
@@ -0,0 +1,96 @@
+diff --git a/Sentinel/TransactionWatcher.cpp b/Sentinel/TransactionWatcher.cpp
+index 05b49cc..12201fd 100644
+--- a/Sentinel/TransactionWatcher.cpp
++++ b/Sentinel/TransactionWatcher.cpp
+@@ -2,6 +2,8 @@
+  *   Copyright (C) 2008-2011 by Daniel Nicoletti                           *
+  *   dantti12 at gmail.com                                                    *
+  *                                                                         *
++ *   (c) 2012 Lukáš Tinkl <ltinkl at redhat.com>                              *
++ *                                                                         *
+  *   This program is free software; you can redistribute it and/or modify  *
+  *   it under the terms of the GNU General Public License as published by  *
+  *   the Free Software Foundation; either version 2 of the License, or     *
+@@ -18,6 +20,8 @@
+  *   Boston, MA 02110-1301, USA.                                           *
+  ***************************************************************************/
+ 
++#include <unistd.h>
++
+ #include "TransactionWatcher.h"
+ 
+ #include "TransactionJob.h"
+@@ -40,6 +44,9 @@
+ #include <Solid/PowerManagement>
+ #include <QtDBus/QDBusMessage>
+ #include <QtDBus/QDBusConnection>
++#include <QtDBus/QDBusUnixFileDescriptor>
++#include <QtDBus/QDBusInterface>
++#include <QtDBus/QDBusPendingReply>
+ 
+ #include <KDebug>
+ 
+@@ -53,7 +60,8 @@ TransactionWatcher::TransactionWatcher(QObject *parent) :
+     m_currentTransaction(0),
+     m_messagesSNI(0),
+     m_restartSNI(0),
+-    m_inhibitCookie(-1)
++    m_inhibitCookie(-1),
++    m_sdInhibitDescriptor(-1)
+ {
+     m_transHasJob = false;
+     m_tracker = new KUiServerJobTracker(this);
+@@ -412,12 +420,36 @@ void TransactionWatcher::suppressSleep(bool enable, const QString &reason)
+             if (m_inhibitCookie == -1) {
+                 kDebug() << "Sleep suppression denied!";
+             }
++
++            // also tell systemd-inhibit
++            QDBusInterface managerIface("org.freedesktop.login1", "/org/freedesktop/login1", "org.freedesktop.login1", QDBusConnection::systemBus());
++            QVariantList args;
++            args << "shutdown:sleep:idle"; // what
++            args << i18n("apper"); // who
++            args << reason; // why
++            args << "block"; // mode
++            QDBusPendingReply<QDBusUnixFileDescriptor> desc = managerIface.asyncCallWithArgumentList("Inhibit", args);
++            desc.waitForFinished();
++            if (desc.isValid() && desc.value().isValid()) {
++                m_sdInhibitDescriptor = dup(desc.value().fileDescriptor());
++            }
++            else
++                kWarning() << "failed to inhibit shutdown using systemd";
+         }
+-    } else if (m_inhibitCookie != -1) {
+-        kDebug() << "Stop Suppressing Sleep";
+-        if (!Solid::PowerManagement::stopSuppressingSleep(m_inhibitCookie)) {
+-            kDebug() << "Stop failed: invalid cookie.";
++    } else {
++        if (m_inhibitCookie != -1) {
++            kDebug() << "Stop Suppressing Sleep";
++            if (!Solid::PowerManagement::stopSuppressingSleep(m_inhibitCookie)) {
++                kDebug() << "Stop failed: invalid cookie.";
++            }
++            m_inhibitCookie = -1;
++        }
++
++        if (m_sdInhibitDescriptor != -1) {
++            ::close(m_sdInhibitDescriptor);
++            m_sdInhibitDescriptor = -1;
+         }
+-        m_inhibitCookie = -1;
++        else
++            kWarning() << "invalid systemd-inhibit cookie";
+     }
+ }
+diff --git a/Sentinel/TransactionWatcher.h b/Sentinel/TransactionWatcher.h
+index b498718..c4a9d9a 100644
+--- a/Sentinel/TransactionWatcher.h
++++ b/Sentinel/TransactionWatcher.h
+@@ -78,6 +78,7 @@ private:
+ 
+     // cookie to suppress sleep
+     int           m_inhibitCookie;
++    int           m_sdInhibitDescriptor;
+     KUiServerJobTracker *m_tracker;
+ };
+ 
diff --git a/apper.spec b/apper.spec
index 2b43dde..401f1cf 100644
--- a/apper.spec
+++ b/apper.spec
@@ -1,13 +1,14 @@
-%define pk_min_version 0.8.2
+%define pk_min_version 0.8.4
+%define pk_version 0.8.4-2
 
 ## include app-install support and/or for testing/customizing categories.xml
 #define app_install 1
 
-%define snap 20120724
+%define snap 20121002
 
 Name:    apper
 Version: 0.8.0
-Release: 0.6.%{snap}git%{?dist}
+Release: 0.7.%{snap}git%{?dist}
 Summary: KDE interface for PackageKit
 
 License: GPLv2+
@@ -20,6 +21,7 @@ Source0: http://download.kde.org/stable/apper/%{version}/src/apper-%{version}.ta
 URL:     http://kde-apps.org/content/show.php/Apper?content=84745
 
 ## upstreamable patches
+Patch50: apper-0.8.0-systemd_inhibit.patch
 
 ## upstream patches
 
@@ -34,11 +36,15 @@ BuildRequires: gettext
 BuildRequires: kdelibs4-devel
 BuildRequires: kdebase-workspace-devel
 BuildRequires: pkgconfig(dbus-1)
-BuildRequires: pkgconfig(packagekit-qt2) >= %{pk_min_version}
+%if 0%{?pk_version:1}
+BuildRequires: PackageKit-qt-devel >= %{pk_version}
+%else
+BuildRequires: pkgconfig(packagekit-qt2) >= %{pk_min_version}}
+%global pk_version %(pkg-config --modversion packagekit-qt 2> /dev/null || echo %{pk_min_version})
+%endif
 
 %{?_qt4_version:Requires: qt4%{?_isa} >= %{_qt4_version}}
-Requires: kdebase-runtime%{?_kde4_version: >= %{_kde4_version}}
-%global pk_version %(pkg-config --modversion packagekit-qt 2> /dev/null || echo %{pk_min_version})
+Requires: kde-runtime%{?_kde4_version: >= %{_kde4_version}}
 Requires: PackageKit-qt%{?_isa} >= %{pk_version}
 
 %description
@@ -48,6 +54,12 @@ KDE interface for PackageKit.
 %prep
 %setup -q 
 
+%patch50 -p1 -b .systemd_inhibit
+
+# hack, allow to build against our patched pk-0.8.4
+sed -i -e \
+  "s|^set(QPACKAGEKIT_MIN_VERSION 0.8.5)|set(QPACKAGEKIT_MIN_VERSION 0.8.4)|" \
+  CMakeLists.txt
 
 %build
 mkdir -p %{_target_platform}
@@ -112,6 +124,11 @@ fi
 
 
 %changelog
+* Tue Oct 02 2012 Rex Dieter <rdieter at fedoraproject.org> 0.8.0-0.7.20121002git
+- 20121002git snapshot
+- initial systemd_inhibit support (#830181)
+- displays wrong warning when no updates are available (#851864)
+
 * Fri Sep 07 2012 Rex Dieter <rdieter at fedoraproject.org> 0.8.0-0.6.20120724git
 - add scriptlet to register mimetypes (#836559)
 


More information about the scm-commits mailing list