summaryrefslogtreecommitdiffstats
path: root/tools/common/repositorygen.cpp
diff options
context:
space:
mode:
authorTim Jenssen <tim.jenssen@digia.com>2013-08-26 12:24:11 +0200
committerTim Jenssen <tim.jenssen@digia.com>2013-08-26 12:24:11 +0200
commitd8d93f85d6362e8cfb24a076e3df0504cb93957f (patch)
tree898b5580dab6ce76d1fea05a723416bee2feeed6 /tools/common/repositorygen.cpp
parentcf7efd742ff29f932beb8f20b8b6e8ed4cac141b (diff)
parentf84cbe8da86dac7daf75cacbb3b68127bdff761a (diff)
Merge remote-tracking branch 'origin/1.4'
Diffstat (limited to 'tools/common/repositorygen.cpp')
-rw-r--r--tools/common/repositorygen.cpp33
1 files changed, 29 insertions, 4 deletions
diff --git a/tools/common/repositorygen.cpp b/tools/common/repositorygen.cpp
index 6fec75039..609844829 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...
@@ -230,7 +233,8 @@ void QInstallerTools::copyMetaData(const QString &_targetDir, const QString &met
}
if (!foundDisplayName) {
- qWarning() << "No DisplayName tag found, using component Name instead.";
+ qWarning() << QString::fromLatin1("No DisplayName tag found at '%1', using component Name instead."
+ ).arg(info.name);
QDomElement displayNameElement = doc.createElement(QLatin1String("DisplayName"));
update.appendChild(displayNameElement).appendChild(doc.createTextNode(info.name));
}
@@ -295,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()) {
@@ -312,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,
@@ -447,7 +471,8 @@ PackageInfoVector QInstallerTools::createListOfPackages(const QStringList &packa
qDebug() << QString::fromLatin1("- it provides the package %1 - %2").arg(info.name, info.version);
}
- if (!packagesToFilter->isEmpty()) {
+ if (!packagesToFilter->isEmpty() && packagesToFilter->at(0) != QString::fromLatin1(
+ "X_fake_filter_component_for_online_only_installer_X")) {
qWarning() << "The following explicitly given packages could not be found\n in package directory:" << *packagesToFilter;
}
@@ -583,7 +608,7 @@ void QInstallerTools::copyComponentData(const QStringList &packageDirs, const QS
}
foreach (const QString &target, compressedFiles) {
- (*infos)[i].copiedArchives.append(target);
+ (*infos)[i].copiedFiles.append(target);
QFile archiveFile(target);
QFile archiveHashFile(archiveFile.fileName() + QLatin1String(".sha1"));
@@ -600,7 +625,7 @@ void QInstallerTools::copyComponentData(const QStringList &packageDirs, const QS
QInstaller::openForWrite(&archiveHashFile, archiveHashFile.fileName());
archiveHashFile.write(hashOfArchiveData);
qDebug() << "Generated sha1 hash:" << hashOfArchiveData;
- (*infos)[i].copiedArchives.append(archiveHashFile.fileName());
+ (*infos)[i].copiedFiles.append(archiveHashFile.fileName());
archiveHashFile.close();
} catch (const QInstaller::Error &/*e*/) {
archiveFile.close();