summaryrefslogtreecommitdiffstats
path: root/tools/common
diff options
context:
space:
mode:
authorTim Jenssen <tim.jenssen@digia.com>2013-02-19 20:18:01 +0100
committerKarsten Heimrich <karsten.heimrich@digia.com>2013-02-20 11:17:42 +0100
commit5c2d700cb134b34dbfb5b92e33ab86d1f6b03125 (patch)
tree4266cd94e3f185985ec9c048a9ab6b65e2a6bb53 /tools/common
parent5d9b4fe6360e261b40e54e1acbba55a921414e22 (diff)
Make Virtual and Default tag mutually exclusive.
Call m_vars value function directly. 1; To prevent recursive calls in case of key "Default". 2; To avoid the extra function call to fetch values from m_vars in case of other values set in the object. Change-Id: I8f40b53704d1f314071d7060d0c92829310c262d Reviewed-by: Tim Jenssen <tim.jenssen@digia.com> Reviewed-by: Niels Weber <niels.weber@digia.com>
Diffstat (limited to 'tools/common')
-rw-r--r--tools/common/repositorygen.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/tools/common/repositorygen.cpp b/tools/common/repositorygen.cpp
index 76d547526..733323a79 100644
--- a/tools/common/repositorygen.cpp
+++ b/tools/common/repositorygen.cpp
@@ -172,13 +172,20 @@ void QInstallerTools::generateMetaDataDirectory(const QString &outDir, const QSt
blackList << QLatin1String("UserInterfaces") << QLatin1String("Translations") <<
QLatin1String("Licenses") << QLatin1String("Name");
+ bool foundDefault = false;
+ bool foundVirtual = false;
const QDomNodeList childNodes = package.childNodes();
for (int i = 0; i < childNodes.count(); ++i) {
const QDomNode node = childNodes.at(i);
const QString key = node.nodeName();
- // just skip comments and some tags...
+
+ if (key == QLatin1String("Default"))
+ foundDefault = true;
+ if (key == QLatin1String("Virtual"))
+ foundVirtual = true;
if (node.isComment() || blackList.contains(key))
- continue;
+ continue; // just skip comments and some tags...
+
const QString value = node.toElement().text();
QDomElement element = doc.createElement(key);
for (int i = 0; i < node.attributes().size(); i++) {
@@ -188,6 +195,11 @@ void QInstallerTools::generateMetaDataDirectory(const QString &outDir, const QSt
update.appendChild(element).appendChild(doc.createTextNode(value));
}
+ if (foundDefault && foundVirtual) {
+ throw QInstaller::Error(QString::fromLatin1("Error: <Default> and <Virtual> elements are "
+ "mutually exclusive. File: '%0'").arg(packageXmlPath));
+ }
+
// get the size of the data
quint64 componentSize = 0;
quint64 compressedComponentSize = 0;