Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: support homebrew/linuxbrew (AppleClang, GCC 11) #3613

Merged
merged 1 commit into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions libmamba/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,9 @@ macro(libmamba_create_target target_name linkage output_name)
solv::libsolvext
solv::cpp
)
# CMake 3.17 provides a LibArchive::LibArchive target that could be used instead of
# LIBRARIES/INCLUDE_DIRS
target_include_directories(${target_name} PRIVATE "${LibArchive_INCLUDE_DIRS}")
endif()

if(WIN32)
Expand Down
1 change: 1 addition & 0 deletions libmamba/ext/solv-cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated: I think we better use PIC for all targets when BUILD_SHARED is set.

Copy link
Contributor Author

@henryiii henryiii Nov 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was the only one that complained, so the only one I fixed.

else()
set(LIBSOLV_DEPS solv::libsolv_static solv::libsolvext_static)
endif()
Expand Down
101 changes: 51 additions & 50 deletions libmamba/include/mamba/specs/channel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::string_view>;
};

template <typename Key, typename Value>
using name_map = util::weakening_map<std::unordered_map<Key, Value>, NameWeakener>;

using platform_list = util::flat_set<std::string>;
using channel_list = std::vector<Channel>;
using channel_map = name_map<std::string, Channel>;
using multichannel_map = name_map<std::string, channel_list>;

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<std::string>;
using channel_list = std::vector<Channel>;

[[nodiscard]] static auto resolve( //
UnresolvedChannel uc,
Expand Down Expand Up @@ -145,6 +99,53 @@ namespace mamba::specs
util::flat_set<std::string> 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<std::string_view>;
};

template <typename Key, typename Value>
using name_map = util::weakening_map<std::unordered_map<Key, Value>, NameWeakener>;

using platform_list = util::flat_set<std::string>;
using channel_list = std::vector<Channel>;
using channel_map = name_map<std::string, Channel>;
using multichannel_map = name_map<std::string, channel_list>;

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;
Expand Down
3 changes: 2 additions & 1 deletion libmamba/src/core/transaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,8 @@ namespace mamba
it != extract_tasks.end();
++it)
{
std::packaged_task task{ [=] { return it->run(); } };
std::packaged_task<mamba::PackageExtractTask::Result()> task{ [=]
{ return it->run(); } };
extract_trackers.push_back(task.get_future());
MainExecutor::instance().schedule(std::move(task));
}
Expand Down
4 changes: 2 additions & 2 deletions libmamba/src/solver/problems_graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ namespace mamba::solver
}

// GCC reports dangling reference when using std::invoke with data members
#if defined(__GNUC__) && !defined(__clang__)
#if defined(__GNUC__) && !defined(__clang__) && __GNUC__ >= 13
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdangling-reference"
#endif
Expand Down Expand Up @@ -334,7 +334,7 @@ namespace mamba::solver
}
}

#if defined(__GNUC__) && !defined(__clang__)
#if defined(__GNUC__) && !defined(__clang__) && __GNUC__ >= 13
#pragma GCC diagnostic pop
#endif

Expand Down
Loading