Merge remote-tracking branch 'origin/3.0' into master

Change-Id: I36894f02abbb180bec7017fa48f2cbf07cee8cdc
This commit is contained in:
Katja Marttila 2017-06-20 12:27:00 +03:00
commit ad00a64d86
5 changed files with 61 additions and 10 deletions

View File

@ -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();

View File

@ -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;

View File

@ -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";
}

View File

@ -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)

View File

@ -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) {