[kde-runtime] drkonqi: use PK to install gdb at runtime, if missing

Rex Dieter rdieter at fedoraproject.org
Sun Oct 20 16:50:30 UTC 2013


commit 6f485e9f1af4ec40b11edf5bc92ac6fec9a7dbc1
Author: Rex Dieter <rdieter at math.unl.edu>
Date:   Sun Oct 20 11:50:32 2013 -0500

    drkonqi: use PK to install gdb at runtime, if missing

 kde-runtime-4.11.2-install_gdb.patch |   60 ++++++++++++++++++++++++++++++++++
 kde-runtime.spec                     |    9 ++++-
 2 files changed, 68 insertions(+), 1 deletions(-)
---
diff --git a/kde-runtime-4.11.2-install_gdb.patch b/kde-runtime-4.11.2-install_gdb.patch
new file mode 100644
index 0000000..7b61d07
--- /dev/null
+++ b/kde-runtime-4.11.2-install_gdb.patch
@@ -0,0 +1,60 @@
+diff -up kde-runtime-4.11.2/drkonqi/backtracegenerator.cpp.install_gdb kde-runtime-4.11.2/drkonqi/backtracegenerator.cpp
+--- kde-runtime-4.11.2/drkonqi/backtracegenerator.cpp.install_gdb	2013-08-28 11:59:56.409413697 -0500
++++ kde-runtime-4.11.2/drkonqi/backtracegenerator.cpp	2013-10-19 20:58:10.072330538 -0500
+@@ -73,6 +73,7 @@ bool BacktraceGenerator::start()
+     emit starting();
+ 
+     if (!m_debugger.isValid() || !m_debugger.isInstalled()) {
++        m_debugger.install();
+         m_state = FailedToStart;
+         emit failedToStart();
+         return false;
+diff -up kde-runtime-4.11.2/drkonqi/debugger.cpp.install_gdb kde-runtime-4.11.2/drkonqi/debugger.cpp
+--- kde-runtime-4.11.2/drkonqi/debugger.cpp.install_gdb	2013-08-28 11:59:56.411413685 -0500
++++ kde-runtime-4.11.2/drkonqi/debugger.cpp	2013-10-19 21:08:13.195798090 -0500
+@@ -16,6 +16,9 @@
+ */
+ #include "debugger.h"
+ 
++#include <QDBusInterface>
++#include <QDBusPendingCall>
++//#include <QLatin1String>
+ #include <KConfig>
+ #include <KConfigGroup>
+ #include <KGlobal>
+@@ -49,6 +52,22 @@ bool Debugger::isInstalled() const
+     return !tryexec.isEmpty() && !KStandardDirs::findExe(tryexec).isEmpty();
+ }
+ 
++void Debugger::install() const
++{
++    QDBusInterface packageKit(QLatin1String("org.freedesktop.PackageKit"),
++                              QLatin1String("/org/freedesktop/PackageKit"),
++                              QLatin1String("org.freedesktop.PackageKit.Modify"));
++    // We don't check packageKit.isValid() because the service is activated on
++    // demand, so it will show up as "not valid".
++    WId wid = 0;
++    //if (parent) {  // how to get this?  -- Rex
++    //   wid = parent->winId();
++    //}
++    packageKit.asyncCall(QLatin1String("InstallPackageNames"),
++                         (unsigned int) wid,
++                         QStringList() << QLatin1String("gdb"),QString());
++}
++
+ QString Debugger::name() const
+ {
+     return isValid() ? m_config->group("General").readEntry("Name") : QString();
+diff -up kde-runtime-4.11.2/drkonqi/debugger.h.install_gdb kde-runtime-4.11.2/drkonqi/debugger.h
+--- kde-runtime-4.11.2/drkonqi/debugger.h.install_gdb	2013-08-28 11:59:56.411413685 -0500
++++ kde-runtime-4.11.2/drkonqi/debugger.h	2013-10-19 20:58:10.072330538 -0500
+@@ -40,6 +40,9 @@ public:
+      */
+     bool isInstalled() const;
+ 
++    /** Try to install debugger via PackageKit. */
++    void install() const;
++
+     /** Returns the translatable name of the debugger (eg. "GDB") */
+     QString name() const;
+ 
diff --git a/kde-runtime.spec b/kde-runtime.spec
index 4297d64..c418261 100644
--- a/kde-runtime.spec
+++ b/kde-runtime.spec
@@ -6,7 +6,7 @@
 Name:    kde-runtime
 Summary: KDE Runtime
 Version: 4.11.2
-Release: 1%{?dist}
+Release: 2%{?dist}
 
 # http://techbase.kde.org/Policies/Licensing_Policy
 License: LGPLv2+ and GPLv2+
@@ -50,6 +50,9 @@ Patch11: kde-runtime-4.10.4-trash-readonly.patch
 # increase some timeouts in an effort to see (some) errors before close
 Patch50: kde-runtime-4.9.0-installdbgsymbols.patch
 
+# use packagekit to install a possibly-missing gdb
+Patch51: kde-runtime-4.11.2-install_gdb.patch
+
 # avoid X3 mouse events
 # https://bugs.kde.org/show_bug.cgi?id=316546
 Patch52: kde-runtime-mouseeventlistener.patch
@@ -196,6 +199,7 @@ Requires: %{name} = %{version}-%{release}
 %endif
 %patch11 -p1 -b .trash-readonly
 %patch50 -p1 -b .installdgbsymbols
+%patch51 -p1 -b .install_gdb
 %patch52 -p1 -b .mouseeventlistener
 %patch53 -p1 -b .initial_passwordless_kwallet_option
 
@@ -415,6 +419,9 @@ fi
 
 
 %changelog
+* Sun Oct 20 2013 Rex Dieter <rdieter at fedoraproject.org> 4.11.2-2
+- -drkonqi: use PK to install gdb at runtime, if missing
+
 * Sat Sep 28 2013 Rex Dieter <rdieter at fedoraproject.org> - 4.11.2-1
 - 4.11.2
 


More information about the scm-commits mailing list