summaryrefslogtreecommitdiffstats
path: root/src/libs/kdtools
diff options
context:
space:
mode:
authorKatja Marttila <katja.marttila@qt.io>2023-09-26 17:11:10 +0300
committerKatja Marttila <katja.marttila@qt.io>2023-10-16 13:52:12 +0300
commitb09ef64c72192569bad97484a77434e9a015e2e1 (patch)
treeeac5bfad7f25524017077d9e303996cdd7341cef /src/libs/kdtools
parente8c4492693328568a1512303834e318aa1c1ea28 (diff)
Enable component script postload setting per repository
This is a custom requirement for Qt Online Installer. Qt Online Installer has a huge amount of scripts to be evaluated. Most of the scripts don't need an evaluation unless those are installed. Skipping the evaluation of scripts has quite significant performance impact. As the postLoad setting in component level is a big task, enabling support for Qt Online Installer to set the postLoad value to scripts per repository. Task-number: QTIFW-3173 Change-Id: If37d7ff39ad07ee56e9a9559c837966c23d76d6e Reviewed-by: Arttu Tarkiainen <arttu.tarkiainen@qt.io>
Diffstat (limited to 'src/libs/kdtools')
-rw-r--r--src/libs/kdtools/updatefinder.cpp4
-rw-r--r--src/libs/kdtools/updatesinfo.cpp16
-rw-r--r--src/libs/kdtools/updatesinfo_p.h2
-rw-r--r--src/libs/kdtools/updatesinfodata_p.h3
4 files changed, 17 insertions, 8 deletions
diff --git a/src/libs/kdtools/updatefinder.cpp b/src/libs/kdtools/updatefinder.cpp
index 120dcb952..dbe7825df 100644
--- a/src/libs/kdtools/updatefinder.cpp
+++ b/src/libs/kdtools/updatefinder.cpp
@@ -301,9 +301,9 @@ bool UpdateFinder::downloadUpdateXMLFiles()
connect(downloader, SIGNAL(downloadCanceled()), this, SLOT(slotDownloadDone()));
connect(downloader, SIGNAL(downloadCompleted()), this, SLOT(slotDownloadDone()));
connect(downloader, SIGNAL(downloadAborted(QString)), this, SLOT(slotDownloadDone()));
- m_updatesInfoList.insert(new UpdatesInfo, Data(info, downloader));
+ m_updatesInfoList.insert(new UpdatesInfo(info.postLoadComponentScript), Data(info, downloader));
} else {
- UpdatesInfo *updatesInfo = new UpdatesInfo;
+ UpdatesInfo *updatesInfo = new UpdatesInfo(info.postLoadComponentScript);
updatesInfo->setFileName(QInstaller::pathFromUrl(url));
m_updatesInfoList.insert(updatesInfo, Data(info));
}
diff --git a/src/libs/kdtools/updatesinfo.cpp b/src/libs/kdtools/updatesinfo.cpp
index 707daf11f..e82c1c1fb 100644
--- a/src/libs/kdtools/updatesinfo.cpp
+++ b/src/libs/kdtools/updatesinfo.cpp
@@ -40,8 +40,9 @@
using namespace KDUpdater;
-UpdatesInfoData::UpdatesInfoData()
+UpdatesInfoData::UpdatesInfoData(const bool postLoadComponentScript)
: error(UpdatesInfo::NotYetReadError)
+ , m_postLoadComponentScript(postLoadComponentScript)
{
}
@@ -135,7 +136,14 @@ bool UpdatesInfoData::parsePackageUpdateElement(QXmlStreamReader &reader, const
parseOperations(reader, info.data);
} else if (elementName == QLatin1String("Script")) {
const QXmlStreamAttributes attr = reader.attributes();
- const bool postLoad = attr.value(QLatin1String("postLoad")).toString().toLower() == QInstaller::scTrue ? true : false;
+ bool postLoad = false;
+ // postLoad can be set either to individual components or to whole repositories.
+ // If individual components has the postLoad attribute, it overwrites the repository value.
+ if (attr.hasAttribute(QLatin1String("postLoad")))
+ postLoad = attr.value(QLatin1String("postLoad")).toString().toLower() == QInstaller::scTrue ? true : false;
+ else if (m_postLoadComponentScript)
+ postLoad = true;
+
if (postLoad)
scriptHash.insert(QLatin1String("postLoadScript"), reader.readElementText());
else
@@ -238,8 +246,8 @@ void UpdatesInfoData::parseLicenses(QXmlStreamReader &reader, QHash<QString, QVa
//
// UpdatesInfo
//
-UpdatesInfo::UpdatesInfo()
- : d(new UpdatesInfoData)
+UpdatesInfo::UpdatesInfo(const bool postLoadComponentScript)
+ : d(new UpdatesInfoData(postLoadComponentScript))
{
}
diff --git a/src/libs/kdtools/updatesinfo_p.h b/src/libs/kdtools/updatesinfo_p.h
index bd9885327..a3768232a 100644
--- a/src/libs/kdtools/updatesinfo_p.h
+++ b/src/libs/kdtools/updatesinfo_p.h
@@ -59,7 +59,7 @@ public:
InvalidContentError
};
- UpdatesInfo();
+ UpdatesInfo(const bool postLoadComponentScript = false);
~UpdatesInfo();
bool isValid() const;
diff --git a/src/libs/kdtools/updatesinfodata_p.h b/src/libs/kdtools/updatesinfodata_p.h
index 9229f8577..c71a85193 100644
--- a/src/libs/kdtools/updatesinfodata_p.h
+++ b/src/libs/kdtools/updatesinfodata_p.h
@@ -43,7 +43,7 @@ struct UpdatesInfoData : public QSharedData
Q_DECLARE_TR_FUNCTIONS(KDUpdater::UpdatesInfoData)
public:
- UpdatesInfoData();
+ UpdatesInfoData(const bool postLoadComponentScript);
~UpdatesInfoData();
int error;
@@ -53,6 +53,7 @@ public:
QString applicationVersion;
QString checkSha1CheckSum;
QList<UpdateInfo> updateInfoList;
+ bool m_postLoadComponentScript;
void parseFile(const QString &updateXmlFile);
bool parsePackageUpdateElement(QXmlStreamReader &reader, const QString &checkSha1CheckSum);