Skip to content

Commit

Permalink
Fix pool_createwhatprovides wiping out channel specific data but not …
Browse files Browse the repository at this point in the history
…cached string
  • Loading branch information
tl-hbk committed Mar 13, 2024
1 parent 751ff1b commit f58572a
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions libmamba/src/core/pool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,23 @@ namespace mamba
// Poor man's ms repr to match waht the user provided
std::string const repr = fmt::format("{}::{}", ms.channel, ms.conda_build_form());

// Already added, return that id
if (const auto maybe_id = pool.find_string(repr))
const auto maybe_id = pool.find_string(repr);
if (maybe_id)
{
return maybe_id.value();
// Channel specific matchspec already added to libsolv string cache
bool already_added = false;
pool.for_each_whatprovides(
maybe_id.value(),
[&](solv::ObjSolvableViewConst s)
{
already_added = true;
}
);
if (already_added)
{
// whatprovides already added and still present in pool
return maybe_id.value();
}
}

// conda_build_form does **NOT** contain the channel info
Expand Down Expand Up @@ -253,7 +266,7 @@ namespace mamba
}
);

solv::StringId const repr_id = pool.add_string(repr);
solv::StringId const repr_id = maybe_id ? maybe_id.value() : pool.add_string(repr);
// FRAGILE This get deleted when calling ``pool_createwhatprovides`` so care
// must be taken to do it before
// TODO investigate namespace providers
Expand Down

0 comments on commit f58572a

Please sign in to comment.