summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore161
-rw-r--r--LGPL_EXCEPTION.txt2
-rw-r--r--doc/doc.pri7
-rw-r--r--doc/installerfw-getting-started.qdoc4
-rw-r--r--doc/installerfw-overview.qdoc2
-rw-r--r--doc/installerfw-using.qdoc6
-rw-r--r--doc/installerfw.qdoc6
-rw-r--r--doc/operations.qdoc66
-rw-r--r--doc/scripting.qdoc18
-rw-r--r--doc/tutorial.qdoc2
-rw-r--r--examples/testapp/testapp.pro18
-rw-r--r--examples/tutorial/packages/com.vendor.product/meta/de_de.ts7
-rw-r--r--installerfw.pri2
-rw-r--r--src/libs/installer/fakestopprocessforupdateoperation.cpp80
-rw-r--r--src/libs/installer/fakestopprocessforupdateoperation.h4
-rw-r--r--src/libs/installer/packagemanagercore_p.cpp28
-rw-r--r--src/libs/installer/repository.h8
-rw-r--r--src/libs/kdtools/kdsysinfo.cpp2
-rw-r--r--src/libs/kdtools/kdsysinfo_x11.cpp2
-rw-r--r--tests/auto/installer/fakestopprocessforupdateoperation/fakestopprocessforupdateoperation.pro6
-rw-r--r--tests/auto/installer/fakestopprocessforupdateoperation/tst_fakestopprocessforupdateoperation.cpp78
-rw-r--r--tests/auto/installer/installer.pro4
-rw-r--r--tests/auto/installer/repository/repository.pro6
-rw-r--r--tests/auto/installer/repository/tst_repository.cpp119
-rw-r--r--tests/testvm-configs/franks-host-config.cfg5
-rw-r--r--tests/testvm-configs/franks-test-vm.cfg7
-rw-r--r--tests/testvm-configs/mikes-host-config.cfg4
-rw-r--r--tests/testvm-configs/mikes-test-vm.cfg7
-rw-r--r--tools/binarycreator/binarycreator.cpp21
-rw-r--r--tools/common/repositorygen.cpp62
-rw-r--r--tools/repogen/repogen.cpp29
31 files changed, 413 insertions, 360 deletions
diff --git a/.gitignore b/.gitignore
index b98f0aab0..05d88e93d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,28 +1,7 @@
-# This file is used to ignore files which are generated in the Qt build system
-# ----------------------------------------------------------------------------
-
-examples/*/*/*
-!examples/*/*/*[.]*
-!examples/*/*/README
-examples/*/*/*[.]app
-!examples/declarative/*
-!examples/tutorials/*
-!examples/ja_JP/*/*
-demos/*/*
-!demos/spectrum/*
-demos/spectrum/bin
-!demos/*/*[.]*
-demos/*/*[.]app
-!demos/declarative/*
-config.tests/*/*/*
-!config.tests/*/*/*[.]*
-config.tests/*/*/*[.]app
-
-callgrind.out.*
-pcviewer.cfg
*~
*.a
*.la
+*.exe
*.core
*.moc
*.o
@@ -36,6 +15,9 @@ pcviewer.cfg
*.mode1v3
*_pch.h.cpp
*_resource.rc
+*_manifest.rc
+*_manifest.res
+*.embed.manifest
.#*
*.*#
core
@@ -52,71 +34,10 @@ Makefile*
*.app
*.pro.user
*.gcov
-bin/Qt*.dll
-bin/assistant*
-bin/designer*
-bin/dumpcpp*
-bin/idc*
-bin/linguist*
-bin/lrelease*
-bin/lupdate*
-bin/lconvert*
-bin/moc*
-bin/makeqpf*
-bin/pixeltool*
-bin/qmake*
-bin/qdoc3*
-bin/qt3to4*
-bin/qtdemo*
-bin/qttracereplay*
-bin/rcc*
-bin/uic*
-bin/patternist*
-bin/phonon*
-bin/qcollectiongenerator*
-bin/qdbus*
-bin/qhelpconverter*
-bin/qhelpgenerator*
-bin/qtconfig*
-bin/xmlpatterns*
-bin/cetest*
-bin/collectiongenerator
-bin/helpconverter
-bin/helpgenerator
-bin/kmap2qmap*
-bin/qlalr*
-bin/qmlconv*
-bin/qmldebugger*
-bin/qml*
-bin/qttracereplay*
-configure.cache
-config.status
-mkspecs/default
-mkspecs/qconfig.pri
moc_*.cpp
-qmake/qmake.exe
-qmake/Makefile.bak
-src/corelib/global/qconfig.cpp
-src/corelib/global/qconfig.h
-src/corelib/global/qconfig.h.qmake
-src/tools/uic/qclass_lib_map.h
ui_*.h
-tests/auto/qprocess/test*/*.exe
-tests/auto/qtcpsocket/stressTest/*.exe
-tests/auto/qprocess/fileWriterProcess/*.exe
-tests/auto/qmake/testdata/quotedfilenames/*.exe
-tests/auto/compilerwarnings/*.exe
-tests/auto/qmake/testdata/quotedfilenames/test.cpp
-tests/auto/qprocess/fileWriterProcess.txt
-.com.apple.timemachine.supported
-tests/auto/qlibrary/libmylib.so*
-tests/auto/qresourceengine/runtime_resource.rcc
-tools/qtestlib/chart/chart*
-tools/qtestlib/updater/updater*
-tools/activeqt/testcon/testcon.tlb
-translations/*.qm
-translations/*_untranslated.ts
qrc_*.cpp
+*.qm
# xemacs temporary files
*.flc
@@ -144,52 +65,19 @@ qrc_*.cpp
*.Debug
*.Release
-# WebKit temp files
-src/3rdparty/webkit/WebCore/mocinclude.tmp
-src/3rdparty/webkit/includes.txt
-src/3rdparty/webkit/includes2.txt
-
-# Symlinks generated by configure
-tools/qvfb/qvfbhdr.h
-tools/qvfb/qlock_p.h
-tools/qvfb/qlock.cpp
-tools/qvfb/qwssignalhandler.cpp
-tools/qvfb/qwssignalhandler_p.h
.DS_Store
.pch
.rcc
*.app
-config.status
-config.tests/unix/cups/cups
-config.tests/unix/getaddrinfo/getaddrinfo
-config.tests/unix/getifaddrs/getifaddrs
-config.tests/unix/iconv/iconv
-config.tests/unix/ipv6/ipv6
-config.tests/unix/ipv6ifname/ipv6ifname
-config.tests/unix/largefile/largefile
-config.tests/unix/nis/nis
-config.tests/unix/odbc/odbc
-config.tests/unix/openssl/openssl
-config.tests/unix/stl/stl
-config.tests/unix/zlib/zlib
-config.tests/unix/3dnow/3dnow
-config.tests/unix/mmx/mmx
-config.tests/unix/sse/sse
-config.tests/unix/sse2/sse2
-
# Directories to ignore
# ---------------------
-
debug
-examples/tools/plugandpaint/plugins
+/bin/*
include/*
include/*/*
lib/*
-!lib/fonts
-!lib/README
-plugins/*/*
release
tmp
doc-build
@@ -199,40 +87,3 @@ doc-build
.rcc
.pch
.metadata
-
-# Symbian build system generated files
-# ---------------------
-
-ABLD.BAT
-bld.inf
-*.mmp
-*.mk
-*.rss
-*.loc
-!s60main.rss
-*.pkg
-plugin_commonu.def
-*.qtplugin
-*.sis
-*.sisx
-*.lst
-*.exe
-*.mif
-*.rsc
-*.sym
-*.lib
-
-# Generated by abldfast.bat from devtools.
-.abldsteps.*
-
-# Carbide project files
-# ---------------------
-.project
-.cproject
-.make.cache
-*.d
-
-qtc-debugging-helper
-src/corelib/lib
-src/network/lib
-src/xml/lib/
diff --git a/LGPL_EXCEPTION.txt b/LGPL_EXCEPTION.txt
index 8f73eca77..7e2e30ff9 100644
--- a/LGPL_EXCEPTION.txt
+++ b/LGPL_EXCEPTION.txt
@@ -1,4 +1,4 @@
-Nokia Qt LGPL Exception version 1.1
+Digia Qt LGPL Exception version 1.1
As an additional permission to the GNU Lesser General Public License version
2.1, the object code form of a "work that uses the Library" may incorporate
diff --git a/doc/doc.pri b/doc/doc.pri
index 30a0c4447..3544962bd 100644
--- a/doc/doc.pri
+++ b/doc/doc.pri
@@ -27,7 +27,14 @@ QHP_FILE = $$OUT_PWD/doc/html/ifw.qhp
QCH_FILE = $$OUT_PWD/doc/ifw.qch
HELP_DEP_FILES = $$PWD/installerfw.qdoc \
+ $$PWD/installerfw-getting-started.qdoc \
+ $$PWD/installerfw-overview.qdoc \
+ $$PWD/installerfw-reference.qdoc \
+ $$PWD/installerfw-using.qdoc \
+ $$PWD/noninteractive.qdoc \
+ $$PWD/operations.qdoc \
$$PWD/scripting.qdoc \
+ $$PWD/tutorial.qdoc \
$$PWD/installerfw.qdocconf \
$$PWD/installerfw-online.qdocconf \
$$PWD/config/compat.qdocconf \
diff --git a/doc/installerfw-getting-started.qdoc b/doc/installerfw-getting-started.qdoc
index c8bae0514..063ed64c7 100644
--- a/doc/installerfw-getting-started.qdoc
+++ b/doc/installerfw-getting-started.qdoc
@@ -27,9 +27,9 @@
/*!
\contentspage {index.html}{Qt Installer Framework}
- \previouspage ifw-use-cases-settings.html
+ \previouspage ifw-overview.html
\page ifw-getting-started.html
- \nextpage ifw-tutorial.html
+ \nextpage ifw-use-cases.html
\title Getting Started
diff --git a/doc/installerfw-overview.qdoc b/doc/installerfw-overview.qdoc
index 26bcab83d..20ae945e1 100644
--- a/doc/installerfw-overview.qdoc
+++ b/doc/installerfw-overview.qdoc
@@ -29,7 +29,7 @@
\contentspage {index.html}{Qt Installer Framework}
\previouspage index.html
\page ifw-overview.html
- \nextpage ifw-use-cases.html
+ \nextpage ifw-getting-started.html
\title Overview of Qt Installer Framework
diff --git a/doc/installerfw-using.qdoc b/doc/installerfw-using.qdoc
index ca2626b1e..95854d51c 100644
--- a/doc/installerfw-using.qdoc
+++ b/doc/installerfw-using.qdoc
@@ -27,11 +27,11 @@
/*!
\contentspage {index.html}{Qt Installer Framework}
- \previouspage ifw-overview.html
+ \previouspage ifw-getting-started.html
\page ifw-use-cases.html
\nextpage ifw-use-cases-install.html
- \title Using Installers
+ \title End User Workflows
The end user experience is similar for both offline and online installers.
The installers consist of a package manager and an updater that enable end
@@ -326,7 +326,7 @@
\contentspage index.html
\previouspage ifw-use-cases-update.html
\page ifw-use-cases-settings.html
- \nextpage ifw-getting-started.html
+ \nextpage ifw-tutorial.html
\title Specifying Settings
diff --git a/doc/installerfw.qdoc b/doc/installerfw.qdoc
index 6386bcc26..c57260e91 100644
--- a/doc/installerfw.qdoc
+++ b/doc/installerfw.qdoc
@@ -49,7 +49,8 @@
\list
\o \l{Overview of Qt Installer Framework}
- \o \l{Using Installers}
+ \o \l{Getting Started}
+ \o \l{End User Workflows}
\list
\o \l{Initial Installation}
\o \l{Adding Components}
@@ -57,7 +58,6 @@
\o \l{Updating Components}
\o \l{Specifying Settings}
\endlist
- \o \l{Getting Started}
\o \l{Tutorial: Creating an Installer}
\o \l{Creating Installers}
\list
@@ -414,7 +414,7 @@
name the version needs to be inherited from.
\row
\o ReleaseDate
- \o Date when this component version was released. Optional.
+ \o Date when this component version was released. Required.
\row
\o Name
\o Domain-like identification for this component. Required.
diff --git a/doc/operations.qdoc b/doc/operations.qdoc
index 276b7515a..b187a20cf 100644
--- a/doc/operations.qdoc
+++ b/doc/operations.qdoc
@@ -33,13 +33,12 @@
\title Operations
- You can call operations manually on the uninstaller or installer.
+ The operations are prepared by component scripts and performed by the
+ installer.
- For example, to register the Qt version in Qt Creator, call the
- "RegisterQtInCreatorV23" operation with the following syntax:
- \code
- SDKMaintenanceTool --runoperation "RegisterQtInCreatorV23" "<displayname>" "<qtpath>" "<target: Symbian/Maemo/Desktop/Simulator/WinCE>" "<internal_ID>"
- \endcode
+ Internally, each operation has a \e DO step that contains instructions for
+ the installer and an \e UNDO step that contains instructions for the
+ uninstaller.
\section1 Summary of Operations
@@ -81,14 +80,34 @@
\o Prepends \a text to the file specified by \a filename. \a text
is treated as ASCII text.
\row
+ \o Replace
+ \o "Replace" \a file \a search \ replace
+ \o Opens \a file to find \a search string and replaces that with the \a replace string.
+ \row
+ \o LineReplace
+ \o "LineReplace" \a file \a search \ replace
+ \o Opens \a file to find lines that start with \a search string and
+ replaces that with the \a replace string.
+ \row
\o Execute
- \o "Execute" [{\a exitcodes}] \a command [\a parameter1 [\a parameter2 [\a parameter3 [\a parameter4]]]]
- \o Executes the command specified by \a command. Up to four
- parameters can be passed.
+ \o "Execute" [{\a exitcodes}] \a command [\a parameter1 [\a parameter... [\a parameter10]]]
+ \o Executes the command specified by \a command. Up to 10
+ parameters can be passed. If that is not enough, you can use a JavaScript string array.
Optionally, you can pass a comma-separated list of exit codes
within curly brackets ({}) as the first argument to specify the
exit codes for successful execution. This defaults to "{0}".
+
+ Other optional named arguments are: "workingdirectory=<your_working_dir>";
+ "errormessage=<your_custom_errormessage>"
+
+ In addition, a special argument, UNDOEXECUTE, separates the DO step of the operation
+ from the UNDO step.
+
+ example:
+ \code
+ component.addOperation("Execute", "touch", "test.txt", "UNDOEXECUTE", "rm", "test.txt")
+ \endcode
\row
\o CreateShortcut
\o "CreateShortcut" \a filename \a linkname [\a arguments]
@@ -151,26 +170,15 @@
\a command. Optionally, you can specify \a description,
\a contentType, and \a icon. This is currently only supported on
Windows.
- \row
- \o RegisterQtInCreatorV2
- \o "RegisterQtInCreatorV2", \a displayname, \a qt_or_qmake_path, [\a system_root, [\a sbs_path]].
- \o Registers the Qt version \a displayname to Qt Creator with
- \a qt_or_qmake_path (if the path does not end with the qmake
- binary, adds \c{bin/qmake} to the path automatically). Optionally,
- you can specify \a system_root. For Symbian SDKs, Qt Creator
- finds the Symbian SDK root (EPOCROOT) in the instance root. For
- Symbian SDKs that support SBS, add \a sbs_path.
-
- \note Supports Qt Creator 2.2, or later.
- \row
- \o RegisterQtInCreatorV23
- \o "RegisterQtInCreatorV23", \a displayname, \a qt_path, \a target, \a internal_id.
- \o Registers the Qt version \a displayname to Qt Creator with
- \a qt_path. \a target is a Qt version in Qt Creator (Symbian,
- Maemo, Desktop, Qt Simulator, WinCE) and \a internal_id is used
- to update or remove the Qt version.
-
- \note Supports Qt Creator 2.3, or later.
\endtable
+ If errors occur, you can test operations manually on the uninstaller or
+ installer. However, variables are not resolved, so you need to use absolute
+ values.
+
+ For example, to test copying a file:
+ \code
+ Installer --runoperation "Copy" "<source>" "<target>"
+ \endcode
+
*/
diff --git a/doc/scripting.qdoc b/doc/scripting.qdoc
index 70ecc8ed0..410e1645a 100644
--- a/doc/scripting.qdoc
+++ b/doc/scripting.qdoc
@@ -33,8 +33,9 @@
\title Component Scripting
- For each component, you can specify one script that is loaded and run by the
- installer. The script format has to be compatible with QScriptEngine.
+ For each component, you can specify one script that prepares the operations
+ to be performed by the installer. The script format has to be
+ compatible with QScriptEngine.
\section1 Construction
@@ -250,7 +251,14 @@
\o Current platform: \c "x11", \c "win", or \c "mac".
\endtable
- \note You can use the variables in the parameter list for installation
- operations. For example, \c{"{TargetDir}/settings.xml"} might be expanded
- to: \c{"C:/Program Files/My Program/settings.xml"}.
+ The variables can be resolved by calls to \c installer.value(). If embedded
+ in '@' they can also be part of strings passed as arguments to installation
+ operations:
+
+ \code
+ if (installer.value("os") === "win") {
+ component.addOperation("CreateShortcut", "@TargetDir@/MyApp.exe", "@StartMenuDir@/MyApp.lnk");
+ }
+ \endcode
+
*/
diff --git a/doc/tutorial.qdoc b/doc/tutorial.qdoc
index 6f6cae7c3..f4d537e49 100644
--- a/doc/tutorial.qdoc
+++ b/doc/tutorial.qdoc
@@ -27,7 +27,7 @@
/*!
\contentspage {index.html}{Qt Installer Framework}
- \previouspage ifw-getting-started.html
+ \previouspage ifw-use-cases-settings.html
\page ifw-tutorial.html
\nextpage ifw-creating-installers.html
diff --git a/examples/testapp/testapp.pro b/examples/testapp/testapp.pro
index f316315e3..418d582ca 100644
--- a/examples/testapp/testapp.pro
+++ b/examples/testapp/testapp.pro
@@ -8,8 +8,7 @@ include(../../installerfw.pri)
warning("You can use this example only with a static build of Qt and IFW!")
}
-LIBS += -linstaller
-DESTDIR = packages/com.nokia.testapp/data
+DESTDIR = $$IFW_BUILD_TREE/examples/testapp/packages/com.nokia.testapp/data
FORMS += \
componentselectiondialog.ui \
@@ -31,7 +30,16 @@ SOURCES += main.cpp \
RESOURCES += testapp.qrc
-isEqual(IFW_SOURCE_TREE, $$IFW_BUILD_TREE) {
- macx:QMAKE_POST_LINK = ($$IFW_APP_PATH/binarycreator -p $$PWD/packages -c $$PWD/config -t $$IFW_APP_PATH/installerbase TestAppInstaller.app)
- win32:QMAKE_POST_LINK = ($$IFW_APP_PATH/binarycreator.exe -p $$PWD/packages -c $$PWD/config -t $$IFW_APP_PATH/installerbase.exe TestAppInstaller.exe)
+macx {
+ QMAKE_POST_LINK = ($$IFW_APP_PATH/binarycreator -p $$IFW_SOURCE_TREE/examples/testapp/packages \
+ -c $$IFW_SOURCE_TREE/examples/testapp/config/config.xml -t $$IFW_APP_PATH/installerbase \
+ TestAppInstaller.app
+} win32: {
+ QMAKE_POST_LINK = ($$IFW_APP_PATH/binarycreator.exe -p $$IFW_SOURCE_TREE/examples/testapp/packages \
+ -c $$IFW_SOURCE_TREE/examples/testapp/config/config.xml -t $$IFW_APP_PATH/installerbase.exe \
+ TestAppInstaller.exe)
+} else {
+ QMAKE_POST_LINK = ($$IFW_APP_PATH/binarycreator -p $$IFW_SOURCE_TREE/examples/testapp/packages \
+ -c $$IFW_SOURCE_TREE/examples/testapp/config/config.xml -t $$IFW_APP_PATH/installerbase \
+ TestAppInstaller)
}
diff --git a/examples/tutorial/packages/com.vendor.product/meta/de_de.ts b/examples/tutorial/packages/com.vendor.product/meta/de_de.ts
index baec665d5..7396ac964 100644
--- a/examples/tutorial/packages/com.vendor.product/meta/de_de.ts
+++ b/examples/tutorial/packages/com.vendor.product/meta/de_de.ts
@@ -1,4 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.0" language="de_DE">
+<context>
+ <name>Dummy</name>
+ <message>
+ <source>Dummy message.</source>
+ <translation>Dummy Nachricht.</translation>
+ </message>
+</context>
</TS>
diff --git a/installerfw.pri b/installerfw.pri
index 3799fcdc5..bec36d95f 100644
--- a/installerfw.pri
+++ b/installerfw.pri
@@ -5,6 +5,8 @@ IFW_PRI_INCLUDED = 1
IFW_VERSION = 1.2.81
+IFW_REPOSITORY_FORMAT_VERSION = 1.0.0
+
IFW_NEWLINE = $$escape_expand(\\n\\t)
defineReplace(toNativeSeparators) {
diff --git a/src/libs/installer/fakestopprocessforupdateoperation.cpp b/src/libs/installer/fakestopprocessforupdateoperation.cpp
index 47d21c39f..ead887118 100644
--- a/src/libs/installer/fakestopprocessforupdateoperation.cpp
+++ b/src/libs/installer/fakestopprocessforupdateoperation.cpp
@@ -41,53 +41,10 @@
#include "fakestopprocessforupdateoperation.h"
-#include <kdsysinfo.h>
-#include <QtCore/QDir>
-
-#include <algorithm>
+#include "messageboxhandler.h"
+#include "packagemanagercore.h"
using namespace KDUpdater;
-
-/*!
- Copied from QInstaller with some adjustments
- Return true, if a process with \a name is running. On Windows, the comparision is case-insensitive.
-*/
-static bool isProcessRunning(const QString &name, const QList<ProcessInfo> &processes)
-{
- for (QList<ProcessInfo>::const_iterator it = processes.constBegin(); it != processes.constEnd(); ++it) {
- if (it->name.isEmpty())
- continue;
-
-#ifndef Q_OS_WIN
- if (it->name == name)
- return true;
- const QFileInfo fi(it->name);
- if (fi.fileName() == name || fi.baseName() == name)
- return true;
-#else
- if (it->name.toLower() == name.toLower())
- return true;
- if (it->name.toLower() == QDir::toNativeSeparators(name.toLower()))
- return true;
- const QFileInfo fi(it->name);
- if (fi.fileName().toLower() == name.toLower() || fi.baseName().toLower() == name.toLower())
- return true;
-#endif
- }
- return false;
-}
-
-static QStringList checkRunningProcessesFromList(const QStringList &processList)
-{
- const QList<ProcessInfo> allProcesses = runningProcesses();
- QStringList stillRunningProcesses;
- foreach (const QString &process, processList) {
- if (!process.isEmpty() && isProcessRunning(process, allProcesses))
- stillRunningProcesses.append(process);
- }
- return stillRunningProcesses;
-}
-
using namespace QInstaller;
FakeStopProcessForUpdateOperation::FakeStopProcessForUpdateOperation()
@@ -113,18 +70,31 @@ bool FakeStopProcessForUpdateOperation::undoOperation()
return false;
}
- QStringList processList = arguments()[0].split(QLatin1String(","), QString::SkipEmptyParts);
- qSort(processList);
- processList.erase(std::unique(processList.begin(), processList.end()), processList.end());
- if (!processList.isEmpty()) {
- const QStringList processes = checkRunningProcessesFromList(processList);
- if (!processes.isEmpty()) {
- setError(KDUpdater::UpdateOperation::UserDefinedError, tr("These processes should be stopped to "
- "continue:\n\n%1").arg(QDir::toNativeSeparators(processes.join(QLatin1String("\n")))));
- }
+ PackageManagerCore *const core = value(QLatin1String("installer")).value<PackageManagerCore*>();
+ if (!core) {
+ setError(KDUpdater::UpdateOperation::UserDefinedError, QObject::tr("Could not get package manager "
+ "core."));
return false;
}
- return true;
+
+ QStringList processes = arguments().at(0).split(QLatin1Char(','), QString::SkipEmptyParts);
+ for (int i = processes.count() - 1; i >= 0; --i) {
+ if (!core->isProcessRunning(processes.at(i)))
+ processes.removeAt(i);
+ }
+
+ if (processes.isEmpty())
+ return true;
+
+ if (processes.count() == 1) {
+ setError(UpdateOperation::UserDefinedError, QObject::tr("This process should be stopped before "
+ "continuing: %1").arg(processes.first()));
+ } else {
+ const QString sep = QString::fromWCharArray(L"\n \u2022 "); // Unicode bullet
+ setError(UpdateOperation::UserDefinedError, QObject::tr("These processes should be stopped before "
+ "continuing: %1").arg(sep + processes.join(sep)));
+ }
+ return false;
}
bool FakeStopProcessForUpdateOperation::testOperation()
diff --git a/src/libs/installer/fakestopprocessforupdateoperation.h b/src/libs/installer/fakestopprocessforupdateoperation.h
index 228d5df03..ca7ba3ccc 100644
--- a/src/libs/installer/fakestopprocessforupdateoperation.h
+++ b/src/libs/installer/fakestopprocessforupdateoperation.h
@@ -46,8 +46,10 @@
namespace QInstaller {
-class FakeStopProcessForUpdateOperation : public Operation
+class INSTALLER_EXPORT FakeStopProcessForUpdateOperation : public QObject, public Operation
{
+ Q_OBJECT
+
public:
FakeStopProcessForUpdateOperation();
diff --git a/src/libs/installer/packagemanagercore_p.cpp b/src/libs/installer/packagemanagercore_p.cpp
index 04faa051a..4a7452cd4 100644
--- a/src/libs/installer/packagemanagercore_p.cpp
+++ b/src/libs/installer/packagemanagercore_p.cpp
@@ -82,30 +82,42 @@ namespace QInstaller {
class OperationTracer
{
public:
- OperationTracer() {}
- void trace(Operation *operation, const QString &state)
+ OperationTracer(Operation *operation) : m_operation(0)
{
- qDebug() << state << " operation: " << operation->name();
- qDebug() << " - arguments: " << operation->arguments().join(QLatin1String(", "));
+ // don't create output for that hacky pseudo operation
+ if (operation->name() != QLatin1String("MinimumProgress"))
+ m_operation = operation;
+ }
+ void trace(const QString &state)
+ {
+ if (!m_operation)
+ return;
+ qDebug() << QString::fromLatin1("%1 operation: %2").arg(state, m_operation->name());
+ qDebug() << QString::fromLatin1("\t- arguments: %1").arg(m_operation->arguments()
+ .join(QLatin1String(", ")));
}
~OperationTracer() {
+ if (!m_operation)
+ return;
qDebug() << "Done";
}
+private:
+ Operation *m_operation;
};
static bool runOperation(Operation *operation, PackageManagerCorePrivate::OperationType type)
{
- OperationTracer tracer;
+ OperationTracer tracer(operation);
switch (type) {
case PackageManagerCorePrivate::Backup:
- tracer.trace(operation, QLatin1String("backup"));
+ tracer.trace(QLatin1String("backup"));
operation->backup();
return true;
case PackageManagerCorePrivate::Perform:
- tracer.trace(operation, QLatin1String("perform"));
+ tracer.trace(QLatin1String("perform"));
return operation->performOperation();
case PackageManagerCorePrivate::Undo:
- tracer.trace(operation, QLatin1String("undo"));
+ tracer.trace(QLatin1String("undo"));
return operation->undoOperation();
default:
Q_ASSERT(!"unexpected operation type");
diff --git a/src/libs/installer/repository.h b/src/libs/installer/repository.h
index c1a979615..967cae75d 100644
--- a/src/libs/installer/repository.h
+++ b/src/libs/installer/repository.h
@@ -79,8 +79,8 @@ public:
uint qHash(const Repository &repository);
const Repository &operator=(const Repository &other);
- friend QDataStream &operator>>(QDataStream &istream, Repository &repository);
- friend QDataStream &operator<<(QDataStream &ostream, const Repository &repository);
+ friend INSTALLER_EXPORT QDataStream &operator>>(QDataStream &istream, Repository &repository);
+ friend INSTALLER_EXPORT QDataStream &operator<<(QDataStream &ostream, const Repository &repository);
private:
void registerMetaType();
@@ -98,8 +98,8 @@ inline uint qHash(const Repository &repository)
return qHash(repository.url());
}
-QDataStream &operator>>(QDataStream &istream, Repository &repository);
-QDataStream &operator<<(QDataStream &ostream, const Repository &repository);
+INSTALLER_EXPORT QDataStream &operator>>(QDataStream &istream, Repository &repository);
+INSTALLER_EXPORT QDataStream &operator<<(QDataStream &ostream, const Repository &repository);
} // namespace QInstaller
diff --git a/src/libs/kdtools/kdsysinfo.cpp b/src/libs/kdtools/kdsysinfo.cpp
index 8e56d01ac..194e5c5b5 100644
--- a/src/libs/kdtools/kdsysinfo.cpp
+++ b/src/libs/kdtools/kdsysinfo.cpp
@@ -73,7 +73,7 @@ VolumeInfo VolumeInfo::fromPath(const QString &path)
if (parts.isEmpty())
targetPath = QDir(QDir::rootPath());
else
- targetPath = QDir(parts.join(QDir::separator()));
+ targetPath = QDir(QLatin1Char('/') + parts.join(QDir::separator()));
}
if (targetPath.canonicalPath().startsWith(volume.mountPath()))
diff --git a/src/libs/kdtools/kdsysinfo_x11.cpp b/src/libs/kdtools/kdsysinfo_x11.cpp
index 5a816dc18..391fb5280 100644
--- a/src/libs/kdtools/kdsysinfo_x11.cpp
+++ b/src/libs/kdtools/kdsysinfo_x11.cpp
@@ -74,7 +74,7 @@ QList<VolumeInfo> mountedVolumes()
if (s.isNull())
return result;
- if (!s.startsWith(QLatin1Char('/')))
+ if (!s.startsWith(QLatin1Char('/')) && !s.startsWith(QLatin1String("tmpfs ") + QDir::tempPath()))
continue;
const QStringList parts = s.split(QLatin1Char(' '), QString::SkipEmptyParts);
diff --git a/tests/auto/installer/fakestopprocessforupdateoperation/fakestopprocessforupdateoperation.pro b/tests/auto/installer/fakestopprocessforupdateoperation/fakestopprocessforupdateoperation.pro
new file mode 100644
index 000000000..871b668b2
--- /dev/null
+++ b/tests/auto/installer/fakestopprocessforupdateoperation/fakestopprocessforupdateoperation.pro
@@ -0,0 +1,6 @@
+include(../../qttest.pri)
+
+QT -= gui
+QT += network script
+
+SOURCES += tst_fakestopprocessforupdateoperation.cpp
diff --git a/tests/auto/installer/fakestopprocessforupdateoperation/tst_fakestopprocessforupdateoperation.cpp b/tests/auto/installer/fakestopprocessforupdateoperation/tst_fakestopprocessforupdateoperation.cpp
new file mode 100644
index 000000000..1d23e1970
--- /dev/null
+++ b/tests/auto/installer/fakestopprocessforupdateoperation/tst_fakestopprocessforupdateoperation.cpp
@@ -0,0 +1,78 @@
+#include "fakestopprocessforupdateoperation.h"
+#include "packagemanagercore.h"
+
+#include <QFileInfo>
+#include <QTest>
+
+using namespace KDUpdater;
+using namespace QInstaller;
+
+class tst_FakeStopProcessForUpdateOperation : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void testMissingArgument()
+ {
+ FakeStopProcessForUpdateOperation op;
+ op.setValue(QLatin1String("installer"), QVariant::fromValue(&m_core));
+
+ QVERIFY(op.testOperation());
+ QVERIFY(op.performOperation());
+ QVERIFY(!op.undoOperation());
+
+ QCOMPARE(UpdateOperation::Error(op.error()), UpdateOperation::InvalidArguments);
+ QCOMPARE(op.errorString(), QString("Number of arguments does not match: one is required"));
+ }
+
+ void testMissingPackageManagerCore()
+ {
+ FakeStopProcessForUpdateOperation op;
+ op.setArguments(QStringList() << QFileInfo(QCoreApplication::applicationFilePath()).fileName());
+
+ QVERIFY(op.testOperation());
+ QVERIFY(op.performOperation());
+ QVERIFY(!op.undoOperation());
+
+ QCOMPARE(UpdateOperation::Error(op.error()), UpdateOperation::UserDefinedError);
+ QCOMPARE(op.errorString(), QString("Could not get package manager core."));
+ }
+
+ void testRunningApplication()
+ {
+ const QString app = QFileInfo(QCoreApplication::applicationFilePath()).fileName();
+
+ FakeStopProcessForUpdateOperation op;
+ op.setArguments(QStringList() << app);
+ op.setValue(QLatin1String("installer"), QVariant::fromValue(&m_core));
+
+ QVERIFY(op.testOperation());
+ QVERIFY(op.performOperation());
+ QVERIFY(!op.undoOperation());
+
+ QCOMPARE(UpdateOperation::Error(op.error()), UpdateOperation::UserDefinedError);
+ QCOMPARE(op.errorString(), QString::fromLatin1("This process should be stopped before "
+ "continuing: %1").arg(app));
+ }
+
+ void testRunningNonApplication()
+ {
+ FakeStopProcessForUpdateOperation op;
+ op.setArguments(QStringList() << "dummy.exe");
+ op.setValue(QLatin1String("installer"), QVariant::fromValue(&m_core));
+
+ QVERIFY(op.testOperation());
+ QVERIFY(op.performOperation());
+ QVERIFY(op.undoOperation());
+
+ QCOMPARE(op.errorString(), QString());
+ QCOMPARE(UpdateOperation::Error(op.error()), UpdateOperation::NoError);
+ }
+
+private:
+ PackageManagerCore m_core;
+};
+
+QTEST_MAIN(tst_FakeStopProcessForUpdateOperation)
+
+#include "tst_fakestopprocessforupdateoperation.moc"
diff --git a/tests/auto/installer/installer.pro b/tests/auto/installer/installer.pro
index c01c4125c..911e1ad75 100644
--- a/tests/auto/installer/installer.pro
+++ b/tests/auto/installer/installer.pro
@@ -1,4 +1,6 @@
TEMPLATE = subdirs
SUBDIRS += \
- settings
+ settings \
+ repository \
+ fakestopprocessforupdateoperation
diff --git a/tests/auto/installer/repository/repository.pro b/tests/auto/installer/repository/repository.pro
new file mode 100644
index 000000000..2d192eeaa
--- /dev/null
+++ b/tests/auto/installer/repository/repository.pro
@@ -0,0 +1,6 @@
+include(../../qttest.pri)
+
+QT += network
+QT -= gui
+
+SOURCES += tst_repository.cpp
diff --git a/tests/auto/installer/repository/tst_repository.cpp b/tests/auto/installer/repository/tst_repository.cpp
new file mode 100644
index 000000000..e3b7b74a6
--- /dev/null
+++ b/tests/auto/installer/repository/tst_repository.cpp
@@ -0,0 +1,119 @@
+#include "repository.h"
+
+#include <QTest>
+
+using namespace QInstaller;
+
+class tst_Repository : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void testRepository()
+ {
+ Repository repo;
+ QCOMPARE(repo.isValid(), false);
+ QCOMPARE(repo.isDefault(), false);
+ QCOMPARE(repo.isEnabled(), false);
+
+ QCOMPARE(repo.url(), QUrl());
+ QCOMPARE(repo.username(), QString());
+ QCOMPARE(repo.password(), QString());
+
+ repo.setUrl(QUrl("http://www.digia.com"));
+ QCOMPARE(repo.isValid(), true);
+ QCOMPARE(repo.url(), QUrl("http://www.digia.com"));
+
+ repo.setEnabled(true);
+ QCOMPARE(repo.isEnabled(), true);
+
+ repo.setUsername("tester");
+ QCOMPARE(repo.username(), QString("tester"));
+
+ repo.setPassword("test");
+ QCOMPARE(repo.password(), QString("test"));
+ }
+
+ void testRepositoryFromUrl()
+ {
+ Repository repo(QUrl("http://www.digia.com"), true);
+ QCOMPARE(repo.isValid(), true);
+ QCOMPARE(repo.isDefault(), true);
+ QCOMPARE(repo.isEnabled(), true);
+
+ QCOMPARE(repo.url(), QUrl("http://www.digia.com"));
+ QCOMPARE(repo.username(), QString());
+ QCOMPARE(repo.password(), QString());
+
+ repo.setUrl(QUrl());
+ QCOMPARE(repo.isValid(), false);
+
+ repo.setEnabled(false);
+ QCOMPARE(repo.isEnabled(), false);
+
+ repo.setUsername("tester");
+ QCOMPARE(repo.username(), QString("tester"));
+
+ repo.setPassword("test");
+ QCOMPARE(repo.password(), QString("test"));
+ }
+
+ void testRepositoryFromUserInput()
+ {
+ Repository repo = Repository::fromUserInput("ftp://tester:test@www.digia.com");
+ QCOMPARE(repo.isValid(), true);
+ QCOMPARE(repo.isDefault(), false);
+ QCOMPARE(repo.isEnabled(), true);
+
+ QCOMPARE(repo.url(), QUrl("ftp://www.digia.com"));
+ QCOMPARE(repo.username(), QString("tester"));
+ QCOMPARE(repo.password(), QString("test"));
+
+ repo.setUrl(QUrl());
+ QCOMPARE(repo.isValid(), false);
+
+ repo.setEnabled(false);
+ QCOMPARE(repo.isEnabled(), false);
+
+ repo.setUsername("");
+ QCOMPARE(repo.username(), QString());
+
+ repo.setPassword("");
+ QCOMPARE(repo.password(), QString());
+ }
+
+ void testRepositoryOperators()
+ {
+ Repository lhs, rhs;
+
+ // operator==
+ QVERIFY(lhs == rhs);
+
+ // assignment operator
+ rhs = Repository::fromUserInput("ftp://tester:test@www.digia.com");
+
+ // operator!=
+ QVERIFY(lhs != rhs);
+
+ // copy constructor
+ Repository clhs(rhs);
+
+ // operator==
+ QVERIFY(clhs == rhs);
+
+ QByteArray ba1, ba2;
+ QDataStream s1(&ba1, QIODevice::ReadWrite), s2(&ba2, QIODevice::ReadWrite);
+
+ // QDatastream operator
+ s1 << clhs; s2 << rhs;
+ QCOMPARE(ba1, ba2);
+
+ Repository r1, r2;
+ s1 >> r1; s2 >> r2;
+ QCOMPARE(r1, r2);
+ }
+};
+
+QTEST_MAIN(tst_Repository)
+
+#include "tst_repository.moc"
diff --git a/tests/testvm-configs/franks-host-config.cfg b/tests/testvm-configs/franks-host-config.cfg
deleted file mode 100644
index bddb76af9..000000000
--- a/tests/testvm-configs/franks-host-config.cfg
+++ /dev/null
@@ -1,5 +0,0 @@
-[General]
-vmrun=vmrun
-checkerInstallation=/home/frank/workspace-eclipse/test-framework/checker
-testcase0=TestCases/testcase1/testcase1.cfg
-vm0=VMs/NokiaTestVistaVM.cfg
diff --git a/tests/testvm-configs/franks-test-vm.cfg b/tests/testvm-configs/franks-test-vm.cfg
deleted file mode 100644
index 9bd0a113e..000000000
--- a/tests/testvm-configs/franks-test-vm.cfg
+++ /dev/null
@@ -1,7 +0,0 @@
-[General]
-snapshot=base
-username=kdab
-password=kdab
-vmx=NokiaTestVistaVM/WindowsVista32Bit.vmx
-tempDir=c:\Users\kdab\Desktop
-os=windows
diff --git a/tests/testvm-configs/mikes-host-config.cfg b/tests/testvm-configs/mikes-host-config.cfg
deleted file mode 100644
index 42fb37d79..000000000
--- a/tests/testvm-configs/mikes-host-config.cfg
+++ /dev/null
@@ -1,4 +0,0 @@
-[General]
-checkerInstallation=/Users/mike/Documents/KDAB/NokiaSDK/installer/test-framework/checker
-testcase0=/Users/mike/Documents/KDAB/NokiaSDK/installer/examples/testcases/testcase1/testcase1.cfg
-vm0=/Users/mike/Documents/KDAB/NokiaSDK/installer/examples/testvm-configs/mikes-test-vm.cfg \ No newline at end of file
diff --git a/tests/testvm-configs/mikes-test-vm.cfg b/tests/testvm-configs/mikes-test-vm.cfg
deleted file mode 100644
index cc8fa4179..000000000
--- a/tests/testvm-configs/mikes-test-vm.cfg
+++ /dev/null
@@ -1,7 +0,0 @@
-[General]
-snapshot=base
-username=nokia
-password=nokia
-vmx=/Users/mike/Documents/Virtual Machines.localized/Nokia.vmwarevm/Nokia.vmx
-tempDir=c:\Users\nokia\Desktop
-os=windows \ No newline at end of file
diff --git a/tools/binarycreator/binarycreator.cpp b/tools/binarycreator/binarycreator.cpp
index 33fd8175a..ac160d57c 100644
--- a/tools/binarycreator/binarycreator.cpp
+++ b/tools/binarycreator/binarycreator.cpp
@@ -621,17 +621,12 @@ int main(int argc, char **argv)
QInstaller::setVerbose(true);
} else if (*it == QLatin1String("-n") || *it == QLatin1String("--online-only")) {
if (!filteredPackages.isEmpty()) {
- return printErrorAndUsageAndExit(QString::fromLatin1("for the --include and --exclude case you also "
- "have to ensure that online-only==false, as that means include nothing"));
+ return printErrorAndUsageAndExit(QString::fromLatin1("Error: 'online-only' option cannot be used "
+ "in conjunction with the 'include' or 'exclude' option. An 'online-only' installer will never "
+ "contain any components apart from the root component."));
}
- filteredPackages.append(QLatin1String("XXXXXXXXXXXXXXXXX_online_XXXXXXXXXXXXXXXXX"));
- ftype = QInstallerTools::Include;
onlineOnly = true;
} else if (*it == QLatin1String("-f") || *it == QLatin1String("--offline-only")) {
- if (onlineOnly) {
- return printErrorAndUsageAndExit(QString::fromLatin1("You cannot use --online-only and "
- "--offline-only at the same time."));
- }
offlineOnly = true;
} else if (*it == QLatin1String("-t") || *it == QLatin1String("--template")) {
++it;
@@ -691,6 +686,16 @@ int main(int argc, char **argv)
}
}
+ if (onlineOnly && offlineOnly) {
+ return printErrorAndUsageAndExit(QString::fromLatin1("You cannot use --online-only and "
+ "--offline-only at the same time."));
+ }
+
+ if (onlineOnly) {
+ filteredPackages.append(QLatin1String("XXXXXXXXXXXXXXXXX_online_XXXXXXXXXXXXXXXXX"));
+ ftype = QInstallerTools::Include;
+ }
+
if (target.isEmpty())
return printErrorAndUsageAndExit(QString::fromLatin1("Error: Target parameter missing."));
diff --git a/tools/common/repositorygen.cpp b/tools/common/repositorygen.cpp
index 733323a79..4ca7867af 100644
--- a/tools/common/repositorygen.cpp
+++ b/tools/common/repositorygen.cpp
@@ -61,8 +61,6 @@ using namespace QInstallerTools;
void QInstallerTools::printRepositoryGenOptions()
{
- std::cout << " -c|--config file The file containing the installer configuration" << std::endl;
-
std::cout << " -p|--packages dir The directory containing the available packages." << std::endl;
std::cout << " Defaults to the current working directory." << std::endl;
@@ -95,7 +93,7 @@ void QInstallerTools::compressMetaDirectories(const QString &repoDir)
QFile tmp(tmpTarget);
const QString finalTarget = absPath + QLatin1String("/") + fn;
if (!tmp.rename(finalTarget)) {
- throw QInstaller::Error(QString::fromLatin1("Could not move file from \"%1\" to \"%2\"").arg(tmpTarget,
+ throw QInstaller::Error(QString::fromLatin1("Could not move file from '%1' to '%2'").arg(tmpTarget,
finalTarget));
}
}
@@ -157,7 +155,7 @@ void QInstallerTools::generateMetaDataDirectory(const QString &outDir, const QSt
int col = 0;
int line = 0;
if (!packageXml.setContent(&file, &errMsg, &line, &col)) {
- throw QInstaller::Error(QString::fromLatin1("Could not parse \"%1\": line: %2, column: %3: %4 (%5)")
+ throw QInstaller::Error(QString::fromLatin1("Could not parse '%1': line: %2, column: %3: %4 (%5)")
.arg(packageXmlPath, QString::number(line), QString::number(col), errMsg, it->name));
}
const QDomNode package = packageXml.firstChildElement(QLatin1String("Package"));
@@ -250,7 +248,7 @@ void QInstallerTools::generateMetaDataDirectory(const QString &outDir, const QSt
root.appendChild(update);
if (!QDir(metapath).mkpath(it->name))
- throw QInstaller::Error(QString::fromLatin1("Could not create directory \"%1\".").arg(it->name));
+ throw QInstaller::Error(QString::fromLatin1("Could not create directory '%1'.").arg(it->name));
// copy scripts
const QString script = package.firstChildElement(QLatin1String("Script")).text();
@@ -266,7 +264,7 @@ void QInstallerTools::generateMetaDataDirectory(const QString &outDir, const QSt
static QScriptEngine testScriptEngine;
testScriptEngine.evaluate(scriptContent, scriptFile.fileName());
if (testScriptEngine.hasUncaughtException()) {
- throw QInstaller::Error(QString::fromLatin1("Exception while loading the component script: \"%1\"")
+ throw QInstaller::Error(QString::fromLatin1("Exception while loading the component script: '%1'")
.arg(QInstaller::uncaughtExceptionString(&testScriptEngine, scriptFile.fileName())));
}
@@ -281,7 +279,7 @@ void QInstallerTools::generateMetaDataDirectory(const QString &outDir, const QSt
QString toLocation(QString::fromLatin1("%1/%2/%3").arg(metapath, it->name, script));
if (!scriptFile.copy(toLocation)) {
qDebug() << "failed!";
- throw QInstaller::Error(QString::fromLatin1("Could not copy the script \"%1\" to its target location \"%2\".")
+ throw QInstaller::Error(QString::fromLatin1("Could not copy the script '%1' to its target location '%2'.")
.arg(fromLocation, toLocation));
} else {
qDebug() << "\tdone.";
@@ -299,8 +297,8 @@ void QInstallerTools::generateMetaDataDirectory(const QString &outDir, const QSt
const QDir dir(QString::fromLatin1("%1/meta").arg(it->directory));
const QStringList uis = dir.entryList(QStringList(node.toElement().text()), QDir::Files);
if (uis.isEmpty()) {
- throw QInstaller::Error(QString::fromLatin1("Couldn't find any user interface matching %1 while "
- "copying user interfaces of %2.").arg(node.toElement().text(), it->name));
+ throw QInstaller::Error(QString::fromLatin1("Couldn't find any user interface matching '%1' while "
+ "copying user interfaces of '%2'.").arg(node.toElement().text(), it->name));
}
for (QStringList::const_iterator ui = uis.begin(); ui != uis.end(); ++ui) {
@@ -309,8 +307,8 @@ void QInstallerTools::generateMetaDataDirectory(const QString &outDir, const QSt
if (!QFile::copy(QString::fromLatin1("%1/meta/%2").arg(it->directory, *ui),
QString::fromLatin1("%1/%2/%3").arg(metapath, it->name, *ui))) {
qDebug() << "failed!";
- throw QInstaller::Error(QString::fromLatin1("Could not copy the UI file %1 to its target "
- "location %2.").arg(*ui, it->name));
+ throw QInstaller::Error(QString::fromLatin1("Could not copy the UI file '%1' to its target "
+ "location '%2'.").arg(*ui, it->name));
} else {
qDebug() << "done";
}
@@ -334,8 +332,8 @@ void QInstallerTools::generateMetaDataDirectory(const QString &outDir, const QSt
const QDir dir(QString::fromLatin1("%1/meta").arg(it->directory));
const QStringList qms = dir.entryList(QStringList(node.toElement().text()), QDir::Files);
if (qms.isEmpty()) {
- throw QInstaller::Error(QString::fromLatin1("Could not find any translation file matching \"%1\" "
- "while copying translations of \"%2\".").arg(node.toElement().text(), it->name));
+ throw QInstaller::Error(QString::fromLatin1("Could not find any translation file matching '%1' "
+ "while copying translations of '%2'.").arg(node.toElement().text(), it->name));
}
for (QStringList::const_iterator qm = qms.begin(); qm != qms.end(); ++qm) {
@@ -344,8 +342,8 @@ void QInstallerTools::generateMetaDataDirectory(const QString &outDir, const QSt
if (!QFile::copy(QString::fromLatin1("%1/meta/%2").arg(it->directory, *qm),
QString::fromLatin1("%1/%2/%3").arg(metapath, it->name, *qm))) {
qDebug() << "failed!";
- throw QInstaller::Error(QString::fromLatin1("Could not copy the translation \"%1\" to its "
- "target location \"%2\".").arg(*qm, it->name));
+ throw QInstaller::Error(QString::fromLatin1("Could not copy the translation '%1' to its "
+ "target location '%2'.").arg(*qm, it->name));
} else {
qDebug() << "done";
}
@@ -369,16 +367,16 @@ void QInstallerTools::generateMetaDataDirectory(const QString &outDir, const QSt
const QString &sourceFile =
QString::fromLatin1("%1/meta/%2").arg(it->directory).arg(licenseFile);
if (!QFile::exists(sourceFile)) {
- throw QInstaller::Error(QString::fromLatin1("Could not find any license matching \"%1\" while "
- "copying license files of %2.").arg(licenseFile, it->name));
+ throw QInstaller::Error(QString::fromLatin1("Could not find any license matching '%1' while "
+ "copying license files of '%2'.").arg(licenseFile, it->name));
}
qDebug() << "\tCopying associated license file" << licenseFile << "into the meta package...";
if (!QFile::copy(sourceFile, QString::fromLatin1("%1/%2/%3")
.arg(metapath, it->name, licenseFile))) {
qDebug() << "failed!";
- throw QInstaller::Error(QString::fromLatin1("Could not copy the license file \"%1\" to its "
- "target location %2.").arg(licenseFile, it->name));
+ throw QInstaller::Error(QString::fromLatin1("Could not copy the license file '%1' to its "
+ "target location '%2'.").arg(licenseFile, it->name));
} else {
qDebug() << "done.";
}
@@ -441,13 +439,13 @@ PackageInfoVector QInstallerTools::createListOfPackages(const QString &packagesD
if (!filteredPackages.contains(it->fileName()))
continue;
}
- qDebug() << QString::fromLatin1("\tfound subdirectory \"%1\"").arg(it->fileName());
+ qDebug() << QString::fromLatin1("\tfound subdirectory '%1'").arg(it->fileName());
// because the filter is QDir::Dirs - filename means the name of the subdirectory
if (it->fileName().contains(QLatin1Char('-'))) {
if (ignoreInvalidPackages)
continue;
- throw QInstaller::Error(QString::fromLatin1("Component \"%1\" can't contain '-'. This is not allowed, because "
- "it is used as the separator between the component name and the version number internally.")
+ throw QInstaller::Error(QString::fromLatin1("Component '%1' mustn't contain '-'. This is not allowed, because "
+ "dashes are used as the separator between the component name and the version number internally.")
.arg(it->fileName()));
}
@@ -456,7 +454,7 @@ PackageInfoVector QInstallerTools::createListOfPackages(const QString &packagesD
if (!fileInfo.exists()) {
if (ignoreInvalidPackages)
continue;
- throw QInstaller::Error(QString::fromLatin1("Component \"%1\" does not contain a package "
+ throw QInstaller::Error(QString::fromLatin1("Component '%1' does not contain a package "
"description (meta/package.xml is missing).").arg(it->fileName()));
}
@@ -469,7 +467,7 @@ PackageInfoVector QInstallerTools::createListOfPackages(const QString &packagesD
if (!doc.setContent(&file, &error, &errorLine, &errorColumn)) {
if (ignoreInvalidPackages)
continue;
- throw QInstaller::Error(QString::fromLatin1("Component package description in \"%1\" is invalid. "
+ throw QInstaller::Error(QString::fromLatin1("Component package description in '%1' is invalid. "
"Error at line: %2, column: %3 -> %4").arg(fileInfo.absoluteFilePath(), QString::number(errorLine),
QString::number(errorColumn), error));
}
@@ -477,15 +475,15 @@ PackageInfoVector QInstallerTools::createListOfPackages(const QString &packagesD
const QDomElement packageElement = doc.firstChildElement(QLatin1String("Package"));
const QString name = packageElement.firstChildElement(QLatin1String("Name")).text();
if (!name.isEmpty() && name != it->fileName()) {
- qWarning() << QString::fromLatin1("The <Name> tag in the \"%1\" is ignored - the installer uses the "
- "path element right before the \"meta\" (\"%2\").").arg(fileInfo.absoluteFilePath(), it->fileName());
+ qWarning() << QString::fromLatin1("The <Name> tag in the '%1' is ignored - the installer uses the "
+ "path element right before the 'meta' ('%2').").arg(fileInfo.absoluteFilePath(), it->fileName());
}
const QString releaseDate = packageElement.firstChildElement(QLatin1String("ReleaseDate")).text();
if (releaseDate.isEmpty() || (!QDate::fromString(releaseDate, Qt::ISODate).isValid())) {
if (ignoreInvalidPackages)
continue;
- throw QInstaller::Error(QString::fromLatin1("Release date for %1 is invalid! <ReleaseDate>%2"
+ throw QInstaller::Error(QString::fromLatin1("Release date for '%1' is invalid! <ReleaseDate>%2"
"</ReleaseDate>. Supported format: YYYY-MM-DD").arg(fileInfo.absoluteFilePath(), releaseDate));
}
@@ -495,7 +493,7 @@ PackageInfoVector QInstallerTools::createListOfPackages(const QString &packagesD
if (!QRegExp(QLatin1String("[0-9]+((\\.|-)[0-9]+)*")).exactMatch(info.version)) {
if (ignoreInvalidPackages)
continue;
- throw QInstaller::Error(QString::fromLatin1("Component version for %1 is invalid! <Version>%2</Version>")
+ throw QInstaller::Error(QString::fromLatin1("Component version for '%1' is invalid! <Version>%2</Version>")
.arg(fileInfo.absoluteFilePath(), info.version));
}
info.dependencies = packageElement.firstChildElement(QLatin1String("Dependencies")).text()
@@ -573,7 +571,7 @@ void QInstallerTools::compressMetaDirectories(const QString &repoDir, const QStr
writeSHA1ToNodeWithName(doc, elements, sha1Sum, path);
const QString finalTarget = absPath + QLatin1String("/") + fn;
if (!tmp.rename(finalTarget))
- throw QInstaller::Error(QString::fromLatin1("Could not move %1 to %2").arg(tmpTarget, finalTarget));
+ throw QInstaller::Error(QString::fromLatin1("Could not move '%1' to '%2'").arg(tmpTarget, finalTarget));
}
QInstaller::openForWrite(&existingUpdatesXml, existingUpdatesXml.fileName());
@@ -591,7 +589,7 @@ void QInstallerTools::copyComponentData(const QString &packageDir, const QString
const QString namedRepoDir = QString::fromLatin1("%1/%2").arg(repoDir, name);
if (!QDir().mkpath(namedRepoDir)) {
- throw QInstaller::Error(QString::fromLatin1("Could not create repository folder for component %1")
+ throw QInstaller::Error(QString::fromLatin1("Could not create repository folder for component '%1'")
.arg(name));
}
@@ -605,10 +603,10 @@ void QInstallerTools::copyComponentData(const QString &packageDir, const QString
if (Lib7z::isSupportedArchive(absoluteEntryFilePath)) {
QFile tmp(absoluteEntryFilePath);
QString target = QString::fromLatin1("%1/%3%2").arg(namedRepoDir, entry, info.version);
- qDebug() << QString::fromLatin1("Copying archive from %1 to %2").arg(tmp.fileName(),
+ qDebug() << QString::fromLatin1("Copying archive from '%1' to '%2'").arg(tmp.fileName(),
target);
if (!tmp.copy(target)) {
- throw QInstaller::Error(QString::fromLatin1("Could not copy %1 to %2: %3").arg(tmp.fileName(),
+ throw QInstaller::Error(QString::fromLatin1("Could not copy '%1' to '%2': %3").arg(tmp.fileName(),
target, tmp.errorString()));
}
compressedFiles.append(target);
diff --git a/tools/repogen/repogen.cpp b/tools/repogen/repogen.cpp
index 9c20234ac..1380e4ebf 100644
--- a/tools/repogen/repogen.cpp
+++ b/tools/repogen/repogen.cpp
@@ -53,6 +53,9 @@
#include <iostream>
+#define QUOTE_(x) #x
+#define QUOTE(x) QUOTE_(x)
+
using namespace Lib7z;
using namespace QInstaller;
@@ -76,7 +79,7 @@ static void printUsage()
std::cout << std::endl;
std::cout << "Example:" << std::endl;
- std::cout << " " << appName << " -p ../examples/packages -c ../examples/config/config.xml -u "
+ std::cout << " " << appName << " -p ../examples/packages -u "
"http://www.some-server.com:8080 repository/" << std::endl;
}
@@ -107,7 +110,6 @@ int main(int argc, char** argv)
QStringList filteredPackages;
bool updateExistingRepository = false;
QString packagesDir;
- QString configFile;
QString redirectUpdateUrl;
QInstallerTools::FilterType filterType = QInstallerTools::Exclude;
bool remove = false;
@@ -156,21 +158,8 @@ int main(int argc, char** argv)
args.removeFirst();
if (args.isEmpty())
return printErrorAndUsageAndExit(QObject::tr("Error: Config parameter missing argument"));
- const QFileInfo fi(args.first());
- if (!fi.exists()) {
- return printErrorAndUsageAndExit(QObject::tr("Error: Config file %1 not found "
- "at the specified location").arg(args.first()));
- }
- if (!fi.isFile()) {
- return printErrorAndUsageAndExit(QObject::tr("Error: Configuration %1 is not a "
- "file").arg(args.first()));
- }
- if (!fi.isReadable()) {
- return printErrorAndUsageAndExit(QObject::tr("Error: Config file %1 is not "
- "readable").arg(args.first()));
- }
- configFile = args.first();
args.removeFirst();
+ std::cout << "Config file parameter is deprecated and ignored." << std::endl;
} else if (args.first() == QLatin1String("-u") || args.first() == QLatin1String("--updateurl")) {
args.removeFirst();
if (args.isEmpty())
@@ -189,7 +178,7 @@ int main(int argc, char** argv)
}
}
- if ((packagesDir.isEmpty() || configFile.isEmpty() || args.count() != 1)) {
+ if (packagesDir.isEmpty() || (args.count() != 1)) {
printUsage();
return 1;
}
@@ -224,10 +213,8 @@ int main(int argc, char** argv)
const QString metaTmp = createTemporaryDirectory();
tmpDeleter.add(metaTmp);
- QString configDir = QFileInfo(configFile).canonicalPath();
- const Settings &settings = Settings::fromFileAndPrefix(configFile, configDir);
- generateMetaDataDirectory(metaTmp, repositoryDir, packages, settings.applicationName(),
- settings.applicationVersion(), redirectUpdateUrl);
+ generateMetaDataDirectory(metaTmp, repositoryDir, packages, QLatin1String("{AnyApplication}"),
+ QLatin1String(QUOTE(IFW_REPOSITORY_FORMAT_VERSION)), redirectUpdateUrl);
QInstallerTools::compressMetaDirectories(metaTmp, metaTmp, pathToVersionMapping);
QDirIterator it(repositoryDir, QStringList(QLatin1String("Updates*.xml")), QDir::Files | QDir::CaseSensitive);