summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libs/installer/componentmodel.cpp8
-rw-r--r--src/libs/installer/metadatajob.cpp40
-rw-r--r--src/libs/installer/packagemanagercore_p.cpp11
-rw-r--r--src/libs/kdtools/filedownloader.cpp13
-rw-r--r--src/libs/kdtools/filedownloader.h1
5 files changed, 50 insertions, 23 deletions
diff --git a/src/libs/installer/componentmodel.cpp b/src/libs/installer/componentmodel.cpp
index 8201248f8..e729f3088 100644
--- a/src/libs/installer/componentmodel.cpp
+++ b/src/libs/installer/componentmodel.cpp
@@ -584,13 +584,9 @@ QSet<QModelIndex> ComponentModel::updateCheckedState(const ComponentSet &compone
if (node->value(scCheckable, scTrue).toLower() == scFalse) {
checkable = false;
}
- // Let the check state to be checked up if the node is installed even if the component is not
- // selectable/enabled or is installed as autodependency. Otherwise the node might not be selected
- // and installer thinks it should be uninstalled.
- if (!node->isInstalled() &&
- ((!node->isCheckable() && checkable) || !node->isEnabled() || !node->autoDependencies().isEmpty())) {
+
+ if ((!node->isCheckable() && checkable) || !node->isEnabled() || !node->autoDependencies().isEmpty())
continue;
- }
Qt::CheckState newState = state;
const Qt::CheckState recentState = node->checkState();
diff --git a/src/libs/installer/metadatajob.cpp b/src/libs/installer/metadatajob.cpp
index e14032640..bbcf9ed5e 100644
--- a/src/libs/installer/metadatajob.cpp
+++ b/src/libs/installer/metadatajob.cpp
@@ -39,6 +39,8 @@
#include <QTemporaryDir>
#include <QtMath>
+const QStringList metaElements = {QLatin1String("Script"), QLatin1String("Licenses"), QLatin1String("UserInterfaces"), QLatin1String("Translations")};
+
namespace QInstaller {
static QUrl resolveUrl(const FileTaskResult &result, const QString &url)
@@ -544,6 +546,7 @@ MetadataJob::Status MetadataJob::parseUpdatesXml(const QList<FileTaskResult> &re
if (!el.isNull() && el.tagName() == QLatin1String("PackageUpdate")) {
const QDomNodeList c2 = el.childNodes();
QString packageName, packageVersion, packageHash;
+ bool metaFound = false;
for (int j = 0; j < c2.count(); ++j) {
if (c2.at(j).toElement().tagName() == scName)
packageName = c2.at(j).toElement().text();
@@ -551,22 +554,33 @@ MetadataJob::Status MetadataJob::parseUpdatesXml(const QList<FileTaskResult> &re
packageVersion = (online ? c2.at(j).toElement().text() : QString());
else if ((c2.at(j).toElement().tagName() == QLatin1String("SHA1")) && testCheckSum)
packageHash = c2.at(j).toElement().text();
+ else {
+ foreach (QString meta, metaElements) {
+ if (c2.at(j).toElement().tagName() == meta) {
+ metaFound = true;
+ break;
+ }
+ }
+ }
}
const QString repoUrl = metadata.repository.url().toString();
- FileTaskItem item(QString::fromLatin1("%1/%2/%3meta.7z").arg(repoUrl, packageName,
- packageVersion), metadata.directory + QString::fromLatin1("/%1-%2-meta.7z")
- .arg(packageName, packageVersion));
-
- QAuthenticator authenticator;
- authenticator.setUser(metadata.repository.username());
- authenticator.setPassword(metadata.repository.password());
-
- item.insert(TaskRole::UserRole, metadata.directory);
- item.insert(TaskRole::Checksum, packageHash.toLatin1());
- item.insert(TaskRole::Authenticator, QVariant::fromValue(authenticator));
- item.insert(TaskRole::Name, packageName);
- m_packages.append(item);
+ //If script element is not found, no need to fetch metadata
+ if (metaFound) {
+ FileTaskItem item(QString::fromLatin1("%1/%2/%3meta.7z").arg(repoUrl, packageName,
+ packageVersion), metadata.directory + QString::fromLatin1("/%1-%2-meta.7z")
+ .arg(packageName, packageVersion));
+
+ QAuthenticator authenticator;
+ authenticator.setUser(metadata.repository.username());
+ authenticator.setPassword(metadata.repository.password());
+
+ item.insert(TaskRole::UserRole, metadata.directory);
+ item.insert(TaskRole::Checksum, packageHash.toLatin1());
+ item.insert(TaskRole::Authenticator, QVariant::fromValue(authenticator));
+ item.insert(TaskRole::Name, packageName);
+ m_packages.append(item);
+ }
}
}
m_metadata.insert(metadata.directory, metadata);
diff --git a/src/libs/installer/packagemanagercore_p.cpp b/src/libs/installer/packagemanagercore_p.cpp
index 2577f09fc..62056d906 100644
--- a/src/libs/installer/packagemanagercore_p.cpp
+++ b/src/libs/installer/packagemanagercore_p.cpp
@@ -406,11 +406,14 @@ bool PackageManagerCorePrivate::buildComponentTree(QHash<QString, Component*> &c
restoreCheckState();
- foreach (QInstaller::Component *component, components) {
- const QStringList warnings = ComponentChecker::checkComponent(component);
- foreach (const QString &warning, warnings)
- qCWarning(lcComponentChecker).noquote() << warning;
+ if (m_core->isVerbose()) {
+ foreach (QInstaller::Component *component, components) {
+ const QStringList warnings = ComponentChecker::checkComponent(component);
+ foreach (const QString &warning, warnings)
+ qCWarning(lcComponentChecker).noquote() << warning;
+ }
}
+
} catch (const Error &error) {
clearAllComponentLists();
emit m_core->finishAllComponentsReset(QList<QInstaller::Component*>());
diff --git a/src/libs/kdtools/filedownloader.cpp b/src/libs/kdtools/filedownloader.cpp
index 8032bbe22..5574a3af6 100644
--- a/src/libs/kdtools/filedownloader.cpp
+++ b/src/libs/kdtools/filedownloader.cpp
@@ -660,6 +660,17 @@ void KDUpdater::FileDownloader::resetCheckSumData()
d->m_hash.reset();
}
+/*!
+ Creates a directory structure for \a fileName if it does not exist.
+*/
+void KDUpdater::FileDownloader::createDirectoryForFile(const QString fileName)
+{
+ QFileInfo fileInfo(fileName);
+ if (!fileInfo.absoluteDir().exists()) {
+ QDir filePath = fileInfo.absoluteDir();
+ filePath.mkdir(filePath.absolutePath());
+ }
+}
/*!
Returns a copy of the proxy factory that this FileDownloader object is using to determine the
@@ -814,6 +825,7 @@ void KDUpdater::LocalFileDownloader::doDownload()
file->open();
d->destination = file;
} else {
+ createDirectoryForFile(d->destFileName);
d->destination = new QFile(d->destFileName, this);
d->destination->open(QIODevice::ReadWrite | QIODevice::Truncate);
}
@@ -1466,6 +1478,7 @@ void KDUpdater::HttpDownloader::startDownload(const QUrl &url)
file->open();
d->destination = file;
} else {
+ createDirectoryForFile(d->destFileName);
d->destination = new QFile(d->destFileName, this);
d->destination->open(QIODevice::ReadWrite | QIODevice::Truncate);
}
diff --git a/src/libs/kdtools/filedownloader.h b/src/libs/kdtools/filedownloader.h
index ede20dcfa..10a041fba 100644
--- a/src/libs/kdtools/filedownloader.h
+++ b/src/libs/kdtools/filedownloader.h
@@ -140,6 +140,7 @@ protected:
void addCheckSumData(const QByteArray &data);
void addCheckSumData(const char *data, int length);
void resetCheckSumData();
+ void createDirectoryForFile(const QString fileName);
private Q_SLOTS:
virtual void doDownload() = 0;