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

exp: Integrating an alternative solver #3820

Closed
wants to merge 8 commits into from
Closed
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
1 change: 1 addition & 0 deletions dev/environment-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ dependencies:
- libcurl >=7.86
- libsodium
- libsolv >=0.7.18
- resolvo-cpp
- nlohmann_json
- reproc-cpp >=14.2.4.post0
- simdjson >=3.3.0
Expand Down
1 change: 1 addition & 0 deletions dev/environment-micromamba-static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ dependencies:
- spdlog
- fmt
- libsolv-static >=0.7.24
- resolvo-cpp
- yaml-cpp-static >=0.8.0
- reproc-static >=14.2.4.post0
- reproc-cpp-static >=14.2.4.post0
Expand Down
2 changes: 1 addition & 1 deletion docs/source/usage/solver.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Populating the Package Database
-------------------------------
The first thing needed is a |Database| of all the packages and their dependencies.
Packages are organised in repositories, described by a
:cpp:type:`RepoInfo <mamba::solver::libsolv::RepoInfo>`.
:cpp:type:`RepoInfo <mamba::solver::RepoInfo>`.
This serves to resolve explicit channel requirements or channel priority.
As such, the database constructor takes a set of
:cpp:type:`ChannelResolveParams <mamba::specs::ChannelResolveParams>`
Expand Down
20 changes: 16 additions & 4 deletions libmamba/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -188,14 +188,18 @@ set(
# Solver generic interface
${LIBMAMBA_SOURCE_DIR}/solver/helpers.cpp
${LIBMAMBA_SOURCE_DIR}/solver/problems_graph.cpp
${LIBMAMBA_SOURCE_DIR}/solver/parameters.cpp
${LIBMAMBA_SOURCE_DIR}/solver/repo_info.cpp
# Solver libsolv implementation
${LIBMAMBA_SOURCE_DIR}/solver/libsolv/database.cpp
${LIBMAMBA_SOURCE_DIR}/solver/libsolv/helpers.cpp
${LIBMAMBA_SOURCE_DIR}/solver/libsolv/matcher.cpp
${LIBMAMBA_SOURCE_DIR}/solver/libsolv/parameters.cpp
${LIBMAMBA_SOURCE_DIR}/solver/libsolv/repo_info.cpp
${LIBMAMBA_SOURCE_DIR}/solver/libsolv/solver.cpp
${LIBMAMBA_SOURCE_DIR}/solver/libsolv/unsolvable.cpp
# Solver resolvo implementation
${LIBMAMBA_SOURCE_DIR}/solver/resolvo/database.cpp
${LIBMAMBA_SOURCE_DIR}/solver/resolvo/solver.cpp
${LIBMAMBA_SOURCE_DIR}/solver/resolvo/unsolvable.cpp
# Artifacts validation
${LIBMAMBA_SOURCE_DIR}/validation/errors.cpp
${LIBMAMBA_SOURCE_DIR}/validation/keys.cpp
Expand Down Expand Up @@ -339,15 +343,19 @@ set(
${LIBMAMBA_INCLUDE_DIR}/mamba/specs/version_spec.hpp
${LIBMAMBA_INCLUDE_DIR}/mamba/specs/version.hpp
# Solver generic interface
${LIBMAMBA_INCLUDE_DIR}/mamba/solver/parameters.hpp
${LIBMAMBA_INCLUDE_DIR}/mamba/solver/problems_graph.hpp
${LIBMAMBA_INCLUDE_DIR}/mamba/solver/repo_info.hpp
${LIBMAMBA_INCLUDE_DIR}/mamba/solver/request.hpp
${LIBMAMBA_INCLUDE_DIR}/mamba/solver/solution.hpp
# Solver libsolv implementation
${LIBMAMBA_INCLUDE_DIR}/mamba/solver/libsolv/database.hpp
${LIBMAMBA_INCLUDE_DIR}/mamba/solver/libsolv/parameters.hpp
${LIBMAMBA_INCLUDE_DIR}/mamba/solver/libsolv/repo_info.hpp
${LIBMAMBA_INCLUDE_DIR}/mamba/solver/libsolv/solver.hpp
${LIBMAMBA_INCLUDE_DIR}/mamba/solver/libsolv/unsolvable.hpp
# Solver resolvo implementation
${LIBMAMBA_INCLUDE_DIR}/mamba/solver/resolvo/database.hpp
${LIBMAMBA_INCLUDE_DIR}/mamba/solver/resolvo/solver.hpp
${LIBMAMBA_INCLUDE_DIR}/mamba/solver/resolvo/unsolvable.hpp
# Artifacts validation
${LIBMAMBA_INCLUDE_DIR}/mamba/validation/errors.hpp
${LIBMAMBA_INCLUDE_DIR}/mamba/validation/keys.hpp
Expand Down Expand Up @@ -430,6 +438,8 @@ find_package(yaml-cpp CONFIG REQUIRED)
find_package(reproc CONFIG REQUIRED)
find_package(reproc++ CONFIG REQUIRED)
find_package(Libsolv MODULE REQUIRED)
find_package(Resolvo CONFIG REQUIRED)

add_subdirectory(ext/solv-cpp)

macro(libmamba_create_target target_name linkage output_name)
Expand Down Expand Up @@ -478,6 +488,7 @@ macro(libmamba_create_target target_name linkage output_name)
solv::libsolv_static
solv::libsolvext_static
solv::cpp
Resolvo::Resolvo
)

if(UNIX)
Expand Down Expand Up @@ -624,6 +635,7 @@ macro(libmamba_create_target target_name linkage output_name)
solv::libsolv
solv::libsolvext
solv::cpp
Resolvo::Resolvo
)
# CMake 3.17 provides a LibArchive::LibArchive target that could be used instead of
# LIBRARIES/INCLUDE_DIRS
Expand Down
13 changes: 13 additions & 0 deletions libmamba/include/mamba/api/channel_loader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ namespace mamba
{
class Database;
}

namespace solver::resolvo
{
class PackageDatabase;
}

class Context;
class ChannelContext;
class MultiPackageCache;
Expand All @@ -34,6 +40,13 @@ namespace mamba
MultiPackageCache& package_caches
) -> expected_t<void, mamba_aggregated_error>;

auto load_channels(
Context& ctx,
ChannelContext& channel_context,
solver::resolvo::PackageDatabase& pool,
MultiPackageCache& package_caches
) -> expected_t<void, mamba_aggregated_error>;

/* Brief Creates channels and mirrors objects,
* but does not load channels.
*
Expand Down
6 changes: 3 additions & 3 deletions libmamba/include/mamba/core/package_database_loader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#define MAMBA_CORE_PACKAGE_DATABASE_LOADER_HPP

#include "mamba/core/error_handling.hpp"
#include "mamba/solver/libsolv/repo_info.hpp"
#include "mamba/solver/repo_info.hpp"
#include "mamba/specs/channel.hpp"

namespace mamba
Expand All @@ -28,12 +28,12 @@ namespace mamba
const Context& ctx,
solver::libsolv::Database& db,
const SubdirData& subdir
) -> expected_t<solver::libsolv::RepoInfo>;
) -> expected_t<solver::RepoInfo>;

auto load_installed_packages_in_database(
const Context& ctx,
solver::libsolv::Database& db,
const PrefixData& prefix
) -> solver::libsolv::RepoInfo;
) -> solver::RepoInfo;
}
#endif
4 changes: 2 additions & 2 deletions libmamba/include/mamba/solver/libsolv/database.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
#include <string_view>

#include "mamba/core/error_handling.hpp"
#include "mamba/solver/libsolv/parameters.hpp"
#include "mamba/solver/libsolv/repo_info.hpp"
#include "mamba/solver/parameters.hpp"
#include "mamba/solver/repo_info.hpp"
#include "mamba/specs/channel.hpp"
#include "mamba/specs/package_info.hpp"
#include "mamba/util/loop_control.hpp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

#include <nlohmann/json_fwd.hpp>

namespace mamba::solver::libsolv
namespace mamba::solver
{
enum class RepodataParser
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,20 @@

#include <string_view>

#include "mamba/solver/libsolv/parameters.hpp"
#include "mamba/solver/parameters.hpp"


extern "C"
{
using Repo = struct s_Repo;
}

namespace mamba::solver::libsolv
namespace mamba::solver
{
class Database;
namespace libsolv
{
class Database;
}

/**
* A libsolv repository descriptor.
Expand Down Expand Up @@ -58,7 +61,7 @@ namespace mamba::solver::libsolv

explicit RepoInfo(::Repo* repo);

friend class Database;
friend class mamba::solver::libsolv::Database;
friend auto operator==(RepoInfo lhs, RepoInfo rhs) -> bool;
};

Expand Down
Loading
Loading