summaryrefslogtreecommitdiffstats
path: root/tools
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
parentcf7efd742ff29f932beb8f20b8b6e8ed4cac141b (diff)
parentf84cbe8da86dac7daf75cacbb3b68127bdff761a (diff)
Merge remote-tracking branch 'origin/1.4'
Diffstat (limited to 'tools')
-rw-r--r--tools/binarycreator/binarycreator.cpp4
-rw-r--r--tools/common/repositorygen.cpp33
-rw-r--r--tools/common/repositorygen.h2
-rw-r--r--tools/repogen/repogen.cpp8
4 files changed, 37 insertions, 10 deletions
diff --git a/tools/binarycreator/binarycreator.cpp b/tools/binarycreator/binarycreator.cpp
index 14359c41c..a87cf46f6 100644
--- a/tools/binarycreator/binarycreator.cpp
+++ b/tools/binarycreator/binarycreator.cpp
@@ -685,7 +685,7 @@ int main(int argc, char **argv)
}
if (onlineOnly) {
- filteredPackages.append(QLatin1String("XXXXXXXXXXXXXXXXX_online_XXXXXXXXXXXXXXXXX"));
+ filteredPackages.append(QLatin1String("X_fake_filter_component_for_online_only_installer_X"));
ftype = QInstallerTools::Include;
}
@@ -738,7 +738,7 @@ int main(int argc, char **argv)
comp.setName(info.name.toUtf8());
qDebug() << "Creating component info for" << info.name;
- foreach (const QString &archive, info.copiedArchives) {
+ foreach (const QString &archive, info.copiedFiles) {
const QSharedPointer<Archive> arch(new Archive(archive));
qDebug() << QString::fromLatin1("Appending %1 (%2)").arg(archive,
humanReadableSize(arch->size()));
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();
diff --git a/tools/common/repositorygen.h b/tools/common/repositorygen.h
index 300ad3ca1..c7bdfa457 100644
--- a/tools/common/repositorygen.h
+++ b/tools/common/repositorygen.h
@@ -55,7 +55,7 @@ struct PackageInfo
QString version;
QString directory;
QStringList dependencies;
- QStringList copiedArchives;
+ QStringList copiedFiles;
};
typedef QVector<PackageInfo> PackageInfoVector;
diff --git a/tools/repogen/repogen.cpp b/tools/repogen/repogen.cpp
index 638325ae1..549fccb05 100644
--- a/tools/repogen/repogen.cpp
+++ b/tools/repogen/repogen.cpp
@@ -130,7 +130,7 @@ int main(int argc, char** argv)
filteredPackages = args.first().split(QLatin1Char(','));
args.removeFirst();
filterType = QInstallerTools::Include;
- } else if (args.first() == QLatin1String("--single") || args.first() == QLatin1String("--update")) {
+ } else if (args.first() == QLatin1String("--update")) {
args.removeFirst();
updateExistingRepository = true;
} else if (args.first() == QLatin1String("-p") || args.first() == QLatin1String("--packages")) {
@@ -169,7 +169,7 @@ int main(int argc, char** argv)
}
if (remove && updateExistingRepository) {
- throw QInstaller::Error(QObject::tr("Argument -r|--remove and --single|--update are mutually "
+ throw QInstaller::Error(QObject::tr("Argument -r|--remove and --update are mutually "
"exclusive!"));
}
@@ -177,7 +177,9 @@ int main(int argc, char** argv)
if (remove)
QInstaller::removeDirectory(repositoryDir);
- if (!updateExistingRepository && QFile::exists(repositoryDir)) {
+ if (!updateExistingRepository && QFile::exists(repositoryDir) && !QDir(repositoryDir).entryList(
+ QDir::AllEntries | QDir::NoDotAndDotDot).isEmpty()) {
+
throw QInstaller::Error(QObject::tr("Repository target folder %1 already exists!")
.arg(repositoryDir));
}