Skip to content

Commit

Permalink
Fix repodata track_features parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
AntoinePrv committed Aug 31, 2023
1 parent 698c420 commit 7fa9448
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions libmamba/src/core/repo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ extern "C" // Incomplete header
#include "mamba/core/prefix_data.hpp"
#include "mamba/core/repo.hpp"
#include "mamba/core/util.hpp"
#include "mamba/util/string.hpp"
#include "mamba/util/url_manip.hpp"
#include "solv-cpp/pool.hpp"
#include "solv-cpp/repo.hpp"
Expand Down Expand Up @@ -133,6 +134,13 @@ namespace mamba
solv.add_self_provide();
}

auto lsplit_track_features(std::string_view features)
{
constexpr auto is_sep = [](char c) -> bool { return (c == ',') || util::is_space(c); };
auto [_, tail] = util::lstrip_if_parts(features, is_sep);
return util::lstrip_if_parts(tail, [&](char c) { return !is_sep(c); });
}

template <typename Json, typename T>
void deserialize_maybe_missing(Json&& j, std::string_view name, T& t)
{
Expand Down Expand Up @@ -313,6 +321,15 @@ namespace mamba
}
}
}
else if (iter->is_string())
{
auto splits = lsplit_track_features(iter->get<std::string_view>());
while (!splits[0].empty())
{
solv.add_track_feature(splits[0]);
splits = lsplit_track_features(splits[1]);
}
}
}

solv.add_self_provide();
Expand Down

0 comments on commit 7fa9448

Please sign in to comment.