summaryrefslogtreecommitdiffstats
path: root/src/libs
diff options
context:
space:
mode:
authorArttu Tarkiainen <arttu.tarkiainen@qt.io>2021-03-26 15:45:35 +0200
committerArttu Tarkiainen <arttu.tarkiainen@qt.io>2021-03-28 09:47:04 +0200
commit6122f6e2e5efa17967a8004c368290afc2fa27f1 (patch)
tree65f945160647aff5163354d5eaf604c80df39905 /src/libs
parent34adba4642ed75ada0468c278e81b868f7c375f2 (diff)
CLI: Calculate required temporary and installation disk space
Task-number: QTIFW-2197 Change-Id: I63a0bb265105f5a722ab8c645fa3511328bbcb33 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Katja Marttila <katja.marttila@qt.io>
Diffstat (limited to 'src/libs')
-rw-r--r--src/libs/installer/packagemanagercore.cpp5
-rw-r--r--src/libs/installer/packagemanagercore_p.cpp7
2 files changed, 10 insertions, 2 deletions
diff --git a/src/libs/installer/packagemanagercore.cpp b/src/libs/installer/packagemanagercore.cpp
index ddfc0f832..5b36f8bc6 100644
--- a/src/libs/installer/packagemanagercore.cpp
+++ b/src/libs/installer/packagemanagercore.cpp
@@ -733,7 +733,7 @@ quint64 PackageManagerCore::requiredDiskSpace() const
quint64 result = 0;
foreach (QInstaller::Component *component, orderedComponentsToInstall())
- result += size(component, scUncompressedSize);
+ result += size(component, isOfflineGenerator() ? scCompressedSize : scUncompressedSize);
return result;
}
@@ -2653,6 +2653,9 @@ bool PackageManagerCore::checkAvailableSpace(QString &message) const
// if we create a local repository, take that space into account as well
required += repositorySize;
}
+ // if we create offline installer, take current executable size into account
+ if (isOfflineGenerator())
+ required += QFile(QCoreApplication::applicationFilePath()).size();
qDebug() << "Installation space required:" << humanReadableSize(required) << "Temporary space "
"required:" << humanReadableSize(tempRequired) << "Local repository size:"
diff --git a/src/libs/installer/packagemanagercore_p.cpp b/src/libs/installer/packagemanagercore_p.cpp
index f4670c738..fbc3f473d 100644
--- a/src/libs/installer/packagemanagercore_p.cpp
+++ b/src/libs/installer/packagemanagercore_p.cpp
@@ -2806,7 +2806,12 @@ bool PackageManagerCorePrivate::calculateComponentsAndRun()
qCDebug(QInstaller::lcInstallerInstallLog) << "Installation canceled.";
} else if (componentsOk && acceptLicenseAgreements()) {
qCDebug(QInstaller::lcInstallerInstallLog).noquote() << htmlToString(htmlOutput);
- if (!(m_autoConfirmCommand || askUserConfirmCommand())) {
+
+ QString spaceInfo;
+ const bool spaceOk = m_core->checkAvailableSpace(spaceInfo);
+ qCDebug(QInstaller::lcInstallerInstallLog) << spaceInfo;
+
+ if (!spaceOk || !(m_autoConfirmCommand || askUserConfirmCommand())) {
qCDebug(QInstaller::lcInstallerInstallLog) << "Installation aborted.";
} else if (m_core->run()) {
// Write maintenance tool if required