summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/libs/installer/binaryformatenginehandler.cpp12
-rw-r--r--src/libs/installer/createlocalrepositoryoperation.cpp4
-rw-r--r--src/libs/installer/packagemanagercore.cpp6
-rw-r--r--src/libs/installer/packagemanagercore_p.cpp1
-rw-r--r--src/libs/installer/productkeycheck.cpp11
-rw-r--r--src/libs/installer/productkeycheck.h6
-rw-r--r--src/sdk/installerbase.cpp13
-rw-r--r--src/sdk/updatechecker.cpp10
8 files changed, 48 insertions, 15 deletions
diff --git a/src/libs/installer/binaryformatenginehandler.cpp b/src/libs/installer/binaryformatenginehandler.cpp
index a884e3b1c..7f82236cc 100644
--- a/src/libs/installer/binaryformatenginehandler.cpp
+++ b/src/libs/installer/binaryformatenginehandler.cpp
@@ -32,8 +32,9 @@
**
**************************************************************************/
-#include "binaryformatenginehandler.h"
#include "binaryformatengine.h"
+#include "binaryformatenginehandler.h"
+#include "productkeycheck.h"
namespace QInstaller {
@@ -78,8 +79,10 @@ BinaryFormatEngineHandler *BinaryFormatEngineHandler::instance()
*/
void BinaryFormatEngineHandler::registerResources(const QList<ResourceCollection> &collections)
{
- foreach (const ResourceCollection &collection, collections)
- m_resources.insert(collection.name(), collection);
+ foreach (const ResourceCollection &collection, collections) {
+ if (ProductKeyCheck::instance()->isValidPackage(QString::fromUtf8(collection.name())))
+ m_resources.insert(collection.name(), collection);
+ }
}
/*!
@@ -104,6 +107,9 @@ BinaryFormatEngineHandler::registerResource(const QString &fileName, const QStri
const QByteArray resourceName = path.section(sep, 1, 1).toUtf8();
const QByteArray collectionName = path.section(sep, 0, 0).toUtf8();
+ if (!ProductKeyCheck::instance()->isValidPackage(QString::fromUtf8(collectionName)))
+ return;
+
m_resources[collectionName].setName(collectionName);
m_resources[collectionName].appendResource(QSharedPointer<Resource>(new Resource(resourcePath,
resourceName)));
diff --git a/src/libs/installer/createlocalrepositoryoperation.cpp b/src/libs/installer/createlocalrepositoryoperation.cpp
index 21676b97a..53ca90eec 100644
--- a/src/libs/installer/createlocalrepositoryoperation.cpp
+++ b/src/libs/installer/createlocalrepositoryoperation.cpp
@@ -42,6 +42,7 @@
#include "copydirectoryoperation.h"
#include "lib7z_facade.h"
#include "packagemanagercore.h"
+#include "productkeycheck.h"
#include "kdupdaterupdateoperations.h"
@@ -238,7 +239,8 @@ bool CreateLocalRepositoryOperation::performOperation()
else if (e.tagName() == QLatin1String("Version"))
version = e.text();
}
- versionMap.insert(name, version);
+ if (ProductKeyCheck::instance()->isValidPackage(name))
+ versionMap.insert(name, version);
}
}
diff --git a/src/libs/installer/packagemanagercore.cpp b/src/libs/installer/packagemanagercore.cpp
index 686917623..792323086 100644
--- a/src/libs/installer/packagemanagercore.cpp
+++ b/src/libs/installer/packagemanagercore.cpp
@@ -2151,6 +2151,9 @@ bool PackageManagerCore::fetchAllPackages(const PackagesList &remotes, const Loc
if (d->statusCanceledOrFailed())
return false;
+ if (!ProductKeyCheck::instance()->isValidPackage(package->data(scName).toString()))
+ continue;
+
QScopedPointer<QInstaller::Component> component(new QInstaller::Component(this));
data.package = package;
component->loadDataFromPackage(*package);
@@ -2197,6 +2200,9 @@ bool PackageManagerCore::fetchUpdaterPackages(const PackagesList &remotes, const
if (d->statusCanceledOrFailed())
return false;
+ if (!ProductKeyCheck::instance()->isValidPackage(update->data(scName).toString()))
+ continue;
+
QScopedPointer<QInstaller::Component> component(new QInstaller::Component(this));
data.package = update;
component->loadDataFromPackage(*update);
diff --git a/src/libs/installer/packagemanagercore_p.cpp b/src/libs/installer/packagemanagercore_p.cpp
index cebcad5d3..b5c99dc87 100644
--- a/src/libs/installer/packagemanagercore_p.cpp
+++ b/src/libs/installer/packagemanagercore_p.cpp
@@ -2186,6 +2186,7 @@ bool PackageManagerCorePrivate::addUpdateResourcesFromRepositories(bool parseChe
}
m_updaterApplication.addUpdateSource(appName, appName, QString(),
QUrl::fromLocalFile(data.directory), 1);
+ ProductKeyCheck::instance()->addPackagesFromXml(data.directory + QLatin1String("/Updates.xml"));
}
m_updaterApplication.updateSourcesInfo()->setModified(false);
diff --git a/src/libs/installer/productkeycheck.cpp b/src/libs/installer/productkeycheck.cpp
index e6c83197e..e86ef77ff 100644
--- a/src/libs/installer/productkeycheck.cpp
+++ b/src/libs/installer/productkeycheck.cpp
@@ -94,6 +94,17 @@ bool ProductKeyCheck::isValidRepository(const QInstaller::Repository &repository
return true;
}
+void ProductKeyCheck::addPackagesFromXml(const QString &xmlPath)
+{
+ Q_UNUSED(xmlPath)
+}
+
+bool ProductKeyCheck::isValidPackage(const QString &packageName) const
+{
+ Q_UNUSED(packageName)
+ return true;
+}
+
QList<int> ProductKeyCheck::registeredPages() const
{
return QList<int>();
diff --git a/src/libs/installer/productkeycheck.h b/src/libs/installer/productkeycheck.h
index 6638819fb..3b0ceb086 100644
--- a/src/libs/installer/productkeycheck.h
+++ b/src/libs/installer/productkeycheck.h
@@ -39,7 +39,8 @@
#include <QString>
-namespace QInstaller{
+namespace QInstaller {
+
class PackageManagerCore;
class ProductKeyCheckPrivate;
class Repository;
@@ -67,6 +68,9 @@ public:
// to filter repositories not matching the license
bool isValidRepository(const QInstaller::Repository &repository) const;
+ void addPackagesFromXml(const QString &xmlPath);
+ bool isValidPackage(const QString &packageName) const;
+
QList<int> registeredPages() const;
private:
diff --git a/src/sdk/installerbase.cpp b/src/sdk/installerbase.cpp
index 054a587b9..f262152ae 100644
--- a/src/sdk/installerbase.cpp
+++ b/src/sdk/installerbase.cpp
@@ -104,15 +104,16 @@ int InstallerBase::run()
}
SDKApp::registerMetaResources(manager.collectionByName("QResources"));
- QInstaller::BinaryFormatEngineHandler::instance()->registerResources(manager.collections());
-
+ m_core = new QInstaller::PackageManagerCore(magicMarker, oldOperations);
+ {
+ using namespace QInstaller;
+ ProductKeyCheck::instance()->init(m_core);
+ ProductKeyCheck::instance()->addPackagesFromXml(QLatin1String(":/metadata/Updates.xml"));
+ BinaryFormatEngineHandler::instance()->registerResources(manager.collections());
+ }
if (QInstaller::isVerbose())
dumpResourceTree();
- // instantiate the installer we are actually going to use
- m_core = new QInstaller::PackageManagerCore(magicMarker, oldOperations);
- QInstaller::ProductKeyCheck::instance()->init(m_core);
-
CommandLineParser parser;
parser.parse(arguments());
diff --git a/src/sdk/updatechecker.cpp b/src/sdk/updatechecker.cpp
index 3aa80394c..56316de8b 100644
--- a/src/sdk/updatechecker.cpp
+++ b/src/sdk/updatechecker.cpp
@@ -79,12 +79,14 @@ int UpdateChecker::check()
SDKApp::registerMetaResources(manager.collectionByName("QResources"));
- // instantiate the installer we are actually going to use
QInstaller::PackageManagerCore core(QInstaller::BinaryContent::MagicUpdaterMarker, operations);
- QInstaller::BinaryFormatEngineHandler::instance()->registerResources(manager.collections());
QInstaller::PackageManagerCore::setVirtualComponentsVisible(true);
- QInstaller::ProductKeyCheck::instance()->init(&core);
-
+ {
+ using namespace QInstaller;
+ ProductKeyCheck::instance()->init(&core);
+ ProductKeyCheck::instance()->addPackagesFromXml(QLatin1String(":/metadata/Updates.xml"));
+ BinaryFormatEngineHandler::instance()->registerResources(manager.collections());
+ }
if (!core.fetchRemotePackagesTree())
throw QInstaller::Error(core.error());