* Tue Sep 27 2011 Kevin Kofler <Kevin@tigcc.ticalc.org> 4.7.1-4

- updated Plasma data engine dependency extraction patch:
  - added support for declarativeappletscript QML code
  - plasma-dataengine-depextractor command-line tool:
    - make sure we pass an absolute path to KDesktopFile
    - autodetect the API/language used, drop --api command-line argument
This commit is contained in:
Kevin Kofler 2011-09-28 01:51:17 +02:00
parent 20d5931c2d
commit 66a25543f5
2 changed files with 43 additions and 23 deletions

View File

@ -1,5 +1,5 @@
From 1ce984bda1bb6a06f237240069a9f3a554cbbf37 Mon Sep 17 00:00:00 2001 From 89e4767148110a5566e463a03b3ed594276b7da0 Mon Sep 17 00:00:00 2001
Message-Id: <1ce984bda1bb6a06f237240069a9f3a554cbbf37.1313890335.git.kevin.kofler@chello.at> Message-Id: <89e4767148110a5566e463a03b3ed594276b7da0.1317166378.git.kevin.kofler@chello.at>
From: Kevin Kofler <kevin.kofler@chello.at> From: Kevin Kofler <kevin.kofler@chello.at>
Date: Wed, 17 Aug 2011 04:54:37 +0200 Date: Wed, 17 Aug 2011 04:54:37 +0200
Subject: [PATCH] Implement automatic scanning of source code for required Subject: [PATCH] Implement automatic scanning of source code for required
@ -20,11 +20,11 @@ fill in X-Plasma-RequiredDataEngines manually. (Please note that the list is
expected to be comma-separated.) expected to be comma-separated.)
--- ---
plasma/CMakeLists.txt | 15 ++++ plasma/CMakeLists.txt | 15 ++++
plasma/depextractor/depextractor.cpp | 115 +++++++++++++++++++++++++++++++++ plasma/depextractor/depextractor.cpp | 125 +++++++++++++++++++++++++++++++++
plasma/package.cpp | 11 +++ plasma/package.cpp | 11 +++
plasma/private/componentinstaller.cpp | 68 +++++++++++++++++++ plasma/private/componentinstaller.cpp | 71 +++++++++++++++++++
plasma/private/componentinstaller_p.h | 17 +++++- plasma/private/componentinstaller_p.h | 17 ++++-
5 files changed, 225 insertions(+), 1 deletions(-) 5 files changed, 238 insertions(+), 1 deletions(-)
diff --git a/plasma/CMakeLists.txt b/plasma/CMakeLists.txt diff --git a/plasma/CMakeLists.txt b/plasma/CMakeLists.txt
index f929967..9a760ef 100644 index f929967..9a760ef 100644
@ -58,10 +58,10 @@ index f929967..9a760ef 100644
+endif(NOT PLASMA_NO_PACKAGEKIT) +endif(NOT PLASMA_NO_PACKAGEKIT)
diff --git a/plasma/depextractor/depextractor.cpp b/plasma/depextractor/depextractor.cpp diff --git a/plasma/depextractor/depextractor.cpp b/plasma/depextractor/depextractor.cpp
new file mode 100644 new file mode 100644
index 0000000..221b88b index 0000000..c489de7
--- /dev/null --- /dev/null
+++ b/plasma/depextractor/depextractor.cpp +++ b/plasma/depextractor/depextractor.cpp
@@ -0,0 +1,115 @@ @@ -0,0 +1,125 @@
+/* Plasma Data Engine dependency extractor +/* Plasma Data Engine dependency extractor
+ Copyright (C) 2011 Kevin Kofler <kevin.kofler@chello.at> + Copyright (C) 2011 Kevin Kofler <kevin.kofler@chello.at>
+ +
@ -92,6 +92,21 @@ index 0000000..221b88b
+ +
+#include "private/componentinstaller_p.h" +#include "private/componentinstaller_p.h"
+ +
+static QString scriptingApi(const QString &desktopFile)
+{
+ KDesktopFile desktop(desktopFile);
+ KConfigGroup desktopGroup = desktop.desktopGroup();
+ if (desktopGroup.readEntry("X-KDE-ServiceTypes", QStringList())
+ .contains("Plasma/ScriptEngine")
+ || desktopGroup.readEntry("ServiceTypes", QStringList())
+ .contains("Plasma/ScriptEngine")) {
+ /* Script engines are always written in C++. Their X-Plasma-API is the
+ API they export, not the language they're written in. */
+ return QString();
+ }
+ return desktopGroup.readEntry("X-Plasma-API", QString());
+}
+
+static void writeDataEngineDependencies(const QStringList &deps, +static void writeDataEngineDependencies(const QStringList &deps,
+ const QString &desktopFile) + const QString &desktopFile)
+{ +{
@ -105,16 +120,13 @@ index 0000000..221b88b
+{ +{
+ KAboutData aboutData("plasma-dataengine-depextractor", QByteArray(), + KAboutData aboutData("plasma-dataengine-depextractor", QByteArray(),
+ ki18n("Plasma Data Engine dependency extractor"), + ki18n("Plasma Data Engine dependency extractor"),
+ "1", + "2",
+ ki18n("Plasma Data Engine dependency extractor")); + ki18n("Plasma Data Engine dependency extractor"));
+ aboutData.addAuthor(ki18n("Kevin Kofler"), ki18n("Author"), + aboutData.addAuthor(ki18n("Kevin Kofler"), ki18n("Author"),
+ "kevin.kofler@chello.at"); + "kevin.kofler@chello.at");
+ +
+ KCmdLineArgs::init(argc, argv, &aboutData); + KCmdLineArgs::init(argc, argv, &aboutData);
+ KCmdLineOptions options; + KCmdLineOptions options;
+ options.add("a")
+ .add("api <name>",
+ ki18n("Sets the name of the scripting API/language"));
+ options.add("+[path]", + options.add("+[path]",
+ ki18n("Source path (default: .)")); + ki18n("Source path (default: .)"));
+ options.add("+[file]", + options.add("+[file]",
@ -129,10 +141,7 @@ index 0000000..221b88b
+ +
+ int exitCode = 0; + int exitCode = 0;
+ +
+ QString api, path, desktopFile; + QString path, desktopFile;
+ if (args->isSet("api")) {
+ api = args->getOption("api");
+ }
+ int argCount = args->count(); + int argCount = args->count();
+ switch (argCount) { + switch (argCount) {
+ case 0: + case 0:
@ -159,12 +168,13 @@ index 0000000..221b88b
+ +
+ if (!exitCode) { + if (!exitCode) {
+ if (QFileInfo(desktopFile).isRelative()) + if (QFileInfo(desktopFile).isRelative())
+ desktopFile = QDir(path).filePath(desktopFile); + desktopFile = QDir(path).absoluteFilePath(desktopFile);
+ +
+ if (QFileInfo(desktopFile).exists()) { + if (QFileInfo(desktopFile).exists()) {
+ writeDataEngineDependencies(Plasma::ComponentInstaller::self() + writeDataEngineDependencies(Plasma::ComponentInstaller::self()
+ ->extractDataEngineDependencies(path, + ->extractDataEngineDependencies(
+ api), + path,
+ scriptingApi(desktopFile)),
+ desktopFile); + desktopFile);
+ } else { + } else {
+ QTextStream err(stderr, QIODevice::WriteOnly | QIODevice::Text); + QTextStream err(stderr, QIODevice::WriteOnly | QIODevice::Text);
@ -200,7 +210,7 @@ index 0a45c87..131f204 100644
QStringList knownDataEngines = DataEngineManager::self()->listAllEngines(meta.application()); QStringList knownDataEngines = DataEngineManager::self()->listAllEngines(meta.application());
foreach (const QString &requiredDataEngine, requiredDataEngines) { foreach (const QString &requiredDataEngine, requiredDataEngines) {
diff --git a/plasma/private/componentinstaller.cpp b/plasma/private/componentinstaller.cpp diff --git a/plasma/private/componentinstaller.cpp b/plasma/private/componentinstaller.cpp
index 870667f..2c8c2dd 100644 index 870667f..087d1c6 100644
--- a/plasma/private/componentinstaller.cpp --- a/plasma/private/componentinstaller.cpp
+++ b/plasma/private/componentinstaller.cpp +++ b/plasma/private/componentinstaller.cpp
@@ -28,6 +28,10 @@ @@ -28,6 +28,10 @@
@ -228,7 +238,7 @@ index 870667f..2c8c2dd 100644
QStringList resources; QStringList resources;
resources.append(searchString); resources.append(searchString);
packageKit.asyncCall(QLatin1String("InstallResources"), (unsigned int) wid, packageKit.asyncCall(QLatin1String("InstallResources"), (unsigned int) wid,
@@ -100,4 +108,64 @@ void ComponentInstaller::installMissingComponent(const QString &type, @@ -100,4 +108,67 @@ void ComponentInstaller::installMissingComponent(const QString &type,
#endif #endif
} }
@ -251,6 +261,9 @@ index 870667f..2c8c2dd 100644
+ nameFilters.append("*.hxx"); + nameFilters.append("*.hxx");
+ nameFilters.append("*.hh"); + nameFilters.append("*.hh");
+ nameFilters.append("*.H"); + nameFilters.append("*.H");
+ } else if (api == "declarativeappletscript") {
+ nameFilters.append("*.qml");
+ searchRegExp = QRegExp("(?:^\\s*engine:\\s*|dataEngine *\\( *)\"([^\"]+)\"");
+ } else if (api == "javascript") { + } else if (api == "javascript") {
+ nameFilters.append("*.js"); + nameFilters.append("*.js");
+ } else if (api == "python") { + } else if (api == "python") {
@ -329,5 +342,5 @@ index f85cbb6..d0d9c75 100644
/** /**
* Default constructor. The singleton method self() is the * Default constructor. The singleton method self() is the
-- --
1.7.4.4 1.7.6.2

View File

@ -20,7 +20,7 @@
Summary: KDE Libraries Summary: KDE Libraries
Version: 4.7.1 Version: 4.7.1
Release: 3%{?dist} Release: 4%{?dist}
Name: kdelibs Name: kdelibs
Epoch: 6 Epoch: 6
@ -562,6 +562,13 @@ rm -rf %{buildroot}
%changelog %changelog
* Tue Sep 27 2011 Kevin Kofler <Kevin@tigcc.ticalc.org> 4.7.1-4
- updated Plasma data engine dependency extraction patch:
- added support for declarativeappletscript QML code
- plasma-dataengine-depextractor command-line tool:
- make sure we pass an absolute path to KDesktopFile
- autodetect the API/language used, drop --api command-line argument
* Thu Sep 22 2011 Rex Dieter <rdieter@fedoraproject.org> 4.7.1-3 * Thu Sep 22 2011 Rex Dieter <rdieter@fedoraproject.org> 4.7.1-3
- pkgconfig-style deps - pkgconfig-style deps
- move kde4_appsdir/kdewidgets to main pkg (pairs with kdewidgets designer plugin) - move kde4_appsdir/kdewidgets to main pkg (pairs with kdewidgets designer plugin)