From dc3f0a459d15aa04f9713dc9c594fbb79215818d Mon Sep 17 00:00:00 2001 From: Niels Weber Date: Thu, 20 Jun 2013 10:58:53 +0200 Subject: Lists packages not found that were given explicitly. When the user calls repogen or binarycreator using the include or exclude parameter, those packages that were given but could not be found in the packages directory are now listed in a warning. Task-number: QTIFW-233 Change-Id: Iaadd0a14d2c6d834daa6dbe956118d674e048fac Reviewed-by: Karsten Heimrich --- tools/binarycreator/binarycreator.cpp | 2 +- tools/common/repositorygen.cpp | 15 ++++++++++++--- tools/common/repositorygen.h | 2 +- tools/repogen/repogen.cpp | 2 +- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/tools/binarycreator/binarycreator.cpp b/tools/binarycreator/binarycreator.cpp index 5afd3f1dd..d7bb0d93a 100644 --- a/tools/binarycreator/binarycreator.cpp +++ b/tools/binarycreator/binarycreator.cpp @@ -704,7 +704,7 @@ int main(int argc, char **argv) try { const Settings settings = Settings::fromFileAndPrefix(configFile, QFileInfo(configFile).absolutePath()); QInstallerTools::PackageInfoVector packages = QInstallerTools::createListOfPackages(packagesDirectory, - filteredPackages, ftype); + &filteredPackages, ftype); QInstallerTools::copyMetaData(tmpMetaDir, packagesDirectory, packages, settings.applicationName(), settings.applicationVersion()); diff --git a/tools/common/repositorygen.cpp b/tools/common/repositorygen.cpp index 60a38377c..bae26d0f3 100644 --- a/tools/common/repositorygen.cpp +++ b/tools/common/repositorygen.cpp @@ -359,7 +359,7 @@ void QInstallerTools::copyMetaData(const QString &_targetDir, const QString &met } PackageInfoVector QInstallerTools::createListOfPackages(const QString &packagesDirectory, - const QStringList &filteredPackages, FilterType filterType) + QStringList *packagesToFilter, FilterType filterType) { qDebug() << "\nCollecting information about available packages..."; @@ -369,11 +369,16 @@ PackageInfoVector QInstallerTools::createListOfPackages(const QString &packagesD const QFileInfoList entries = QDir(packagesDirectory).entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot); for (QFileInfoList::const_iterator it = entries.begin(); it != entries.end(); ++it) { if (filterType == Exclude) { - if (filteredPackages.contains(it->fileName())) + // Check for current file in exclude list, if found, skip it and remove it from exclude list + if (packagesToFilter->contains(it->fileName())) { + packagesToFilter->removeAll(it->fileName()); continue; + } } else { - if (!filteredPackages.contains(it->fileName())) + // Check for current file in include list, if not found, skip it; if found, remove it from include list + if (!packagesToFilter->contains(it->fileName())) continue; + packagesToFilter->removeAll(it->fileName()); } qDebug() << QString::fromLatin1("found subdirectory '%1'").arg(it->fileName()); // because the filter is QDir::Dirs - filename means the name of the subdirectory @@ -440,6 +445,10 @@ PackageInfoVector QInstallerTools::createListOfPackages(const QString &packagesD qDebug() << QString::fromLatin1("- it provides the package %1 - %2").arg(info.name, info.version); } + if (!packagesToFilter->isEmpty()) { + qWarning() << "The following explicitly given packages could not be found\n in package directory:" << *packagesToFilter; + } + if (dict.isEmpty()) qDebug() << "No available packages found at the specified location."; diff --git a/tools/common/repositorygen.h b/tools/common/repositorygen.h index d9a4ec476..bd941a206 100644 --- a/tools/common/repositorygen.h +++ b/tools/common/repositorygen.h @@ -68,7 +68,7 @@ void printRepositoryGenOptions(); QString makePathAbsolute(const QString &path); void copyWithException(const QString &source, const QString &target, const QString &kind = QString()); -PackageInfoVector createListOfPackages(const QString &packagesDirectory, const QStringList &filteredPackages, +PackageInfoVector createListOfPackages(const QString &packagesDirectory, QStringList *packagesToFilter, FilterType ftype); QHash buildPathToVersionMapping(const PackageInfoVector &info); diff --git a/tools/repogen/repogen.cpp b/tools/repogen/repogen.cpp index 74829be2a..154a924ac 100644 --- a/tools/repogen/repogen.cpp +++ b/tools/repogen/repogen.cpp @@ -183,7 +183,7 @@ int main(int argc, char** argv) } QInstallerTools::PackageInfoVector packages = QInstallerTools::createListOfPackages(packagesDir, - filteredPackages, filterType); + &filteredPackages, filterType); QHash pathToVersionMapping = QInstallerTools::buildPathToVersionMapping(packages); foreach (const QInstallerTools::PackageInfo &package, packages) { -- cgit v1.2.3