summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/archivegen/archivegen.pro1
-rw-r--r--tools/binarycreator/binarycreator.pro3
-rw-r--r--tools/common/repositorygen.cpp15
-rw-r--r--tools/repogen/repogen.pro1
4 files changed, 16 insertions, 4 deletions
diff --git a/tools/archivegen/archivegen.pro b/tools/archivegen/archivegen.pro
index 9d778ee98..ff9fdbd59 100644
--- a/tools/archivegen/archivegen.pro
+++ b/tools/archivegen/archivegen.pro
@@ -6,6 +6,7 @@ INCLUDEPATH += . .. ../common
include(../../installerfw.pri)
QT -= gui
+QT += script
LIBS += -linstaller
CONFIG += console
diff --git a/tools/binarycreator/binarycreator.pro b/tools/binarycreator/binarycreator.pro
index b6f164b4d..706318ebc 100644
--- a/tools/binarycreator/binarycreator.pro
+++ b/tools/binarycreator/binarycreator.pro
@@ -6,6 +6,7 @@ INCLUDEPATH += . .. rcc ../common
include(../../installerfw.pri)
QT -= gui
+QT += script
LIBS += -linstaller
CONFIG += console
@@ -17,4 +18,4 @@ SOURCES = binarycreator.cpp \
rccmain.cpp \
repositorygen.cpp
HEADERS = rcc.h
-RESOURCES += binarycreator.qrc \ No newline at end of file
+RESOURCES += binarycreator.qrc
diff --git a/tools/common/repositorygen.cpp b/tools/common/repositorygen.cpp
index cd5996b76..68fe09b28 100644
--- a/tools/common/repositorygen.cpp
+++ b/tools/common/repositorygen.cpp
@@ -35,12 +35,15 @@
#include <errors.h>
#include <lib7z_facade.h>
#include <settings.h>
+#include <qinstallerglobal.h>
#include <kdupdater.h>
#include <QtCore/QCryptographicHash>
#include <QtCore/QDirIterator>
+#include <QtScript/QScriptEngine>
+
#include <QtXml/QDomDocument>
#include <iostream>
@@ -240,13 +243,20 @@ void QInstallerTools::generateMetaDataDirectory(const QString &outDir, const QSt
// copy scripts
const QString script = package.firstChildElement(QLatin1String("Script")).text();
if (!script.isEmpty()) {
+ const QString fromLocation(QString::fromLatin1("%1/meta/%2").arg(it->directory, script));
- QFile scriptFile(script);
QString scriptContent;
+ QFile scriptFile(fromLocation);
if (scriptFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
QTextStream in(&scriptFile);
scriptContent = in.readAll();
}
+ static QScriptEngine testScriptEngine;
+ testScriptEngine.evaluate(scriptContent, scriptFile.fileName());
+ if (testScriptEngine.hasUncaughtException()) {
+ throw QInstaller::Error(QObject::tr("Exception while loading the component script: %1")
+ .arg(QInstaller::uncaughtExceptionString(&testScriptEngine, scriptFile.fileName())));
+ }
// added the xml tag RequiresAdminRights to the xml if somewhere addElevatedOperation is used
if (scriptContent.contains(QLatin1String("addElevatedOperation"))) {
@@ -256,9 +266,8 @@ void QInstallerTools::generateMetaDataDirectory(const QString &outDir, const QSt
}
qDebug() << "\tCopying associated script" << script << "into the meta package...";
- QString fromLocation(QString::fromLatin1("%1/meta/%2").arg(it->directory, script));
QString toLocation(QString::fromLatin1("%1/%2/%3").arg(metapath, it->name, script));
- if (!QFile::copy(fromLocation, toLocation)) {
+ if (!scriptFile.copy(toLocation)) {
qDebug() << "failed!";
throw QInstaller::Error(QObject::tr("Could not copy the script %1 to its target location %2.")
.arg(fromLocation, toLocation));
diff --git a/tools/repogen/repogen.pro b/tools/repogen/repogen.pro
index e9652b25a..5b6f0d03a 100644
--- a/tools/repogen/repogen.pro
+++ b/tools/repogen/repogen.pro
@@ -6,6 +6,7 @@ INCLUDEPATH += . .. ../common
include(../../installerfw.pri)
QT -= gui
+QT += script
LIBS += -linstaller
CONFIG += console