diff options
author | Karsten Heimrich <karsten.heimrich@theqtcompany.com> | 2015-05-04 14:27:46 +0200 |
---|---|---|
committer | Karsten Heimrich <karsten.heimrich@theqtcompany.com> | 2015-05-06 12:20:59 +0000 |
commit | dbdf186ac50e42068c71821ae157a43df3438d55 (patch) | |
tree | f2d51541f9b4e842a6277830161d3256e8cd93fd /src/libs/installer/packagemanagercore_p.cpp | |
parent | cd75e52e5e3beb29eb0137695494fd3245acd1dd (diff) |
Fix issue with accessing install target directory.
In case we run as installer, do not look into the installation
target directory to read the package XML file. This needs only
be done to get installed packages, read the application name
and version to compare updates and online components against.
Change-Id: Ie5b82854e41dc2f11ae5668c5839351c2fc52e04
Reviewed-by: Jarek Kobus <jaroslaw.kobus@theqtcompany.com>
Reviewed-by: Karsten Heimrich <karsten.heimrich@theqtcompany.com>
Diffstat (limited to 'src/libs/installer/packagemanagercore_p.cpp')
-rw-r--r-- | src/libs/installer/packagemanagercore_p.cpp | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/src/libs/installer/packagemanagercore_p.cpp b/src/libs/installer/packagemanagercore_p.cpp index 6eb469410..34378fb7a 100644 --- a/src/libs/installer/packagemanagercore_p.cpp +++ b/src/libs/installer/packagemanagercore_p.cpp @@ -560,13 +560,9 @@ void PackageManagerCorePrivate::initialize(const QHash<QString, QString> ¶ms disconnect(this, SIGNAL(uninstallationStarted()), ProgressCoordinator::instance(), SLOT(reset())); connect(this, SIGNAL(uninstallationStarted()), ProgressCoordinator::instance(), SLOT(reset())); - // TODO: We should avoid this in case of installer. - m_packagesInfo->setFileName(componentsXmlPath()); + if (!isInstaller()) + m_packagesInfo->setFileName(componentsXmlPath()); - // Note: force overwriting the application name and version in case we run as installer. - // Both will be set to wrong initial values if we install into an already existing - // installation. This can happen if the components.xml path has not been changed, - // but name or version of the new installer. if (isInstaller() || m_packagesInfo->applicationName().isEmpty()) { // TODO: this seems to be wrong, we should ask for ProductName defaulting to applicationName... m_packagesInfo->setApplicationName(m_data.settings().applicationName()); @@ -2120,28 +2116,32 @@ PackagesList PackageManagerCorePrivate::remotePackages() */ LocalPackagesHash PackageManagerCorePrivate::localInstalledPackages() { - LocalPackagesHash installedPackages; + if (isInstaller()) + return LocalPackagesHash(); - if (!isInstaller()) { - if (!m_packagesInfo->isValid()) { + LocalPackagesHash installedPackages; + if (m_packagesInfo->error() != PackagesInfo::NoError) { + if (m_packagesInfo->fileName().isEmpty()) m_packagesInfo->setFileName(componentsXmlPath()); - if (m_packagesInfo->applicationName().isEmpty()) - m_packagesInfo->setApplicationName(m_data.settings().applicationName()); - if (m_packagesInfo->applicationVersion().isEmpty()) - m_packagesInfo->setApplicationVersion(QLatin1String(QUOTE(IFW_REPOSITORY_FORMAT_VERSION))); - } + else + m_packagesInfo->refresh(); - if (m_packagesInfo->error() != KDUpdater::PackagesInfo::NoError) { - setStatus(PackageManagerCore::Failure, tr("Failure to read packages from: %1.") - .arg(componentsXmlPath())); - } + if (m_packagesInfo->applicationName().isEmpty()) + m_packagesInfo->setApplicationName(m_data.settings().applicationName()); + if (m_packagesInfo->applicationVersion().isEmpty()) + m_packagesInfo->setApplicationVersion(QLatin1String(QUOTE(IFW_REPOSITORY_FORMAT_VERSION))); + } - foreach (const LocalPackage &package, m_packagesInfo->packageInfos()) { - if (statusCanceledOrFailed()) - break; - installedPackages.insert(package.name, package); - } - } + if (m_packagesInfo->error() != PackagesInfo::NoError) { + setStatus(PackageManagerCore::Failure, tr("Failure to read packages from: %1.") + .arg(componentsXmlPath())); + } + + foreach (const LocalPackage &package, m_packagesInfo->packageInfos()) { + if (statusCanceledOrFailed()) + break; + installedPackages.insert(package.name, package); + } return installedPackages; } |