diff options
author | kh1 <karsten.heimrich@digia.com> | 2013-02-01 13:34:13 +0100 |
---|---|---|
committer | Karsten Heimrich <karsten.heimrich@digia.com> | 2013-02-01 14:12:56 +0100 |
commit | 96bfbec76b8cda4ea72f80819a2e0c6c404fcb99 (patch) | |
tree | c0adc55ae54d6b59667d5570ffbc447f536c0f69 | |
parent | c2b187c2d8ffe7b849dd6a6ec12a4068a3a60d8b (diff) |
Check for all needed tags in package.xml (missing release date).
Task-number: QTIFW-184
Change-Id: I5b5fdda255cffe3dcd5b46b8eb4334fa3410f869
Reviewed-by: Niels Weber <niels.weber@digia.com>
-rw-r--r-- | tools/common/repositorygen.cpp | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/tools/common/repositorygen.cpp b/tools/common/repositorygen.cpp index 7327bc7cc..76d547526 100644 --- a/tools/common/repositorygen.cpp +++ b/tools/common/repositorygen.cpp @@ -462,26 +462,32 @@ PackageInfoVector QInstallerTools::createListOfPackages(const QString &packagesD QString::number(errorColumn), error)); } - const QString name = doc.firstChildElement(QLatin1String("Package")) - .firstChildElement(QLatin1String("Name")).text(); + const QDomElement packageElement = doc.firstChildElement(QLatin1String("Package")); + const QString name = packageElement.firstChildElement(QLatin1String("Name")).text(); if (!name.isEmpty() && name != it->fileName()) { qWarning() << QString::fromLatin1("The <Name> tag in the \"%1\" is ignored - the installer uses the " "path element right before the \"meta\" (\"%2\").").arg(fileInfo.absoluteFilePath(), it->fileName()); } + const QString releaseDate = packageElement.firstChildElement(QLatin1String("ReleaseDate")).text(); + if (releaseDate.isEmpty() || (!QDate::fromString(releaseDate, Qt::ISODate).isValid())) { + if (ignoreInvalidPackages) + continue; + throw QInstaller::Error(QString::fromLatin1("Release date for %1 is invalid! <ReleaseDate>%2" + "</ReleaseDate>. Supported format: YYYY-MM-DD").arg(fileInfo.absoluteFilePath(), releaseDate)); + } + PackageInfo info; info.name = it->fileName(); - info.version = doc.firstChildElement(QLatin1String("Package")). - firstChildElement(QLatin1String("Version")).text(); + info.version = packageElement.firstChildElement(QLatin1String("Version")).text(); if (!QRegExp(QLatin1String("[0-9]+((\\.|-)[0-9]+)*")).exactMatch(info.version)) { if (ignoreInvalidPackages) continue; throw QInstaller::Error(QString::fromLatin1("Component version for %1 is invalid! <Version>%2</Version>") .arg(fileInfo.absoluteFilePath(), info.version)); } - info.dependencies = doc.firstChildElement(QLatin1String("Package")). - firstChildElement(QLatin1String("Dependencies")).text().split(QInstaller::scCommaRegExp, - QString::SkipEmptyParts); + info.dependencies = packageElement.firstChildElement(QLatin1String("Dependencies")).text() + .split(QInstaller::scCommaRegExp, QString::SkipEmptyParts); info.directory = it->filePath(); dict.push_back(info); |