summaryrefslogtreecommitdiffstats
path: root/tools/repogen/repogen.cpp
diff options
context:
space:
mode:
authorkh1 <karsten.heimrich@nokia.com>2012-03-27 14:20:37 +0200
committerKarsten Heimrich <karsten.heimrich@nokia.com>2012-03-27 15:16:40 +0200
commit9e91e8a56fdc8080353323af0f380aab117a6920 (patch)
treee655ed82a1409ab3f7907d321ddcf3f693811dc1 /tools/repogen/repogen.cpp
parent520d98028f37e550c0cfec34b9c10278c4a44aff (diff)
Add remove parameter.
Change-Id: Ie7594516cd59c493ad29a40f92661843844dd7b6 Reviewed-by: Niels Weber <niels.2.weber@nokia.com>
Diffstat (limited to 'tools/repogen/repogen.cpp')
-rw-r--r--tools/repogen/repogen.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/tools/repogen/repogen.cpp b/tools/repogen/repogen.cpp
index d678976fd..2dc7a860e 100644
--- a/tools/repogen/repogen.cpp
+++ b/tools/repogen/repogen.cpp
@@ -55,7 +55,8 @@ static void printUsage()
QInstallerTools::printRepositoryGenOptions();
- std::cout << " -u|--updateurl url instructs clients to receive updates from a " << std::endl;
+ std::cout << " -r|--remove Force removing target directory if existent." << std::endl;
+ std::cout << " -u|--updateurl URL instructs clients to receive updates from a " << std::endl;
std::cout << " different location" << std::endl;
std::cout << " --update Update a set of existing components (defined by " << std::endl;
@@ -99,6 +100,7 @@ int main(int argc, char** argv)
QString configDir;
QString redirectUpdateUrl;
QInstallerTools::FilterType filterType = QInstallerTools::Exclude;
+ bool remove = false;
//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) {
@@ -168,6 +170,9 @@ int main(int argc, char** argv)
} else if (args.first() == QLatin1String("--ignore-translations")
|| args.first() == QLatin1String("--ignore-invalid-packages")) {
args.removeFirst();
+ } else if (args.first() == QLatin1String("-r") || args.first() == QLatin1String("--remove")) {
+ remove = true;
+ args.removeFirst();
} else {
printUsage();
return 1;
@@ -179,7 +184,14 @@ int main(int argc, char** argv)
return 1;
}
+ if (remove && updateExistingRepository) {
+ throw QInstaller::Error(QObject::tr("Argument -r|--remove and --single|--update are mutually "
+ "exclusive!"));
+ }
+
const QString repositoryDir = makeAbsolute(args.first());
+ if (remove)
+ QInstaller::removeDirectory(repositoryDir);
if (!updateExistingRepository && QFile::exists(repositoryDir)) {
throw QInstaller::Error(QObject::tr("Repository target folder %1 already exists!")