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