diff options
author | Alexander Lenhardt <alexander.lenhardt@nokia.com> | 2012-03-09 12:06:05 +0100 |
---|---|---|
committer | Alexander Lenhardt <alexander.lenhardt@nokia.com> | 2012-03-09 12:58:23 +0100 |
commit | 1b4bdda0659d2f725955eba1c325203e8e93975f (patch) | |
tree | be2024fe3ea2da4b4fabdb2b6107ab9826377f1e /installerbuilder/repogen/repogen.cpp | |
parent | 2d99a6cfb4949cd87f5f052b667e79e445e208eb (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/repogen/repogen.cpp')
-rw-r--r-- | installerbuilder/repogen/repogen.cpp | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/installerbuilder/repogen/repogen.cpp b/installerbuilder/repogen/repogen.cpp index 0a72c6649..e79621c02 100644 --- a/installerbuilder/repogen/repogen.cpp +++ b/installerbuilder/repogen/repogen.cpp @@ -92,11 +92,12 @@ int main(int argc, char** argv) QStringList args = app.arguments().mid(1); - QStringList excludedPackages; + QStringList filteredPackages; bool replaceSingleComponent = false; QString packagesDir; QString configDir; QString redirectUpdateUrl; + FilterType ftype = Exclude; //TODO: use a for loop without removing values from args like it is in binarycreator.cpp //for (QStringList::const_iterator it = args.begin(); it != args.end(); ++it) { @@ -106,10 +107,23 @@ int main(int argc, char** argv) setVerbose(true); } else if (args.first() == QLatin1String("--exclude") || args.first() == QLatin1String("-e")) { args.removeFirst(); + if (!filteredPackages.isEmpty()) + return printErrorAndUsageAndExit(QObject::tr("Error: --include and --exclude are mutually " + "exclusive. Use either one or the other.")); if (args.isEmpty() || args.first().startsWith(QLatin1Char('-'))) return printErrorAndUsageAndExit(QObject::tr("Error: Package to exclude missing")); - excludedPackages = args.first().split(QLatin1Char(',')); + filteredPackages = args.first().split(QLatin1Char(',')); args.removeFirst(); + } else if (args.first() == QLatin1String("--include") || args.first() == QLatin1String("-i")) { + args.removeFirst(); + if (!filteredPackages.isEmpty()) + return printErrorAndUsageAndExit(QObject::tr("Error: --include and --exclude are mutual " + "exclusive options. Use either one or the other.")); + if (args.isEmpty() || args.first().startsWith(QLatin1Char('-'))) + return printErrorAndUsageAndExit(QObject::tr("Error: Package to include missing")); + filteredPackages = args.first().split(QLatin1Char(',')); + args.removeFirst(); + ftype = Include; } else if (args.first() == QLatin1String("--single")) { args.removeFirst(); replaceSingleComponent = true; @@ -193,8 +207,8 @@ int main(int argc, char** argv) .arg(repositoryDir)); } - PackageInfoVector packages = createListOfPackages(components, packagesDir, excludedPackages, - !replaceSingleComponent); + PackageInfoVector packages = createListOfPackages(components, packagesDir, filteredPackages, + ftype, !replaceSingleComponent); QMap<QString, QString> pathToVersionMapping = buildPathToVersionMap(packages); for (PackageInfoVector::const_iterator it = packages.begin(); it != packages.end(); ++it) { |