summaryrefslogtreecommitdiffstats
path: root/src/sdk
diff options
context:
space:
mode:
authorKatja Marttila <katja.marttila@qt.io>2019-05-31 13:30:18 +0300
committerIikka Eklund <iikka.eklund@qt.io>2019-12-04 12:11:59 +0000
commit0842ea01554202b4552911c827417acb00a03cf1 (patch)
tree8633ef3e268a2f0064f0051755bd2e0d7ec6eb04 /src/sdk
parentf8ade64515482e2079fde805b93ee11e3dae44f5 (diff)
Install selected packages from CLI
Also move targetDirWarning() from targetdirectorypage to packagemanager and move target directory check to checkTargetDir() function so that those are accessible also without UI. Change-Id: Ia38cc7e66bb542e6a60fea2c39cc3b80735564ef Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
Diffstat (limited to 'src/sdk')
-rw-r--r--src/sdk/commandlineparser.cpp6
-rw-r--r--src/sdk/constants.h2
-rw-r--r--src/sdk/installerbase.cpp27
3 files changed, 35 insertions, 0 deletions
diff --git a/src/sdk/commandlineparser.cpp b/src/sdk/commandlineparser.cpp
index 7f833417c..493a77866 100644
--- a/src/sdk/commandlineparser.cpp
+++ b/src/sdk/commandlineparser.cpp
@@ -124,10 +124,16 @@ CommandLineParser::CommandLineParser()
QLatin1String("Lists installed packages.")));
m_parser.addOption(QCommandLineOption(QLatin1String(CommandLineOptions::ListPackages),
QLatin1String("Lists available packages."), QLatin1String("regexp")));
+ m_parser.addOption(QCommandLineOption(QLatin1String(CommandLineOptions::InstallPackages),
+ QLatin1String("Install selected packages"),
+ QLatin1String("package,...")));
m_parser.addOption(QCommandLineOption(QLatin1String(CommandLineOptions::Platform),
QLatin1String("Use the specified platform plugin."), QLatin1String("plugin")));
m_parser.addPositionalArgument(QLatin1String(CommandLineOptions::KeyValue),
QLatin1String("Key Value pair to be set."));
+ m_parser.addOption(QCommandLineOption(QLatin1String(CommandLineOptions::TargetDir),
+ QLatin1String("Set install directory"),
+ QLatin1String("directory")));
m_parser.addOption(QCommandLineOption(QLatin1String(CommandLineOptions::SquishPort),
QLatin1String("Give a port where Squish can connect to. If no port is given, default "
"port 11233 is used. Note: To enable Squish support you first need to build IFW with "
diff --git a/src/sdk/constants.h b/src/sdk/constants.h
index 0c3b2edc9..0cdf36bf4 100644
--- a/src/sdk/constants.h
+++ b/src/sdk/constants.h
@@ -57,6 +57,8 @@ const char SilentUpdate[] = "silentUpdate";
const char UpdatePackages[] = "updatePackages";
const char ListInstalledPackages[] = "listInstalledPackages";
const char ListPackages[] = "listPackages";
+const char InstallPackages[] = "installPackages";
+const char TargetDir[] = "targetDir";
const char Platform[] = "platform";
const char SquishPort[] = "squish-port";
diff --git a/src/sdk/installerbase.cpp b/src/sdk/installerbase.cpp
index 09cc547d2..e32b4f127 100644
--- a/src/sdk/installerbase.cpp
+++ b/src/sdk/installerbase.cpp
@@ -341,6 +341,33 @@ int InstallerBase::run()
if (!value.isEmpty())
packages = value.split(QLatin1Char(','), QString::SkipEmptyParts);
m_core->updateComponentsSilently(packages);
+ } else if (parser.isSet(QLatin1String(CommandLineOptions::InstallPackages))) {
+ checkLicense();
+ m_core->autoRejectMessageBoxes();
+ if (m_core->isInstaller()) {
+ if (parser.isSet(QLatin1String(CommandLineOptions::TargetDir))) {
+ const QString &value = parser.value(QLatin1String(CommandLineOptions::TargetDir));
+ if (m_core->checkTargetDir(value)) {
+ QString targetDirWarning = m_core->targetDirWarning(value);
+ if (!targetDirWarning.isEmpty()) {
+ qDebug() << m_core->targetDirWarning(value);
+ return EXIT_FAILURE;
+ }
+ m_core->setValue(QLatin1String("TargetDir"), value);
+ } else {
+ return EXIT_FAILURE;
+ }
+ } else {
+ qWarning() << "Please specify target directory.";
+ return EXIT_FAILURE;
+ }
+ }
+
+ QStringList packages;
+ const QString &value = parser.value(QLatin1String(CommandLineOptions::InstallPackages));
+ if (!value.isEmpty())
+ packages = value.split(QLatin1Char(','), QString::SkipEmptyParts);
+ m_core->installSelectedComponentsSilently(packages);
} else {
//create the wizard GUI
TabController controller(nullptr);