summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/libs/installer/component.cpp9
-rw-r--r--tests/auto/installer/commandlineupdate/data/repositoryWithDependencyToEssential/Updates.xml26
-rw-r--r--tests/auto/installer/commandlineupdate/data/repositoryWithDependencyToEssential/componentA/3.0.0content.7zbin0 -> 257 bytes
-rw-r--r--tests/auto/installer/commandlineupdate/data/repositoryWithDependencyToEssential/componentAutoDependOnA/1.0content.7zbin0 -> 265 bytes
-rw-r--r--tests/auto/installer/commandlineupdate/settings.qrc3
-rw-r--r--tests/auto/installer/commandlineupdate/tst_commandlineupdate.cpp35
6 files changed, 61 insertions, 12 deletions
diff --git a/src/libs/installer/component.cpp b/src/libs/installer/component.cpp
index 061c4e110..16b417b02 100644
--- a/src/libs/installer/component.cpp
+++ b/src/libs/installer/component.cpp
@@ -1295,12 +1295,15 @@ bool Component::isAutoDependOn(const QSet<QString> &componentsToInstall) const
// will be installed
if (packageManagerCore()->foundEssentialUpdate()) {
const QSet<QString> autoDependOnSet = autoDependOnList.toSet();
- if (autoDependOnSet.intersects(componentsToInstall)) {
- return true;
+ if (componentsToInstall.contains(autoDependOnSet)) {
+ foreach (const QString &autoDep, autoDependOnSet) {
+ Component *component = packageManagerCore()->componentByName(autoDep);
+ if (component->value(scEssential, scFalse).toLower() == scTrue)
+ return true;
+ }
}
return false;
}
-
QSet<QString> components = componentsToInstall;
const QStringList installedPackages = d->m_core->localInstalledPackages().keys();
foreach (const QString &name, installedPackages)
diff --git a/tests/auto/installer/commandlineupdate/data/repositoryWithDependencyToEssential/Updates.xml b/tests/auto/installer/commandlineupdate/data/repositoryWithDependencyToEssential/Updates.xml
new file mode 100644
index 000000000..1729f5732
--- /dev/null
+++ b/tests/auto/installer/commandlineupdate/data/repositoryWithDependencyToEssential/Updates.xml
@@ -0,0 +1,26 @@
+<Updates>
+ <ApplicationName>{AnyApplication}</ApplicationName>
+ <ApplicationVersion>1.0.0</ApplicationVersion>
+ <Checksum>false</Checksum>
+ <PackageUpdate>
+ <Name>componentA</Name>
+ <DisplayName>Component A</DisplayName>
+ <Description>This component does not depend on any other component.</Description>
+ <Version>3.0.0</Version>
+ <ReleaseDate>2015-08-25</ReleaseDate>
+ <SortingPriority>100</SortingPriority>
+ <Essential>true</Essential>
+ <UpdateFile UncompressedSize="99" OS="Any" CompressedSize="297"/>
+ <DownloadableArchives>content.7z</DownloadableArchives>
+ </PackageUpdate>
+ <PackageUpdate>
+ <Name>componentAutoDependOnA</Name>
+ <DisplayName>Component, autodepends on A</DisplayName>
+ <Description>Component, autodepends on A</Description>
+ <Version>1.0</Version>
+ <ReleaseDate>2018-03-14</ReleaseDate>
+ <AutoDependOn>componentA</AutoDependOn>
+ <UpdateFile UncompressedSize="99" OS="Any" CompressedSize="305"/>
+ <DownloadableArchives>content.7z</DownloadableArchives>
+ </PackageUpdate>
+</Updates>
diff --git a/tests/auto/installer/commandlineupdate/data/repositoryWithDependencyToEssential/componentA/3.0.0content.7z b/tests/auto/installer/commandlineupdate/data/repositoryWithDependencyToEssential/componentA/3.0.0content.7z
new file mode 100644
index 000000000..e8c35fdea
--- /dev/null
+++ b/tests/auto/installer/commandlineupdate/data/repositoryWithDependencyToEssential/componentA/3.0.0content.7z
Binary files differ
diff --git a/tests/auto/installer/commandlineupdate/data/repositoryWithDependencyToEssential/componentAutoDependOnA/1.0content.7z b/tests/auto/installer/commandlineupdate/data/repositoryWithDependencyToEssential/componentAutoDependOnA/1.0content.7z
new file mode 100644
index 000000000..0f3b123e0
--- /dev/null
+++ b/tests/auto/installer/commandlineupdate/data/repositoryWithDependencyToEssential/componentAutoDependOnA/1.0content.7z
Binary files differ
diff --git a/tests/auto/installer/commandlineupdate/settings.qrc b/tests/auto/installer/commandlineupdate/settings.qrc
index 812727cd2..a0a04a9e3 100644
--- a/tests/auto/installer/commandlineupdate/settings.qrc
+++ b/tests/auto/installer/commandlineupdate/settings.qrc
@@ -31,5 +31,8 @@
<file>data/installPackagesRepositoryUpdate/componentF.subcomponent1.subsubcomponent2/1.0.0content.7z</file>
<file>data/installPackagesRepositoryUpdate/componentF.subcomponent2.subsubcomponent1/1.0.0content.7z</file>
<file>data/installPackagesRepositoryUpdate/componentF.subcomponent2.subsubcomponent2/1.0.0content.7z</file>
+ <file>data/repositoryWithDependencyToEssential/Updates.xml</file>
+ <file>data/repositoryWithDependencyToEssential/componentAutoDependOnA/1.0content.7z</file>
+ <file>data/repositoryWithDependencyToEssential/componentA/3.0.0content.7z</file>
</qresource>
</RCC>
diff --git a/tests/auto/installer/commandlineupdate/tst_commandlineupdate.cpp b/tests/auto/installer/commandlineupdate/tst_commandlineupdate.cpp
index 7a61e9608..e465f8a75 100644
--- a/tests/auto/installer/commandlineupdate/tst_commandlineupdate.cpp
+++ b/tests/auto/installer/commandlineupdate/tst_commandlineupdate.cpp
@@ -86,28 +86,43 @@ private slots:
QCOMPARE(PackageManagerCore::EssentialUpdated, core->updateComponentsSilently(QStringList()));
VerifyInstaller::verifyInstallerResources(m_installDir, "componentA", "2.0.0content.txt");
VerifyInstaller::verifyInstallerResources(m_installDir, "componentE", "1.0.0content.txt");
- //Because of bug QTIFW-1970 componentD got installed too
VerifyInstaller::verifyFileExistence(m_installDir, QStringList() << "components.xml"
- << "installcontentA_update.txt" << "installcontentE.txt" << "installcontentG.txt"
- << "installcontentD_update.txt");
+ << "installcontentA_update.txt" << "installcontentE.txt" << "installcontentG.txt");
VerifyInstaller::verifyInstallerResourceFileDeletion(m_installDir, "componentA", "1.0.0content.txt");
//As we are using the same core in tests, clean the essentalupdate value
core->setFoundEssentialUpdate(false);
}
+ void testUpdateEssentialWithAutodependOnSilently()
+ {
+ setRepository(":///data/repositoryWithDependencyToEssential");
+ QCOMPARE(PackageManagerCore::EssentialUpdated, core->updateComponentsSilently(QStringList()));
+
+ VerifyInstaller::verifyInstallerResources(m_installDir, "componentA", "3.0.0content.txt");
+ VerifyInstaller::verifyInstallerResources(m_installDir, "componentAutoDependOnA", "1.0content.txt");
+ VerifyInstaller::verifyFileExistence(m_installDir, QStringList() << "components.xml"
+ << "installcontentA_update.txt" << "installcontentE.txt" << "installcontentG.txt"
+ << "installContentAutoDependOnA.txt");
+
+ //As we are using the same core in tests, clean the essentalupdate value
+ core->setFoundEssentialUpdate(false);
+ }
+
void testUpdatePackageSilently()
{
setRepository(":///data/installPackagesRepository");
QCOMPARE(PackageManagerCore::Success, core->installSelectedComponentsSilently(QStringList()
<< "componentB"));
QCOMPARE(PackageManagerCore::Success, core->status());
- //Because of bug QTIFW-1970 componentD got uninstalled. It should be installed now
- //as its dependencies are installed.
- VerifyInstaller::verifyInstallerResources(m_installDir, "componentA", "2.0.0content.txt");
+
+ VerifyInstaller::verifyInstallerResources(m_installDir, "componentA", "3.0.0content.txt");
VerifyInstaller::verifyInstallerResources(m_installDir, "componentB", "1.0.0content.txt");
+ VerifyInstaller::verifyInstallerResources(m_installDir, "componentD", "1.0.0content.txt");
+ VerifyInstaller::verifyInstallerResources(m_installDir, "componentAutoDependOnA", "1.0content.txt");
VerifyInstaller::verifyFileExistence(m_installDir, QStringList() << "components.xml"
<< "installcontentA_update.txt" << "installcontentE.txt" << "installcontentG.txt"
- << "installcontentB.txt");
+ << "installcontentB.txt" << "installcontentD.txt"
+ << "installContentAutoDependOnA.txt");
core->commitSessionOperations();
setRepository(":///data/installPackagesRepositoryUpdate");
@@ -115,16 +130,18 @@ private slots:
<< "componentB"));
// componentD is autodependent and cannot be deselected
// componentE is a forced component and thus will be updated
- VerifyInstaller::verifyInstallerResources(m_installDir, "componentA", "2.0.0content.txt");
+ VerifyInstaller::verifyInstallerResources(m_installDir, "componentA", "3.0.0content.txt");
VerifyInstaller::verifyInstallerResources(m_installDir, "componentB", "2.0.0content.txt");
VerifyInstaller::verifyInstallerResources(m_installDir, "componentD", "2.0.0content.txt");
VerifyInstaller::verifyInstallerResources(m_installDir, "componentE", "2.0.0content.txt");
+ VerifyInstaller::verifyInstallerResources(m_installDir, "componentAutoDependOnA", "1.0content.txt");
VerifyInstaller::verifyInstallerResourceFileDeletion(m_installDir, "componentD", "1.0.0content.txt");
VerifyInstaller::verifyInstallerResourceFileDeletion(m_installDir, "componentE", "1.0.0content.txt");
VerifyInstaller::verifyFileExistence(m_installDir, QStringList() << "components.xml" << "installcontentA_update.txt"
<< "installcontentE_update.txt" << "installcontentG.txt"
- << "installcontentB_update.txt" << "installcontentD_update.txt");
+ << "installcontentB_update.txt" << "installcontentD_update.txt"
+ << "installContentAutoDependOnA.txt");
}
void testUpdateNoUpdatesForSelectedPackage()