diff options
author | tjenssen <tim.jenssen@digia.com> | 2012-09-27 15:50:36 +0200 |
---|---|---|
committer | Tim Jenssen <tim.jenssen@digia.com> | 2012-09-28 11:36:45 +0200 |
commit | b27243a9970ebac7c64d293cdb914b8fb5332b50 (patch) | |
tree | 257480cda98d8d0aa99c1d0b770ad6f9c1f2a23f /tools/common | |
parent | 830522f3a2a57f989f07e4dbd49b899c7fc69e06 (diff) |
ignore <Name> tag and use the subdirectory name
- this makes moving of components much easier
Change-Id: Ie26daedd5f293b361761e14e370d6b01b55c12b6
Reviewed-by: Niels Weber <niels.weber@digia.com>
Reviewed-by: Karsten Heimrich <karsten.heimrich@digia.com>
Diffstat (limited to 'tools/common')
-rw-r--r-- | tools/common/repositorygen.cpp | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/tools/common/repositorygen.cpp b/tools/common/repositorygen.cpp index 3821dc913..eeed91516 100644 --- a/tools/common/repositorygen.cpp +++ b/tools/common/repositorygen.cpp @@ -154,19 +154,21 @@ void QInstallerTools::generateMetaDataDirectory(const QString &outDir, const QSt const QDomNode package = packageXml.firstChildElement(QLatin1String("Package")); QDomElement update = doc.createElement(QLatin1String("PackageUpdate")); + QDomElement nameElement = doc.createElement(QLatin1String("Name")); + nameElement.appendChild(doc.createTextNode(it->name)); + update.appendChild(nameElement); + + // list of current unused or later transformed tags + QStringList blackList; + blackList << QLatin1String("UserInterfaces") << QLatin1String("Translations") << + QLatin1String("Licenses") << QLatin1String("Name"); const QDomNodeList childNodes = package.childNodes(); for (int i = 0; i < childNodes.count(); ++i) { const QDomNode node = childNodes.at(i); - // just skip the comments... - if (node.isComment()) - continue; const QString key = node.nodeName(); - if (key == QLatin1String("UserInterfaces")) - continue; - if (key == QLatin1String("Translations")) - continue; - if (key == QLatin1String("Licenses")) + // just skip comments and some tags... + if (node.isComment() || blackList.contains(key)) continue; const QString value = node.toElement().text(); QDomElement element = doc.createElement(key); @@ -435,7 +437,8 @@ PackageInfoVector QInstallerTools::createListOfPackages(const QString &packagesD } QFile file(QString::fromLatin1("%1/meta/package.xml").arg(it->filePath())); - if (!file.exists()) { + QFileInfo fileInfo(file); + if (!fileInfo.exists()) { if (ignoreInvalidPackages) continue; throw QInstaller::Error(QObject::tr("Component %1 does not contain a package " @@ -451,29 +454,27 @@ PackageInfoVector QInstallerTools::createListOfPackages(const QString &packagesD if (!doc.setContent(&file, &error, &errorLine, &errorColumn)) { if (ignoreInvalidPackages) continue; - throw QInstaller::Error(QObject::tr("Component package description for %1 is invalid. " - "Error at line: %2, column: %3 -> %4").arg(it->fileName(), QString::number(errorLine), + throw QInstaller::Error(QObject::tr("Component package description in %1 is invalid. " + "Error at line: %2, column: %3 -> %4").arg(fileInfo.absoluteFilePath(), QString::number(errorLine), QString::number(errorColumn), error)); } const QString name = doc.firstChildElement(QLatin1String("Package")) .firstChildElement(QLatin1String("Name")).text(); - if (name != it->fileName()) { - if (ignoreInvalidPackages) - continue; - throw QInstaller::Error(QObject::tr("Component folder name must match component name: " - "%1 in %2/").arg(name, it->fileName())); + 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()); } PackageInfo info; - info.name = name; + info.name = it->fileName(); info.version = doc.firstChildElement(QLatin1String("Package")). firstChildElement(QLatin1String("Version")).text(); if (!QRegExp(QLatin1String("[0-9]+((\\.|-)[0-9]+)*")).exactMatch(info.version)) { if (ignoreInvalidPackages) continue; throw QInstaller::Error(QObject::tr("Component version for %1 is invalid! <Version>%2</version>") - .arg(it->fileName(), info.version)); + .arg(fileInfo.absoluteFilePath(), info.version)); } info.dependencies = doc.firstChildElement(QLatin1String("Package")). firstChildElement(QLatin1String("Dependencies")).text().split(QInstaller::scCommaRegExp, |