From 7f68f729ad2b5725ef007b55cd73bd48809e97e9 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Mon, 18 Nov 2024 16:30:08 -0500 Subject: [PATCH] fix: support homebrew/linuxbrew Signed-off-by: Henry Schreiner --- libmamba/ext/solv-cpp/CMakeLists.txt | 1 + libmamba/include/mamba/specs/channel.hpp | 101 ++++++++++++----------- libmamba/src/core/transaction.cpp | 2 +- 3 files changed, 53 insertions(+), 51 deletions(-) diff --git a/libmamba/ext/solv-cpp/CMakeLists.txt b/libmamba/ext/solv-cpp/CMakeLists.txt index 4af07a432a..8934098b4b 100644 --- a/libmamba/ext/solv-cpp/CMakeLists.txt +++ b/libmamba/ext/solv-cpp/CMakeLists.txt @@ -20,6 +20,7 @@ find_package(Libsolv REQUIRED) if(BUILD_SHARED) set(LIBSOLV_DEPS solv::libsolv solv::libsolvext) + set_target_properties(solv-cpp PROPERTIES POSITION_INDEPENDENT_CODE ON) else() set(LIBSOLV_DEPS solv::libsolv_static solv::libsolvext_static) endif() diff --git a/libmamba/include/mamba/specs/channel.hpp b/libmamba/include/mamba/specs/channel.hpp index f3bdc23ff4..26e829a728 100644 --- a/libmamba/include/mamba/specs/channel.hpp +++ b/libmamba/include/mamba/specs/channel.hpp @@ -22,61 +22,15 @@ namespace mamba::specs { - class Channel; - - struct ChannelResolveParams - { - /** - * The weakener for @ref ResolveParams::custom_channels. - */ - struct NameWeakener - { - /** - * Return the key unchanged. - */ - [[nodiscard]] auto make_first_key(std::string_view key) const -> std::string_view; - - /** - * Remove the last element of the '/'-separated name. - */ - [[nodiscard]] auto weaken_key(std::string_view key) const - -> std::optional; - }; - - template - using name_map = util::weakening_map, NameWeakener>; - - using platform_list = util::flat_set; - using channel_list = std::vector; - using channel_map = name_map; - using multichannel_map = name_map; - - platform_list platforms = {}; - CondaURL channel_alias = {}; - channel_map custom_channels = {}; - multichannel_map custom_multichannels = {}; - AuthenticationDataBase authentication_db = {}; - std::string home_dir = {}; - std::string current_working_dir = {}; - }; - - struct ChannelResolveParamsView - { - const ChannelResolveParams::platform_list& platforms = {}; - const CondaURL& channel_alias = {}; - const ChannelResolveParams::channel_map& custom_channels = {}; - const ChannelResolveParams::multichannel_map& custom_multichannels = {}; - const AuthenticationDataBase& authentication_db = {}; - std::string_view home_dir = {}; - std::string_view current_working_dir = {}; - }; + struct ChannelResolveParams; + struct ChannelResolveParamsView; class Channel { public: - using platform_list = ChannelResolveParams::platform_list; - using channel_list = ChannelResolveParams::channel_list; + using platform_list = util::flat_set; + using channel_list = std::vector; [[nodiscard]] static auto resolve( // UnresolvedChannel uc, @@ -145,6 +99,53 @@ namespace mamba::specs util::flat_set m_platforms; }; + struct ChannelResolveParams + { + /** + * The weakener for @ref ResolveParams::custom_channels. + */ + struct NameWeakener + { + /** + * Return the key unchanged. + */ + [[nodiscard]] auto make_first_key(std::string_view key) const -> std::string_view; + + /** + * Remove the last element of the '/'-separated name. + */ + [[nodiscard]] auto weaken_key(std::string_view key) const + -> std::optional; + }; + + template + using name_map = util::weakening_map, NameWeakener>; + + using platform_list = util::flat_set; + using channel_list = std::vector; + using channel_map = name_map; + using multichannel_map = name_map; + + platform_list platforms = {}; + CondaURL channel_alias = {}; + channel_map custom_channels = {}; + multichannel_map custom_multichannels = {}; + AuthenticationDataBase authentication_db = {}; + std::string home_dir = {}; + std::string current_working_dir = {}; + }; + + struct ChannelResolveParamsView + { + const ChannelResolveParams::platform_list& platforms = {}; + const CondaURL& channel_alias = {}; + const ChannelResolveParams::channel_map& custom_channels = {}; + const ChannelResolveParams::multichannel_map& custom_multichannels = {}; + const AuthenticationDataBase& authentication_db = {}; + std::string_view home_dir = {}; + std::string_view current_working_dir = {}; + }; + /** Tuple-like equality of all observable members */ auto operator==(const Channel& a, const Channel& b) -> bool; auto operator!=(const Channel& a, const Channel& b) -> bool; diff --git a/libmamba/src/core/transaction.cpp b/libmamba/src/core/transaction.cpp index 7d2f766896..1b1c5fba08 100644 --- a/libmamba/src/core/transaction.cpp +++ b/libmamba/src/core/transaction.cpp @@ -698,7 +698,7 @@ namespace mamba it != extract_tasks.end(); ++it) { - std::packaged_task task{ [=] { return it->run(); } }; + std::packaged_task task{ [=] { return it->run(); } }; extract_trackers.push_back(task.get_future()); MainExecutor::instance().schedule(std::move(task)); }