From 92fc769542c6f87d436254b63ad98eaeadfe37228fb4a5fdf5c52bd0c2629314 Mon Sep 17 00:00:00 2001 From: Christophe Marin Date: Tue, 31 Jan 2023 14:47:02 +0000 Subject: [PATCH] Accepting request 1062248 from home:Vogtinator:plasma5.27 - Add patch to actually disable sentry: * 0001-Handle-WITH_SENTRY-correctly.patch - Add patch to avoid unnecessary dependencies of the gdb script: * 0002-Make-python-distro-and-psutil-modules-in-the-gdb-pre.patch OBS-URL: https://build.opensuse.org/request/show/1062248 OBS-URL: https://build.opensuse.org/package/show/KDE:Frameworks5/drkonqi5?expand=0&rev=209 --- 0001-Handle-WITH_SENTRY-correctly.patch | 50 +++++++++++++++++ ...ro-and-psutil-modules-in-the-gdb-pre.patch | 54 +++++++++++++++++++ drkonqi5.changes | 8 +++ drkonqi5.spec | 7 +-- 4 files changed, 116 insertions(+), 3 deletions(-) create mode 100644 0001-Handle-WITH_SENTRY-correctly.patch create mode 100644 0002-Make-python-distro-and-psutil-modules-in-the-gdb-pre.patch diff --git a/0001-Handle-WITH_SENTRY-correctly.patch b/0001-Handle-WITH_SENTRY-correctly.patch new file mode 100644 index 0000000..c8169b9 --- /dev/null +++ b/0001-Handle-WITH_SENTRY-correctly.patch @@ -0,0 +1,50 @@ +From 2e3e56c5ec62a817409d3c47bc0ccd716e288d9a Mon Sep 17 00:00:00 2001 +From: Fabian Vogt +Date: Wed, 23 Nov 2022 10:22:22 +0100 +Subject: [PATCH 1/2] Handle WITH_SENTRY correctly + +cmakedefine01 always defines the macro, so #ifdef is always true. +Use #if instead. +--- + src/backtracegenerator.cpp | 2 +- + src/bugzillaintegration/reportinterface.cpp | 4 ++-- + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/backtracegenerator.cpp b/src/backtracegenerator.cpp +index 0fd38646..4101f00c 100644 +--- a/src/backtracegenerator.cpp ++++ b/src/backtracegenerator.cpp +@@ -190,7 +190,7 @@ void BacktraceGenerator::setBackendPrepared() + if (!m_tempDirectory->isValid()) { + qCWarning(DRKONQI_LOG) << "Failed to create temporary directory for generator!"; + } else { +-#ifdef WITH_SENTRY ++#if WITH_SENTRY + m_proc->setEnv(QStringLiteral("DRKONQI_WITH_SENTRY"), QStringLiteral("1")); + #endif + m_proc->setEnv(QStringLiteral("DRKONQI_TMP_DIR"), m_tempDirectory->path()); +diff --git a/src/bugzillaintegration/reportinterface.cpp b/src/bugzillaintegration/reportinterface.cpp +index 6951a75b..c4ce4ea6 100644 +--- a/src/bugzillaintegration/reportinterface.cpp ++++ b/src/bugzillaintegration/reportinterface.cpp +@@ -330,7 +330,7 @@ Bugzilla::NewBug ReportInterface::newBugReportTemplate() const + + void ReportInterface::sendCrashEvent() + { +-#ifdef WITH_SENTRY ++#if WITH_SENTRY + if (DrKonqi::debuggerManager()->backtraceGenerator()->state() == BacktraceGenerator::Loaded) { + m_sentryBeacon.sendEvent(); + return; +@@ -350,7 +350,7 @@ void ReportInterface::sendCrashEvent() + + void ReportInterface::sendCrashComment() + { +-#ifdef WITH_SENTRY ++#if WITH_SENTRY + m_sentryBeacon.sendUserFeedback(m_reportTitle + QLatin1Char('\n') + m_reportDetailText + QLatin1Char('\n') + DrKonqi::kdeBugzillaURL() + + QLatin1String("show_bug.cgi?id=%1").arg(QString::number(m_sentReport))); + #endif +-- +2.39.1 + diff --git a/0002-Make-python-distro-and-psutil-modules-in-the-gdb-pre.patch b/0002-Make-python-distro-and-psutil-modules-in-the-gdb-pre.patch new file mode 100644 index 0000000..a359c64 --- /dev/null +++ b/0002-Make-python-distro-and-psutil-modules-in-the-gdb-pre.patch @@ -0,0 +1,54 @@ +From 188c0e8297f65f7bf222dde86bd472f6fadeab4d Mon Sep 17 00:00:00 2001 +From: Fabian Vogt +Date: Wed, 23 Nov 2022 10:23:37 +0100 +Subject: [PATCH 2/2] Make python distro and psutil modules in the gdb preable + optional + +Those are only used if sentry is enabled. The other modules are part of python +itself. If they are missing, disable sentry support. +--- + src/data/gdb/preamble.py | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +diff --git a/src/data/gdb/preamble.py b/src/data/gdb/preamble.py +index 114a5ad9..1f7595e5 100644 +--- a/src/data/gdb/preamble.py ++++ b/src/data/gdb/preamble.py +@@ -6,7 +6,6 @@ import gdb + from gdb.FrameDecorator import FrameDecorator + + from datetime import datetime +-import distro + import uuid + import os + import json +@@ -15,11 +14,11 @@ import signal + import re + import binascii + import platform +-import psutil + import multiprocessing + from pathlib import Path + + if os.getenv('DRKONQI_WITH_SENTRY'): ++ # Initialize sentry reports for exceptions in this script + try: + import sentry_sdk + sentry_sdk.init( +@@ -31,6 +30,13 @@ if os.getenv('DRKONQI_WITH_SENTRY'): + except ImportError: + print("python sentry-sdk not installed :(") + ++ try: ++ import distro ++ import psutil ++ except ImportError: ++ print("python distro and/or psutil modules missing, disabling sentry") ++ del os.environ['DRKONQI_WITH_SENTRY'] ++ + def mangle_path(path): + if not path: + return path +-- +2.39.1 + diff --git a/drkonqi5.changes b/drkonqi5.changes index 5c28b5f..272ad49 100644 --- a/drkonqi5.changes +++ b/drkonqi5.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Tue Jan 31 08:36:48 UTC 2023 - Fabian Vogt + +- Add patch to actually disable sentry: + * 0001-Handle-WITH_SENTRY-correctly.patch +- Add patch to avoid unnecessary dependencies of the gdb script: + * 0002-Make-python-distro-and-psutil-modules-in-the-gdb-pre.patch + ------------------------------------------------------------------- Thu Jan 19 14:42:33 UTC 2023 - Fabian Vogt diff --git a/drkonqi5.spec b/drkonqi5.spec index d0d2982..d8be7e7 100644 --- a/drkonqi5.spec +++ b/drkonqi5.spec @@ -34,8 +34,9 @@ Source: https://download.kde.org/unstable/plasma/%{version}/drkonqi-%{ve Source1: https://download.kde.org/unstable/plasma/%{version}/drkonqi-%{version}.tar.xz.sig Source2: plasma.keyring %endif -# PATCHES 100-199 are from upstream 5.16 branch -# PATCHES 200-299 and above are from upstream master/5.17+ branch +# PATCH-FIX-UPSTREAM https://invent.kde.org/plasma/drkonqi/-/merge_requests/84 +Patch1: 0001-Handle-WITH_SENTRY-correctly.patch +Patch2: 0002-Make-python-distro-and-psutil-modules-in-the-gdb-pre.patch BuildRequires: extra-cmake-modules >= %{kf5_version} BuildRequires: cmake(KF5Completion) >= %{kf5_version} BuildRequires: cmake(KF5Config) >= %{kf5_version} @@ -89,7 +90,7 @@ The KDE Crash Handler gives the user feedback if a program has crashed. %lang_package %prep -%setup -q -n drkonqi-%{version} +%autosetup -p1 -n drkonqi-%{version} %build %if 0%{?suse_version} < 1550