|
|
379fd8 |
From 058b6112374f5feb5ee57488ac3fdbc7666a2016 Mon Sep 17 00:00:00 2001
|
|
|
379fd8 |
From: =?UTF-8?q?Ale=C5=A1=20Mat=C4=9Bj?= <amatej@redhat.com>
|
|
|
379fd8 |
Date: Sun, 25 Apr 2021 19:47:53 +0200
|
|
|
379fd8 |
Subject: [PATCH 10/19] Revert "Call addVersion2Modules(); as late as possible"
|
|
|
379fd8 |
|
|
|
379fd8 |
This reverts commit fe27dba67384e549a3be2a91c4a6cf1151113157.
|
|
|
379fd8 |
---
|
|
|
379fd8 |
libdnf/module/ModulePackageContainer.cpp | 28 +++---------------------
|
|
|
379fd8 |
1 file changed, 3 insertions(+), 25 deletions(-)
|
|
|
379fd8 |
|
|
|
379fd8 |
diff --git a/libdnf/module/ModulePackageContainer.cpp b/libdnf/module/ModulePackageContainer.cpp
|
|
|
379fd8 |
index 893b839a..6ee2b68f 100644
|
|
|
379fd8 |
--- a/libdnf/module/ModulePackageContainer.cpp
|
|
|
379fd8 |
+++ b/libdnf/module/ModulePackageContainer.cpp
|
|
|
379fd8 |
@@ -346,6 +346,7 @@ ModulePackageContainer::add(DnfSack * sack)
|
|
|
379fd8 |
exception.what()));
|
|
|
379fd8 |
}
|
|
|
379fd8 |
}
|
|
|
379fd8 |
+ pImpl->addVersion2Modules();
|
|
|
379fd8 |
}
|
|
|
379fd8 |
|
|
|
379fd8 |
void ModulePackageContainer::addDefaultsFromDisk()
|
|
|
379fd8 |
@@ -427,7 +428,6 @@ void ModulePackageContainer::createConflictsBetweenStreams()
|
|
|
379fd8 |
|
|
|
379fd8 |
bool ModulePackageContainer::empty() const noexcept
|
|
|
379fd8 |
{
|
|
|
379fd8 |
- pImpl->addVersion2Modules();
|
|
|
379fd8 |
return pImpl->modules.empty();
|
|
|
379fd8 |
}
|
|
|
379fd8 |
|
|
|
379fd8 |
@@ -521,13 +521,11 @@ bool ModulePackageContainer::isDisabled(const ModulePackage * module)
|
|
|
379fd8 |
std::vector<std::string> ModulePackageContainer::getDefaultProfiles(std::string moduleName,
|
|
|
379fd8 |
std::string moduleStream)
|
|
|
379fd8 |
{
|
|
|
379fd8 |
- pImpl->addVersion2Modules();
|
|
|
379fd8 |
return pImpl->moduleMetadata.getDefaultProfiles(moduleName, moduleStream);
|
|
|
379fd8 |
}
|
|
|
379fd8 |
|
|
|
379fd8 |
const std::string & ModulePackageContainer::getDefaultStream(const std::string &name) const
|
|
|
379fd8 |
{
|
|
|
379fd8 |
- pImpl->addVersion2Modules();
|
|
|
379fd8 |
auto it = pImpl->moduleDefaults.find(name);
|
|
|
379fd8 |
if (it == pImpl->moduleDefaults.end()) {
|
|
|
379fd8 |
return EMPTY_RESULT;
|
|
|
379fd8 |
@@ -537,7 +535,6 @@ const std::string & ModulePackageContainer::getDefaultStream(const std::string &
|
|
|
379fd8 |
|
|
|
379fd8 |
const std::string & ModulePackageContainer::getEnabledStream(const std::string &name)
|
|
|
379fd8 |
{
|
|
|
379fd8 |
- pImpl->addVersion2Modules();
|
|
|
379fd8 |
return pImpl->persistor->getStream(name);
|
|
|
379fd8 |
}
|
|
|
379fd8 |
|
|
|
379fd8 |
@@ -547,7 +544,6 @@ const std::string & ModulePackageContainer::getEnabledStream(const std::string &
|
|
|
379fd8 |
bool
|
|
|
379fd8 |
ModulePackageContainer::enable(const std::string &name, const std::string & stream, const bool count)
|
|
|
379fd8 |
{
|
|
|
379fd8 |
- pImpl->addVersion2Modules();
|
|
|
379fd8 |
if (count) {
|
|
|
379fd8 |
pImpl->persistor->getEntry(name).second.streamChangesNum++;
|
|
|
379fd8 |
}
|
|
|
379fd8 |
@@ -573,7 +569,6 @@ ModulePackageContainer::enable(const ModulePackage * module, const bool count)
|
|
|
379fd8 |
*/
|
|
|
379fd8 |
void ModulePackageContainer::disable(const std::string & name, const bool count)
|
|
|
379fd8 |
{
|
|
|
379fd8 |
- pImpl->addVersion2Modules();
|
|
|
379fd8 |
if (count) {
|
|
|
379fd8 |
pImpl->persistor->getEntry(name).second.streamChangesNum++;
|
|
|
379fd8 |
}
|
|
|
379fd8 |
@@ -594,11 +589,11 @@ void ModulePackageContainer::disable(const ModulePackage * module, const bool co
|
|
|
379fd8 |
*/
|
|
|
379fd8 |
void ModulePackageContainer::reset(const std::string & name, const bool count)
|
|
|
379fd8 |
{
|
|
|
379fd8 |
- pImpl->addVersion2Modules();
|
|
|
379fd8 |
if (count) {
|
|
|
379fd8 |
pImpl->persistor->getEntry(name).second.streamChangesNum++;
|
|
|
379fd8 |
}
|
|
|
379fd8 |
pImpl->persistor->changeState(name, ModuleState::UNKNOWN);
|
|
|
379fd8 |
+
|
|
|
379fd8 |
pImpl->persistor->changeStream(name, "");
|
|
|
379fd8 |
auto & profiles = pImpl->persistor->getEntry(name).second.profiles;
|
|
|
379fd8 |
profiles.clear();
|
|
|
379fd8 |
@@ -638,7 +633,6 @@ bool ModulePackageContainer::isChanged()
|
|
|
379fd8 |
void ModulePackageContainer::install(const std::string &name, const std::string &stream,
|
|
|
379fd8 |
const std::string &profile)
|
|
|
379fd8 |
{
|
|
|
379fd8 |
- pImpl->addVersion2Modules();
|
|
|
379fd8 |
for (const auto &iter : pImpl->modules) {
|
|
|
379fd8 |
auto modulePackage = iter.second.get();
|
|
|
379fd8 |
if (modulePackage->getName() == name && modulePackage->getStream() == stream) {
|
|
|
379fd8 |
@@ -656,7 +650,6 @@ void ModulePackageContainer::install(const ModulePackage * module, const std::st
|
|
|
379fd8 |
void ModulePackageContainer::uninstall(const std::string &name, const std::string &stream,
|
|
|
379fd8 |
const std::string &profile)
|
|
|
379fd8 |
{
|
|
|
379fd8 |
- pImpl->addVersion2Modules();
|
|
|
379fd8 |
for (const auto &iter : pImpl->modules) {
|
|
|
379fd8 |
auto modulePackage = iter.second.get();
|
|
|
379fd8 |
if (modulePackage->getName() == name && modulePackage->getStream() == stream) {
|
|
|
379fd8 |
@@ -744,7 +737,6 @@ ModulePackageContainer::query(Nsvcap& moduleNevra)
|
|
|
379fd8 |
std::vector<ModulePackage *>
|
|
|
379fd8 |
ModulePackageContainer::query(std::string subject)
|
|
|
379fd8 |
{
|
|
|
379fd8 |
- pImpl->addVersion2Modules();
|
|
|
379fd8 |
// Alternatively a search using module provides could be performed
|
|
|
379fd8 |
std::vector<ModulePackage *> result;
|
|
|
379fd8 |
Query query(pImpl->moduleSack, Query::ExcludeFlags::IGNORE_EXCLUDES);
|
|
|
379fd8 |
@@ -765,7 +757,6 @@ std::vector<ModulePackage *>
|
|
|
379fd8 |
ModulePackageContainer::query(std::string name, std::string stream, std::string version,
|
|
|
379fd8 |
std::string context, std::string arch)
|
|
|
379fd8 |
{
|
|
|
379fd8 |
- pImpl->addVersion2Modules();
|
|
|
379fd8 |
// Alternatively a search using module provides could be performed
|
|
|
379fd8 |
std::vector<ModulePackage *> result;
|
|
|
379fd8 |
Query query(pImpl->moduleSack, Query::ExcludeFlags::IGNORE_EXCLUDES);
|
|
|
379fd8 |
@@ -847,7 +838,6 @@ ModulePackageContainer::getModuleState(const std::string& name)
|
|
|
379fd8 |
|
|
|
379fd8 |
std::set<std::string> ModulePackageContainer::getInstalledPkgNames()
|
|
|
379fd8 |
{
|
|
|
379fd8 |
- pImpl->addVersion2Modules();
|
|
|
379fd8 |
auto moduleNames = pImpl->persistor->getAllModuleNames();
|
|
|
379fd8 |
std::set<std::string> pkgNames;
|
|
|
379fd8 |
for (auto & moduleName: moduleNames) {
|
|
|
379fd8 |
@@ -1029,7 +1019,6 @@ std::vector<std::vector<std::vector<ModulePackage *>>>
|
|
|
379fd8 |
ModulePackageContainer::getLatestModulesPerRepo(ModuleState moduleFilter,
|
|
|
379fd8 |
std::vector<ModulePackage *> modulePackages)
|
|
|
379fd8 |
{
|
|
|
379fd8 |
- pImpl->addVersion2Modules();
|
|
|
379fd8 |
if (modulePackages.empty()) {
|
|
|
379fd8 |
return {};
|
|
|
379fd8 |
}
|
|
|
379fd8 |
@@ -1113,7 +1102,6 @@ ModulePackageContainer::getLatestModulesPerRepo(ModuleState moduleFilter,
|
|
|
379fd8 |
std::pair<std::vector<std::vector<std::string>>, ModulePackageContainer::ModuleErrorType>
|
|
|
379fd8 |
ModulePackageContainer::resolveActiveModulePackages(bool debugSolver)
|
|
|
379fd8 |
{
|
|
|
379fd8 |
- pImpl->addVersion2Modules();
|
|
|
379fd8 |
dnf_sack_reset_excludes(pImpl->moduleSack);
|
|
|
379fd8 |
std::vector<ModulePackage *> packages;
|
|
|
379fd8 |
|
|
|
379fd8 |
@@ -1164,7 +1152,6 @@ bool ModulePackageContainer::isModuleActive(const ModulePackage * modulePackage)
|
|
|
379fd8 |
|
|
|
379fd8 |
std::vector<ModulePackage *> ModulePackageContainer::getModulePackages()
|
|
|
379fd8 |
{
|
|
|
379fd8 |
- pImpl->addVersion2Modules();
|
|
|
379fd8 |
std::vector<ModulePackage *> values;
|
|
|
379fd8 |
const auto & modules = pImpl->modules;
|
|
|
379fd8 |
std::transform(
|
|
|
379fd8 |
@@ -1186,56 +1173,47 @@ void ModulePackageContainer::rollback()
|
|
|
379fd8 |
|
|
|
379fd8 |
std::map<std::string, std::string> ModulePackageContainer::getEnabledStreams()
|
|
|
379fd8 |
{
|
|
|
379fd8 |
- pImpl->addVersion2Modules();
|
|
|
379fd8 |
return pImpl->persistor->getEnabledStreams();
|
|
|
379fd8 |
}
|
|
|
379fd8 |
|
|
|
379fd8 |
std::vector<std::string> ModulePackageContainer::getDisabledModules()
|
|
|
379fd8 |
{
|
|
|
379fd8 |
- pImpl->addVersion2Modules();
|
|
|
379fd8 |
return pImpl->persistor->getDisabledModules();
|
|
|
379fd8 |
}
|
|
|
379fd8 |
|
|
|
379fd8 |
std::map<std::string, std::string> ModulePackageContainer::getDisabledStreams()
|
|
|
379fd8 |
{
|
|
|
379fd8 |
- pImpl->addVersion2Modules();
|
|
|
379fd8 |
return pImpl->persistor->getDisabledStreams();
|
|
|
379fd8 |
}
|
|
|
379fd8 |
|
|
|
379fd8 |
std::vector<std::string> ModulePackageContainer::getResetModules()
|
|
|
379fd8 |
{
|
|
|
379fd8 |
- pImpl->addVersion2Modules();
|
|
|
379fd8 |
return pImpl->persistor->getResetModules();
|
|
|
379fd8 |
}
|
|
|
379fd8 |
|
|
|
379fd8 |
std::map<std::string, std::string> ModulePackageContainer::getResetStreams()
|
|
|
379fd8 |
{
|
|
|
379fd8 |
- pImpl->addVersion2Modules();
|
|
|
379fd8 |
return pImpl->persistor->getResetStreams();
|
|
|
379fd8 |
}
|
|
|
379fd8 |
|
|
|
379fd8 |
std::map<std::string, std::pair<std::string, std::string>>
|
|
|
379fd8 |
ModulePackageContainer::getSwitchedStreams()
|
|
|
379fd8 |
{
|
|
|
379fd8 |
- pImpl->addVersion2Modules();
|
|
|
379fd8 |
return pImpl->persistor->getSwitchedStreams();
|
|
|
379fd8 |
}
|
|
|
379fd8 |
|
|
|
379fd8 |
std::map<std::string, std::vector<std::string>> ModulePackageContainer::getInstalledProfiles()
|
|
|
379fd8 |
{
|
|
|
379fd8 |
- pImpl->addVersion2Modules();
|
|
|
379fd8 |
return pImpl->persistor->getInstalledProfiles();
|
|
|
379fd8 |
}
|
|
|
379fd8 |
|
|
|
379fd8 |
std::vector<std::string> ModulePackageContainer::getInstalledProfiles(std::string moduleName)
|
|
|
379fd8 |
{
|
|
|
379fd8 |
- pImpl->addVersion2Modules();
|
|
|
379fd8 |
return pImpl->persistor->getProfiles(moduleName);
|
|
|
379fd8 |
}
|
|
|
379fd8 |
|
|
|
379fd8 |
std::map<std::string, std::vector<std::string>> ModulePackageContainer::getRemovedProfiles()
|
|
|
379fd8 |
{
|
|
|
379fd8 |
- pImpl->addVersion2Modules();
|
|
|
379fd8 |
return pImpl->persistor->getRemovedProfiles();
|
|
|
379fd8 |
}
|
|
|
379fd8 |
const std::string &
|
|
|
379fd8 |
@@ -1641,7 +1619,7 @@ ModulePackageContainer::Impl::ModulePersistor::getRemovedProfiles()
|
|
|
379fd8 |
void ModulePackageContainer::loadFailSafeData()
|
|
|
379fd8 |
{
|
|
|
379fd8 |
auto persistor = pImpl->persistor->configs;
|
|
|
379fd8 |
-
|
|
|
379fd8 |
+
|
|
|
379fd8 |
std::map<std::string, std::pair<std::string, bool>> enabledStreams;
|
|
|
379fd8 |
for (auto & nameConfig: persistor) {
|
|
|
379fd8 |
if (nameConfig.second.second.state == ModuleState::ENABLED) {
|
|
|
379fd8 |
--
|
|
|
379fd8 |
2.31.1
|
|
|
379fd8 |
|