mirror of https://github.com/mamba-org/mamba.git
maint: Update clang-format to v19 (#3600)
This commit is contained in:
parent
6654e15633
commit
ad9b2d6b88
|
@ -34,7 +34,7 @@ repos:
|
|||
- id: blacken-docs
|
||||
additional_dependencies: [black==24.10.0]
|
||||
- repo: https://github.com/pre-commit/mirrors-clang-format
|
||||
rev: v18.1.2
|
||||
rev: v19.1.3
|
||||
hooks:
|
||||
- id: clang-format
|
||||
args: [--style=file]
|
||||
|
|
|
@ -71,8 +71,8 @@ namespace solv
|
|||
*/
|
||||
[[nodiscard]] auto problem_rules(ProblemId id) const -> ObjQueue;
|
||||
[[nodiscard]] auto get_rule_info(const ObjPool& pool, RuleId id) const -> ObjRuleInfo;
|
||||
[[nodiscard]] auto
|
||||
rule_info_to_string(const ObjPool& pool, const ObjRuleInfo& id) const -> std::string;
|
||||
[[nodiscard]] auto rule_info_to_string(const ObjPool& pool, const ObjRuleInfo& id) const
|
||||
-> std::string;
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
@ -37,16 +37,16 @@ namespace solv
|
|||
*
|
||||
* Negative solvable ids are use to mean that the solvable must be removed.
|
||||
*/
|
||||
[[nodiscard]] static auto
|
||||
from_solvables(const ObjPool& pool, const ObjQueue& solvables) -> ObjTransaction;
|
||||
[[nodiscard]] static auto from_solvables(const ObjPool& pool, const ObjQueue& solvables)
|
||||
-> ObjTransaction;
|
||||
|
||||
/**
|
||||
* Create a transaction from the result of a solver run.
|
||||
*
|
||||
* The solver must be solved.
|
||||
*/
|
||||
[[nodiscard]] static auto
|
||||
from_solver(const ObjPool& pool, const ObjSolver& solver) -> ObjTransaction;
|
||||
[[nodiscard]] static auto from_solver(const ObjPool& pool, const ObjSolver& solver)
|
||||
-> ObjTransaction;
|
||||
|
||||
ObjTransaction(const ObjPool& pool);
|
||||
ObjTransaction(ObjTransaction&&) noexcept = default;
|
||||
|
|
|
@ -118,8 +118,8 @@ namespace solv
|
|||
return (id == 0) ? std::nullopt : std::optional(DependencyId{ id });
|
||||
}
|
||||
|
||||
auto
|
||||
ObjPoolView::add_dependency(StringId name_id, RelationFlag flag, StringId version_id) -> DependencyId
|
||||
auto ObjPoolView::add_dependency(StringId name_id, RelationFlag flag, StringId version_id)
|
||||
-> DependencyId
|
||||
{
|
||||
// Note: libsolv cannot report failure to allocate
|
||||
const ::Id id = ::pool_rel2id(
|
||||
|
@ -181,8 +181,8 @@ namespace solv
|
|||
return solvables;
|
||||
}
|
||||
|
||||
auto
|
||||
ObjPoolView::what_matches_dep(KeyNameId key, DependencyId dep, DependencyMarker marker) const -> ObjQueue
|
||||
auto ObjPoolView::what_matches_dep(KeyNameId key, DependencyId dep, DependencyMarker marker) const
|
||||
-> ObjQueue
|
||||
{
|
||||
ObjQueue solvables = {};
|
||||
::pool_whatmatchesdep(const_cast<::Pool*>(raw()), key, dep, solvables.raw(), marker);
|
||||
|
|
|
@ -228,8 +228,8 @@ namespace solv
|
|||
};
|
||||
}
|
||||
|
||||
auto
|
||||
ObjSolver::rule_info_to_string(const ObjPool& /* pool */, const ObjRuleInfo& ri) const -> std::string
|
||||
auto ObjSolver::rule_info_to_string(const ObjPool& /* pool */, const ObjRuleInfo& ri) const
|
||||
-> std::string
|
||||
{
|
||||
// pool is captured inside solver so we take it as a parameter to be explicit.
|
||||
return ::solver_ruleinfo2str(
|
||||
|
|
|
@ -41,8 +41,8 @@ namespace solv
|
|||
return *this;
|
||||
}
|
||||
|
||||
auto
|
||||
ObjTransaction::from_solvables(const ObjPool& pool, const ObjQueue& solvables) -> ObjTransaction
|
||||
auto ObjTransaction::from_solvables(const ObjPool& pool, const ObjQueue& solvables)
|
||||
-> ObjTransaction
|
||||
{
|
||||
return ObjTransaction{ ::transaction_create_decisionq(
|
||||
const_cast<::Pool*>(pool.raw()),
|
||||
|
@ -103,8 +103,8 @@ namespace solv
|
|||
return ::transaction_type(const_cast<::Transaction*>(raw()), step, mode);
|
||||
}
|
||||
|
||||
auto
|
||||
ObjTransaction::step_newer(const ObjPool& pool, SolvableId step) const -> std::optional<SolvableId>
|
||||
auto ObjTransaction::step_newer(const ObjPool& pool, SolvableId step) const
|
||||
-> std::optional<SolvableId>
|
||||
{
|
||||
assert_same_pool(pool, *this);
|
||||
if (const auto solvable = pool.get_solvable(step); solvable && solvable->installed())
|
||||
|
|
|
@ -48,8 +48,8 @@ namespace solv::test
|
|||
return attrs(a) >= attrs(b);
|
||||
}
|
||||
|
||||
auto
|
||||
add_simple_package(solv::ObjPool& pool, solv::ObjRepoView& repo, const SimplePkg& pkg) -> solv::SolvableId
|
||||
auto add_simple_package(solv::ObjPool& pool, solv::ObjRepoView& repo, const SimplePkg& pkg)
|
||||
-> solv::SolvableId
|
||||
{
|
||||
auto [solv_id, solv] = repo.add_solvable();
|
||||
solv.set_name(pkg.name);
|
||||
|
|
|
@ -94,8 +94,8 @@ namespace mamba
|
|||
|
||||
using Database = solver::libsolv::Database;
|
||||
|
||||
[[nodiscard]] static auto
|
||||
find(Database& db, const std::vector<std::string>& queries) -> QueryResult;
|
||||
[[nodiscard]] static auto find(Database& db, const std::vector<std::string>& queries)
|
||||
-> QueryResult;
|
||||
|
||||
[[nodiscard]] static auto whoneeds(Database& db, std::string query, bool tree) -> QueryResult;
|
||||
|
||||
|
|
|
@ -64,8 +64,8 @@ namespace mamba::download
|
|||
};
|
||||
|
||||
template <class MirrorType, class... Args>
|
||||
auto
|
||||
mirror_map::create_unique_mirror(const std::string& mirror_name, Args&&... args) -> MirrorType&
|
||||
auto mirror_map::create_unique_mirror(const std::string& mirror_name, Args&&... args)
|
||||
-> MirrorType&
|
||||
{
|
||||
static_assert(std::is_base_of_v<Mirror, MirrorType>);
|
||||
|
||||
|
|
|
@ -100,11 +100,9 @@ namespace mamba::solver::libsolv
|
|||
PipAsPythonDependency add = PipAsPythonDependency::No
|
||||
) -> RepoInfo;
|
||||
|
||||
auto native_serialize_repo(
|
||||
const RepoInfo& repo,
|
||||
const fs::u8path& path,
|
||||
const RepodataOrigin& metadata
|
||||
) -> expected_t<RepoInfo>;
|
||||
auto
|
||||
native_serialize_repo(const RepoInfo& repo, const fs::u8path& path, const RepodataOrigin& metadata)
|
||||
-> expected_t<RepoInfo>;
|
||||
|
||||
[[nodiscard]] auto installed_repo() const -> std::optional<RepoInfo>;
|
||||
|
||||
|
@ -162,11 +160,11 @@ namespace mamba::solver::libsolv
|
|||
|
||||
[[nodiscard]] auto packages_in_repo(RepoInfo repo) const -> std::vector<PackageId>;
|
||||
|
||||
[[nodiscard]] auto
|
||||
packages_matching_ids(const specs::MatchSpec& ms) -> std::vector<PackageId>;
|
||||
[[nodiscard]] auto packages_matching_ids(const specs::MatchSpec& ms)
|
||||
-> std::vector<PackageId>;
|
||||
|
||||
[[nodiscard]] auto
|
||||
packages_depending_on_ids(const specs::MatchSpec& ms) -> std::vector<PackageId>;
|
||||
[[nodiscard]] auto packages_depending_on_ids(const specs::MatchSpec& ms)
|
||||
-> std::vector<PackageId>;
|
||||
};
|
||||
|
||||
/********************
|
||||
|
@ -191,11 +189,9 @@ namespace mamba::solver::libsolv
|
|||
}
|
||||
|
||||
template <typename Range>
|
||||
auto Database::add_repo_from_packages(
|
||||
const Range& packages,
|
||||
std::string_view name,
|
||||
PipAsPythonDependency add
|
||||
) -> RepoInfo
|
||||
auto
|
||||
Database::add_repo_from_packages(const Range& packages, std::string_view name, PipAsPythonDependency add)
|
||||
-> RepoInfo
|
||||
{
|
||||
return add_repo_from_packages(packages.begin(), packages.end(), name, add);
|
||||
}
|
||||
|
|
|
@ -71,8 +71,8 @@ namespace mamba::specs
|
|||
BuildNumberPredicate(BuildNumber ver, BinaryOperator op);
|
||||
|
||||
friend auto equal(free_interval, free_interval) -> bool;
|
||||
friend auto
|
||||
operator==(const BuildNumberPredicate& lhs, const BuildNumberPredicate& rhs) -> bool;
|
||||
friend auto operator==(const BuildNumberPredicate& lhs, const BuildNumberPredicate& rhs)
|
||||
-> bool;
|
||||
friend struct ::fmt::formatter<BuildNumberPredicate>;
|
||||
};
|
||||
|
||||
|
|
|
@ -39,8 +39,8 @@ namespace mamba::specs
|
|||
/**
|
||||
* Remove the last element of the '/'-separated name.
|
||||
*/
|
||||
[[nodiscard]] auto
|
||||
weaken_key(std::string_view key) const -> std::optional<std::string_view>;
|
||||
[[nodiscard]] auto weaken_key(std::string_view key) const
|
||||
-> std::optional<std::string_view>;
|
||||
};
|
||||
|
||||
template <typename Key, typename Value>
|
||||
|
@ -95,8 +95,8 @@ namespace mamba::specs
|
|||
|
||||
[[nodiscard]] auto mirror_urls() const -> const std::vector<CondaURL>&;
|
||||
[[nodiscard]] auto platform_mirror_urls() const -> std::vector<CondaURL>;
|
||||
[[nodiscard]] auto
|
||||
platform_mirror_urls(const std::string_view platform) const -> std::vector<CondaURL>;
|
||||
[[nodiscard]] auto platform_mirror_urls(const std::string_view platform) const
|
||||
-> std::vector<CondaURL>;
|
||||
|
||||
[[nodiscard]] auto url() const -> const CondaURL&;
|
||||
auto clear_url() -> const CondaURL;
|
||||
|
|
|
@ -65,8 +65,8 @@ struct fmt::formatter<mamba::specs::GlobSpec>
|
|||
{
|
||||
auto parse(format_parse_context& ctx) -> decltype(ctx.begin());
|
||||
|
||||
auto
|
||||
format(const ::mamba::specs::GlobSpec& spec, format_context& ctx) const -> decltype(ctx.out());
|
||||
auto format(const ::mamba::specs::GlobSpec& spec, format_context& ctx) const
|
||||
-> decltype(ctx.out());
|
||||
};
|
||||
|
||||
template <>
|
||||
|
|
|
@ -226,8 +226,8 @@ struct fmt::formatter<::mamba::specs::MatchSpec>
|
|||
{
|
||||
auto parse(format_parse_context& ctx) -> decltype(ctx.begin());
|
||||
|
||||
auto
|
||||
format(const ::mamba::specs::MatchSpec& spec, format_context& ctx) const -> decltype(ctx.out());
|
||||
auto format(const ::mamba::specs::MatchSpec& spec, format_context& ctx) const
|
||||
-> decltype(ctx.out());
|
||||
};
|
||||
|
||||
/*********************************
|
||||
|
|
|
@ -53,11 +53,11 @@ namespace mamba::specs
|
|||
return static_cast<std::size_t>(KnownPlatform::count_);
|
||||
}
|
||||
|
||||
[[nodiscard]] constexpr auto
|
||||
known_platforms() -> std::array<KnownPlatform, known_platforms_count()>;
|
||||
[[nodiscard]] constexpr auto known_platforms()
|
||||
-> std::array<KnownPlatform, known_platforms_count()>;
|
||||
|
||||
[[nodiscard]] constexpr auto
|
||||
known_platform_names() -> std::array<std::string_view, known_platforms_count()>;
|
||||
[[nodiscard]] constexpr auto known_platform_names()
|
||||
-> std::array<std::string_view, known_platforms_count()>;
|
||||
|
||||
/**
|
||||
* Convert the enumeration to its conda string.
|
||||
|
|
|
@ -71,8 +71,8 @@ struct fmt::formatter<mamba::specs::RegexSpec>
|
|||
{
|
||||
auto parse(format_parse_context& ctx) -> decltype(ctx.begin());
|
||||
|
||||
auto
|
||||
format(const ::mamba::specs::RegexSpec& spec, format_context& ctx) const -> decltype(ctx.out());
|
||||
auto format(const ::mamba::specs::RegexSpec& spec, format_context& ctx) const
|
||||
-> decltype(ctx.out());
|
||||
};
|
||||
|
||||
template <>
|
||||
|
|
|
@ -37,8 +37,8 @@ namespace mamba::specs
|
|||
[[nodiscard]] static auto make_less_equal(Version ver) -> VersionPredicate;
|
||||
[[nodiscard]] static auto make_starts_with(Version ver) -> VersionPredicate;
|
||||
[[nodiscard]] static auto make_not_starts_with(Version ver) -> VersionPredicate;
|
||||
[[nodiscard]] static auto
|
||||
make_compatible_with(Version ver, std::size_t level) -> VersionPredicate;
|
||||
[[nodiscard]] static auto make_compatible_with(Version ver, std::size_t level)
|
||||
-> VersionPredicate;
|
||||
|
||||
/** Construct an free interval. */
|
||||
VersionPredicate() = default;
|
||||
|
@ -243,8 +243,8 @@ struct fmt::formatter<mamba::specs::VersionSpec>
|
|||
|
||||
auto parse(format_parse_context& ctx) -> decltype(ctx.begin());
|
||||
|
||||
auto
|
||||
format(const ::mamba::specs::VersionSpec& spec, format_context& ctx) const -> decltype(ctx.out());
|
||||
auto format(const ::mamba::specs::VersionSpec& spec, format_context& ctx) const
|
||||
-> decltype(ctx.out());
|
||||
};
|
||||
|
||||
template <>
|
||||
|
|
|
@ -51,14 +51,14 @@ namespace mamba::util
|
|||
/**
|
||||
* Convert two hexadecimal characters to a byte.
|
||||
*/
|
||||
[[nodiscard]] auto
|
||||
two_hex_to_byte(char high, char low, EncodingError& error) noexcept -> std::byte;
|
||||
[[nodiscard]] auto two_hex_to_byte(char high, char low, EncodingError& error) noexcept
|
||||
-> std::byte;
|
||||
|
||||
/**
|
||||
* Convert two hexadecimal characters to a byte.
|
||||
*/
|
||||
[[nodiscard]] auto
|
||||
two_hex_to_byte(char high, char low) noexcept -> tl::expected<std::byte, EncodingError>;
|
||||
[[nodiscard]] auto two_hex_to_byte(char high, char low) noexcept
|
||||
-> tl::expected<std::byte, EncodingError>;
|
||||
|
||||
/**
|
||||
* Convert hexadecimal characters to a bytes and write it to the given output.
|
||||
|
@ -74,8 +74,8 @@ namespace mamba::util
|
|||
* The number of hexadecimal characters must be even and out must be allocated with half the
|
||||
* number of hexadecimal characters.
|
||||
*/
|
||||
[[nodiscard]] auto
|
||||
hex_to_bytes_to(std::string_view hex, std::byte* out) noexcept -> tl::expected<void, EncodingError>;
|
||||
[[nodiscard]] auto hex_to_bytes_to(std::string_view hex, std::byte* out) noexcept
|
||||
-> tl::expected<void, EncodingError>;
|
||||
|
||||
/**
|
||||
* Escape reserved URL reserved characters with '%' encoding.
|
||||
|
@ -100,13 +100,13 @@ namespace mamba::util
|
|||
/**
|
||||
* Convert a string to base64 encoding.
|
||||
*/
|
||||
[[nodiscard]] auto
|
||||
encode_base64(std::string_view input) -> tl::expected<std::string, EncodingError>;
|
||||
[[nodiscard]] auto encode_base64(std::string_view input)
|
||||
-> tl::expected<std::string, EncodingError>;
|
||||
|
||||
/**
|
||||
* Convert a string from base64 back to its original representation.
|
||||
*/
|
||||
[[nodiscard]] auto
|
||||
decode_base64(std::string_view input) -> tl::expected<std::string, EncodingError>;
|
||||
[[nodiscard]] auto decode_base64(std::string_view input)
|
||||
-> tl::expected<std::string, EncodingError>;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -108,8 +108,8 @@ namespace mamba::util
|
|||
* Return the full path of a program from its name if found inside the given directories.
|
||||
*/
|
||||
template <typename Iter>
|
||||
[[nodiscard]] auto
|
||||
which_in(std::string_view exe, Iter search_path_first, Iter search_path_last) -> fs::u8path;
|
||||
[[nodiscard]] auto which_in(std::string_view exe, Iter search_path_first, Iter search_path_last)
|
||||
-> fs::u8path;
|
||||
|
||||
/**
|
||||
* Return the full path of a program from its name if found inside the given directories.
|
||||
|
@ -139,8 +139,8 @@ namespace mamba::util
|
|||
{
|
||||
[[nodiscard]] auto which_in_one(const fs::u8path& exe, const fs::u8path& dir) -> fs::u8path;
|
||||
|
||||
[[nodiscard]] auto
|
||||
which_in_split(const fs::u8path& exe, std::string_view paths) -> fs::u8path;
|
||||
[[nodiscard]] auto which_in_split(const fs::u8path& exe, std::string_view paths)
|
||||
-> fs::u8path;
|
||||
}
|
||||
|
||||
template <typename Iter>
|
||||
|
|
|
@ -87,8 +87,8 @@ namespace mamba::util
|
|||
* The children must have been previously added to the tree and their IDs can be used
|
||||
* to point to them.
|
||||
*/
|
||||
auto
|
||||
add_branch(const branch_type& branch, idx_type left_child, idx_type right_child) -> idx_type;
|
||||
auto add_branch(const branch_type& branch, idx_type left_child, idx_type right_child)
|
||||
-> idx_type;
|
||||
auto add_branch(branch_type&& branch, idx_type left_child, idx_type right_child) -> idx_type;
|
||||
|
||||
[[nodiscard]] auto node(idx_type idx) const -> const node_type&;
|
||||
|
@ -258,11 +258,9 @@ namespace mamba::util
|
|||
}
|
||||
|
||||
template <typename B, typename L>
|
||||
auto flat_binary_tree<B, L>::add_branch(
|
||||
const branch_type& branch,
|
||||
idx_type left_child,
|
||||
idx_type right_child
|
||||
) -> idx_type
|
||||
auto
|
||||
flat_binary_tree<B, L>::add_branch(const branch_type& branch, idx_type left_child, idx_type right_child)
|
||||
-> idx_type
|
||||
{
|
||||
return add_branch_impl(branch, left_child, right_child);
|
||||
}
|
||||
|
|
|
@ -167,8 +167,8 @@ namespace mamba::util
|
|||
void reserve(size_type size);
|
||||
|
||||
template <typename UnaryFunc = identity>
|
||||
[[nodiscard]] auto
|
||||
evaluate(UnaryFunc&& var_evaluator = {}, bool empty_val = true) const -> bool;
|
||||
[[nodiscard]] auto evaluate(UnaryFunc&& var_evaluator = {}, bool empty_val = true) const
|
||||
-> bool;
|
||||
|
||||
template <typename UnaryFunc>
|
||||
void infix_for_each(UnaryFunc&& func) const;
|
||||
|
|
|
@ -127,14 +127,14 @@ namespace mamba::util
|
|||
friend auto operator==(const flat_set<K, C, A>& lhs, const flat_set<K, C, A>& rhs) -> bool;
|
||||
|
||||
template <typename K, typename C, typename A>
|
||||
friend auto
|
||||
set_union(const flat_set<K, C, A>&, const flat_set<K, C, A>&) -> flat_set<K, C, A>;
|
||||
friend auto set_union(const flat_set<K, C, A>&, const flat_set<K, C, A>&)
|
||||
-> flat_set<K, C, A>;
|
||||
template <typename K, typename C, typename A>
|
||||
friend auto
|
||||
set_intersection(const flat_set<K, C, A>&, const flat_set<K, C, A>&) -> flat_set<K, C, A>;
|
||||
friend auto set_intersection(const flat_set<K, C, A>&, const flat_set<K, C, A>&)
|
||||
-> flat_set<K, C, A>;
|
||||
template <typename K, typename C, typename A>
|
||||
friend auto
|
||||
set_difference(const flat_set<K, C, A>&, const flat_set<K, C, A>&) -> flat_set<K, C, A>;
|
||||
friend auto set_difference(const flat_set<K, C, A>&, const flat_set<K, C, A>&)
|
||||
-> flat_set<K, C, A>;
|
||||
template <typename K, typename C, typename A>
|
||||
friend auto set_symmetric_difference(const flat_set<K, C, A>&, const flat_set<K, C, A>&)
|
||||
-> flat_set<K, C, A>;
|
||||
|
@ -160,16 +160,14 @@ namespace mamba::util
|
|||
-> flat_set<Key, Compare, Allocator>;
|
||||
|
||||
template <typename Key, typename Compare, typename Allocator>
|
||||
auto operator==(
|
||||
const flat_set<Key, Compare, Allocator>& lhs,
|
||||
const flat_set<Key, Compare, Allocator>& rhs
|
||||
) -> bool;
|
||||
auto
|
||||
operator==(const flat_set<Key, Compare, Allocator>& lhs, const flat_set<Key, Compare, Allocator>& rhs)
|
||||
-> bool;
|
||||
|
||||
template <typename Key, typename Compare, typename Allocator>
|
||||
auto operator!=(
|
||||
const flat_set<Key, Compare, Allocator>& lhs,
|
||||
const flat_set<Key, Compare, Allocator>& rhs
|
||||
) -> bool;
|
||||
auto
|
||||
operator!=(const flat_set<Key, Compare, Allocator>& lhs, const flat_set<Key, Compare, Allocator>& rhs)
|
||||
-> bool;
|
||||
|
||||
template <typename Key, typename Compare, typename Allocator>
|
||||
auto set_is_disjoint_of(
|
||||
|
@ -430,7 +428,8 @@ namespace mamba::util
|
|||
*/
|
||||
template <class InputIt1, class InputIt2, class Compare>
|
||||
auto
|
||||
set_disjoint(InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, Compare comp) -> bool
|
||||
set_disjoint(InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, Compare comp)
|
||||
-> bool
|
||||
{
|
||||
while (first1 != last1 && first2 != last2)
|
||||
{
|
||||
|
@ -512,8 +511,8 @@ namespace mamba::util
|
|||
}
|
||||
|
||||
template <typename K, typename C, typename A>
|
||||
auto
|
||||
set_intersection(const flat_set<K, C, A>& lhs, const flat_set<K, C, A>& rhs) -> flat_set<K, C, A>
|
||||
auto set_intersection(const flat_set<K, C, A>& lhs, const flat_set<K, C, A>& rhs)
|
||||
-> flat_set<K, C, A>
|
||||
{
|
||||
auto out = flat_set<K, C, A>();
|
||||
std::set_intersection(
|
||||
|
@ -528,8 +527,8 @@ namespace mamba::util
|
|||
}
|
||||
|
||||
template <typename K, typename C, typename A>
|
||||
auto
|
||||
set_difference(const flat_set<K, C, A>& lhs, const flat_set<K, C, A>& rhs) -> flat_set<K, C, A>
|
||||
auto set_difference(const flat_set<K, C, A>& lhs, const flat_set<K, C, A>& rhs)
|
||||
-> flat_set<K, C, A>
|
||||
{
|
||||
auto out = flat_set<K, C, A>();
|
||||
std::set_difference(
|
||||
|
|
|
@ -705,7 +705,8 @@ namespace mamba::util
|
|||
|
||||
template <typename Graph>
|
||||
auto
|
||||
is_reachable(const Graph& graph, typename Graph::node_id source, typename Graph::node_id target) -> bool
|
||||
is_reachable(const Graph& graph, typename Graph::node_id source, typename Graph::node_id target)
|
||||
-> bool
|
||||
{
|
||||
struct : EmptyVisitor<Graph>
|
||||
{
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
namespace mamba::util
|
||||
{
|
||||
[[nodiscard]] auto
|
||||
unix_name_version() -> tl::expected<std::pair<std::string, std::string>, OSError>;
|
||||
[[nodiscard]] auto unix_name_version()
|
||||
-> tl::expected<std::pair<std::string, std::string>, OSError>;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -249,8 +249,8 @@ namespace mamba::util
|
|||
/**
|
||||
* Test whether the glob pattern @p pattern matches the string @p str.
|
||||
*/
|
||||
[[nodiscard]] auto
|
||||
glob_match(std::string_view pattern, std::string_view str, char glob = '*') -> bool;
|
||||
[[nodiscard]] auto glob_match(std::string_view pattern, std::string_view str, char glob = '*')
|
||||
-> bool;
|
||||
|
||||
/********************
|
||||
* Implementation *
|
||||
|
|
|
@ -80,8 +80,8 @@ namespace mamba::util
|
|||
/**
|
||||
* Concatenate paths with the given separator.
|
||||
*/
|
||||
[[nodiscard]] auto
|
||||
path_concat(std::string_view parent, std::string_view child, char sep) -> std::string;
|
||||
[[nodiscard]] auto path_concat(std::string_view parent, std::string_view child, char sep)
|
||||
-> std::string;
|
||||
|
||||
/**
|
||||
* Concatenate paths with '/' on Unix and detected separator on Windows.
|
||||
|
@ -91,8 +91,8 @@ namespace mamba::util
|
|||
/**
|
||||
* Expand a leading '~' with the given home directory, assuming the given separator.
|
||||
*/
|
||||
[[nodiscard]] auto
|
||||
expand_home(std::string_view path, std::string_view home, char sep) -> std::string;
|
||||
[[nodiscard]] auto expand_home(std::string_view path, std::string_view home, char sep)
|
||||
-> std::string;
|
||||
|
||||
/**
|
||||
* Expand a leading '~' with the given home directory.
|
||||
|
@ -109,8 +109,8 @@ namespace mamba::util
|
|||
*
|
||||
* This assumes the given separator is used separate paths.
|
||||
*/
|
||||
[[nodiscard]] auto
|
||||
shrink_home(std::string_view path, std::string_view home, char sep) -> std::string;
|
||||
[[nodiscard]] auto shrink_home(std::string_view path, std::string_view home, char sep)
|
||||
-> std::string;
|
||||
|
||||
/**
|
||||
* If the path starts with the given home directory, replace it with a leading '~'.
|
||||
|
|
|
@ -61,8 +61,8 @@ namespace mamba::util
|
|||
return rng;
|
||||
}
|
||||
|
||||
extern template auto
|
||||
local_random_generator<default_random_generator>() -> default_random_generator&;
|
||||
extern template auto local_random_generator<default_random_generator>()
|
||||
-> default_random_generator&;
|
||||
|
||||
template <typename T, typename Generator>
|
||||
auto random_int(T min, T max, Generator& generator) -> T
|
||||
|
|
|
@ -103,32 +103,32 @@ namespace mamba::util
|
|||
/**
|
||||
* Return a view to the input without the prefix if present.
|
||||
*/
|
||||
[[nodiscard]] auto
|
||||
remove_prefix(std::string_view str, std::string_view prefix) -> std::string_view;
|
||||
[[nodiscard]] auto
|
||||
remove_prefix(std::string_view str, std::string_view::value_type c) -> std::string_view;
|
||||
[[nodiscard]] auto remove_prefix(std::string_view str, std::string_view prefix)
|
||||
-> std::string_view;
|
||||
[[nodiscard]] auto remove_prefix(std::string_view str, std::string_view::value_type c)
|
||||
-> std::string_view;
|
||||
|
||||
/**
|
||||
* Return a view to prefix if present, and a view to the rest of the input.
|
||||
*/
|
||||
[[nodiscard]] auto
|
||||
split_prefix(std::string_view str, std::string_view prefix) -> std::array<std::string_view, 2>;
|
||||
[[nodiscard]] auto split_prefix(std::string_view str, std::string_view prefix)
|
||||
-> std::array<std::string_view, 2>;
|
||||
[[nodiscard]] auto split_prefix(std::string_view str, std::string_view::value_type c)
|
||||
-> std::array<std::string_view, 2>;
|
||||
|
||||
/**
|
||||
* Return a view to the input without the suffix if present.
|
||||
*/
|
||||
[[nodiscard]] auto
|
||||
remove_suffix(std::string_view str, std::string_view suffix) -> std::string_view;
|
||||
[[nodiscard]] auto
|
||||
remove_suffix(std::string_view str, std::string_view::value_type c) -> std::string_view;
|
||||
[[nodiscard]] auto remove_suffix(std::string_view str, std::string_view suffix)
|
||||
-> std::string_view;
|
||||
[[nodiscard]] auto remove_suffix(std::string_view str, std::string_view::value_type c)
|
||||
-> std::string_view;
|
||||
|
||||
/**
|
||||
* Return a view to the head of the input, and a view to suffix if present.
|
||||
*/
|
||||
[[nodiscard]] auto
|
||||
split_suffix(std::string_view str, std::string_view suffix) -> std::array<std::string_view, 2>;
|
||||
[[nodiscard]] auto split_suffix(std::string_view str, std::string_view suffix)
|
||||
-> std::array<std::string_view, 2>;
|
||||
[[nodiscard]] auto split_suffix(std::string_view str, std::string_view::value_type c)
|
||||
-> std::array<std::string_view, 2>;
|
||||
|
||||
|
@ -139,24 +139,24 @@ namespace mamba::util
|
|||
[[nodiscard]] auto lstrip(std::string_view input) -> std::string_view;
|
||||
[[nodiscard]] auto lstrip(std::wstring_view input) -> std::wstring_view;
|
||||
|
||||
[[nodiscard]] auto
|
||||
lstrip_parts(std::string_view input, char c) -> std::array<std::string_view, 2>;
|
||||
[[nodiscard]] auto
|
||||
lstrip_parts(std::wstring_view input, wchar_t c) -> std::array<std::wstring_view, 2>;
|
||||
[[nodiscard]] auto
|
||||
lstrip_parts(std::string_view input, std::string_view chars) -> std::array<std::string_view, 2>;
|
||||
[[nodiscard]] auto
|
||||
lstrip_parts(std::wstring_view input, std::wstring_view chars) -> std::array<std::wstring_view, 2>;
|
||||
[[nodiscard]] auto lstrip_parts(std::string_view input, char c)
|
||||
-> std::array<std::string_view, 2>;
|
||||
[[nodiscard]] auto lstrip_parts(std::wstring_view input, wchar_t c)
|
||||
-> std::array<std::wstring_view, 2>;
|
||||
[[nodiscard]] auto lstrip_parts(std::string_view input, std::string_view chars)
|
||||
-> std::array<std::string_view, 2>;
|
||||
[[nodiscard]] auto lstrip_parts(std::wstring_view input, std::wstring_view chars)
|
||||
-> std::array<std::wstring_view, 2>;
|
||||
|
||||
template <typename UnaryFunc>
|
||||
[[nodiscard]] auto lstrip_if(std::string_view input, UnaryFunc should_strip) -> std::string_view;
|
||||
template <typename UnaryFunc>
|
||||
[[nodiscard]] auto
|
||||
lstrip_if(std::wstring_view input, UnaryFunc should_strip) -> std::wstring_view;
|
||||
[[nodiscard]] auto lstrip_if(std::wstring_view input, UnaryFunc should_strip)
|
||||
-> std::wstring_view;
|
||||
|
||||
template <typename UnaryFunc>
|
||||
[[nodiscard]] auto
|
||||
lstrip_if_parts(std::string_view input, UnaryFunc should_strip) -> std::array<std::string_view, 2>;
|
||||
[[nodiscard]] auto lstrip_if_parts(std::string_view input, UnaryFunc should_strip)
|
||||
-> std::array<std::string_view, 2>;
|
||||
template <typename UnaryFunc>
|
||||
[[nodiscard]] auto lstrip_if_parts(std::wstring_view input, UnaryFunc should_strip)
|
||||
-> std::array<std::wstring_view, 2>;
|
||||
|
@ -168,24 +168,24 @@ namespace mamba::util
|
|||
[[nodiscard]] auto rstrip(std::string_view input) -> std::string_view;
|
||||
[[nodiscard]] auto rstrip(std::wstring_view input) -> std::wstring_view;
|
||||
|
||||
[[nodiscard]] auto
|
||||
rstrip_parts(std::string_view input, char c) -> std::array<std::string_view, 2>;
|
||||
[[nodiscard]] auto
|
||||
rstrip_parts(std::wstring_view input, wchar_t c) -> std::array<std::wstring_view, 2>;
|
||||
[[nodiscard]] auto
|
||||
rstrip_parts(std::string_view input, std::string_view chars) -> std::array<std::string_view, 2>;
|
||||
[[nodiscard]] auto
|
||||
rstrip_parts(std::wstring_view input, std::wstring_view chars) -> std::array<std::wstring_view, 2>;
|
||||
[[nodiscard]] auto rstrip_parts(std::string_view input, char c)
|
||||
-> std::array<std::string_view, 2>;
|
||||
[[nodiscard]] auto rstrip_parts(std::wstring_view input, wchar_t c)
|
||||
-> std::array<std::wstring_view, 2>;
|
||||
[[nodiscard]] auto rstrip_parts(std::string_view input, std::string_view chars)
|
||||
-> std::array<std::string_view, 2>;
|
||||
[[nodiscard]] auto rstrip_parts(std::wstring_view input, std::wstring_view chars)
|
||||
-> std::array<std::wstring_view, 2>;
|
||||
|
||||
template <typename UnaryFunc>
|
||||
[[nodiscard]] auto rstrip_if(std::string_view input, UnaryFunc should_strip) -> std::string_view;
|
||||
template <typename UnaryFunc>
|
||||
[[nodiscard]] auto
|
||||
rstrip_if(std::wstring_view input, UnaryFunc should_strip) -> std::wstring_view;
|
||||
[[nodiscard]] auto rstrip_if(std::wstring_view input, UnaryFunc should_strip)
|
||||
-> std::wstring_view;
|
||||
|
||||
template <typename UnaryFunc>
|
||||
[[nodiscard]] auto
|
||||
rstrip_if_parts(std::string_view input, UnaryFunc should_strip) -> std::array<std::string_view, 2>;
|
||||
[[nodiscard]] auto rstrip_if_parts(std::string_view input, UnaryFunc should_strip)
|
||||
-> std::array<std::string_view, 2>;
|
||||
template <typename UnaryFunc>
|
||||
[[nodiscard]] auto rstrip_if_parts(std::wstring_view input, UnaryFunc should_strip)
|
||||
-> std::array<std::wstring_view, 2>;
|
||||
|
@ -198,24 +198,25 @@ namespace mamba::util
|
|||
[[nodiscard]] auto strip(std::wstring_view input) -> std::wstring_view;
|
||||
|
||||
[[nodiscard]] auto strip_parts(std::string_view input, char c) -> std::array<std::string_view, 3>;
|
||||
[[nodiscard]] auto
|
||||
strip_parts(std::wstring_view input, wchar_t c) -> std::array<std::wstring_view, 3>;
|
||||
[[nodiscard]] auto
|
||||
strip_parts(std::string_view input, std::string_view chars) -> std::array<std::string_view, 3>;
|
||||
[[nodiscard]] auto
|
||||
strip_parts(std::wstring_view input, std::wstring_view chars) -> std::array<std::wstring_view, 3>;
|
||||
[[nodiscard]] auto strip_parts(std::wstring_view input, wchar_t c)
|
||||
-> std::array<std::wstring_view, 3>;
|
||||
[[nodiscard]] auto strip_parts(std::string_view input, std::string_view chars)
|
||||
-> std::array<std::string_view, 3>;
|
||||
[[nodiscard]] auto strip_parts(std::wstring_view input, std::wstring_view chars)
|
||||
-> std::array<std::wstring_view, 3>;
|
||||
|
||||
template <typename UnaryFunc>
|
||||
[[nodiscard]] auto strip_if(std::string_view input, UnaryFunc should_strip) -> std::string_view;
|
||||
template <typename UnaryFunc>
|
||||
[[nodiscard]] auto strip_if(std::wstring_view input, UnaryFunc should_strip) -> std::wstring_view;
|
||||
[[nodiscard]] auto strip_if(std::wstring_view input, UnaryFunc should_strip)
|
||||
-> std::wstring_view;
|
||||
|
||||
template <typename UnaryFunc>
|
||||
[[nodiscard]] auto
|
||||
strip_if_parts(std::string_view input, UnaryFunc should_strip) -> std::array<std::string_view, 3>;
|
||||
[[nodiscard]] auto strip_if_parts(std::string_view input, UnaryFunc should_strip)
|
||||
-> std::array<std::string_view, 3>;
|
||||
template <typename UnaryFunc>
|
||||
[[nodiscard]] auto
|
||||
strip_if_parts(std::wstring_view input, UnaryFunc should_strip) -> std::array<std::wstring_view, 3>;
|
||||
[[nodiscard]] auto strip_if_parts(std::wstring_view input, UnaryFunc should_strip)
|
||||
-> std::array<std::wstring_view, 3>;
|
||||
|
||||
[[nodiscard]] auto split_once(std::string_view str, char sep)
|
||||
-> std::tuple<std::string_view, std::optional<std::string_view>>;
|
||||
|
@ -269,10 +270,11 @@ namespace mamba::util
|
|||
* would return "private/channel/label/foo", but "private/chan" and "channel/label/foo"
|
||||
* would return the "private/chan/channel/label/foo".
|
||||
*/
|
||||
[[nodiscard]] auto concat_dedup_splits(std::string_view str1, std::string_view str2, char sep)
|
||||
-> std::string;
|
||||
[[nodiscard]] auto
|
||||
concat_dedup_splits(std::string_view str1, std::string_view str2, char sep) -> std::string;
|
||||
[[nodiscard]] auto
|
||||
concat_dedup_splits(std::string_view str1, std::string_view str2, std::string_view sep) -> std::string;
|
||||
concat_dedup_splits(std::string_view str1, std::string_view str2, std::string_view sep)
|
||||
-> std::string;
|
||||
|
||||
void replace_all(std::string& data, std::string_view search, std::string_view replace);
|
||||
void replace_all(std::wstring& data, std::wstring_view search, std::wstring_view replace);
|
||||
|
@ -294,8 +296,8 @@ namespace mamba::util
|
|||
* separator in between the elements (thus appearing ``n-1`` times).
|
||||
*/
|
||||
template <typename InputIt, typename UnaryFunction, typename Value>
|
||||
auto
|
||||
join_for_each(InputIt first, InputIt last, UnaryFunction func, const Value& sep) -> UnaryFunction;
|
||||
auto join_for_each(InputIt first, InputIt last, UnaryFunction func, const Value& sep)
|
||||
-> UnaryFunction;
|
||||
|
||||
/**
|
||||
* Concatenate the elements of the container @p container by interleaving a separator.
|
||||
|
@ -460,15 +462,15 @@ namespace mamba::util
|
|||
}
|
||||
|
||||
template <typename UnaryFunc>
|
||||
auto
|
||||
lstrip_if_parts(std::string_view input, UnaryFunc should_strip) -> std::array<std::string_view, 2>
|
||||
auto lstrip_if_parts(std::string_view input, UnaryFunc should_strip)
|
||||
-> std::array<std::string_view, 2>
|
||||
{
|
||||
return detail::lstrip_if_parts_impl(input, std::move(should_strip));
|
||||
}
|
||||
|
||||
template <typename UnaryFunc>
|
||||
auto
|
||||
lstrip_if_parts(std::wstring_view input, UnaryFunc should_strip) -> std::array<std::wstring_view, 2>
|
||||
auto lstrip_if_parts(std::wstring_view input, UnaryFunc should_strip)
|
||||
-> std::array<std::wstring_view, 2>
|
||||
{
|
||||
return detail::lstrip_if_parts_impl(input, std::move(should_strip));
|
||||
}
|
||||
|
@ -502,15 +504,15 @@ namespace mamba::util
|
|||
}
|
||||
|
||||
template <typename UnaryFunc>
|
||||
auto
|
||||
rstrip_if_parts(std::string_view input, UnaryFunc should_strip) -> std::array<std::string_view, 2>
|
||||
auto rstrip_if_parts(std::string_view input, UnaryFunc should_strip)
|
||||
-> std::array<std::string_view, 2>
|
||||
{
|
||||
return detail::rstrip_if_parts_impl(input, std::move(should_strip));
|
||||
}
|
||||
|
||||
template <typename UnaryFunc>
|
||||
auto
|
||||
rstrip_if_parts(std::wstring_view input, UnaryFunc should_strip) -> std::array<std::wstring_view, 2>
|
||||
auto rstrip_if_parts(std::wstring_view input, UnaryFunc should_strip)
|
||||
-> std::array<std::wstring_view, 2>
|
||||
{
|
||||
return detail::rstrip_if_parts_impl(input, std::move(should_strip));
|
||||
}
|
||||
|
@ -540,15 +542,15 @@ namespace mamba::util
|
|||
}
|
||||
|
||||
template <typename UnaryFunc>
|
||||
auto
|
||||
strip_if_parts(std::string_view input, UnaryFunc should_strip) -> std::array<std::string_view, 3>
|
||||
auto strip_if_parts(std::string_view input, UnaryFunc should_strip)
|
||||
-> std::array<std::string_view, 3>
|
||||
{
|
||||
return detail::strip_if_parts_impl(input, std::move(should_strip));
|
||||
}
|
||||
|
||||
template <typename UnaryFunc>
|
||||
auto
|
||||
strip_if_parts(std::wstring_view input, UnaryFunc should_strip) -> std::array<std::wstring_view, 3>
|
||||
auto strip_if_parts(std::wstring_view input, UnaryFunc should_strip)
|
||||
-> std::array<std::wstring_view, 3>
|
||||
{
|
||||
return detail::strip_if_parts_impl(input, std::move(should_strip));
|
||||
}
|
||||
|
@ -607,8 +609,8 @@ namespace mamba::util
|
|||
|
||||
// TODO(C++20) Use ``std::ranges::join_view`` (or ``std::ranges::join``)
|
||||
template <typename InputIt, typename UnaryFunction, typename Value>
|
||||
auto
|
||||
join_for_each(InputIt first, InputIt last, UnaryFunction func, const Value& sep) -> UnaryFunction
|
||||
auto join_for_each(InputIt first, InputIt last, UnaryFunction func, const Value& sep)
|
||||
-> UnaryFunction
|
||||
{
|
||||
if (first < last)
|
||||
{
|
||||
|
|
|
@ -21,8 +21,8 @@ namespace mamba::util
|
|||
}
|
||||
|
||||
template <class T, typename Hasher = std::hash<T>>
|
||||
constexpr auto
|
||||
hash_combine_val(std::size_t seed, const T& val, const Hasher& hasher = {}) -> std::size_t
|
||||
constexpr auto hash_combine_val(std::size_t seed, const T& val, const Hasher& hasher = {})
|
||||
-> std::size_t
|
||||
{
|
||||
return hash_combine(seed, hasher(val));
|
||||
}
|
||||
|
|
|
@ -260,15 +260,15 @@ namespace mamba::util
|
|||
|
||||
protected:
|
||||
|
||||
[[nodiscard]] auto
|
||||
authentication_elems(Credentials, Decode::no_type) const -> std::array<std::string_view, 3>;
|
||||
[[nodiscard]] auto
|
||||
authentication_elems(Credentials, Decode::yes_type) const -> std::array<std::string, 3>;
|
||||
[[nodiscard]] auto authentication_elems(Credentials, Decode::no_type) const
|
||||
-> std::array<std::string_view, 3>;
|
||||
[[nodiscard]] auto authentication_elems(Credentials, Decode::yes_type) const
|
||||
-> std::array<std::string, 3>;
|
||||
|
||||
[[nodiscard]] auto
|
||||
authority_elems(Credentials, Decode::no_type) const -> std::array<std::string_view, 7>;
|
||||
[[nodiscard]] auto
|
||||
authority_elems(Credentials, Decode::yes_type) const -> std::array<std::string, 7>;
|
||||
[[nodiscard]] auto authority_elems(Credentials, Decode::no_type) const
|
||||
-> std::array<std::string_view, 7>;
|
||||
[[nodiscard]] auto authority_elems(Credentials, Decode::yes_type) const
|
||||
-> std::array<std::string, 7>;
|
||||
|
||||
[[nodiscard]] auto
|
||||
pretty_str_path(StripScheme strip_scheme = StripScheme::no, char rstrip_path = 0) const
|
||||
|
|
|
@ -35,8 +35,8 @@ namespace mamba::validation
|
|||
|
||||
auto generate_ed25519_keypair(std::byte* pk, std::byte* sk) -> int;
|
||||
auto generate_ed25519_keypair() -> std::pair<
|
||||
std::array<std::byte, MAMBA_ED25519_KEYSIZE_BYTES>,
|
||||
std::array<std::byte, MAMBA_ED25519_KEYSIZE_BYTES>>;
|
||||
std::array<std::byte, MAMBA_ED25519_KEYSIZE_BYTES>,
|
||||
std::array<std::byte, MAMBA_ED25519_KEYSIZE_BYTES>>;
|
||||
auto generate_ed25519_keypair_hex() -> std::pair<std::string, std::string>;
|
||||
|
||||
auto sign(const std::string& data, const std::byte* sk, std::byte* signature) -> int;
|
||||
|
@ -52,8 +52,8 @@ namespace mamba::validation
|
|||
verify(const std::byte* data, std::size_t data_len, const std::byte* pk, const std::byte* signature)
|
||||
-> int;
|
||||
auto verify(const std::string& data, const std::byte* pk, const std::byte* signature) -> int;
|
||||
auto
|
||||
verify(const std::string& data, const std::string& pk_hex, const std::string& signature_hex) -> int;
|
||||
auto verify(const std::string& data, const std::string& pk_hex, const std::string& signature_hex)
|
||||
-> int;
|
||||
|
||||
/**
|
||||
* Verify a GPG/PGP signature against the hash of the binary data and
|
||||
|
@ -61,8 +61,8 @@ namespace mamba::validation
|
|||
* See RFC4880, section 5.2.4 https://datatracker.ietf.org/doc/html/rfc4880#section-5.2.4
|
||||
* This method assumes hash function to be SHA-256
|
||||
*/
|
||||
auto
|
||||
verify_gpg_hashed_msg(const std::byte* data, const std::byte* pk, const std::byte* signature) -> int;
|
||||
auto verify_gpg_hashed_msg(const std::byte* data, const std::byte* pk, const std::byte* signature)
|
||||
-> int;
|
||||
auto
|
||||
verify_gpg_hashed_msg(const std::string& data, const std::byte* pk, const std::byte* signature)
|
||||
-> int;
|
||||
|
|
|
@ -59,8 +59,9 @@ namespace mamba::validation
|
|||
[[nodiscard]] virtual auto json_key() const -> std::string = 0;
|
||||
[[nodiscard]] virtual auto expiration_json_key() const -> std::string = 0;
|
||||
|
||||
[[nodiscard]] virtual auto
|
||||
signatures(const nlohmann::json& j) const -> std::set<RoleSignature> = 0;
|
||||
[[nodiscard]] virtual auto signatures(const nlohmann::json& j) const
|
||||
-> std::set<RoleSignature>
|
||||
= 0;
|
||||
|
||||
protected:
|
||||
|
||||
|
@ -103,8 +104,8 @@ namespace mamba::validation
|
|||
|
||||
protected:
|
||||
|
||||
[[nodiscard]] auto
|
||||
read_json_file(const fs::u8path& p, bool update = false) const -> nlohmann::json;
|
||||
[[nodiscard]] auto read_json_file(const fs::u8path& p, bool update = false) const
|
||||
-> nlohmann::json;
|
||||
|
||||
/**
|
||||
* Check that a threshold of valid signatures is met
|
||||
|
@ -178,7 +179,8 @@ namespace mamba::validation
|
|||
const TimeRef& time_reference,
|
||||
const std::string& url,
|
||||
const fs::u8path& cache_path
|
||||
) const -> std::unique_ptr<RepoIndexChecker> = 0;
|
||||
) const -> std::unique_ptr<RepoIndexChecker>
|
||||
= 0;
|
||||
|
||||
protected:
|
||||
|
||||
|
|
|
@ -32,8 +32,8 @@ namespace mamba::validation::v0_6
|
|||
[[nodiscard]] auto json_key() const -> std::string override;
|
||||
[[nodiscard]] auto expiration_json_key() const -> std::string override;
|
||||
|
||||
[[nodiscard]] auto
|
||||
signatures(const nlohmann::json& j) const -> std::set<RoleSignature> override;
|
||||
[[nodiscard]] auto signatures(const nlohmann::json& j) const
|
||||
-> std::set<RoleSignature> override;
|
||||
|
||||
[[nodiscard]] auto canonicalize(const nlohmann::json& j) const -> std::string override;
|
||||
[[nodiscard]] auto upgradable() const -> bool override;
|
||||
|
|
|
@ -34,8 +34,8 @@ namespace mamba::validation::v1
|
|||
[[nodiscard]] auto json_key() const -> std::string override;
|
||||
[[nodiscard]] auto expiration_json_key() const -> std::string override;
|
||||
|
||||
[[nodiscard]] auto
|
||||
signatures(const nlohmann::json& j) const -> std::set<RoleSignature> override;
|
||||
[[nodiscard]] auto signatures(const nlohmann::json& j) const
|
||||
-> std::set<RoleSignature> override;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -629,8 +629,8 @@ namespace mamba
|
|||
}
|
||||
}
|
||||
|
||||
auto
|
||||
get_root_prefix_from_mamba_bin(const fs::u8path& mamba_bin_path) -> expected_t<fs::u8path>
|
||||
auto get_root_prefix_from_mamba_bin(const fs::u8path& mamba_bin_path)
|
||||
-> expected_t<fs::u8path>
|
||||
{
|
||||
if (mamba_bin_path.empty())
|
||||
{
|
||||
|
@ -1555,7 +1555,8 @@ namespace mamba
|
|||
previous versions of conda, this parameter was configured as either
|
||||
True or False. True is now an alias to 'flexible'.)"))
|
||||
.set_post_merge_hook<ChannelPriority>(
|
||||
[&](ChannelPriority& value) {
|
||||
[&](ChannelPriority& value)
|
||||
{
|
||||
m_context.solver_flags.strict_repo_priority = (value == ChannelPriority::Strict);
|
||||
}
|
||||
));
|
||||
|
|
|
@ -23,8 +23,8 @@ namespace mamba
|
|||
{
|
||||
namespace
|
||||
{
|
||||
auto
|
||||
make_activator(const Context& context, std::string_view name) -> std::unique_ptr<Activator>
|
||||
auto make_activator(const Context& context, std::string_view name)
|
||||
-> std::unique_ptr<Activator>
|
||||
{
|
||||
if (name == "bash" || name == "zsh" || name == "dash" || name == "posix")
|
||||
{
|
||||
|
|
|
@ -27,8 +27,8 @@ namespace mamba
|
|||
|
||||
namespace
|
||||
{
|
||||
auto create_platforms(const std::vector<std::string>& platforms
|
||||
) -> specs::ChannelResolveParams::platform_list
|
||||
auto create_platforms(const std::vector<std::string>& platforms)
|
||||
-> specs::ChannelResolveParams::platform_list
|
||||
{
|
||||
return { platforms.cbegin(), platforms.cend() };
|
||||
}
|
||||
|
@ -193,7 +193,8 @@ namespace mamba
|
|||
{
|
||||
auto channels = specs::UnresolvedChannel::parse(loc)
|
||||
.and_then( //
|
||||
[&](specs::UnresolvedChannel&& uc) {
|
||||
[&](specs::UnresolvedChannel&& uc)
|
||||
{
|
||||
return specs::Channel::resolve(std::move(uc), params);
|
||||
}
|
||||
)
|
||||
|
|
|
@ -178,8 +178,8 @@ namespace mamba
|
|||
return request;
|
||||
}
|
||||
|
||||
auto
|
||||
PackageFetcher::validate(std::size_t downloaded_size, progress_callback_t* cb) const -> ValidationResult
|
||||
auto PackageFetcher::validate(std::size_t downloaded_size, progress_callback_t* cb) const
|
||||
-> ValidationResult
|
||||
{
|
||||
update_monitor(cb, PackageExtractEvent::validate_update);
|
||||
ValidationResult res = validate_size(downloaded_size);
|
||||
|
|
|
@ -73,7 +73,7 @@ namespace mamba
|
|||
public:
|
||||
|
||||
scoped_archive_read()
|
||||
: scoped_archive_read(archive_read_new()){};
|
||||
: scoped_archive_read(archive_read_new()) {};
|
||||
|
||||
static scoped_archive_read read_disk()
|
||||
{
|
||||
|
@ -450,7 +450,8 @@ namespace mamba
|
|||
zstd,
|
||||
compression_level,
|
||||
compression_threads,
|
||||
[](const fs::u8path& p) -> bool {
|
||||
[](const fs::u8path& p) -> bool
|
||||
{
|
||||
return p.std_path().begin() != p.std_path().end()
|
||||
&& *p.std_path().begin() != "info";
|
||||
}
|
||||
|
@ -461,7 +462,8 @@ namespace mamba
|
|||
zstd,
|
||||
compression_level,
|
||||
compression_threads,
|
||||
[](const fs::u8path& p) -> bool {
|
||||
[](const fs::u8path& p) -> bool
|
||||
{
|
||||
return p.std_path().begin() != p.std_path().end()
|
||||
&& *p.std_path().begin() == "info";
|
||||
}
|
||||
|
|
|
@ -285,7 +285,8 @@ namespace mamba
|
|||
return m;
|
||||
}
|
||||
|
||||
auto SubdirMetadata::from_repodata_file(const fs::u8path& repodata_file) -> expected_subdir_metadata
|
||||
auto SubdirMetadata::from_repodata_file(const fs::u8path& repodata_file)
|
||||
-> expected_subdir_metadata
|
||||
{
|
||||
const std::string json = [](const fs::u8path& file) -> std::string
|
||||
{
|
||||
|
|
|
@ -84,8 +84,8 @@ namespace mamba
|
|||
return out;
|
||||
}
|
||||
|
||||
auto
|
||||
installed_python(const solver::libsolv::Database& db) -> std::optional<specs::PackageInfo>
|
||||
auto installed_python(const solver::libsolv::Database& db)
|
||||
-> std::optional<specs::PackageInfo>
|
||||
{
|
||||
// TODO combine Repo and MatchSpec search API in Pool
|
||||
auto out = std::optional<specs::PackageInfo>();
|
||||
|
|
|
@ -262,7 +262,8 @@ namespace mamba
|
|||
{
|
||||
overridable_windows_version()
|
||||
.transform(
|
||||
[&](std::string&& version) {
|
||||
[&](std::string&& version)
|
||||
{
|
||||
res.push_back(make_virtual_package("__win", platform, std::move(version)));
|
||||
}
|
||||
)
|
||||
|
@ -284,7 +285,8 @@ namespace mamba
|
|||
|
||||
overridable_linux_version()
|
||||
.transform(
|
||||
[&](std::string&& version) {
|
||||
[&](std::string&& version)
|
||||
{
|
||||
res.push_back(
|
||||
make_virtual_package("__linux", platform, std::move(version))
|
||||
);
|
||||
|
@ -318,7 +320,8 @@ namespace mamba
|
|||
|
||||
overridable_osx_version()
|
||||
.transform(
|
||||
[&](std::string&& version) {
|
||||
[&](std::string&& version)
|
||||
{
|
||||
res.push_back(make_virtual_package("__osx", platform, std::move(version)));
|
||||
}
|
||||
)
|
||||
|
|
|
@ -962,7 +962,8 @@ namespace mamba::download
|
|||
{
|
||||
new_mirror = find_mirror(
|
||||
m_mirror_set,
|
||||
[iteration](const auto& mirror) {
|
||||
[iteration](const auto& mirror)
|
||||
{
|
||||
return iteration > mirror->failed_transfers()
|
||||
&& mirror->can_accept_more_connections();
|
||||
}
|
||||
|
@ -1016,7 +1017,8 @@ namespace mamba::download
|
|||
m_requests.begin(),
|
||||
m_requests.end(),
|
||||
std::back_inserter(m_trackers),
|
||||
[tracker_options, this](const Request& req) {
|
||||
[tracker_options, this](const Request& req)
|
||||
{
|
||||
return DownloadTracker(req, p_mirrors->get_mirrors(req.mirror_name), tracker_options);
|
||||
}
|
||||
);
|
||||
|
|
|
@ -193,8 +193,8 @@ namespace mamba::download
|
|||
DownloadTrackerOptions options
|
||||
);
|
||||
|
||||
auto
|
||||
prepare_new_attempt(CURLMultiHandle& handle, const Context& context) -> completion_map_entry;
|
||||
auto prepare_new_attempt(CURLMultiHandle& handle, const Context& context)
|
||||
-> completion_map_entry;
|
||||
|
||||
bool has_failed() const;
|
||||
bool can_start_transfer() const;
|
||||
|
|
|
@ -153,10 +153,9 @@ namespace mamba::download
|
|||
return MirrorID(std::move(url));
|
||||
}
|
||||
|
||||
auto OCIMirror::get_request_generators_impl(
|
||||
const std::string& url_path,
|
||||
const std::string& spec_sha256
|
||||
) const -> request_generator_list
|
||||
auto
|
||||
OCIMirror::get_request_generators_impl(const std::string& url_path, const std::string& spec_sha256) const
|
||||
-> request_generator_list
|
||||
{
|
||||
// NB: This method can be executed by many threads in parallel. Therefore,
|
||||
// data should not be captured in lambda used for building the request, as
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
|
||||
namespace mamba::solver
|
||||
{
|
||||
auto find_new_python_in_solution(const Solution& solution
|
||||
) -> std::optional<std::reference_wrapper<const specs::PackageInfo>>
|
||||
auto find_new_python_in_solution(const Solution& solution)
|
||||
-> std::optional<std::reference_wrapper<const specs::PackageInfo>>
|
||||
{
|
||||
auto out = std::optional<std::reference_wrapper<const specs::PackageInfo>>{};
|
||||
for_each_to_install(
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
|
||||
namespace mamba::solver
|
||||
{
|
||||
[[nodiscard]] auto find_new_python_in_solution(const Solution& solution
|
||||
) -> std::optional<std::reference_wrapper<const specs::PackageInfo>>;
|
||||
[[nodiscard]] auto find_new_python_in_solution(const Solution& solution)
|
||||
-> std::optional<std::reference_wrapper<const specs::PackageInfo>>;
|
||||
|
||||
[[nodiscard]] auto python_binary_compatible( //
|
||||
const specs::Version& older,
|
||||
|
|
|
@ -91,8 +91,8 @@ namespace mamba::solver::libsolv
|
|||
solv.add_self_provide();
|
||||
}
|
||||
|
||||
auto
|
||||
make_package_info(const solv::ObjPool& pool, solv::ObjSolvableViewConst s) -> specs::PackageInfo
|
||||
auto make_package_info(const solv::ObjPool& pool, solv::ObjSolvableViewConst s)
|
||||
-> specs::PackageInfo
|
||||
{
|
||||
specs::PackageInfo out = {};
|
||||
|
||||
|
@ -814,11 +814,9 @@ namespace mamba::solver::libsolv
|
|||
repo.set_pip_added(true);
|
||||
}
|
||||
|
||||
auto make_abused_namespace_dep_args(
|
||||
solv::ObjPool& pool,
|
||||
std::string_view dependency,
|
||||
const MatchFlags& flags
|
||||
) -> std::pair<solv::StringId, solv::StringId>
|
||||
auto
|
||||
make_abused_namespace_dep_args(solv::ObjPool& pool, std::string_view dependency, const MatchFlags& flags)
|
||||
-> std::pair<solv::StringId, solv::StringId>
|
||||
{
|
||||
return {
|
||||
pool.add_string(dependency),
|
||||
|
@ -1083,8 +1081,8 @@ namespace mamba::solver::libsolv
|
|||
}
|
||||
}
|
||||
|
||||
auto
|
||||
transaction_to_solution_all(const solv::ObjPool& pool, const solv::ObjTransaction& trans) -> Solution
|
||||
auto transaction_to_solution_all(const solv::ObjPool& pool, const solv::ObjTransaction& trans)
|
||||
-> Solution
|
||||
{
|
||||
return transaction_to_solution_impl(pool, trans, [](const auto&) { return true; });
|
||||
}
|
||||
|
@ -1194,7 +1192,8 @@ namespace mamba::solver::libsolv
|
|||
|
||||
namespace
|
||||
{
|
||||
auto action_refers_to(const Solution::Action& unknown_action, std::string_view pkg_name) -> bool
|
||||
auto action_refers_to(const Solution::Action& unknown_action, std::string_view pkg_name)
|
||||
-> bool
|
||||
{
|
||||
return std::visit(
|
||||
[&](const auto& action)
|
||||
|
@ -1369,7 +1368,8 @@ namespace mamba::solver::libsolv
|
|||
{
|
||||
return pool_add_matchspec(pool, job.spec)
|
||||
.transform(
|
||||
[&](auto id) {
|
||||
[&](auto id)
|
||||
{
|
||||
raw_jobs.push_back(
|
||||
SOLVER_ERASE | (job.clean_dependencies ? SOLVER_CLEANDEPS : 0),
|
||||
id
|
||||
|
|
|
@ -38,8 +38,8 @@ namespace mamba::solver::libsolv
|
|||
{
|
||||
void set_solvable(solv::ObjPool& pool, solv::ObjSolvableView solv, const specs::PackageInfo& pkg);
|
||||
|
||||
auto
|
||||
make_package_info(const solv::ObjPool& pool, solv::ObjSolvableViewConst s) -> specs::PackageInfo;
|
||||
auto make_package_info(const solv::ObjPool& pool, solv::ObjSolvableViewConst s)
|
||||
-> specs::PackageInfo;
|
||||
|
||||
[[nodiscard]] auto libsolv_read_json( //
|
||||
solv::ObjRepoView repo,
|
||||
|
@ -135,8 +135,8 @@ namespace mamba::solver::libsolv
|
|||
const Request::Flags& flags
|
||||
) -> Solution;
|
||||
|
||||
[[nodiscard]] auto
|
||||
installed_python(const solv::ObjPool& pool) -> std::optional<solv::ObjSolvableViewConst>;
|
||||
[[nodiscard]] auto installed_python(const solv::ObjPool& pool)
|
||||
-> std::optional<solv::ObjSolvableViewConst>;
|
||||
|
||||
[[nodiscard]] auto solution_needs_python_relink( //
|
||||
const solv::ObjPool& pool,
|
||||
|
|
|
@ -182,8 +182,8 @@ namespace mamba::solver::libsolv
|
|||
.value();
|
||||
}
|
||||
|
||||
auto
|
||||
Matcher::get_channels(const specs::UnresolvedChannel& uc) -> expected_t<channel_list_const_ref>
|
||||
auto Matcher::get_channels(const specs::UnresolvedChannel& uc)
|
||||
-> expected_t<channel_list_const_ref>
|
||||
{
|
||||
// Channel maps require converting channel to string because unresolved channels are
|
||||
// awkward to compare.
|
||||
|
|
|
@ -563,8 +563,8 @@ namespace mamba::solver::libsolv
|
|||
return out;
|
||||
}
|
||||
|
||||
auto
|
||||
UnSolvable::explain_problems(Database& pool, const ProblemsMessageFormat& format) const -> std::string
|
||||
auto UnSolvable::explain_problems(Database& pool, const ProblemsMessageFormat& format) const
|
||||
-> std::string
|
||||
|
||||
{
|
||||
std::stringstream ss;
|
||||
|
|
|
@ -213,10 +213,9 @@ namespace mamba::solver
|
|||
* @return For each node type, a partition of the the indices in @p of that type..
|
||||
*/
|
||||
template <typename CompFunc>
|
||||
auto merge_node_indices(
|
||||
const node_type_list<old_node_id_list>& nodes_by_type,
|
||||
CompFunc&& merge_criteria
|
||||
) -> node_type_list<std::vector<old_node_id_list>>
|
||||
auto
|
||||
merge_node_indices(const node_type_list<old_node_id_list>& nodes_by_type, CompFunc&& merge_criteria)
|
||||
-> node_type_list<std::vector<old_node_id_list>>
|
||||
{
|
||||
auto merge_func = [&merge_criteria](const auto& node_indices_of_one_node_type)
|
||||
{
|
||||
|
@ -532,10 +531,9 @@ namespace mamba::solver
|
|||
* If two groups contain a node that are respectively in conflicts, then they are in
|
||||
* conflicts.
|
||||
*/
|
||||
auto merge_conflicts(
|
||||
const ProblemsGraph::conflicts_t& old_conflicts,
|
||||
const node_id_mapping& old_to_new
|
||||
) -> CompressedProblemsGraph::conflicts_t
|
||||
auto
|
||||
merge_conflicts(const ProblemsGraph::conflicts_t& old_conflicts, const node_id_mapping& old_to_new)
|
||||
-> CompressedProblemsGraph::conflicts_t
|
||||
{
|
||||
auto new_conflicts = CompressedProblemsGraph::conflicts_t();
|
||||
for (const auto& [old_from, old_with] : old_conflicts)
|
||||
|
@ -1254,8 +1252,8 @@ namespace mamba::solver
|
|||
template <typename Node>
|
||||
auto concat_nodes_impl(const std::vector<node_id>& ids) -> Node;
|
||||
auto concat_nodes(const std::vector<node_id>& ids) -> node_t;
|
||||
auto
|
||||
concat_edges(const std::vector<node_id>& from, const std::vector<node_id>& to) -> edge_t;
|
||||
auto concat_edges(const std::vector<node_id>& from, const std::vector<node_id>& to)
|
||||
-> edge_t;
|
||||
};
|
||||
|
||||
/*************************************
|
||||
|
@ -1313,8 +1311,8 @@ namespace mamba::solver
|
|||
* Sort suffices such that if one ends with the other, the longest one is put first.
|
||||
*/
|
||||
template <std::size_t N>
|
||||
constexpr auto
|
||||
sorted_suffix(std::array<std::string_view, N> arr) -> std::array<std::string_view, N>
|
||||
constexpr auto sorted_suffix(std::array<std::string_view, N> arr)
|
||||
-> std::array<std::string_view, N>
|
||||
{
|
||||
std::sort(
|
||||
arr.begin(),
|
||||
|
@ -1654,8 +1652,8 @@ namespace mamba::solver
|
|||
return out;
|
||||
}
|
||||
|
||||
auto
|
||||
problem_tree_msg(const CompressedProblemsGraph& pbs, const ProblemsMessageFormat& format) -> std::string
|
||||
auto problem_tree_msg(const CompressedProblemsGraph& pbs, const ProblemsMessageFormat& format)
|
||||
-> std::string
|
||||
{
|
||||
std::stringstream ss;
|
||||
print_problem_tree_msg(ss, pbs, format);
|
||||
|
|
|
@ -87,15 +87,15 @@ std::hash<mamba::specs::BasicHTTPAuthentication>::operator()(
|
|||
}
|
||||
|
||||
auto
|
||||
std::hash<mamba::specs::BearerToken>::operator()(const mamba::specs::BearerToken& auth
|
||||
) const -> std::size_t
|
||||
std::hash<mamba::specs::BearerToken>::operator()(const mamba::specs::BearerToken& auth) const
|
||||
-> std::size_t
|
||||
{
|
||||
return std::hash<std::string>{}(auth.token);
|
||||
}
|
||||
|
||||
auto
|
||||
std::hash<mamba::specs::CondaToken>::operator()(const mamba::specs::CondaToken& auth
|
||||
) const -> std::size_t
|
||||
std::hash<mamba::specs::CondaToken>::operator()(const mamba::specs::CondaToken& auth) const
|
||||
-> std::size_t
|
||||
{
|
||||
return std::hash<std::string>{}(auth.token);
|
||||
}
|
||||
|
|
|
@ -19,8 +19,8 @@ namespace mamba::specs
|
|||
* BuildNumberPredicate BinaryOperators Implementation *
|
||||
*********************************************************/
|
||||
|
||||
auto
|
||||
BuildNumberPredicate::free_interval::operator()(const BuildNumber&, const BuildNumber&) const -> bool
|
||||
auto BuildNumberPredicate::free_interval::operator()(const BuildNumber&, const BuildNumber&) const
|
||||
-> bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -98,8 +98,8 @@ namespace mamba::specs
|
|||
}
|
||||
|
||||
auto
|
||||
fmt::formatter<mamba::specs::BuildNumberPredicate>::parse(format_parse_context& ctx
|
||||
) -> decltype(ctx.begin())
|
||||
fmt::formatter<mamba::specs::BuildNumberPredicate>::parse(format_parse_context& ctx)
|
||||
-> decltype(ctx.begin())
|
||||
{
|
||||
// make sure that range is empty
|
||||
if (ctx.begin() != ctx.end() && *ctx.begin() != '}')
|
||||
|
@ -253,8 +253,8 @@ namespace mamba::specs
|
|||
}
|
||||
|
||||
auto
|
||||
fmt::formatter<mamba::specs::BuildNumberSpec>::parse(format_parse_context& ctx
|
||||
) -> decltype(ctx.begin())
|
||||
fmt::formatter<mamba::specs::BuildNumberSpec>::parse(format_parse_context& ctx)
|
||||
-> decltype(ctx.begin())
|
||||
{
|
||||
// make sure that range is empty
|
||||
if (ctx.begin() != ctx.end() && *ctx.begin() != '}')
|
||||
|
|
|
@ -20,14 +20,14 @@ namespace mamba::specs
|
|||
* NameWeakener Implementation *
|
||||
*********************************/
|
||||
|
||||
auto ChannelResolveParams::NameWeakener::make_first_key(std::string_view key
|
||||
) const -> std::string_view
|
||||
auto ChannelResolveParams::NameWeakener::make_first_key(std::string_view key) const
|
||||
-> std::string_view
|
||||
{
|
||||
return key;
|
||||
}
|
||||
|
||||
auto ChannelResolveParams::NameWeakener::weaken_key(std::string_view key
|
||||
) const -> std::optional<std::string_view>
|
||||
auto ChannelResolveParams::NameWeakener::weaken_key(std::string_view key) const
|
||||
-> std::optional<std::string_view>
|
||||
{
|
||||
return std::get<0>(util::rsplit_once(key, '/'));
|
||||
}
|
||||
|
@ -328,7 +328,8 @@ namespace mamba::specs
|
|||
return uri.pretty_str();
|
||||
}
|
||||
|
||||
auto resolve_path_location(std::string location, ChannelResolveParamsView params) -> std::string
|
||||
auto resolve_path_location(std::string location, ChannelResolveParamsView params)
|
||||
-> std::string
|
||||
{
|
||||
if (util::url_has_scheme(location))
|
||||
{
|
||||
|
@ -387,8 +388,8 @@ namespace mamba::specs
|
|||
return url.pretty_str(StripScheme::no, '/', Credentials::Remove);
|
||||
}
|
||||
|
||||
auto
|
||||
resolve_url(UnresolvedChannel&& uc, ChannelResolveParamsView params) -> expected_parse_t<Channel>
|
||||
auto resolve_url(UnresolvedChannel&& uc, ChannelResolveParamsView params)
|
||||
-> expected_parse_t<Channel>
|
||||
{
|
||||
assert(util::url_has_scheme(uc.location()));
|
||||
assert(util::url_get_scheme(uc.location()) != "file");
|
||||
|
@ -450,7 +451,8 @@ namespace mamba::specs
|
|||
return out;
|
||||
}
|
||||
|
||||
auto resolve_name_from_alias(UnresolvedChannel&& uc, ChannelResolveParamsView params) -> Channel
|
||||
auto resolve_name_from_alias(UnresolvedChannel&& uc, ChannelResolveParamsView params)
|
||||
-> Channel
|
||||
{
|
||||
auto url = params.channel_alias;
|
||||
url.append_path(uc.location());
|
||||
|
@ -462,8 +464,8 @@ namespace mamba::specs
|
|||
};
|
||||
}
|
||||
|
||||
auto
|
||||
resolve_name(UnresolvedChannel&& uc, ChannelResolveParamsView params) -> Channel::channel_list
|
||||
auto resolve_name(UnresolvedChannel&& uc, ChannelResolveParamsView params)
|
||||
-> Channel::channel_list
|
||||
{
|
||||
if (auto it = params.custom_channels.find_weaken(uc.location());
|
||||
it != params.custom_channels.cend())
|
||||
|
@ -561,8 +563,8 @@ namespace mamba::specs
|
|||
* Implementation of std::hash *
|
||||
*********************************/
|
||||
|
||||
auto ::std::hash<mamba::specs::Channel>::operator()(const mamba::specs::Channel
|
||||
& chan) const -> std::size_t
|
||||
auto ::std::hash<mamba::specs::Channel>::operator()(const mamba::specs::Channel & chan) const
|
||||
-> std::size_t
|
||||
{
|
||||
return mamba::util::hash_combine(
|
||||
mamba::util::hash_vals(chan.url(), chan.display_name()),
|
||||
|
|
|
@ -46,7 +46,8 @@ namespace mamba::specs
|
|||
|
||||
[[nodiscard]] auto is_likely_glob(std::string_view pattern) -> bool
|
||||
{
|
||||
constexpr auto is_likely_glob_char = [](char c) -> bool {
|
||||
constexpr auto is_likely_glob_char = [](char c) -> bool
|
||||
{
|
||||
return util::is_alphanum(c) || (c == '-') || (c == '_')
|
||||
|| (c == GlobSpec::glob_pattern);
|
||||
};
|
||||
|
@ -125,8 +126,8 @@ namespace mamba::specs
|
|||
}
|
||||
|
||||
auto
|
||||
fmt::formatter<mamba::specs::ChimeraStringSpec>::parse(format_parse_context& ctx
|
||||
) -> decltype(ctx.begin())
|
||||
fmt::formatter<mamba::specs::ChimeraStringSpec>::parse(format_parse_context& ctx)
|
||||
-> decltype(ctx.begin())
|
||||
{
|
||||
// make sure that range is empty
|
||||
if (ctx.begin() != ctx.end() && *ctx.begin() != '}')
|
||||
|
|
|
@ -24,8 +24,8 @@ namespace mamba::specs
|
|||
*
|
||||
* Not a static function, it is needed in "channel_spec.cpp".
|
||||
*/
|
||||
auto find_slash_and_platform(std::string_view path
|
||||
) -> std::tuple<std::size_t, std::size_t, std::optional<KnownPlatform>>
|
||||
auto find_slash_and_platform(std::string_view path)
|
||||
-> std::tuple<std::size_t, std::size_t, std::optional<KnownPlatform>>
|
||||
{
|
||||
static constexpr auto npos = std::string_view::npos;
|
||||
|
||||
|
|
|
@ -56,10 +56,8 @@ fmt::formatter<mamba::specs::GlobSpec>::parse(format_parse_context& ctx) -> decl
|
|||
}
|
||||
|
||||
auto
|
||||
fmt::formatter<mamba::specs::GlobSpec>::format(
|
||||
const ::mamba::specs::GlobSpec& spec,
|
||||
format_context& ctx
|
||||
) const -> decltype(ctx.out())
|
||||
fmt::formatter<mamba::specs::GlobSpec>::format(const ::mamba::specs::GlobSpec& spec, format_context& ctx) const
|
||||
-> decltype(ctx.out())
|
||||
{
|
||||
return fmt::format_to(ctx.out(), "{}", spec.str());
|
||||
}
|
||||
|
|
|
@ -180,7 +180,8 @@ namespace mamba::specs
|
|||
{
|
||||
return util::strip_if(
|
||||
str,
|
||||
[](char c) -> bool {
|
||||
[](char c) -> bool
|
||||
{
|
||||
return !util::is_graphic(c) || (c == MatchSpec::preferred_quote)
|
||||
|| (c == MatchSpec::alt_quote);
|
||||
}
|
||||
|
@ -312,8 +313,8 @@ namespace mamba::specs
|
|||
);
|
||||
}
|
||||
|
||||
[[nodiscard]] auto split_attribute_val(std::string_view key_val
|
||||
) -> expected_parse_t<std::tuple<std::string_view, std::optional<std::string_view>>>
|
||||
[[nodiscard]] auto split_attribute_val(std::string_view key_val)
|
||||
-> expected_parse_t<std::tuple<std::string_view, std::optional<std::string_view>>>
|
||||
{
|
||||
// Forbid known ambiguity
|
||||
if (util::starts_with(key_val, "version"))
|
||||
|
@ -427,7 +428,8 @@ namespace mamba::specs
|
|||
assert(start < end);
|
||||
return set_matchspec_attributes(spec, str.substr(start + 1, end - start - 1))
|
||||
.and_then( //
|
||||
[&]() {
|
||||
[&]()
|
||||
{
|
||||
return rparse_and_set_matchspec_attributes(
|
||||
spec,
|
||||
str.substr(0, start_end.first)
|
||||
|
@ -438,8 +440,8 @@ namespace mamba::specs
|
|||
);
|
||||
}
|
||||
|
||||
auto split_version_and_build(std::string_view str
|
||||
) -> std::pair<std::string_view, std::string_view>
|
||||
auto split_version_and_build(std::string_view str)
|
||||
-> std::pair<std::string_view, std::string_view>
|
||||
{
|
||||
str = util::strip(str);
|
||||
|
||||
|
|
|
@ -26,8 +26,8 @@
|
|||
namespace mamba::specs
|
||||
{
|
||||
// Defined in conda_url.cpp
|
||||
[[nodiscard]] auto find_slash_and_platform(std::string_view path
|
||||
) -> std::tuple<std::size_t, std::size_t, std::optional<KnownPlatform>>;
|
||||
[[nodiscard]] auto find_slash_and_platform(std::string_view path)
|
||||
-> std::tuple<std::size_t, std::size_t, std::optional<KnownPlatform>>;
|
||||
|
||||
auto UnresolvedChannel::parse_platform_list(std::string_view plats) -> platform_set
|
||||
{
|
||||
|
@ -68,8 +68,8 @@ namespace mamba::specs
|
|||
return { {}, {} };
|
||||
}
|
||||
|
||||
auto split_location_platform(std::string_view str
|
||||
) -> expected_parse_t<std::pair<std::string, dynamic_platform_set>>
|
||||
auto split_location_platform(std::string_view str)
|
||||
-> expected_parse_t<std::pair<std::string, dynamic_platform_set>>
|
||||
{
|
||||
if (util::ends_with(str, ']'))
|
||||
{
|
||||
|
@ -247,10 +247,8 @@ namespace mamba::specs
|
|||
}
|
||||
|
||||
auto
|
||||
fmt::formatter<mamba::specs::UnresolvedChannel>::format(
|
||||
const UnresolvedChannel& uc,
|
||||
format_context& ctx
|
||||
) const -> format_context::iterator
|
||||
fmt::formatter<mamba::specs::UnresolvedChannel>::format(const UnresolvedChannel& uc, format_context& ctx) const
|
||||
-> format_context::iterator
|
||||
{
|
||||
auto out = fmt::format_to(ctx.out(), "{}", uc.location());
|
||||
if (!uc.platform_filters().empty())
|
||||
|
|
|
@ -176,8 +176,8 @@ namespace mamba::specs
|
|||
}
|
||||
|
||||
auto
|
||||
fmt::formatter<mamba::specs::VersionPartAtom>::parse(format_parse_context& ctx
|
||||
) -> decltype(ctx.begin())
|
||||
fmt::formatter<mamba::specs::VersionPartAtom>::parse(format_parse_context& ctx)
|
||||
-> decltype(ctx.begin())
|
||||
{
|
||||
// make sure that range is empty
|
||||
if (ctx.begin() != ctx.end() && *ctx.begin() != '}')
|
||||
|
@ -404,8 +404,8 @@ namespace mamba::specs
|
|||
{
|
||||
};
|
||||
|
||||
[[maybe_unused]] auto
|
||||
starts_with_three_way(const AlwaysEqual&, const AlwaysEqual&) -> strong_ordering
|
||||
[[maybe_unused]] auto starts_with_three_way(const AlwaysEqual&, const AlwaysEqual&)
|
||||
-> strong_ordering
|
||||
{
|
||||
// This comparison should not happen with the current usage.
|
||||
assert(false);
|
||||
|
@ -424,8 +424,8 @@ namespace mamba::specs
|
|||
return strong_ordering::equal;
|
||||
}
|
||||
|
||||
auto
|
||||
starts_with_three_way(const VersionPartAtom& a, const VersionPartAtom& b) -> strong_ordering
|
||||
auto starts_with_three_way(const VersionPartAtom& a, const VersionPartAtom& b)
|
||||
-> strong_ordering
|
||||
{
|
||||
if ((a.numeral() == b.numeral()) && b.literal().empty())
|
||||
{
|
||||
|
@ -533,8 +533,8 @@ namespace mamba::specs
|
|||
}
|
||||
|
||||
template <typename Int>
|
||||
auto parse_leading_epoch(std::string_view str
|
||||
) -> expected_parse_t<std::pair<Int, std::string_view>>
|
||||
auto parse_leading_epoch(std::string_view str)
|
||||
-> expected_parse_t<std::pair<Int, std::string_view>>
|
||||
{
|
||||
const auto delim_pos = str.find(Version::epoch_delim);
|
||||
// No epoch is specified
|
||||
|
@ -574,8 +574,8 @@ namespace mamba::specs
|
|||
return { maybe_integer.value(), rest };
|
||||
}
|
||||
|
||||
auto
|
||||
parse_leading_literal(std::string_view str) -> std::pair<std::string_view, std::string_view>
|
||||
auto parse_leading_literal(std::string_view str)
|
||||
-> std::pair<std::string_view, std::string_view>
|
||||
{
|
||||
const auto [literal, rest] = util::lstrip_if_parts(
|
||||
str,
|
||||
|
@ -584,8 +584,8 @@ namespace mamba::specs
|
|||
return { literal, rest };
|
||||
}
|
||||
|
||||
auto
|
||||
parse_leading_part_atom(std::string_view str) -> std::pair<VersionPartAtom, std::string_view>
|
||||
auto parse_leading_part_atom(std::string_view str)
|
||||
-> std::pair<VersionPartAtom, std::string_view>
|
||||
{
|
||||
assert(!str.empty());
|
||||
|
||||
|
@ -694,8 +694,8 @@ namespace mamba::specs
|
|||
return { std::move(parts) };
|
||||
}
|
||||
|
||||
auto parse_trailing_local_version(std::string_view str
|
||||
) -> expected_parse_t<std::pair<std::string_view, CommonVersion>>
|
||||
auto parse_trailing_local_version(std::string_view str)
|
||||
-> expected_parse_t<std::pair<std::string_view, CommonVersion>>
|
||||
{
|
||||
const auto delim_pos = str.rfind(Version::local_delim);
|
||||
// No local is specified
|
||||
|
@ -791,8 +791,8 @@ fmt::formatter<mamba::specs::Version>::parse(format_parse_context& ctx) -> declt
|
|||
}
|
||||
|
||||
auto
|
||||
fmt::formatter<mamba::specs::Version>::format(const ::mamba::specs::Version v, format_context& ctx)
|
||||
const -> decltype(ctx.out())
|
||||
fmt::formatter<mamba::specs::Version>::format(const ::mamba::specs::Version v, format_context& ctx) const
|
||||
-> decltype(ctx.out())
|
||||
{
|
||||
auto out = ctx.out();
|
||||
if (v.epoch() != 0)
|
||||
|
|
|
@ -29,8 +29,8 @@ namespace mamba::specs
|
|||
return true;
|
||||
}
|
||||
|
||||
auto
|
||||
VersionPredicate::starts_with::operator()(const Version& point, const Version& prefix) const -> bool
|
||||
auto VersionPredicate::starts_with::operator()(const Version& point, const Version& prefix) const
|
||||
-> bool
|
||||
{
|
||||
return point.starts_with(prefix);
|
||||
}
|
||||
|
@ -41,7 +41,8 @@ namespace mamba::specs
|
|||
}
|
||||
|
||||
auto
|
||||
VersionPredicate::not_starts_with::operator()(const Version& point, const Version& prefix) const -> bool
|
||||
VersionPredicate::not_starts_with::operator()(const Version& point, const Version& prefix) const
|
||||
-> bool
|
||||
{
|
||||
return !point.starts_with(prefix);
|
||||
}
|
||||
|
@ -52,13 +53,14 @@ namespace mamba::specs
|
|||
}
|
||||
|
||||
auto
|
||||
VersionPredicate::compatible_with::operator()(const Version& point, const Version& older) const -> bool
|
||||
VersionPredicate::compatible_with::operator()(const Version& point, const Version& older) const
|
||||
-> bool
|
||||
{
|
||||
return point.compatible_with(older, level);
|
||||
}
|
||||
|
||||
auto
|
||||
operator==(VersionPredicate::compatible_with lhs, VersionPredicate::compatible_with rhs) -> bool
|
||||
auto operator==(VersionPredicate::compatible_with lhs, VersionPredicate::compatible_with rhs)
|
||||
-> bool
|
||||
{
|
||||
return lhs.level == rhs.level;
|
||||
}
|
||||
|
@ -180,8 +182,8 @@ namespace mamba::specs
|
|||
}
|
||||
|
||||
auto
|
||||
fmt::formatter<mamba::specs::VersionPredicate>::parse(format_parse_context& ctx
|
||||
) -> decltype(ctx.begin())
|
||||
fmt::formatter<mamba::specs::VersionPredicate>::parse(format_parse_context& ctx)
|
||||
-> decltype(ctx.begin())
|
||||
{
|
||||
if (auto it = std::find(ctx.begin(), ctx.end(), 'b'); it < ctx.end())
|
||||
{
|
||||
|
|
|
@ -144,8 +144,8 @@ namespace mamba::util
|
|||
}
|
||||
|
||||
// TODO(C++20): use iterators return type
|
||||
auto
|
||||
hex_to_bytes_to(std::string_view hex, std::byte* out) noexcept -> tl::expected<void, EncodingError>
|
||||
auto hex_to_bytes_to(std::string_view hex, std::byte* out) noexcept
|
||||
-> tl::expected<void, EncodingError>
|
||||
{
|
||||
auto error = EncodingError::Ok;
|
||||
hex_to_bytes_to(hex, out, error);
|
||||
|
|
|
@ -285,8 +285,8 @@ namespace mamba::util
|
|||
* Implementation of remove prefix/suffix functions *
|
||||
******************************************************/
|
||||
|
||||
auto
|
||||
split_prefix(std::string_view str, std::string_view prefix) -> std::array<std::string_view, 2>
|
||||
auto split_prefix(std::string_view str, std::string_view prefix)
|
||||
-> std::array<std::string_view, 2>
|
||||
{
|
||||
if (starts_with(str, prefix))
|
||||
{
|
||||
|
@ -315,8 +315,8 @@ namespace mamba::util
|
|||
return std::get<1>(split_prefix(str, c));
|
||||
}
|
||||
|
||||
auto
|
||||
split_suffix(std::string_view str, std::string_view suffix) -> std::array<std::string_view, 2>
|
||||
auto split_suffix(std::string_view str, std::string_view suffix)
|
||||
-> std::array<std::string_view, 2>
|
||||
{
|
||||
if (ends_with(str, suffix))
|
||||
{
|
||||
|
@ -478,14 +478,14 @@ namespace mamba::util
|
|||
return lstrip_parts_impl(input, c);
|
||||
}
|
||||
|
||||
auto
|
||||
lstrip_parts(std::string_view input, std::string_view chars) -> std::array<std::string_view, 2>
|
||||
auto lstrip_parts(std::string_view input, std::string_view chars)
|
||||
-> std::array<std::string_view, 2>
|
||||
{
|
||||
return lstrip_parts_impl(input, chars);
|
||||
}
|
||||
|
||||
auto
|
||||
lstrip_parts(std::wstring_view input, std::wstring_view chars) -> std::array<std::wstring_view, 2>
|
||||
auto lstrip_parts(std::wstring_view input, std::wstring_view chars)
|
||||
-> std::array<std::wstring_view, 2>
|
||||
{
|
||||
return lstrip_parts_impl(input, chars);
|
||||
}
|
||||
|
@ -517,14 +517,14 @@ namespace mamba::util
|
|||
return rstrip_parts_impl(input, c);
|
||||
}
|
||||
|
||||
auto
|
||||
rstrip_parts(std::string_view input, std::string_view chars) -> std::array<std::string_view, 2>
|
||||
auto rstrip_parts(std::string_view input, std::string_view chars)
|
||||
-> std::array<std::string_view, 2>
|
||||
{
|
||||
return rstrip_parts_impl(input, chars);
|
||||
}
|
||||
|
||||
auto
|
||||
rstrip_parts(std::wstring_view input, std::wstring_view chars) -> std::array<std::wstring_view, 2>
|
||||
auto rstrip_parts(std::wstring_view input, std::wstring_view chars)
|
||||
-> std::array<std::wstring_view, 2>
|
||||
{
|
||||
return rstrip_parts_impl(input, chars);
|
||||
}
|
||||
|
@ -558,14 +558,14 @@ namespace mamba::util
|
|||
return strip_parts_impl(input, c);
|
||||
}
|
||||
|
||||
auto
|
||||
strip_parts(std::string_view input, std::string_view chars) -> std::array<std::string_view, 3>
|
||||
auto strip_parts(std::string_view input, std::string_view chars)
|
||||
-> std::array<std::string_view, 3>
|
||||
{
|
||||
return strip_parts_impl(input, chars);
|
||||
}
|
||||
|
||||
auto
|
||||
strip_parts(std::wstring_view input, std::wstring_view chars) -> std::array<std::wstring_view, 3>
|
||||
auto strip_parts(std::wstring_view input, std::wstring_view chars)
|
||||
-> std::array<std::wstring_view, 3>
|
||||
{
|
||||
return strip_parts_impl(input, chars);
|
||||
}
|
||||
|
@ -767,8 +767,8 @@ namespace mamba::util
|
|||
}
|
||||
|
||||
// TODO(C++20) lazy_split_view is a range
|
||||
auto
|
||||
split(std::wstring_view input, wchar_t sep, std::size_t max_split) -> std::vector<std::wstring>
|
||||
auto split(std::wstring_view input, wchar_t sep, std::size_t max_split)
|
||||
-> std::vector<std::wstring>
|
||||
{
|
||||
const auto sep_arr = std::array<wchar_t, 2>{ sep, L'\0' };
|
||||
return split<decltype(input)::value_type>(input, sep_arr.data(), max_split);
|
||||
|
@ -796,8 +796,8 @@ namespace mamba::util
|
|||
}
|
||||
|
||||
// TODO(C++20) lazy_split_view is a range
|
||||
auto
|
||||
rsplit(std::wstring_view input, wchar_t sep, std::size_t max_split) -> std::vector<std::wstring>
|
||||
auto rsplit(std::wstring_view input, wchar_t sep, std::size_t max_split)
|
||||
-> std::vector<std::wstring>
|
||||
{
|
||||
const auto sep_arr = std::array<wchar_t, 2>{ sep, L'\0' };
|
||||
return rsplit<decltype(input)::value_type>(input, sep_arr.data(), max_split);
|
||||
|
@ -897,8 +897,8 @@ namespace mamba::util
|
|||
return concat_dedup_splits_impl(str1, str2, sep);
|
||||
}
|
||||
|
||||
auto
|
||||
concat_dedup_splits(std::string_view str1, std::string_view str2, std::string_view sep) -> std::string
|
||||
auto concat_dedup_splits(std::string_view str1, std::string_view str2, std::string_view sep)
|
||||
-> std::string
|
||||
{
|
||||
return concat_dedup_splits_impl(str1, str2, sep);
|
||||
}
|
||||
|
|
|
@ -52,8 +52,8 @@ namespace mamba::util
|
|||
|
||||
CurlUrl();
|
||||
|
||||
[[nodiscard]] auto
|
||||
get_part(::CURLUPart part, flag_type flags = 0) const -> std::optional<std::string>;
|
||||
[[nodiscard]] auto get_part(::CURLUPart part, flag_type flags = 0) const
|
||||
-> std::optional<std::string>;
|
||||
|
||||
private:
|
||||
|
||||
|
@ -99,8 +99,8 @@ namespace mamba::util
|
|||
size_type m_len = { -1 };
|
||||
};
|
||||
|
||||
auto
|
||||
CurlUrl::parse(const std::string& url, flag_type flags) -> tl::expected<CurlUrl, URL::ParseError>
|
||||
auto CurlUrl::parse(const std::string& url, flag_type flags)
|
||||
-> tl::expected<CurlUrl, URL::ParseError>
|
||||
{
|
||||
auto out = CurlUrl();
|
||||
const CURLUcode uc = ::curl_url_set(out.m_handle.get(), CURLUPART_URL, url.c_str(), flags);
|
||||
|
@ -445,8 +445,8 @@ namespace mamba::util
|
|||
);
|
||||
}
|
||||
|
||||
auto
|
||||
URL::authority_elems(Credentials credentials, Decode::yes_type) const -> std::array<std::string, 7>
|
||||
auto URL::authority_elems(Credentials credentials, Decode::yes_type) const
|
||||
-> std::array<std::string, 7>
|
||||
{
|
||||
return authority_elems_impl<std::string>(
|
||||
authentication_elems(credentials, Decode::yes),
|
||||
|
|
|
@ -82,7 +82,7 @@ namespace mamba::validation
|
|||
|
||||
RoleFullKeys::RoleFullKeys(const std::map<std::string, Key>& keys_, const std::size_t& threshold_)
|
||||
: keys(keys_)
|
||||
, threshold(threshold_){};
|
||||
, threshold(threshold_) {};
|
||||
|
||||
auto RoleFullKeys::to_keys() const -> std::map<std::string, Key>
|
||||
{
|
||||
|
|
|
@ -42,8 +42,8 @@ namespace mamba::validation
|
|||
namespace
|
||||
{
|
||||
template <size_t S, class B>
|
||||
[[nodiscard]] auto
|
||||
hex_to_bytes_arr(const B& buffer, int& error_code) noexcept -> std::array<std::byte, S>
|
||||
[[nodiscard]] auto hex_to_bytes_arr(const B& buffer, int& error_code) noexcept
|
||||
-> std::array<std::byte, S>
|
||||
{
|
||||
auto out = std::array<std::byte, S>{};
|
||||
auto err = util::EncodingError::Ok;
|
||||
|
@ -53,8 +53,8 @@ namespace mamba::validation
|
|||
}
|
||||
|
||||
template <class B>
|
||||
[[nodiscard]] auto
|
||||
hex_to_bytes_vec(const B& buffer, int& error_code) noexcept -> std::vector<std::byte>
|
||||
[[nodiscard]] auto hex_to_bytes_vec(const B& buffer, int& error_code) noexcept
|
||||
-> std::vector<std::byte>
|
||||
{
|
||||
auto out = std::vector<std::byte>(buffer.size() / 2);
|
||||
auto err = util::EncodingError::Ok;
|
||||
|
@ -133,8 +133,8 @@ namespace mamba::validation
|
|||
}
|
||||
|
||||
auto generate_ed25519_keypair() -> std::pair<
|
||||
std::array<std::byte, MAMBA_ED25519_KEYSIZE_BYTES>,
|
||||
std::array<std::byte, MAMBA_ED25519_KEYSIZE_BYTES>>
|
||||
std::array<std::byte, MAMBA_ED25519_KEYSIZE_BYTES>,
|
||||
std::array<std::byte, MAMBA_ED25519_KEYSIZE_BYTES>>
|
||||
{
|
||||
std::array<std::byte, MAMBA_ED25519_KEYSIZE_BYTES> pk, sk;
|
||||
generate_ed25519_keypair(pk.data(), sk.data());
|
||||
|
@ -288,14 +288,15 @@ namespace mamba::validation
|
|||
return verify(data, bin_pk.data(), bin_signature.data());
|
||||
}
|
||||
|
||||
auto
|
||||
verify_gpg_hashed_msg(const std::byte* data, const std::byte* pk, const std::byte* signature) -> int
|
||||
auto verify_gpg_hashed_msg(const std::byte* data, const std::byte* pk, const std::byte* signature)
|
||||
-> int
|
||||
{
|
||||
return verify(data, MAMBA_SHA256_SIZE_BYTES, pk, signature);
|
||||
}
|
||||
|
||||
auto
|
||||
verify_gpg_hashed_msg(const std::string& data, const std::byte* pk, const std::byte* signature) -> int
|
||||
verify_gpg_hashed_msg(const std::string& data, const std::byte* pk, const std::byte* signature)
|
||||
-> int
|
||||
{
|
||||
int error = 0;
|
||||
auto data_bin = hex_to_bytes_arr<MAMBA_SHA256_SIZE_BYTES>(data, error);
|
||||
|
|
|
@ -146,8 +146,8 @@ namespace mamba::validation::v0_6
|
|||
}
|
||||
|
||||
auto
|
||||
RootImpl::upgraded_signature(const nlohmann::json& j, const std::string& pk, const std::byte* sk)
|
||||
const -> RoleSignature
|
||||
RootImpl::upgraded_signature(const nlohmann::json& j, const std::string& pk, const std::byte* sk) const
|
||||
-> RoleSignature
|
||||
{
|
||||
std::array<std::byte, MAMBA_ED25519_SIGSIZE_BYTES> sig_bin;
|
||||
sign(j.dump(), sk, sig_bin.data());
|
||||
|
|
|
@ -22,8 +22,8 @@ using namespace mamba::solver;
|
|||
|
||||
namespace
|
||||
{
|
||||
auto
|
||||
mkpkg(std::string name, std::string version, std::vector<std::string> deps = {}) -> specs::PackageInfo
|
||||
auto mkpkg(std::string name, std::string version, std::vector<std::string> deps = {})
|
||||
-> specs::PackageInfo
|
||||
{
|
||||
auto out = specs::PackageInfo();
|
||||
out.name = std::move(name);
|
||||
|
|
|
@ -25,7 +25,8 @@ using namespace mamba;
|
|||
using namespace mamba::solver;
|
||||
|
||||
auto
|
||||
find_actions_with_name(const Solution& solution, std::string_view name) -> std::vector<Solution::Action>
|
||||
find_actions_with_name(const Solution& solution, std::string_view name)
|
||||
-> std::vector<Solution::Action>
|
||||
{
|
||||
auto out = std::vector<Solution::Action>();
|
||||
for (const auto& action : solution.actions)
|
||||
|
|
|
@ -297,10 +297,9 @@ namespace
|
|||
);
|
||||
}
|
||||
|
||||
auto make_platform_channels(
|
||||
std::vector<std::string>&& channels,
|
||||
const std::vector<std::string>& platforms
|
||||
) -> std::vector<std::string>
|
||||
auto
|
||||
make_platform_channels(std::vector<std::string>&& channels, const std::vector<std::string>& platforms)
|
||||
-> std::vector<std::string>
|
||||
{
|
||||
auto add_plat = [&platforms](const auto& chan)
|
||||
{ return fmt::format("{}[{}]", chan, fmt::join(platforms, ",")); };
|
||||
|
|
|
@ -233,9 +233,8 @@ TEST_SUITE("specs::channel")
|
|||
{
|
||||
auto make_typical_params = []() -> ChannelResolveParams
|
||||
{
|
||||
auto make_channel = [](std::string_view loc, const ChannelResolveParams& params) {
|
||||
return Channel::resolve(UnresolvedChannel::parse(loc).value(), params).value().at(0);
|
||||
};
|
||||
auto make_channel = [](std::string_view loc, const ChannelResolveParams& params)
|
||||
{ return Channel::resolve(UnresolvedChannel::parse(loc).value(), params).value().at(0); };
|
||||
|
||||
auto params = ChannelResolveParams{};
|
||||
params.platforms = { "linux-64", "noarch" };
|
||||
|
|
|
@ -176,8 +176,8 @@ protected:
|
|||
|
||||
std::unique_ptr<TemporaryDirectory> channel_dir;
|
||||
|
||||
auto generate_role_secrets(int count
|
||||
) -> std::map<std::string, std::array<std::byte, MAMBA_ED25519_KEYSIZE_BYTES>>
|
||||
auto generate_role_secrets(int count)
|
||||
-> std::map<std::string, std::array<std::byte, MAMBA_ED25519_KEYSIZE_BYTES>>
|
||||
{
|
||||
std::map<std::string, std::array<std::byte, MAMBA_ED25519_KEYSIZE_BYTES>> role_secrets;
|
||||
|
||||
|
@ -757,8 +757,8 @@ public:
|
|||
return update_key_mgr.patch(sig_patch);
|
||||
}
|
||||
|
||||
auto
|
||||
write_key_mgr_file(const nl::json& j, const std::string& filename = "key_mgr.json") -> fs::u8path
|
||||
auto write_key_mgr_file(const nl::json& j, const std::string& filename = "key_mgr.json")
|
||||
-> fs::u8path
|
||||
{
|
||||
fs::u8path p = channel_dir->path() / filename;
|
||||
|
||||
|
@ -1030,8 +1030,8 @@ public:
|
|||
return update_pkg_mgr.patch(sig_patch);
|
||||
}
|
||||
|
||||
auto
|
||||
write_pkg_mgr_file(const nl::json& j, const std::string& filename = "pkg_mgr.json") -> fs::u8path
|
||||
auto write_pkg_mgr_file(const nl::json& j, const std::string& filename = "pkg_mgr.json")
|
||||
-> fs::u8path
|
||||
{
|
||||
fs::u8path p = channel_dir->path() / filename;
|
||||
|
||||
|
|
|
@ -133,8 +133,8 @@ protected:
|
|||
|
||||
secrets_type secrets;
|
||||
|
||||
auto generate_role_secrets(int count
|
||||
) -> std::map<std::string, std::array<std::byte, MAMBA_ED25519_KEYSIZE_BYTES>>
|
||||
auto generate_role_secrets(int count)
|
||||
-> std::map<std::string, std::array<std::byte, MAMBA_ED25519_KEYSIZE_BYTES>>
|
||||
{
|
||||
std::map<std::string, std::array<std::byte, MAMBA_ED25519_KEYSIZE_BYTES>> role_secrets;
|
||||
|
||||
|
|
|
@ -371,7 +371,8 @@ bind_submodule_impl(pybind11::module_ m)
|
|||
|
||||
py::enum_<SolverRuleinfoV2Migrator>(m, "SolverRuleinfo")
|
||||
.def(py::init(
|
||||
[](py::args, py::kwargs) -> SolverRuleinfoV2Migrator {
|
||||
[](py::args, py::kwargs) -> SolverRuleinfoV2Migrator
|
||||
{
|
||||
throw std::runtime_error("Direct access to libsolv objects is not longer supported.");
|
||||
}
|
||||
));
|
||||
|
@ -579,7 +580,8 @@ bind_submodule_impl(pybind11::module_ m)
|
|||
const std::string& full_url,
|
||||
MultiPackageCache& caches,
|
||||
const std::string& repodata_fn,
|
||||
const std::string& url) {
|
||||
const std::string& url)
|
||||
{
|
||||
self.create(context, channel_context, channel, platform, full_url, caches, repodata_fn, url);
|
||||
},
|
||||
py::arg("context"),
|
||||
|
|
|
@ -225,12 +225,12 @@ namespace mambapy
|
|||
py::arg("format")
|
||||
);
|
||||
|
||||
constexpr auto solver_flags_v2_migrator = [](Solver&, py::args, py::kwargs) {
|
||||
constexpr auto solver_flags_v2_migrator = [](Solver&, py::args, py::kwargs)
|
||||
{
|
||||
throw std::runtime_error("All flags need to be passed in the libmambapy.solver.Request.");
|
||||
};
|
||||
constexpr auto solver_job_v2_migrator = [](Solver&, py::args, py::kwargs) {
|
||||
throw std::runtime_error("All jobs need to be passed in the libmambapy.solver.Request.");
|
||||
};
|
||||
constexpr auto solver_job_v2_migrator = [](Solver&, py::args, py::kwargs)
|
||||
{ throw std::runtime_error("All jobs need to be passed in the libmambapy.solver.Request."); };
|
||||
|
||||
py::class_<Solver>(m, "Solver") //
|
||||
.def(py::init())
|
||||
|
|
|
@ -122,7 +122,8 @@ namespace mambapy
|
|||
)
|
||||
.def(
|
||||
"user",
|
||||
[](const CondaURL& self, bool decode) {
|
||||
[](const CondaURL& self, bool decode)
|
||||
{
|
||||
return decode ? self.user(CondaURL::Decode::yes)
|
||||
: self.user(CondaURL::Decode::no);
|
||||
},
|
||||
|
@ -145,7 +146,8 @@ namespace mambapy
|
|||
.def("has_user", [](const CondaURL& self) { return self.has_user(); })
|
||||
.def(
|
||||
"password",
|
||||
[](const CondaURL& self, bool decode) {
|
||||
[](const CondaURL& self, bool decode)
|
||||
{
|
||||
return decode ? self.password(CondaURL::Decode::yes)
|
||||
: self.password(CondaURL::Decode::no);
|
||||
},
|
||||
|
@ -197,7 +199,8 @@ namespace mambapy
|
|||
.def("authority", [](const CondaURL& self) { return self.authority(); })
|
||||
.def(
|
||||
"path",
|
||||
[](const CondaURL& self, bool decode) {
|
||||
[](const CondaURL& self, bool decode)
|
||||
{
|
||||
return decode ? self.path(CondaURL::Decode::yes)
|
||||
: self.path(CondaURL::Decode::no);
|
||||
},
|
||||
|
@ -778,7 +781,8 @@ namespace mambapy
|
|||
.def(
|
||||
// V2 Migation: Hard deprecation since errors would be hard to track.
|
||||
py::init(
|
||||
[](std::string_view) -> MatchSpec {
|
||||
[](std::string_view) -> MatchSpec
|
||||
{
|
||||
throw std::invalid_argument(
|
||||
"Use 'MatchSpec.parse' to create a new object from a string"
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue