diff options
-rw-r--r-- | doc/installerfw.qdoc | 6 | ||||
-rw-r--r-- | tools/common/repositorygen.cpp | 23 |
2 files changed, 28 insertions, 1 deletions
diff --git a/doc/installerfw.qdoc b/doc/installerfw.qdoc index f61592ad9..b766eb78f 100644 --- a/doc/installerfw.qdoc +++ b/doc/installerfw.qdoc @@ -506,7 +506,11 @@ \row \o DownloadableArchives - \o Lists the data files (separated by commas) for an online installer to download. Optional. + \o Lists the data files (separated by commas) for an online + installer to download. + If there is some data inside the component and the package.xml + and/or the script has no DownloadableArchives value, the + repogen tool registers the found data automatically. \endtable \section2 Component Dependencies 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, |