From 64f379f55e14e2120fddb2b6e5acacbdedf2518e Mon Sep 17 00:00:00 2001 From: groni Date: Wed, 1 Jul 2015 18:13:56 +0200 Subject: [PATCH] libksysguard version bump and check --- desktop/kde/plasma/libksysguard/actions.py | 19 + .../files/libksysguard_kauth.diff | 339 ++++++++++++++++++ desktop/kde/plasma/libksysguard/pspec.xml | 103 ++++++ 3 files changed, 461 insertions(+) create mode 100644 desktop/kde/plasma/libksysguard/actions.py create mode 100644 desktop/kde/plasma/libksysguard/files/libksysguard_kauth.diff create mode 100755 desktop/kde/plasma/libksysguard/pspec.xml diff --git a/desktop/kde/plasma/libksysguard/actions.py b/desktop/kde/plasma/libksysguard/actions.py new file mode 100644 index 0000000000..389685f7a8 --- /dev/null +++ b/desktop/kde/plasma/libksysguard/actions.py @@ -0,0 +1,19 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Licensed under the GNU General Public License, version 3. +# See the file http://www.gnu.org/licenses/gpl.txt + +from pisi.actionsapi import kde5 +from pisi.actionsapi import pisitools + +def setup(): + kde5.configure() + +def build(): + kde5.make() + +def install(): + kde5.install() + + pisitools.dodoc("COPYING.LIB") diff --git a/desktop/kde/plasma/libksysguard/files/libksysguard_kauth.diff b/desktop/kde/plasma/libksysguard/files/libksysguard_kauth.diff new file mode 100644 index 0000000000..b267af97d1 --- /dev/null +++ b/desktop/kde/plasma/libksysguard/files/libksysguard_kauth.diff @@ -0,0 +1,339 @@ +diff --git a/processcore/CMakeLists.txt b/processcore/CMakeLists.txt +index 9fef4ec..939d055 100644 +--- a/processcore/CMakeLists.txt ++++ b/processcore/CMakeLists.txt +@@ -41,18 +41,18 @@ install( FILES processes.h process.h DESTINATION ${INCLUDE_INSTALL_DIR}/ksysguar + #------ KAuth stuff + + # Auth example helper +-# set(ksysguardprocesslist_helper_srcs +-# helper.cpp +-# process.cpp +-# processes_local_p.cpp +-# processes_base_p.cpp) +-# +-# add_executable(ksysguardprocesslist_helper ${ksysguardprocesslist_helper_srcs}) +-# target_link_libraries(ksysguardprocesslist_helper ) +-# install(TARGETS ksysguardprocesslist_helper DESTINATION ${LIBEXEC_INSTALL_DIR}) +-# +-# kauth_install_helper_files(ksysguardprocesslist_helper org.kde.ksysguard.processlisthelper root) +-# kauth_install_actions(org.kde.ksysguard.processlisthelper actions.actions) +-# +-# set_target_properties(ksysguardprocesslist_helper PROPERTIES COMPILE_FLAGS "-Wall -ggdb") ++set(ksysguardprocesslist_helper_srcs ++ helper.cpp ++ process.cpp ++ processes_local_p.cpp ++ processes_base_p.cpp) ++ ++add_executable(ksysguardprocesslist_helper ${ksysguardprocesslist_helper_srcs}) ++target_link_libraries(ksysguardprocesslist_helper Qt5::Core KF5::Auth KF5::I18n) ++install(TARGETS ksysguardprocesslist_helper DESTINATION ${KAUTH_HELPER_INSTALL_DIR}) ++ ++kauth_install_helper_files(ksysguardprocesslist_helper org.kde.ksysguard.processlisthelper root) ++kauth_install_actions(org.kde.ksysguard.processlisthelper actions.actions) ++ ++set_target_properties(ksysguardprocesslist_helper PROPERTIES COMPILE_FLAGS "-Wall -ggdb") + +diff --git a/processcore/helper.cpp b/processcore/helper.cpp +index 6c1f570..c34ab1e 100644 +--- a/processcore/helper.cpp ++++ b/processcore/helper.cpp +@@ -23,24 +23,26 @@ + #include "helper.h" + #include "processes_local_p.h" + ++using namespace KAuth; ++ + KSysGuardProcessListHelper::KSysGuardProcessListHelper() + { + qRegisterMetaType >(); + } + + /* The functions here run as ROOT. So be careful. DO NOT TRUST THE INPUTS TO BE SANE. */ +-#define GET_PID(i) parameters.value(QString("pid%1").arg(i), -1).toULongLong(); if(pid < 0) return KAuth::ActionReply::HelperErrorReply; +-KAuth::ActionReply KSysGuardProcessListHelper::sendsignal(QVariantMap parameters) { +- KAuth::ActionReply errorReply(KAuth::ActionReply::HelperError); ++#define GET_PID(i) parameters.value(QString("pid%1").arg(i), -1).toULongLong(); if(pid < 0) return ActionReply(ActionReply::HelperErrorType); ++ActionReply KSysGuardProcessListHelper::sendsignal(QVariantMap parameters) { ++ ActionReply reply(ActionReply::HelperErrorType); + if(!parameters.contains("signal")) { +- errorReply.setErrorDescription("Internal error - no signal parameter was passed to the helper"); +- errorReply.setErrorCode(1); +- return errorReply; ++ reply.setErrorDescription("Internal error - no signal parameter was passed to the helper"); ++ reply.setErrorCode(static_cast(1)); ++ return reply; + } + if(!parameters.contains("pidcount")) { +- errorReply.setErrorDescription("Internal error - no pidcount parameter was passed to the helper"); +- errorReply.setErrorCode(2); +- return errorReply; ++ reply.setErrorDescription("Internal error - no pidcount parameter was passed to the helper"); ++ reply.setErrorCode(static_cast(2)); ++ return reply; + } + + KSysGuard::ProcessesLocal processes; +@@ -56,17 +58,17 @@ KAuth::ActionReply KSysGuardProcessListHelper::sendsignal(QVariantMap parameters + success = successForThisPid && success; + } + if(success) { +- return KAuth::ActionReply::SuccessReply; ++ return ActionReply::SuccessReply(); + } else { +- errorReply.setErrorDescription(QString("Could not send signal to: ") + errorList.join(", ")); +- errorReply.setErrorCode(0); +- return errorReply; ++ reply.setErrorDescription(QString("Could not send signal to: ") + errorList.join(", ")); ++ reply.setErrorCode(static_cast(0)); ++ return reply; + } + } + +-KAuth::ActionReply KSysGuardProcessListHelper::renice(QVariantMap parameters) { ++ActionReply KSysGuardProcessListHelper::renice(QVariantMap parameters) { + if(!parameters.contains("nicevalue") || !parameters.contains("pidcount")) +- return KAuth::ActionReply::HelperErrorReply; ++ return ActionReply(ActionReply::HelperErrorType); + + KSysGuard::ProcessesLocal processes; + int niceValue = qvariant_cast(parameters.value("nicevalue")); +@@ -77,14 +79,14 @@ KAuth::ActionReply KSysGuardProcessListHelper::renice(QVariantMap parameters) { + success = processes.setNiceness(pid, niceValue) && success; + } + if(success) +- return KAuth::ActionReply::SuccessReply; ++ return ActionReply::SuccessReply(); + else +- return KAuth::ActionReply::HelperErrorReply; ++ return ActionReply(ActionReply::HelperErrorType); + } + +-KAuth::ActionReply KSysGuardProcessListHelper::changeioscheduler(QVariantMap parameters) { ++ActionReply KSysGuardProcessListHelper::changeioscheduler(QVariantMap parameters) { + if(!parameters.contains("ioScheduler") || !parameters.contains("ioSchedulerPriority") || !parameters.contains("pidcount")) +- return KAuth::ActionReply::HelperErrorReply; ++ return ActionReply(ActionReply::HelperErrorType); + + KSysGuard::ProcessesLocal processes; + int ioScheduler = qvariant_cast(parameters.value("ioScheduler")); +@@ -96,14 +98,14 @@ KAuth::ActionReply KSysGuardProcessListHelper::changeioscheduler(QVariantMap par + success = processes.setIoNiceness(pid, ioScheduler, ioSchedulerPriority) && success; + } + if(success) +- return KAuth::ActionReply::SuccessReply; ++ return ActionReply::SuccessReply(); + else +- return KAuth::ActionReply::HelperErrorReply; ++ return ActionReply(ActionReply::HelperErrorType); + + } +-KAuth::ActionReply KSysGuardProcessListHelper::changecpuscheduler(QVariantMap parameters) { ++ActionReply KSysGuardProcessListHelper::changecpuscheduler(QVariantMap parameters) { + if(!parameters.contains("cpuScheduler") || !parameters.contains("cpuSchedulerPriority") || !parameters.contains("pidcount")) +- return KAuth::ActionReply::HelperErrorReply; ++ return ActionReply(ActionReply::HelperErrorType); + + KSysGuard::ProcessesLocal processes; + int cpuScheduler = qvariant_cast(parameters.value("cpuScheduler")); +@@ -116,9 +118,9 @@ KAuth::ActionReply KSysGuardProcessListHelper::changecpuscheduler(QVariantMap pa + success = processes.setScheduler(pid, cpuScheduler, cpuSchedulerPriority) && success; + } + if(success) +- return KAuth::ActionReply::SuccessReply; ++ return ActionReply::SuccessReply(); + else +- return KAuth::ActionReply::HelperErrorReply; ++ return ActionReply(ActionReply::HelperErrorType); + + } + KAUTH_HELPER_MAIN("org.kde.ksysguard.processlisthelper", KSysGuardProcessListHelper) +diff --git a/processcore/processes_linux_p.cpp b/processcore/processes_linux_p.cpp +index 65b8dfd..0cff0e8 100644 +--- a/processcore/processes_linux_p.cpp ++++ b/processcore/processes_linux_p.cpp +@@ -22,7 +22,7 @@ + #include "processes_local_p.h" + #include "process.h" + +-#include ++#include + + #include + #include +diff --git a/processui/ksysguardprocesslist.cpp b/processui/ksysguardprocesslist.cpp +index 1651a0a..ba9d8c9 100644 +--- a/processui/ksysguardprocesslist.cpp ++++ b/processui/ksysguardprocesslist.cpp +@@ -48,6 +48,9 @@ + #include //For SIGTERM + + #include ++#include ++#include ++#include + #include + #include + #include +@@ -188,7 +191,7 @@ struct KSysGuardProcessListPrivate { + int totalRowCount(const QModelIndex &parent) const; + + /** Helper function to setup 'action' with the given pids */ +- void setupKAuthAction(KAuth::Action *action, const QList & pids) const; ++ void setupKAuthAction(KAuth::Action &action, const QList & pids) const; + + /** fire a timer event if we are set to use our internal timer*/ + void fireTimerEvent(); +@@ -392,15 +395,15 @@ int KSysGuardProcessListPrivate::totalRowCount(const QModelIndex &parent ) const + return total; + } + +-void KSysGuardProcessListPrivate::setupKAuthAction(KAuth::Action *action, const QList & pids) const ++void KSysGuardProcessListPrivate::setupKAuthAction(KAuth::Action &action, const QList & pids) const + { +- action->setHelperId("org.kde.ksysguard.processlisthelper"); ++ action.setHelperId("org.kde.ksysguard.processlisthelper"); + + int processCount = pids.count(); + for(int i = 0; i < processCount; i++) { +- action->addArgument(QString("pid%1").arg(i), pids[i]); ++ action.addArgument(QString("pid%1").arg(i), pids[i]); + } +- action->addArgument("pidcount", processCount); ++ action.addArgument("pidcount", processCount); + } + void KSysGuardProcessList::selectionChanged() + { +@@ -1023,23 +1026,19 @@ bool KSysGuardProcessList::reniceProcesses(const QList &pids, int nic + + + #warning KAuth needs porting, but docu is not adjusted, no idea how to do it +-#if 0 +- KAuth::Action *action = new KAuth::Action("org.kde.ksysguard.processlisthelper.renice"); +- action->setParentWidget(window()); ++ KAuth::Action action("org.kde.ksysguard.processlisthelper.renice"); ++ action.setParentWidget(window()); + d->setupKAuthAction( action, unreniced_pids); +- action->addArgument("nicevalue", niceValue); +- KAuth::ActionReply reply = action->execute(); ++ action.addArgument("nicevalue", niceValue); ++ KAuth::ExecuteJob *job = action.execute(); + +- if (reply == KAuth::ActionReply::SuccessReply) { ++ if (job->exec()) { + updateList(); +- delete action; +- } else if (reply != KAuth::ActionReply::UserCancelled && reply != KAuth::ActionReply::AuthorizationDenied) { ++ } else if (!job->exec()) { + KMessageBox::sorry(this, i18n("You do not have the permission to renice the process and there " +- "was a problem trying to run as root. Error %1 %2", reply.errorCode(), reply.errorDescription())); +- delete action; ++ "was a problem trying to run as root. Error %1 %2", job->error(), job->errorString())); + return false; + } +-#endif + return true; + } + +@@ -1189,26 +1188,22 @@ bool KSysGuardProcessList::changeIoScheduler(const QList< long long> &pids, KSys + if(!d->mModel.isLocalhost()) return false; //We can't use kauth to affect non-localhost processes + + #warning KAuth needs porting, but docu is not adjusted, no idea how to do it +-#if 0 +- KAuth::Action *action = new KAuth::Action("org.kde.ksysguard.processlisthelper.changeioscheduler"); +- action->setParentWidget(window()); ++ KAuth::Action action("org.kde.ksysguard.processlisthelper.changeioscheduler"); ++ action.setParentWidget(window()); + + d->setupKAuthAction( action, unchanged_pids); +- action->addArgument("ioScheduler", (int)newIoSched); +- action->addArgument("ioSchedulerPriority", newIoSchedPriority); ++ action.addArgument("ioScheduler", (int)newIoSched); ++ action.addArgument("ioSchedulerPriority", newIoSchedPriority); + +- KAuth::ActionReply reply = action->execute(); ++ KAuth::ExecuteJob *job = action.execute(); + +- if (reply == KAuth::ActionReply::SuccessReply) { ++ if (job->exec()) { + updateList(); +- delete action; +- } else if (reply != KAuth::ActionReply::UserCancelled && reply != KAuth::ActionReply::AuthorizationDenied) { ++ } else if (!job->exec()) { + KMessageBox::sorry(this, i18n("You do not have the permission to change the I/O priority of the process and there " +- "was a problem trying to run as root. Error %1 %2", reply.errorCode(), reply.errorDescription())); +- delete action; ++ "was a problem trying to run as root. Error %1 %2", job->error(), job->errorString())); + return false; + } +-#endif + return true; + } + +@@ -1226,24 +1221,20 @@ bool KSysGuardProcessList::changeCpuScheduler(const QList< long long> &pids, KSy + if(!d->mModel.isLocalhost()) return false; //We can't use KAuth to affect non-localhost processes + + #warning KAuth needs porting, but docu is not adjusted, no idea how to do it +-#if 0 +- KAuth::Action *action = new KAuth::Action("org.kde.ksysguard.processlisthelper.changecpuscheduler"); +- action->setParentWidget(window()); ++ KAuth::Action action("org.kde.ksysguard.processlisthelper.changecpuscheduler"); ++ action.setParentWidget(window()); + d->setupKAuthAction( action, unchanged_pids); +- action->addArgument("cpuScheduler", (int)newCpuSched); +- action->addArgument("cpuSchedulerPriority", newCpuSchedPriority); +- KAuth::ActionReply reply = action->execute(); ++ action.addArgument("cpuScheduler", (int)newCpuSched); ++ action.addArgument("cpuSchedulerPriority", newCpuSchedPriority); ++ KAuth::ExecuteJob *job = action.execute(); + +- if (reply == KAuth::ActionReply::SuccessReply) { ++ if (job->exec()) { + updateList(); +- delete action; +- } else if (reply != KAuth::ActionReply::UserCancelled && reply != KAuth::ActionReply::AuthorizationDenied) { ++ } else if (!job->exec()) { + KMessageBox::sorry(this, i18n("You do not have the permission to change the CPU Scheduler for the process and there " +- "was a problem trying to run as root. Error %1 %2", reply.errorCode(), reply.errorDescription())); +- delete action; ++ "was a problem trying to run as root. Error %1 %2", job->error(), job->errorString())); + return false; + } +-#endif + return true; + } + +@@ -1262,26 +1253,20 @@ bool KSysGuardProcessList::killProcesses(const QList< long long> &pids, int sig) + if(!d->mModel.isLocalhost()) return false; //We can't elevate privileges to kill non-localhost processes + + #warning KAuth needs porting, but docu is not adjusted, no idea how to do it +-#if 0 + KAuth::Action action("org.kde.ksysguard.processlisthelper.sendsignal"); + action.setParentWidget(window()); +- d->setupKAuthAction( &action, unkilled_pids); ++ //action.setHelperId("org.kde.ksysguard.processlisthelper"); ++ d->setupKAuthAction( action, unkilled_pids); + action.addArgument("signal", sig); +- KAuth::ActionReply reply = action.execute(); ++ KAuth::ExecuteJob *job = action.execute(); + +- if (reply == KAuth::ActionReply::SuccessReply) { ++ if (job->exec()) { + updateList(); +- } else if (reply.type() == KAuth::ActionReply::HelperError) { +- if (reply.errorCode() > 0) +- KMessageBox::sorry(this, i18n("You do not have the permission to kill the process and there " +- "was a problem trying to run as root. %1", reply.errorDescription())); +- return false; +- } else if (reply != KAuth::ActionReply::UserCancelled && reply != KAuth::ActionReply::AuthorizationDenied) { ++ } else if (!job->exec()) { + KMessageBox::sorry(this, i18n("You do not have the permission to kill the process and there " +- "was a problem trying to run as root. Error %1 %2", reply.errorCode(), reply.errorDescription())); ++ "was a problem trying to run as root. Error %1 %2", job->error(), job->errorString())); + return false; + } +-#endif + return true; + } + diff --git a/desktop/kde/plasma/libksysguard/pspec.xml b/desktop/kde/plasma/libksysguard/pspec.xml new file mode 100755 index 0000000000..1e5f7b995b --- /dev/null +++ b/desktop/kde/plasma/libksysguard/pspec.xml @@ -0,0 +1,103 @@ + + + + + libksysguard + http://www.kde.org + + Pisi Linux Admins + admins@pisilinux.org + + LGPLv2 + library + app:console + Task management and system monitoring library + Task management and system monitoring library + http://download.kde.org/stable/plasma/5.3.2/libksysguard-5.3.2.tar.xz + + qt5-base-devel + python3 + kdoctools-devel + libgcc + libX11-devel + zlib-devel + extra-cmake-modules + + + + + + + + libksysguard + + qt5-base + libgcc + libX11 + zlib + libXres + qt5-webkit + qt5-x11extras + kwindowsystem + kconfigwidgets + kwidgetsaddons + kconfig + kauth + kcoreaddons + kdelibs4-support + ki18n + plasma-framework + + + /etc + /usr/share + /usr/share/locale + /usr/lib/qt5 + /usr/lib + /usr/share/doc + + + kde-workspace + + + kde-workspace + + + + + libksysguard-devel + Development files for libksysguard + + qt5-base-devel + libksysguard + + + /usr/include + /usr/lib/cmake + /usr/lib/pkgconfig + + + kde-workspace-devel + + + kde-workspace-devel + + + + + + 2015-07-01 + 5.3.2 + Version bump. + Stefan Gronewold(groni) + groni@pisilinux.org + + + 2015-06-12 + 5.3.1 + First Release. + Stefan Gronewold(groni) + groni@pisilinux.org + + +