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

Read repodata.json using nl::json (rerun) #2753

Merged
merged 5 commits into from
Oct 4, 2023
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
1 change: 1 addition & 0 deletions .github/workflows/static_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ jobs:
cli11>=2.2,<3
cpp-expected
nlohmann_json
simdjson-static>=3.3.0
spdlog
fmt
yaml-cpp-static>=0.8.0
Expand Down
4 changes: 0 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@ endif()

# libmamba library and tests
if (BUILD_LIBMAMBA)
if (BUILD_LIBMAMBA_TESTS)
set(BUILD_TESTS ON)
endif()

add_subdirectory(libmamba)
endif()

Expand Down
7 changes: 6 additions & 1 deletion libmamba/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ find_package(fmt REQUIRED)
find_package(spdlog REQUIRED)
find_package(tl-expected REQUIRED)
find_package(nlohmann_json REQUIRED)
find_package(simdjson REQUIRED)
find_package(yaml-cpp REQUIRED)
find_package(reproc REQUIRED)
find_package(reproc++ REQUIRED)
Expand Down Expand Up @@ -358,6 +359,8 @@ macro(libmamba_create_target target_name linkage output_name)
if (${linkage_upper} STREQUAL "STATIC")
message(" -> Statically linking against libmamba (static) dependencies")

target_compile_definitions(${target_name} PUBLIC SPDLOG_FMT_EXTERNAL)

mamba_target_check_type(yaml-cpp::yaml-cpp STATIC_LIBRARY FATAL_ERROR)
mamba_target_check_type(reproc STATIC_LIBRARY FATAL_ERROR)
mamba_target_check_type(reproc++ STATIC_LIBRARY FATAL_ERROR)
Expand All @@ -373,6 +376,7 @@ macro(libmamba_create_target target_name linkage output_name)
PRIVATE
reproc
reproc++
simdjson::simdjson_static
)

if (UNIX)
Expand Down Expand Up @@ -535,6 +539,7 @@ macro(libmamba_create_target target_name linkage output_name)
PRIVATE
reproc
reproc++
simdjson::simdjson
)
endif ()

Expand Down Expand Up @@ -622,7 +627,7 @@ if (NOT (BUILD_SHARED OR BUILD_STATIC))
endif ()

# Tests
if (BUILD_TESTS)
if (BUILD_LIBMAMBA_TESTS)
add_subdirectory(tests)
endif()

Expand Down
1 change: 1 addition & 0 deletions libmamba/environment-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ dependencies:
- cmake >=3.16
- ninja
- nlohmann_json
- simdjson >=3.3.0
- libsolv >=0.7.18
- libarchive
- libsodium
Expand Down
1 change: 1 addition & 0 deletions libmamba/include/mamba/core/context.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ namespace mamba

// Configurable
bool experimental = false;
bool experimental_repodata_parsing = false;
bool debug = false;

// TODO check writable and add other potential dirs
Expand Down
29 changes: 24 additions & 5 deletions libmamba/include/mamba/core/repo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,27 @@ namespace mamba
{
public:

MRepo(MPool& pool, const std::string& name, const fs::u8path& filename, const RepoMetadata& meta);
enum class RepodataParser
{
automatic,
mamba,
libsolv,
};

enum class LibsolvCache
{
yes,
no,
};

MRepo(
MPool& pool,
const std::string& name,
const fs::u8path& filename,
const RepoMetadata& meta,
RepodataParser parser = RepodataParser::automatic,
LibsolvCache use_cache = LibsolvCache::yes
);
MRepo(MPool& pool, const PrefixData& prefix_data);
MRepo(MPool& pool, const std::string& name, const std::vector<PackageInfo>& uris);

Expand Down Expand Up @@ -96,12 +116,11 @@ namespace mamba

void add_pip_as_python_dependency();
void clear(bool reuse_ids = true);
void load_file(const fs::u8path& filename);
void read_json(const fs::u8path& filename);
void load_file(const fs::u8path& filename, RepodataParser parser, LibsolvCache use_cache);
void libsolv_read_json(const fs::u8path& filename);
void mamba_read_json(const fs::u8path& filename);
bool read_solv(const fs::u8path& filename);
void write_solv(fs::u8path path);
void add_package_info(const PackageInfo& pkg_info);
void set_solvables_url(const std::string& repo_url);

MPool m_pool;

Expand Down
6 changes: 6 additions & 0 deletions libmamba/src/api/configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1209,6 +1209,12 @@ namespace mamba
under active development and not stable yet.)"))
.set_post_merge_hook(detail::experimental_hook));

insert(Configurable("experimental_repodata_parsing", &m_context.experimental_repodata_parsing)
.group("Basic")
.description("Enable experimental parsing of repodata.json using nl::json")
.set_rc_configurable()
.set_env_var_names());

insert(Configurable("debug", &m_context.debug)
.group("Basic")
.set_env_var_names()
Expand Down
Loading