summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--dist/packages/org.qtproject.ifw/meta/installscript.qs2
-rw-r--r--src/libs/installer/packagemanagercoredata.cpp2
-rw-r--r--src/libs/installer/resources/patch_file_lists.qrc2
-rw-r--r--src/libs/installer/settings.cpp78
-rw-r--r--src/libs/installer/settings.h8
-rw-r--r--src/libs/installer/updatesettings.cpp2
-rw-r--r--tests/auto/installer/fakestopprocessforupdateoperation/tst_fakestopprocessforupdateoperation.cpp1
-rw-r--r--tests/auto/installer/repository/tst_repository.cpp1
-rw-r--r--tests/auto/installer/settings/data/unknown_element_config.xml1
-rw-r--r--tests/auto/installer/settings/tst_settings.cpp31
-rw-r--r--tools/build_installer.py4
11 files changed, 92 insertions, 40 deletions
diff --git a/dist/packages/org.qtproject.ifw/meta/installscript.qs b/dist/packages/org.qtproject.ifw/meta/installscript.qs
index 0019255e1..8a12a6804 100644
--- a/dist/packages/org.qtproject.ifw/meta/installscript.qs
+++ b/dist/packages/org.qtproject.ifw/meta/installscript.qs
@@ -9,4 +9,6 @@ function Component()
// do not show component selection page
installer.setDefaultPageVisible(QInstaller.ComponentSelection, false);
+ // no startmenu entry so no need to ask where to create it
+ installer.setDefaultPageVisible(QInstaller.StartMenuSelection, false);
}
diff --git a/src/libs/installer/packagemanagercoredata.cpp b/src/libs/installer/packagemanagercoredata.cpp
index f383bd62f..efc83f520 100644
--- a/src/libs/installer/packagemanagercoredata.cpp
+++ b/src/libs/installer/packagemanagercoredata.cpp
@@ -73,7 +73,7 @@ PackageManagerCoreData::PackageManagerCoreData(const QHash<QString, QString> &va
try {
m_settings = Settings::fromFileAndPrefix(QLatin1String(":/metadata/installer-config/config.xml"),
- QLatin1String(":/metadata/installer-config/"));
+ QLatin1String(":/metadata/installer-config/"), Settings::RelaxedParseMode);
} catch (const Error &e) {
// TODO: try better error handling
qCritical("Could not parse Config: %s", qPrintable(e.message()));
diff --git a/src/libs/installer/resources/patch_file_lists.qrc b/src/libs/installer/resources/patch_file_lists.qrc
index 26154dec2..fe4b77046 100644
--- a/src/libs/installer/resources/patch_file_lists.qrc
+++ b/src/libs/installer/resources/patch_file_lists.qrc
@@ -6,5 +6,7 @@
<file>files-to-patch-linux-qt5</file>
<file>files-to-patch-windows-qt5</file>
<file>files-to-patch-macx-qt5</file>
+ <file>files-to-patch-linux-emb-arm</file>
+ <file>files-to-patch-windows-emb-arm</file>
</qresource>
</RCC>
diff --git a/src/libs/installer/settings.cpp b/src/libs/installer/settings.cpp
index 602c6cc06..3ba85cdd6 100644
--- a/src/libs/installer/settings.cpp
+++ b/src/libs/installer/settings.cpp
@@ -41,6 +41,7 @@
#include "settings.h"
#include "errors.h"
+#include "qinstallerglobal.h"
#include "repository.h"
#include <QtCore/QFileInfo>
@@ -80,38 +81,57 @@ static QSet<T> variantListToSet(const QVariantList &list)
return set;
}
-static QSet<Repository> readRepositories(QXmlStreamReader &reader, bool isDefault)
+static void raiseError(QXmlStreamReader &reader, const QString &error, Settings::ParseMode parseMode)
+{
+ if (parseMode == Settings::StrictParseMode) {
+ reader.raiseError(error);
+ } else {
+ QFile *xmlFile = qobject_cast<QFile*>(reader.device());
+ if (xmlFile) {
+ qWarning() << QString::fromLatin1("Ignoring following settings reader error in %1, line %2, "
+ "column %3: %4").arg(xmlFile->fileName()).arg(reader.lineNumber()).arg(reader.columnNumber())
+ .arg(reader.errorString());
+ } else {
+ qWarning("Ignoring following settings reader error: %s", qPrintable(error));
+ }
+ }
+}
+
+static QSet<Repository> readRepositories(QXmlStreamReader &reader, bool isDefault, Settings::ParseMode parseMode)
{
QSet<Repository> set;
while (reader.readNextStartElement()) {
if (reader.name() == QLatin1String("Repository")) {
Repository repo(QString(), isDefault);
while (reader.readNextStartElement()) {
- if (reader.name() == QLatin1String("Url"))
+ if (reader.name() == QLatin1String("Url")) {
repo.setUrl(reader.readElementText());
- else if (reader.name() == QLatin1String("Username"))
+ } else if (reader.name() == QLatin1String("Username")) {
repo.setUsername(reader.readElementText());
- else if (reader.name() == QLatin1String("Password"))
+ } else if (reader.name() == QLatin1String("Password")) {
repo.setPassword(reader.readElementText());
- else if (reader.name() == QLatin1String("Enabled"))
+ } else if (reader.name() == QLatin1String("Enabled")) {
repo.setEnabled(bool(reader.readElementText().toInt()));
- else
- reader.raiseError(QString::fromLatin1("Unexpected element '%1'.").arg(
- reader.name().toString()));
-
- if (!reader.attributes().isEmpty())
- reader.raiseError(QString::fromLatin1("Unexpected attribute for element '%1'.").arg(
- reader.name().toString()));
+ } else {
+ raiseError(reader, QString::fromLatin1("Unexpected element '%1'.").arg(reader.name()
+ .toString()), parseMode);
+ }
+
+ if (!reader.attributes().isEmpty()) {
+ raiseError(reader, QString::fromLatin1("Unexpected attribute for element '%1'.")
+ .arg(reader.name().toString()), parseMode);
+ }
}
set.insert(repo);
} else {
- reader.raiseError(QString::fromLatin1("Unexpected element '%1'.").arg(
- reader.name().toString()));
+ raiseError(reader, QString::fromLatin1("Unexpected element '%1'.").arg(reader.name().toString()),
+ parseMode);
}
- if (!reader.attributes().isEmpty())
- reader.raiseError(QString::fromLatin1("Unexpected attribute for element '%1'.").arg(
- reader.name().toString()));
+ if (!reader.attributes().isEmpty()) {
+ raiseError(reader, QString::fromLatin1("Unexpected attribute for element '%1'.").arg(reader
+ .name().toString()), parseMode);
+ }
}
return set;
}
@@ -162,7 +182,7 @@ Settings& Settings::operator=(const Settings &other)
}
/* static */
-Settings Settings::fromFileAndPrefix(const QString &path, const QString &prefix)
+Settings Settings::fromFileAndPrefix(const QString &path, const QString &prefix, ParseMode parseMode)
{
QFile file(path);
QFile overrideConfig(QLatin1String(":/overrideconfig.xml"));
@@ -175,9 +195,10 @@ Settings Settings::fromFileAndPrefix(const QString &path, const QString &prefix)
QXmlStreamReader reader(&file);
if (reader.readNextStartElement()) {
- if (reader.name() != QLatin1String("Installer"))
- reader.raiseError(QString::fromLatin1("Unexpected element '%1' as root element.").arg(
- reader.name().toString()));
+ if (reader.name() != QLatin1String("Installer")) {
+ raiseError(reader, QString::fromLatin1("Unexpected element '%1' as root element.").arg(reader
+ .name().toString()), parseMode);
+ }
}
QStringList elementList;
elementList << scName << scVersion << scTitle << scPublisher << scProductUrl
@@ -195,12 +216,13 @@ Settings Settings::fromFileAndPrefix(const QString &path, const QString &prefix)
s.d->m_data.insert(scPrefix, prefix);
while (reader.readNextStartElement()) {
const QString name = reader.name().toString();
-
if (!elementList.contains(name))
- reader.raiseError(QString::fromLatin1("Unexpected element '%1'.").arg(name));
+ raiseError(reader, QString::fromLatin1("Unexpected element '%1'.").arg(name), parseMode);
- if (!reader.attributes().isEmpty())
- reader.raiseError(QString::fromLatin1("Unexpected attribute for element '%1'.").arg(name));
+ if (!reader.attributes().isEmpty()) {
+ raiseError(reader, QString::fromLatin1("Unexpected attribute for element '%1'.").arg(name),
+ parseMode);
+ }
if (name == scIcon)
qWarning() << "Deprecated element 'Icon'.";
@@ -209,15 +231,15 @@ Settings Settings::fromFileAndPrefix(const QString &path, const QString &prefix)
reader.raiseError(QString::fromLatin1("Element '%1' has been defined before.").arg(name));
if (name == scRemoteRepositories) {
- s.addDefaultRepositories(readRepositories(reader, true));
+ s.addDefaultRepositories(readRepositories(reader, true, parseMode));
} else {
s.d->m_data.insert(name, reader.readElementText(QXmlStreamReader::SkipChildElements));
}
}
if (reader.error() != QXmlStreamReader::NoError) {
- throw Error(QString::fromLatin1("Error in %1, line %2, column %3: %4")
- .arg(path).arg(reader.lineNumber()).arg(reader.columnNumber()).arg(reader.errorString()));
+ throw Error(QString::fromLatin1("Error in %1, line %2, column %3: %4").arg(path).arg(reader
+ .lineNumber()).arg(reader.columnNumber()).arg(reader.errorString()));
}
if (s.d->m_data.value(scName).isNull())
diff --git a/src/libs/installer/settings.h b/src/libs/installer/settings.h
index 79f70c3a3..277264f79 100644
--- a/src/libs/installer/settings.h
+++ b/src/libs/installer/settings.h
@@ -74,13 +74,19 @@ public:
UserDefinedProxy
};
+ enum ParseMode {
+ StrictParseMode,
+ RelaxedParseMode
+ };
+
explicit Settings();
~Settings();
Settings(const Settings &other);
Settings &operator=(const Settings &other);
- static Settings fromFileAndPrefix(const QString &path, const QString &prefix);
+ static Settings fromFileAndPrefix(const QString &path, const QString &prefix,
+ ParseMode parseMode = StrictParseMode);
QString logo() const;
QString title() const;
diff --git a/src/libs/installer/updatesettings.cpp b/src/libs/installer/updatesettings.cpp
index da6ab9319..2e876839f 100644
--- a/src/libs/installer/updatesettings.cpp
+++ b/src/libs/installer/updatesettings.cpp
@@ -153,7 +153,7 @@ QSet<Repository> UpdateSettings::repositories() const
try {
if(result.isEmpty()) {
result = Settings::fromFileAndPrefix(QLatin1String(":/metadata/installer-config/config.xml"),
- QLatin1String(":/metadata/installer-config/")).userRepositories();
+ QLatin1String(":/metadata/installer-config/"), Settings::RelaxedParseMode).userRepositories();
}
} catch (const Error &error) {
qDebug("Could not parse config: %s", qPrintable(error.message()));
diff --git a/tests/auto/installer/fakestopprocessforupdateoperation/tst_fakestopprocessforupdateoperation.cpp b/tests/auto/installer/fakestopprocessforupdateoperation/tst_fakestopprocessforupdateoperation.cpp
index 1d23e1970..c8b314657 100644
--- a/tests/auto/installer/fakestopprocessforupdateoperation/tst_fakestopprocessforupdateoperation.cpp
+++ b/tests/auto/installer/fakestopprocessforupdateoperation/tst_fakestopprocessforupdateoperation.cpp
@@ -2,6 +2,7 @@
#include "packagemanagercore.h"
#include <QFileInfo>
+#include <QString>
#include <QTest>
using namespace KDUpdater;
diff --git a/tests/auto/installer/repository/tst_repository.cpp b/tests/auto/installer/repository/tst_repository.cpp
index e3b7b74a6..380d9a9a2 100644
--- a/tests/auto/installer/repository/tst_repository.cpp
+++ b/tests/auto/installer/repository/tst_repository.cpp
@@ -1,5 +1,6 @@
#include "repository.h"
+#include <QString>
#include <QTest>
using namespace QInstaller;
diff --git a/tests/auto/installer/settings/data/unknown_element_config.xml b/tests/auto/installer/settings/data/unknown_element_config.xml
index 0d97564e6..ee9e0ef1a 100644
--- a/tests/auto/installer/settings/data/unknown_element_config.xml
+++ b/tests/auto/installer/settings/data/unknown_element_config.xml
@@ -3,4 +3,5 @@
<Name>Your application</Name>
<Version>1.2.3</Version>
<unknown></unknown>
+ <Title>Your application Installer</Title>
</Installer>
diff --git a/tests/auto/installer/settings/tst_settings.cpp b/tests/auto/installer/settings/tst_settings.cpp
index cf61e0c9d..8db9edb11 100644
--- a/tests/auto/installer/settings/tst_settings.cpp
+++ b/tests/auto/installer/settings/tst_settings.cpp
@@ -1,9 +1,10 @@
-#include <QTest>
#include "settings.h"
#include "errors.h"
#include "repository.h"
#include <QFile>
+#include <QString>
+#include <QTest>
using namespace QInstaller;
@@ -17,13 +18,13 @@ private slots:
void loadEmptyConfig();
void loadNotExistingConfig();
void loadMalformedConfig();
- void loadUnknownElementConfig();
+ void loadUnknownElementConfigInStrictParseMode();
+ void loadUnknownElementConfigInRelaxedParseMode();
};
void tst_Settings::loadTutorialConfig()
{
- Settings settings =
- Settings::fromFileAndPrefix(":///data/tutorial_config.xml", ":///data");
+ Settings settings = Settings::fromFileAndPrefix(":///data/tutorial_config.xml", ":///data");
// specified values
QCOMPARE(settings.applicationName(), QLatin1String("Your application"));
@@ -80,8 +81,7 @@ void tst_Settings::loadTutorialConfig()
void tst_Settings::loadFullConfig()
{
QTest::ignoreMessage(QtWarningMsg, "Deprecated element 'Icon'. ");
- Settings settings =
- Settings::fromFileAndPrefix(":///data/full_config.xml", ":///data");
+ Settings settings = Settings::fromFileAndPrefix(":///data/full_config.xml", ":///data");
}
void tst_Settings::loadEmptyConfig()
@@ -127,10 +127,10 @@ void tst_Settings::loadMalformedConfig()
QFAIL("No exception thrown");
}
-void tst_Settings::loadUnknownElementConfig()
+void tst_Settings::loadUnknownElementConfigInStrictParseMode()
{
- QTest::ignoreMessage(QtDebugMsg, "create Error-Exception: \"Error in :/data/unknown_element_config.xml, line 5, "
- "column 13: Unexpected element 'unknown'.\" ");
+ QTest::ignoreMessage(QtDebugMsg, "create Error-Exception: \"Error in :/data/unknown_element_config.xml, "
+ "line 5, column 13: Unexpected element 'unknown'.\" ");
try {
Settings::fromFileAndPrefix(":/data/unknown_element_config.xml", ":/data");
} catch (const Error &error) {
@@ -141,6 +141,19 @@ void tst_Settings::loadUnknownElementConfig()
QFAIL("No exception thrown");
}
+void tst_Settings::loadUnknownElementConfigInRelaxedParseMode()
+{
+ QTest::ignoreMessage(QtWarningMsg, "\"Ignoring following settings reader error in "
+ ":/data/unknown_element_config.xml, line 5, column 13: \" ");
+ try {
+ Settings settings = Settings::fromFileAndPrefix(":/data/unknown_element_config.xml", ":/data",
+ Settings::RelaxedParseMode);
+ QCOMPARE(settings.title(), QLatin1String("Your application Installer"));
+ } catch (const Error &error) {
+ QFAIL(qPrintable(QString::fromLatin1("Got an exception in TolerantParseMode: %1").arg(error.message())));
+ }
+}
+
QTEST_MAIN(tst_Settings)
#include "tst_settings.moc"
diff --git a/tools/build_installer.py b/tools/build_installer.py
index 44fa0c106..a301c6f48 100644
--- a/tools/build_installer.py
+++ b/tools/build_installer.py
@@ -24,6 +24,8 @@ def parse_arguments():
parser.add_argument('--doc-qmake', dest='doc_qmake', required=True, help='path to qmake that will be used to generate the documentation')
parser.add_argument('--make', dest='make', required=True, help='make command')
parser.add_argument('--targetdir', dest='target_dir', required=True, help='directory the generated installer will be placed in')
+ if sys.platform == 'darwin':
+ parser.add_argument('--qt_menu_nib', dest='menu_nib', required=True, help='location of qt_menu.nib (usually src/gui/mac/qt_menu.nib)')
args = parser.parse_args()
@@ -97,6 +99,8 @@ def package():
package_dir = os.path.join(src_dir, 'dist', 'packages')
installer_path = os.path.join(src_dir, 'dist', 'packages')
run((binary_creator, '--offline-only', '-c', config_file, '-p', package_dir, target_path))
+ if sys.platform == 'darwin':
+ shutil.copytree(args.menu_nib, target_path + '.app/Contents/Resources/qt_menu.nib')
parse_arguments()