summaryrefslogtreecommitdiffstats
path: root/installerbuilder/common
diff options
context:
space:
mode:
authorAlexander Lenhardt <alexander.lenhardt@nokia.com>2012-03-09 12:06:05 +0100
committerAlexander Lenhardt <alexander.lenhardt@nokia.com>2012-03-09 12:58:23 +0100
commit1b4bdda0659d2f725955eba1c325203e8e93975f (patch)
treebe2024fe3ea2da4b4fabdb2b6107ab9826377f1e /installerbuilder/common
parent2d99a6cfb4949cd87f5f052b667e79e445e208eb (diff)
added --include option
allows to specify whitelists for the inclusion into the repository. --include and --exclude are mutually exclusive. Change-Id: I3148482250234e44dd34b6ad2dadedc8923adc36 Reviewed-by: Niels Weber <niels.2.weber@nokia.com> Reviewed-by: Tim Jenssen <tim.jenssen@nokia.com>
Diffstat (limited to 'installerbuilder/common')
-rw-r--r--installerbuilder/common/repositorygen.cpp22
-rw-r--r--installerbuilder/common/repositorygen.h7
2 files changed, 21 insertions, 8 deletions
diff --git a/installerbuilder/common/repositorygen.cpp b/installerbuilder/common/repositorygen.cpp
index 8f565b3b4..d68e6e4c6 100644
--- a/installerbuilder/common/repositorygen.cpp
+++ b/installerbuilder/common/repositorygen.cpp
@@ -52,12 +52,13 @@ void QInstaller::printRepositoryGenOptions()
std::cout << " -p|--packages dir The directory containing the available packages." << std::endl;
std::cout << " Defaults to the current working directory." << std::endl;
- std::cout << " -e|--exclude p1,...,pn exclude the given packages" << std::endl;
+ std::cout << " -e|--exclude p1,...,pn Exclude the given packages." << std::endl;
+ std::cout << " -i|--include p1,...,pn Include the given packages and their dependencies from the "
+ << "repository." << std::endl;
std::cout << " --ignore-translations Don't use any translation" << std::endl;
std::cout << " --ignore-invalid-packages Ignore all invalid packages instead of aborting." << std::endl;
}
-
QT_BEGIN_NAMESPACE
static bool operator==(const PackageInfo &lhs, const PackageInfo &rhs)
{
@@ -65,7 +66,8 @@ static bool operator==(const PackageInfo &lhs, const PackageInfo &rhs)
}
QT_END_NAMESPACE
-static PackageInfoVector collectAvailablePackages(const QString &packagesDirectory, const QStringList &excludedPackages)
+static PackageInfoVector collectAvailablePackages(const QString &packagesDirectory,
+ const QStringList &filteredPackages, FilterType ftype)
{
qDebug() << "Collecting information about available packages...";
@@ -75,8 +77,13 @@ static PackageInfoVector collectAvailablePackages(const QString &packagesDirecto
const QFileInfoList entries = QDir(packagesDirectory)
.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot);
for (QFileInfoList::const_iterator it = entries.begin(); it != entries.end(); ++it) {
- if (excludedPackages.contains(it->fileName()))
- continue;
+ if (ftype == Exclude) {
+ if (filteredPackages.contains(it->fileName()))
+ continue;
+ } else {
+ if (!filteredPackages.contains(it->fileName()))
+ continue;
+ }
qDebug() << QString::fromLatin1("\tfound subdirectory %1").arg(it->fileName());
// because the filter is QDir::Dirs - filename means the name of the subdirectory
if (it->fileName().contains(QLatin1Char('-'))) {
@@ -616,9 +623,10 @@ void QInstaller::generateMetaDataDirectory(const QString &outDir, const QString
}
PackageInfoVector QInstaller::createListOfPackages(const QStringList &components,
- const QString &packagesDirectory, const QStringList &excludedPackages, bool addDependencies)
+ const QString &packagesDirectory, const QStringList &filteredPackages, FilterType ftype, bool addDependencies)
{
- const PackageInfoVector availablePackageInfos = collectAvailablePackages(packagesDirectory, excludedPackages);
+ const PackageInfoVector availablePackageInfos = collectAvailablePackages(packagesDirectory,
+ filteredPackages, ftype);
if (!addDependencies) {
PackageInfoVector packageInfos;
foreach (const PackageInfo &info, availablePackageInfos) {
diff --git a/installerbuilder/common/repositorygen.h b/installerbuilder/common/repositorygen.h
index b77ae2fc7..64290856b 100644
--- a/installerbuilder/common/repositorygen.h
+++ b/installerbuilder/common/repositorygen.h
@@ -51,6 +51,11 @@ struct PackageInfo
};
typedef QVector<PackageInfo> PackageInfoVector;
+enum FilterType {
+ Include,
+ Exclude
+};
+
QMap<QString, QString> buildPathToVersionMap(const PackageInfoVector &info);
void compressMetaDirectories(const QString &repoDir);
@@ -65,7 +70,7 @@ void generateMetaDataDirectory(const QString &outDir, const QString &dataDir,
const QString& appVersion, const QString &redirectUpdateUrl = QString());
PackageInfoVector createListOfPackages(const QStringList &components, const QString &packagesDirectory,
- const QStringList &excludedPackages, bool addDependencies = true);
+ const QStringList &filteredPackages, FilterType ftype, bool addDependencies = true);
} // namespace QInstaller