diff options
author | Tim Jenssen <tim.jenssen@digia.com> | 2013-08-01 15:56:52 +0200 |
---|---|---|
committer | Tim Jenssen <tim.jenssen@digia.com> | 2013-08-01 19:15:14 +0200 |
commit | 550de62138a0deb2873814f35c9def2294666535 (patch) | |
tree | 3b9ff29abf68c3cc3d9fd3c660d912dd5bce2487 /tools | |
parent | 9407b867943e880a90ae0b3354c06c8368f17bb0 (diff) |
adding archives automatically to updates.xml
Task-number: QTIFW-210
Task-number: QTIFW-248
Change-Id: I6deeade922dfe796df4223dae9e4a4744b7d6724
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@digia.com>
Reviewed-by: Karsten Heimrich <karsten.heimrich@digia.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/common/repositorygen.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tools/common/repositorygen.cpp b/tools/common/repositorygen.cpp index 359d1ba31..2af72f0cb 100644 --- a/tools/common/repositorygen.cpp +++ b/tools/common/repositorygen.cpp @@ -201,6 +201,7 @@ void QInstallerTools::copyMetaData(const QString &_targetDir, const QString &met bool foundDefault = false; bool foundVirtual = false; bool foundDisplayName = false; + bool foundDownloadableArchives = false; const QDomNode package = packageXml.firstChildElement(QLatin1String("Package")); const QDomNodeList childNodes = package.childNodes(); for (int i = 0; i < childNodes.count(); ++i) { @@ -213,6 +214,8 @@ void QInstallerTools::copyMetaData(const QString &_targetDir, const QString &met foundVirtual = true; if (key == QLatin1String("DisplayName")) foundDisplayName = true; + if (key == QLatin1String("DownloadableArchives")) + foundDownloadableArchives = true; if (node.isComment() || blackList.contains(key)) continue; // just skip comments and some tags... @@ -296,6 +299,11 @@ void QInstallerTools::copyMetaData(const QString &_targetDir, const QString &met QTextStream in(&scriptFile); scriptContent = in.readAll(); } + + // if the user isn't aware of the downloadable archives value we will add it automatically later + foundDownloadableArchives |= scriptContent.contains(QLatin1String("addDownloadableArchive")) + || scriptContent.contains(QLatin1String("removeDownloadableArchive")); + static QScriptEngine testScriptEngine; testScriptEngine.evaluate(scriptContent, scriptFile.fileName()); if (testScriptEngine.hasUncaughtException()) { @@ -313,6 +321,21 @@ void QInstallerTools::copyMetaData(const QString &_targetDir, const QString &met copyWithException(scriptFile.fileName(), toLocation, QLatin1String("script")); } + // write DownloadableArchives tag if that is missed by the user + if (!foundDownloadableArchives && !info.copiedFiles.isEmpty()) { + QStringList realContentFiles; + foreach (const QString &filePath, info.copiedFiles) { + if (!filePath.endsWith(QLatin1String(".sha1"), Qt::CaseInsensitive)) { + const QString fileName = QFileInfo(filePath).fileName(); + // remove unnecessary version string from filename and add it to the list + realContentFiles.append(fileName.mid(info.version.count())); + } + } + + update.appendChild(doc.createElement(QLatin1String("DownloadableArchives"))).appendChild(doc + .createTextNode(realContentFiles.join(QChar::fromLatin1(',')))); + } + // copy user interfaces const QStringList uiFiles = copyFilesFromNode(QLatin1String("UserInterfaces"), QLatin1String("UserInterface"), QString(), QLatin1String("user interface"), package, info, |