libksysguard version bump and check

This commit is contained in:
groni
2015-07-01 18:13:56 +02:00
parent 1b86cac3e5
commit 64f379f55e
3 changed files with 461 additions and 0 deletions
@@ -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")
@@ -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<QList<long long> >();
}
/* 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<ActionReply::Error>(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<ActionReply::Error>(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<ActionReply::Error>(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<int>(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<int>(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<int>(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 <klocale.h>
+#include <klocalizedstring.h>
#include <QFile>
#include <QHash>
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 <signal.h> //For SIGTERM
#include <kauth.h>
+#include <kauthaction.h>
+#include <kauthactionreply.h>
+#include <kauthobjectdecorator.h>
#include <klocale.h>
#include <kmessagebox.h>
#include <kdialog.h>
@@ -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<long long> & pids) const;
+ void setupKAuthAction(KAuth::Action &action, const QList<long long> & 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<long long> & pids) const
+void KSysGuardProcessListPrivate::setupKAuthAction(KAuth::Action &action, const QList<long long> & 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<long long> &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;
}
+103
View File
@@ -0,0 +1,103 @@
<?xml version="1.0" ?>
<!DOCTYPE PISI SYSTEM "http://www.pisilinux.org/projeler/pisi/pisi-spec.dtd">
<PISI>
<Source>
<Name>libksysguard</Name>
<Homepage>http://www.kde.org</Homepage>
<Packager>
<Name>Pisi Linux Admins</Name>
<Email>admins@pisilinux.org</Email>
</Packager>
<License>LGPLv2</License>
<IsA>library</IsA>
<IsA>app:console</IsA>
<Summary>Task management and system monitoring library</Summary>
<Description>Task management and system monitoring library</Description>
<Archive sha1sum="062ba33ebf09a41afe30ced2ef3e5552f0378806" type="tarxz">http://download.kde.org/stable/plasma/5.3.2/libksysguard-5.3.2.tar.xz</Archive>
<BuildDependencies>
<Dependency>qt5-base-devel</Dependency>
<Dependency>python3</Dependency>
<Dependency>kdoctools-devel</Dependency>
<Dependency>libgcc</Dependency>
<Dependency>libX11-devel</Dependency>
<Dependency>zlib-devel</Dependency>
<Dependency>extra-cmake-modules</Dependency>
</BuildDependencies>
<Patches>
<!--<Patch level="1">libksysguard_kauth.diff</Patch> -->
</Patches>
</Source>
<Package>
<Name>libksysguard</Name>
<RuntimeDependencies>
<Dependency>qt5-base</Dependency>
<Dependency>libgcc</Dependency>
<Dependency>libX11</Dependency>
<Dependency>zlib</Dependency>
<Dependency>libXres</Dependency>
<Dependency>qt5-webkit</Dependency>
<Dependency>qt5-x11extras</Dependency>
<Dependency>kwindowsystem</Dependency>
<Dependency>kconfigwidgets</Dependency>
<Dependency>kwidgetsaddons</Dependency>
<Dependency>kconfig</Dependency>
<Dependency>kauth</Dependency>
<Dependency>kcoreaddons</Dependency>
<Dependency>kdelibs4-support</Dependency>
<Dependency>ki18n</Dependency>
<Dependency>plasma-framework</Dependency>
</RuntimeDependencies>
<Files>
<Path fileType="config">/etc</Path>
<Path fileType="data">/usr/share</Path>
<Path fileType="localedata">/usr/share/locale</Path>
<Path fileType="library">/usr/lib/qt5</Path>
<Path fileType="library">/usr/lib</Path>
<Path fileType="doc">/usr/share/doc</Path>
</Files>
<Replaces>
<Package>kde-workspace</Package>
</Replaces>
<Conflicts>
<Package>kde-workspace</Package>
</Conflicts>
</Package>
<Package>
<Name>libksysguard-devel</Name>
<Summary>Development files for libksysguard</Summary>
<RuntimeDependencies>
<Dependency>qt5-base-devel</Dependency>
<Dependency release="current">libksysguard</Dependency>
</RuntimeDependencies>
<Files>
<Path fileType="header">/usr/include</Path>
<Path fileType="data">/usr/lib/cmake</Path>
<Path fileType="config">/usr/lib/pkgconfig</Path>
</Files>
<Replaces>
<Package>kde-workspace-devel</Package>
</Replaces>
<Conflicts>
<Package>kde-workspace-devel</Package>
</Conflicts>
</Package>
<History>
<Update release="2">
<Date>2015-07-01</Date>
<Version>5.3.2</Version>
<Comment>Version bump.</Comment>
<Name>Stefan Gronewold(groni)</Name>
<Email>groni@pisilinux.org</Email>
</Update>
<Update release="1">
<Date>2015-06-12</Date>
<Version>5.3.1</Version>
<Comment>First Release.</Comment>
<Name>Stefan Gronewold(groni)</Name>
<Email>groni@pisilinux.org</Email>
</Update>
</History>
</PISI>