summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/libs/installer/metadatajob.cpp8
-rw-r--r--src/libs/installer/packagemanagercore.cpp28
-rw-r--r--src/libs/installer/packagemanagercore_p.cpp12
-rw-r--r--src/libs/installer/packagemanagergui.cpp2
-rw-r--r--src/sdk/main.cpp21
5 files changed, 61 insertions, 10 deletions
diff --git a/src/libs/installer/metadatajob.cpp b/src/libs/installer/metadatajob.cpp
index ecc66f493..0c674e313 100644
--- a/src/libs/installer/metadatajob.cpp
+++ b/src/libs/installer/metadatajob.cpp
@@ -457,6 +457,11 @@ MetadataJob::Status MetadataJob::parseUpdatesXml(const QList<FileTaskResult> &re
if (error() != Job::NoError)
return XmlDownloadFailure;
+ //If repository is not found, target might be empty. Do not continue parsing the
+ //repository and do not prevent further repositories usage.
+ if (result.target().isEmpty()) {
+ continue;
+ }
Metadata metadata;
QTemporaryDir tmp(QDir::tempPath() + QLatin1String("/remoterepo-XXXXXX"));
if (!tmp.isValid()) {
@@ -484,7 +489,8 @@ MetadataJob::Status MetadataJob::parseUpdatesXml(const QList<FileTaskResult> &re
if (!doc.setContent(&file, &error)) {
qDebug().nospace() << "Cannot fetch a valid version of Updates.xml from repository "
<< metadata.repository.displayname() << ": " << error;
- return XmlDownloadFailure;
+ //If there are other repositories, try to use those
+ continue;
}
file.close();
diff --git a/src/libs/installer/packagemanagercore.cpp b/src/libs/installer/packagemanagercore.cpp
index c4ba5ae4a..7b6842720 100644
--- a/src/libs/installer/packagemanagercore.cpp
+++ b/src/libs/installer/packagemanagercore.cpp
@@ -1816,21 +1816,39 @@ void PackageManagerCore::updateComponentsSilently()
setMessageBoxAutomaticAnswer(QLatin1String("installationErrorWithRetry"), QMessageBox::Cancel);
fetchRemotePackagesTree();
- //Mark all components to be installed
+
const QList<QInstaller::Component*> componentList = components(
ComponentType::Root | ComponentType::Descendants);
if (componentList.count() == 0) {
qDebug() << "No updates available.";
} else {
- foreach (Component *comp, componentList) {
- comp->setCheckState(Qt::Checked);
+ // Check if essential components are available (essential components are disabled).
+ // If essential components are found, update first essential updates,
+ // restart installer and install rest of the updates.
+ bool essentialUpdatesFound = false;
+ foreach (Component *component, componentList) {
+ if (component->value(scEssential, scFalse).toLower() == scTrue)
+ essentialUpdatesFound = true;
+ }
+ if (!essentialUpdatesFound) {
+ //Mark all components to be updated
+ foreach (Component *comp, componentList) {
+ comp->setCheckState(Qt::Checked);
+ }
}
QString htmlOutput;
bool componentsOk = calculateComponents(&htmlOutput);
if (componentsOk) {
- if (runPackageUpdater())
- qDebug() << "Components updated successfully.";
+ if (runPackageUpdater()) {
+ writeMaintenanceTool();
+ if (essentialUpdatesFound) {
+ qDebug() << "Essential components updated successfully.";
+ }
+ else {
+ qDebug() << "Components updated successfully.";
+ }
+ }
}
else {
qDebug() << htmlOutput;
diff --git a/src/libs/installer/packagemanagercore_p.cpp b/src/libs/installer/packagemanagercore_p.cpp
index 28d64d09c..fb802ef8b 100644
--- a/src/libs/installer/packagemanagercore_p.cpp
+++ b/src/libs/installer/packagemanagercore_p.cpp
@@ -162,8 +162,16 @@ static void deferredRename(const QString &oldName, const QString &newName, bool
batch << " WScript.Sleep(1000)\n";
batch << "wend\n";
batch << QString::fromLatin1("fso.MoveFile \"%1\", file\n").arg(arguments[1]);
- if (restart)
- batch << QString::fromLatin1("tmp.exec \"%1 --updater\"\n").arg(arguments[2]);
+ if (restart) {
+ //Restart with same command line arguments as first executable
+ QStringList commandLineArguments = QCoreApplication::arguments();
+ batch << QString::fromLatin1("tmp.exec \"%1 --updater").arg(arguments[2]);
+ //Skip the first argument as that is executable itself
+ for (int i = 1; i < commandLineArguments.count(); i++) {
+ batch << QString::fromLatin1(" %1").arg(commandLineArguments.at(i));
+ }
+ batch << QString::fromLatin1("\"\n");
+ }
batch << "fso.DeleteFile(WScript.ScriptFullName)\n";
}
diff --git a/src/libs/installer/packagemanagergui.cpp b/src/libs/installer/packagemanagergui.cpp
index d31eb6a94..27bf91dc6 100644
--- a/src/libs/installer/packagemanagergui.cpp
+++ b/src/libs/installer/packagemanagergui.cpp
@@ -1986,6 +1986,8 @@ public:
if (!installActionColumnVisible)
m_treeView->hideColumn(ComponentModelHelper::ActionColumn);
+ m_treeView->header()->setSectionResizeMode(
+ ComponentModelHelper::NameColumn, QHeaderView::ResizeToContents);
if (m_core->isInstaller()) {
m_treeView->setHeaderHidden(true);
for (int i = ComponentModelHelper::InstalledVersionColumn; i < m_currentModel->columnCount(); ++i)
diff --git a/src/sdk/main.cpp b/src/sdk/main.cpp
index 91550614e..70c675f91 100644
--- a/src/sdk/main.cpp
+++ b/src/sdk/main.cpp
@@ -44,7 +44,7 @@
#include <iostream>
-#if defined(Q_OS_OSX)
+#if defined(Q_OS_OSX) or defined(Q_OS_UNIX)
# include <unistd.h>
# include <sys/types.h>
#endif
@@ -58,6 +58,7 @@ static const char PLACEHOLDER[32] = "MY_InstallerCreateDateTime_MY";
int main(int argc, char *argv[])
{
+ QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
// increase maximum numbers of file descriptors
#if defined (Q_OS_OSX)
QCoreApplication::setSetuidAllowed(true);
@@ -132,8 +133,24 @@ int main(int argc, char *argv[])
const bool production = (mode.compare(QLatin1String(QInstaller::Protocol::ModeProduction),
Qt::CaseInsensitive) == 0);
- if (production)
+ if (production) {
argumentsValid = (!key.isEmpty()) && (!socketName.isEmpty());
+#if defined(Q_OS_UNIX) && !defined(Q_OS_OSX)
+ /* In production mode detach child so that sudo waiting on us will terminate. */
+ pid_t child = fork();
+ if (child <= -1) {
+ std::cerr << "Fatal cannot fork and detach server." << std::endl;
+ return EXIT_FAILURE;
+ }
+
+ if (child != 0) {
+ return EXIT_SUCCESS;
+ }
+
+ ::setsid();
+#endif
+ }
+
SDKApp<QCoreApplication> app(argc, argv);
if (!argumentsValid) {