mirror of https://github.com/mamba-org/mamba.git
Move PackageInfo in specs:: (#3109)
* Move PackageInfo in specs:: * Move PackageInfo in specs:: * Rename PackageInfo::url > PackageInfo::package_url * Add changelog entry * Add MatchSpec migration help
This commit is contained in:
parent
dae5e0e378
commit
717456890a
|
@ -67,6 +67,9 @@ Changes inlcude:
|
|||
- ``MatchSpec`` has been redesigned and moved to ``libmambapy.specs``.
|
||||
The module also includes a platform enumeration, an implementation of ordered ``Version``, and a
|
||||
``VersionSpec`` to match versions.
|
||||
- ``PackageInfo`` has been moved to ``libmambapy.specs``.
|
||||
Some attributes have been given a more explicit name ``fn`` > ``filename``,
|
||||
``url`` > ``package_url``.
|
||||
|
||||
.. TODO include final decision for Channels as URLs.
|
||||
|
||||
|
|
|
@ -176,6 +176,7 @@ set(
|
|||
${LIBMAMBA_SOURCE_DIR}/specs/conda_url.cpp
|
||||
${LIBMAMBA_SOURCE_DIR}/specs/glob_spec.cpp
|
||||
${LIBMAMBA_SOURCE_DIR}/specs/match_spec.cpp
|
||||
${LIBMAMBA_SOURCE_DIR}/specs/package_info.cpp
|
||||
${LIBMAMBA_SOURCE_DIR}/specs/platform.cpp
|
||||
${LIBMAMBA_SOURCE_DIR}/specs/repo_data.cpp
|
||||
${LIBMAMBA_SOURCE_DIR}/specs/version.cpp
|
||||
|
@ -216,7 +217,6 @@ set(
|
|||
${LIBMAMBA_SOURCE_DIR}/core/progress_bar_impl.cpp
|
||||
${LIBMAMBA_SOURCE_DIR}/core/pinning.cpp
|
||||
${LIBMAMBA_SOURCE_DIR}/core/package_fetcher.cpp
|
||||
${LIBMAMBA_SOURCE_DIR}/core/package_info.cpp
|
||||
${LIBMAMBA_SOURCE_DIR}/core/package_paths.cpp
|
||||
${LIBMAMBA_SOURCE_DIR}/core/query.cpp
|
||||
${LIBMAMBA_SOURCE_DIR}/core/repo.cpp
|
||||
|
@ -293,6 +293,7 @@ set(
|
|||
${LIBMAMBA_INCLUDE_DIR}/mamba/specs/conda_url.hpp
|
||||
${LIBMAMBA_INCLUDE_DIR}/mamba/specs/glob_spec.hpp
|
||||
${LIBMAMBA_INCLUDE_DIR}/mamba/specs/match_spec.hpp
|
||||
${LIBMAMBA_INCLUDE_DIR}/mamba/specs/package_info.hpp
|
||||
${LIBMAMBA_INCLUDE_DIR}/mamba/specs/platform.hpp
|
||||
${LIBMAMBA_INCLUDE_DIR}/mamba/specs/repo_data.hpp
|
||||
${LIBMAMBA_INCLUDE_DIR}/mamba/specs/version.hpp
|
||||
|
@ -323,7 +324,6 @@ set(
|
|||
${LIBMAMBA_INCLUDE_DIR}/mamba/core/package_cache.hpp
|
||||
${LIBMAMBA_INCLUDE_DIR}/mamba/core/package_fetcher.hpp
|
||||
${LIBMAMBA_INCLUDE_DIR}/mamba/core/package_handling.hpp
|
||||
${LIBMAMBA_INCLUDE_DIR}/mamba/core/package_info.hpp
|
||||
${LIBMAMBA_INCLUDE_DIR}/mamba/core/package_paths.hpp
|
||||
${LIBMAMBA_INCLUDE_DIR}/mamba/core/pool.hpp
|
||||
${LIBMAMBA_INCLUDE_DIR}/mamba/core/prefix_data.hpp
|
||||
|
|
|
@ -15,11 +15,11 @@
|
|||
#include <yaml-cpp/yaml.h>
|
||||
|
||||
#include "mamba/core/package_cache.hpp"
|
||||
#include "mamba/core/package_info.hpp"
|
||||
#include "mamba/core/pool.hpp"
|
||||
#include "mamba/core/repo.hpp"
|
||||
#include "mamba/fs/filesystem.hpp"
|
||||
#include "mamba/specs/match_spec.hpp"
|
||||
#include "mamba/specs/package_info.hpp"
|
||||
|
||||
namespace mamba
|
||||
{
|
||||
|
@ -66,7 +66,8 @@ namespace mamba
|
|||
|
||||
void channels_hook(Configuration& config, std::vector<std::string>& channels);
|
||||
|
||||
bool download_explicit(const std::vector<PackageInfo>& pkgs, MultiPackageCache& pkg_caches);
|
||||
bool
|
||||
download_explicit(const std::vector<specs::PackageInfo>& pkgs, MultiPackageCache& pkg_caches);
|
||||
|
||||
struct other_pkg_mgr_spec
|
||||
{
|
||||
|
@ -88,7 +89,7 @@ namespace mamba
|
|||
|
||||
yaml_file_contents read_yaml_file(fs::u8path yaml_file, const std::string platform);
|
||||
|
||||
std::tuple<std::vector<PackageInfo>, std::vector<specs::MatchSpec>>
|
||||
std::tuple<std::vector<specs::PackageInfo>, std::vector<specs::MatchSpec>>
|
||||
parse_urls_to_package_info(const std::vector<std::string>& urls);
|
||||
|
||||
inline void to_json(nlohmann::json&, const other_pkg_mgr_spec&)
|
||||
|
|
|
@ -15,11 +15,10 @@
|
|||
|
||||
#include <tl/expected.hpp>
|
||||
|
||||
#include "mamba/core/error_handling.hpp"
|
||||
#include "mamba/core/fsutil.hpp"
|
||||
#include "mamba/fs/filesystem.hpp"
|
||||
|
||||
#include "error_handling.hpp"
|
||||
#include "fsutil.hpp"
|
||||
#include "package_info.hpp"
|
||||
#include "mamba/specs/package_info.hpp"
|
||||
|
||||
namespace mamba
|
||||
{
|
||||
|
@ -79,7 +78,7 @@ namespace mamba
|
|||
|
||||
struct Package
|
||||
{
|
||||
mamba::PackageInfo info;
|
||||
specs::PackageInfo info;
|
||||
bool is_optional = false;
|
||||
std::string category;
|
||||
std::string manager;
|
||||
|
@ -92,7 +91,7 @@ namespace mamba
|
|||
{
|
||||
}
|
||||
|
||||
std::vector<PackageInfo>
|
||||
std::vector<specs::PackageInfo>
|
||||
get_packages_for(std::string_view category, std::string_view platform, std::string_view manager)
|
||||
const;
|
||||
|
||||
|
|
|
@ -12,13 +12,12 @@
|
|||
#include <tuple>
|
||||
#include <vector>
|
||||
|
||||
#include "mamba/core/package_info.hpp"
|
||||
#include "mamba/core/package_paths.hpp"
|
||||
#include "mamba/core/transaction_context.hpp"
|
||||
#include "mamba/fs/filesystem.hpp"
|
||||
#include "mamba/specs/package_info.hpp"
|
||||
#include "mamba/util/build.hpp"
|
||||
|
||||
#include "package_paths.hpp"
|
||||
#include "transaction_context.hpp"
|
||||
|
||||
namespace mamba
|
||||
{
|
||||
std::string replace_long_shebang(const std::string& shebang);
|
||||
|
@ -45,7 +44,11 @@ namespace mamba
|
|||
{
|
||||
public:
|
||||
|
||||
UnlinkPackage(const PackageInfo& pkg_info, const fs::u8path& cache_path, TransactionContext* context);
|
||||
UnlinkPackage(
|
||||
const specs::PackageInfo& pkg_info,
|
||||
const fs::u8path& cache_path,
|
||||
TransactionContext* context
|
||||
);
|
||||
|
||||
bool execute();
|
||||
bool undo();
|
||||
|
@ -54,7 +57,7 @@ namespace mamba
|
|||
|
||||
bool unlink_path(const nlohmann::json& path_data);
|
||||
|
||||
PackageInfo m_pkg_info;
|
||||
specs::PackageInfo m_pkg_info;
|
||||
fs::u8path m_cache_path;
|
||||
std::string m_specifier;
|
||||
TransactionContext* m_context;
|
||||
|
@ -64,7 +67,11 @@ namespace mamba
|
|||
{
|
||||
public:
|
||||
|
||||
LinkPackage(const PackageInfo& pkg_info, const fs::u8path& cache_path, TransactionContext* context);
|
||||
LinkPackage(
|
||||
const specs::PackageInfo& pkg_info,
|
||||
const fs::u8path& cache_path,
|
||||
TransactionContext* context
|
||||
);
|
||||
|
||||
bool execute();
|
||||
bool undo();
|
||||
|
@ -81,7 +88,7 @@ namespace mamba
|
|||
const fs::u8path& python_full_path
|
||||
);
|
||||
|
||||
PackageInfo m_pkg_info;
|
||||
specs::PackageInfo m_pkg_info;
|
||||
fs::u8path m_cache_path;
|
||||
fs::u8path m_source;
|
||||
std::vector<std::string> m_clobber_warnings;
|
||||
|
|
|
@ -11,10 +11,9 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "mamba/core/fsutil.hpp"
|
||||
#include "mamba/fs/filesystem.hpp"
|
||||
|
||||
#include "fsutil.hpp"
|
||||
#include "package_info.hpp"
|
||||
#include "mamba/specs/package_info.hpp"
|
||||
|
||||
#define PACKAGE_CACHE_MAGIC_FILE "urls.txt"
|
||||
|
||||
|
@ -41,10 +40,10 @@ namespace mamba
|
|||
void set_writable(Writable writable);
|
||||
Writable is_writable();
|
||||
fs::u8path path() const;
|
||||
void clear_query_cache(const PackageInfo& s);
|
||||
void clear_query_cache(const specs::PackageInfo& s);
|
||||
|
||||
bool has_valid_tarball(const PackageInfo& s, const ValidationOptions& options);
|
||||
bool has_valid_extracted_dir(const PackageInfo& s, const ValidationOptions& options);
|
||||
bool has_valid_tarball(const specs::PackageInfo& s, const ValidationOptions& options);
|
||||
bool has_valid_extracted_dir(const specs::PackageInfo& s, const ValidationOptions& options);
|
||||
|
||||
private:
|
||||
|
||||
|
@ -64,14 +63,14 @@ namespace mamba
|
|||
|
||||
std::vector<fs::u8path> paths() const;
|
||||
|
||||
fs::u8path get_tarball_path(const PackageInfo& s, bool return_empty = true);
|
||||
fs::u8path get_extracted_dir_path(const PackageInfo& s, bool return_empty = true);
|
||||
fs::u8path get_tarball_path(const specs::PackageInfo& s, bool return_empty = true);
|
||||
fs::u8path get_extracted_dir_path(const specs::PackageInfo& s, bool return_empty = true);
|
||||
|
||||
fs::u8path first_writable_path();
|
||||
PackageCacheData& first_writable_cache(bool create = false);
|
||||
std::vector<PackageCacheData*> writable_caches();
|
||||
|
||||
void clear_query_cache(const PackageInfo& s);
|
||||
void clear_query_cache(const specs::PackageInfo& s);
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
#include "mamba/core/download.hpp"
|
||||
#include "mamba/core/package_cache.hpp"
|
||||
#include "mamba/core/package_handling.hpp"
|
||||
#include "mamba/core/package_info.hpp"
|
||||
#include "mamba/core/thread_utils.hpp"
|
||||
#include "mamba/specs/package_info.hpp"
|
||||
|
||||
namespace mamba
|
||||
{
|
||||
|
@ -78,7 +78,7 @@ namespace mamba
|
|||
using post_download_success_t = std::function<void(std::size_t)>;
|
||||
using progress_callback_t = std::function<void(PackageExtractEvent)>;
|
||||
|
||||
PackageFetcher(const PackageInfo& pkg_info, MultiPackageCache& caches);
|
||||
PackageFetcher(const specs::PackageInfo& pkg_info, MultiPackageCache& caches);
|
||||
|
||||
const std::string& name() const;
|
||||
|
||||
|
@ -115,7 +115,7 @@ namespace mamba
|
|||
|
||||
void update_monitor(progress_callback_t* cb, PackageExtractEvent event) const;
|
||||
|
||||
PackageInfo m_package_info;
|
||||
specs::PackageInfo m_package_info;
|
||||
|
||||
fs::u8path m_tarball_path;
|
||||
fs::u8path m_cache_path;
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
#include <solv/pooltypes.h>
|
||||
|
||||
#include "mamba/core/package_info.hpp"
|
||||
#include "mamba/specs/package_info.hpp"
|
||||
|
||||
namespace mamba
|
||||
{
|
||||
|
@ -50,7 +50,7 @@ namespace mamba
|
|||
std::vector<Id> select_solvables(Id id, bool sorted = false) const;
|
||||
Id matchspec2id(const specs::MatchSpec& ms);
|
||||
|
||||
std::optional<PackageInfo> id2pkginfo(Id solv_id) const;
|
||||
std::optional<specs::PackageInfo> id2pkginfo(Id solv_id) const;
|
||||
std::optional<std::string> dep2str(Id dep_id) const;
|
||||
|
||||
// TODO: (TMP) This is not meant to exist but is needed for a transition period
|
||||
|
|
|
@ -10,9 +10,9 @@
|
|||
#include <map>
|
||||
#include <string>
|
||||
|
||||
#include "error_handling.hpp"
|
||||
#include "history.hpp"
|
||||
#include "package_info.hpp"
|
||||
#include "mamba/core/error_handling.hpp"
|
||||
#include "mamba/core/history.hpp"
|
||||
#include "mamba/specs/package_info.hpp"
|
||||
|
||||
namespace mamba
|
||||
{
|
||||
|
@ -22,18 +22,18 @@ namespace mamba
|
|||
{
|
||||
public:
|
||||
|
||||
using package_map = std::map<std::string, PackageInfo>;
|
||||
using package_map = std::map<std::string, specs::PackageInfo>;
|
||||
|
||||
static expected_t<PrefixData>
|
||||
create(const fs::u8path& prefix_path, ChannelContext& channel_context);
|
||||
|
||||
void add_packages(const std::vector<PackageInfo>& packages);
|
||||
void add_packages(const std::vector<specs::PackageInfo>& packages);
|
||||
const package_map& records() const;
|
||||
void load_single_record(const fs::u8path& path);
|
||||
|
||||
History& history();
|
||||
const fs::u8path& path() const;
|
||||
std::vector<PackageInfo> sorted_records() const;
|
||||
std::vector<specs::PackageInfo> sorted_records() const;
|
||||
|
||||
ChannelContext& channel_context() const
|
||||
{
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
#include <vector>
|
||||
|
||||
#include "mamba/core/context.hpp"
|
||||
#include "mamba/core/package_info.hpp"
|
||||
#include "mamba/core/pool.hpp"
|
||||
#include "mamba/specs/package_info.hpp"
|
||||
#include "mamba/util/graph.hpp"
|
||||
|
||||
typedef struct s_Solvable Solvable;
|
||||
|
@ -73,7 +73,7 @@ namespace mamba
|
|||
{
|
||||
public:
|
||||
|
||||
using dependency_graph = util::DiGraph<PackageInfo>;
|
||||
using dependency_graph = util::DiGraph<specs::PackageInfo>;
|
||||
|
||||
query_result(QueryType type, const std::string& query, dependency_graph&& dep_graph);
|
||||
|
||||
|
@ -107,7 +107,7 @@ namespace mamba
|
|||
using ordered_package_list = std::map<std::string, package_id_list>;
|
||||
|
||||
void reset_pkg_view_list();
|
||||
std::string get_package_repr(const PackageInfo& pkg) const;
|
||||
std::string get_package_repr(const specs::PackageInfo& pkg) const;
|
||||
|
||||
QueryType m_type;
|
||||
std::string m_query;
|
||||
|
|
|
@ -10,13 +10,12 @@
|
|||
#include <string>
|
||||
#include <string_view>
|
||||
#include <tuple>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include <nlohmann/json_fwd.hpp>
|
||||
#include <solv/pooltypes.h>
|
||||
|
||||
#include "pool.hpp"
|
||||
#include "mamba/core/pool.hpp"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
|
@ -32,7 +31,11 @@ namespace mamba
|
|||
class u8path;
|
||||
}
|
||||
|
||||
class PackageInfo;
|
||||
namespace specs
|
||||
{
|
||||
class PackageInfo;
|
||||
}
|
||||
|
||||
class PrefixData;
|
||||
|
||||
/**
|
||||
|
@ -85,7 +88,7 @@ namespace mamba
|
|||
LibsolvCache use_cache = LibsolvCache::yes
|
||||
);
|
||||
MRepo(MPool& pool, const PrefixData& prefix_data);
|
||||
MRepo(MPool& pool, const std::string& name, const std::vector<PackageInfo>& uris);
|
||||
MRepo(MPool& pool, const std::string& name, const std::vector<specs::PackageInfo>& uris);
|
||||
|
||||
MRepo(const MRepo&) = delete;
|
||||
MRepo(MRepo&&) = default;
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
|
||||
#include <fmt/color.h>
|
||||
|
||||
#include "mamba/core/package_info.hpp"
|
||||
#include "mamba/specs/match_spec.hpp"
|
||||
#include "mamba/specs/package_info.hpp"
|
||||
#include "mamba/util/flat_set.hpp"
|
||||
#include "mamba/util/graph.hpp"
|
||||
|
||||
|
@ -75,7 +75,7 @@ namespace mamba
|
|||
{
|
||||
};
|
||||
|
||||
struct PackageNode : PackageInfo
|
||||
struct PackageNode : specs::PackageInfo
|
||||
{
|
||||
};
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include <variant>
|
||||
#include <vector>
|
||||
|
||||
#include "package_info.hpp"
|
||||
#include "mamba/specs/package_info.hpp"
|
||||
|
||||
namespace mamba
|
||||
{
|
||||
|
@ -25,40 +25,40 @@ namespace mamba
|
|||
{
|
||||
struct Omit
|
||||
{
|
||||
PackageInfo what;
|
||||
specs::PackageInfo what;
|
||||
};
|
||||
|
||||
struct Upgrade
|
||||
{
|
||||
PackageInfo remove;
|
||||
PackageInfo install;
|
||||
specs::PackageInfo remove;
|
||||
specs::PackageInfo install;
|
||||
};
|
||||
|
||||
struct Downgrade
|
||||
{
|
||||
PackageInfo remove;
|
||||
PackageInfo install;
|
||||
specs::PackageInfo remove;
|
||||
specs::PackageInfo install;
|
||||
};
|
||||
|
||||
struct Change
|
||||
{
|
||||
PackageInfo remove;
|
||||
PackageInfo install;
|
||||
specs::PackageInfo remove;
|
||||
specs::PackageInfo install;
|
||||
};
|
||||
|
||||
struct Reinstall
|
||||
{
|
||||
PackageInfo what;
|
||||
specs::PackageInfo what;
|
||||
};
|
||||
|
||||
struct Remove
|
||||
{
|
||||
PackageInfo remove;
|
||||
specs::PackageInfo remove;
|
||||
};
|
||||
|
||||
struct Install
|
||||
{
|
||||
PackageInfo install;
|
||||
specs::PackageInfo install;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
|
@ -97,7 +97,8 @@ namespace mamba
|
|||
template <typename Action>
|
||||
auto to_remove_ptr(Action& action)
|
||||
{
|
||||
using PackageInfoPtr = std::conditional_t<std::is_const_v<Action>, const PackageInfo*, PackageInfo*>;
|
||||
using PackageInfoPtr = std::
|
||||
conditional_t<std::is_const_v<Action>, const specs::PackageInfo*, specs::PackageInfo*>;
|
||||
return std::visit(
|
||||
[](auto& a) -> PackageInfoPtr
|
||||
{
|
||||
|
@ -140,7 +141,8 @@ namespace mamba
|
|||
template <typename Action>
|
||||
auto to_install_ptr(Action& action)
|
||||
{
|
||||
using PackageInfoPtr = std::conditional_t<std::is_const_v<Action>, const PackageInfo*, PackageInfo*>;
|
||||
using PackageInfoPtr = std::
|
||||
conditional_t<std::is_const_v<Action>, const specs::PackageInfo*, specs::PackageInfo*>;
|
||||
return std::visit(
|
||||
[](auto& a) -> PackageInfoPtr
|
||||
{
|
||||
|
@ -183,7 +185,8 @@ namespace mamba
|
|||
template <typename Action>
|
||||
auto to_omit_ptr(Action& action)
|
||||
{
|
||||
using PackageInfoPtr = std::conditional_t<std::is_const_v<Action>, const PackageInfo*, PackageInfo*>;
|
||||
using PackageInfoPtr = std::
|
||||
conditional_t<std::is_const_v<Action>, const specs::PackageInfo*, specs::PackageInfo*>;
|
||||
return std::visit(
|
||||
[](auto& a) -> PackageInfoPtr
|
||||
{
|
||||
|
|
|
@ -19,10 +19,10 @@
|
|||
// Incomplete header
|
||||
#include <solv/rules.h>
|
||||
|
||||
#include "mamba/core/package_info.hpp"
|
||||
#include "mamba/core/pool.hpp"
|
||||
#include "mamba/core/satisfiability_error.hpp"
|
||||
#include "mamba/specs/match_spec.hpp"
|
||||
#include "mamba/specs/package_info.hpp"
|
||||
|
||||
#define PY_MAMBA_NO_DEPS 0b0001
|
||||
#define PY_MAMBA_ONLY_DEPS 0b0010
|
||||
|
@ -48,8 +48,8 @@ namespace mamba
|
|||
Id source_id;
|
||||
Id target_id;
|
||||
Id dep_id;
|
||||
std::optional<PackageInfo> source;
|
||||
std::optional<PackageInfo> target;
|
||||
std::optional<specs::PackageInfo> source;
|
||||
std::optional<specs::PackageInfo> target;
|
||||
std::optional<std::string> dep;
|
||||
std::string description;
|
||||
};
|
||||
|
|
|
@ -12,15 +12,14 @@
|
|||
#include <vector>
|
||||
|
||||
#include "mamba/api/install.hpp"
|
||||
#include "mamba/core/package_cache.hpp"
|
||||
#include "mamba/core/pool.hpp"
|
||||
#include "mamba/core/prefix_data.hpp"
|
||||
#include "mamba/core/solution.hpp"
|
||||
#include "mamba/core/transaction_context.hpp"
|
||||
#include "mamba/fs/filesystem.hpp"
|
||||
#include "mamba/specs/match_spec.hpp"
|
||||
|
||||
#include "package_cache.hpp"
|
||||
#include "package_info.hpp"
|
||||
#include "pool.hpp"
|
||||
#include "prefix_data.hpp"
|
||||
#include "solution.hpp"
|
||||
#include "transaction_context.hpp"
|
||||
#include "mamba/specs/package_info.hpp"
|
||||
|
||||
namespace mamba
|
||||
{
|
||||
|
@ -40,7 +39,7 @@ namespace mamba
|
|||
MTransaction(MPool& pool, MSolver& solver, MultiPackageCache& caches);
|
||||
|
||||
// Only use if the packages have been solved previously already.
|
||||
MTransaction(MPool& pool, const std::vector<PackageInfo>& packages, MultiPackageCache& caches);
|
||||
MTransaction(MPool& pool, const std::vector<specs::PackageInfo>& packages, MultiPackageCache& caches);
|
||||
|
||||
MTransaction(const MTransaction&) = delete;
|
||||
MTransaction(MTransaction&&) = delete;
|
||||
|
|
|
@ -10,25 +10,27 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "mamba/core/package_info.hpp"
|
||||
#include "mamba/specs/package_info.hpp"
|
||||
|
||||
namespace mamba
|
||||
{
|
||||
std::vector<PackageInfo> get_virtual_packages(const Context& context);
|
||||
class Context;
|
||||
|
||||
std::vector<specs::PackageInfo> get_virtual_packages(const Context& context);
|
||||
|
||||
namespace detail
|
||||
{
|
||||
std::string cuda_version();
|
||||
std::string get_arch();
|
||||
|
||||
PackageInfo make_virtual_package(
|
||||
specs::PackageInfo make_virtual_package(
|
||||
const std::string& name,
|
||||
const std::string& subdir,
|
||||
const std::string& version = "",
|
||||
const std::string& build_string = ""
|
||||
);
|
||||
|
||||
std::vector<PackageInfo> dist_packages(const Context& context);
|
||||
std::vector<specs::PackageInfo> dist_packages(const Context& context);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
#include <nlohmann/json_fwd.hpp>
|
||||
|
||||
namespace mamba
|
||||
namespace mamba::specs
|
||||
{
|
||||
class PackageInfo
|
||||
{
|
||||
|
@ -29,7 +29,7 @@ namespace mamba
|
|||
* @todo need to use a proper type for channels
|
||||
*/
|
||||
std::string channel = {};
|
||||
std::string url = {};
|
||||
std::string package_url = {};
|
||||
std::string subdir = {};
|
||||
std::string filename = {};
|
||||
std::string license = {};
|
|
@ -342,10 +342,10 @@ namespace mamba
|
|||
return result;
|
||||
}
|
||||
|
||||
std::tuple<std::vector<PackageInfo>, std::vector<specs::MatchSpec>>
|
||||
std::tuple<std::vector<specs::PackageInfo>, std::vector<specs::MatchSpec>>
|
||||
parse_urls_to_package_info(const std::vector<std::string>& urls)
|
||||
{
|
||||
std::vector<PackageInfo> pi_result;
|
||||
std::vector<specs::PackageInfo> pi_result;
|
||||
std::vector<specs::MatchSpec> ms_result;
|
||||
for (auto& u : urls)
|
||||
{
|
||||
|
@ -355,8 +355,8 @@ namespace mamba
|
|||
}
|
||||
std::size_t hash = u.find_first_of('#');
|
||||
auto ms = specs::MatchSpec::parse(u.substr(0, hash));
|
||||
PackageInfo p(ms.name().str());
|
||||
p.url = ms.url();
|
||||
specs::PackageInfo p(ms.name().str());
|
||||
p.package_url = ms.url();
|
||||
p.build_string = ms.build_string().str();
|
||||
p.version = ms.version().str();
|
||||
if (ms.channel().has_value())
|
||||
|
|
|
@ -71,7 +71,7 @@ namespace mamba
|
|||
|
||||
if (regex.empty() || std::regex_search(pkg_info.name, spec_pat))
|
||||
{
|
||||
auto channels = channel_context.make_channel(pkg_info.url);
|
||||
auto channels = channel_context.make_channel(pkg_info.package_url);
|
||||
assert(channels.size() == 1); // A URL can only resolve to one channel
|
||||
obj["base_url"] = channels.front().url().str(specs::CondaURL::Credentials::Remove
|
||||
);
|
||||
|
@ -111,7 +111,7 @@ namespace mamba
|
|||
}
|
||||
else
|
||||
{
|
||||
auto channels = channel_context.make_channel(package.second.url);
|
||||
auto channels = channel_context.make_channel(package.second.package_url);
|
||||
assert(channels.size() == 1); // A URL can only resolve to one channel
|
||||
formatted_pkgs.channel = channels.front().display_name();
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ namespace mamba
|
|||
tl::expected<Package, mamba_error> read_package_info(const YAML::Node& package_node)
|
||||
{
|
||||
Package package{
|
||||
/* .info = */ mamba::PackageInfo{ package_node["name"].as<std::string>() },
|
||||
/* .info = */ specs::PackageInfo{ package_node["name"].as<std::string>() },
|
||||
/* .is_optional = */
|
||||
[&]
|
||||
{
|
||||
|
@ -55,8 +55,8 @@ namespace mamba
|
|||
));
|
||||
}
|
||||
|
||||
package.info.url = package_node["url"].as<std::string>();
|
||||
const auto spec = specs::MatchSpec::parse(package.info.url);
|
||||
package.info.package_url = package_node["url"].as<std::string>();
|
||||
const auto spec = specs::MatchSpec::parse(package.info.package_url);
|
||||
package.info.filename = spec.filename();
|
||||
package.info.build_string = spec.build_string().str();
|
||||
if (spec.channel().has_value())
|
||||
|
@ -232,13 +232,13 @@ namespace mamba
|
|||
}
|
||||
}
|
||||
|
||||
std::vector<PackageInfo> EnvironmentLockFile::get_packages_for(
|
||||
std::vector<specs::PackageInfo> EnvironmentLockFile::get_packages_for(
|
||||
std::string_view category,
|
||||
std::string_view platform,
|
||||
std::string_view manager
|
||||
) const
|
||||
{
|
||||
std::vector<PackageInfo> results;
|
||||
std::vector<specs::PackageInfo> results;
|
||||
|
||||
// TODO: c++20 - rewrite this with ranges
|
||||
const auto package_predicate = [&](const auto& package)
|
||||
|
|
|
@ -317,7 +317,7 @@ namespace mamba
|
|||
bool run_script(
|
||||
const Context& context,
|
||||
const fs::u8path& prefix,
|
||||
const PackageInfo& pkg_info,
|
||||
const specs::PackageInfo& pkg_info,
|
||||
const std::string& action = "post-link",
|
||||
const std::string& env_prefix = "",
|
||||
bool activate = false
|
||||
|
@ -469,7 +469,7 @@ namespace mamba
|
|||
}
|
||||
|
||||
UnlinkPackage::UnlinkPackage(
|
||||
const PackageInfo& pkg_info,
|
||||
const specs::PackageInfo& pkg_info,
|
||||
const fs::u8path& cache_path,
|
||||
TransactionContext* context
|
||||
)
|
||||
|
@ -567,7 +567,7 @@ namespace mamba
|
|||
}
|
||||
|
||||
LinkPackage::LinkPackage(
|
||||
const PackageInfo& pkg_info,
|
||||
const specs::PackageInfo& pkg_info,
|
||||
const fs::u8path& cache_path,
|
||||
TransactionContext* context
|
||||
)
|
||||
|
|
|
@ -78,7 +78,7 @@ namespace mamba
|
|||
return m_path;
|
||||
}
|
||||
|
||||
void PackageCacheData::clear_query_cache(const PackageInfo& s)
|
||||
void PackageCacheData::clear_query_cache(const specs::PackageInfo& s)
|
||||
{
|
||||
m_valid_tarballs.erase(s.str());
|
||||
m_valid_extracted_dir.erase(s.str());
|
||||
|
@ -127,7 +127,8 @@ namespace mamba
|
|||
}
|
||||
}
|
||||
|
||||
bool PackageCacheData::has_valid_tarball(const PackageInfo& s, const ValidationOptions& options)
|
||||
bool
|
||||
PackageCacheData::has_valid_tarball(const specs::PackageInfo& s, const ValidationOptions& options)
|
||||
{
|
||||
std::string pkg = s.str();
|
||||
if (m_valid_tarballs.find(pkg) != m_valid_tarballs.end())
|
||||
|
@ -191,7 +192,7 @@ namespace mamba
|
|||
}
|
||||
|
||||
bool
|
||||
PackageCacheData::has_valid_extracted_dir(const PackageInfo& s, const ValidationOptions& options)
|
||||
PackageCacheData::has_valid_extracted_dir(const specs::PackageInfo& s, const ValidationOptions& options)
|
||||
{
|
||||
bool valid = false, can_validate = false;
|
||||
|
||||
|
@ -298,7 +299,10 @@ namespace mamba
|
|||
{
|
||||
if (!repodata_record["url"].get<std::string>().empty())
|
||||
{
|
||||
if (!compare_cleaned_url(repodata_record["url"].get<std::string>(), s.url))
|
||||
if (!compare_cleaned_url(
|
||||
repodata_record["url"].get<std::string>(),
|
||||
s.package_url
|
||||
))
|
||||
{
|
||||
LOG_WARNING << "Extracted package cache '" << extracted_dir.string()
|
||||
<< "' has invalid url";
|
||||
|
@ -416,7 +420,7 @@ namespace mamba
|
|||
return fs::u8path();
|
||||
}
|
||||
|
||||
fs::u8path MultiPackageCache::get_tarball_path(const PackageInfo& s, bool return_empty)
|
||||
fs::u8path MultiPackageCache::get_tarball_path(const specs::PackageInfo& s, bool return_empty)
|
||||
{
|
||||
const std::string pkg(s.str());
|
||||
const auto cache_iter(m_cached_tarballs.find(pkg));
|
||||
|
@ -445,7 +449,8 @@ namespace mamba
|
|||
}
|
||||
}
|
||||
|
||||
fs::u8path MultiPackageCache::get_extracted_dir_path(const PackageInfo& s, bool return_empty)
|
||||
fs::u8path
|
||||
MultiPackageCache::get_extracted_dir_path(const specs::PackageInfo& s, bool return_empty)
|
||||
{
|
||||
const std::string pkg(s.str());
|
||||
const auto cache_iter(m_cached_extracted_dirs.find(pkg));
|
||||
|
@ -485,7 +490,7 @@ namespace mamba
|
|||
return paths;
|
||||
}
|
||||
|
||||
void MultiPackageCache::clear_query_cache(const PackageInfo& s)
|
||||
void MultiPackageCache::clear_query_cache(const specs::PackageInfo& s)
|
||||
{
|
||||
for (auto& c : m_caches)
|
||||
{
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
// Copyright (c) 2023, QuantStack and Mamba Contributors
|
||||
//
|
||||
// Distributed under the terms of the BSD 3-Clause License.
|
||||
//
|
||||
// The full license is in the file LICENSE, distributed with this software.
|
||||
|
||||
#include "mamba/core/invoke.hpp"
|
||||
#include "mamba/core/package_fetcher.hpp"
|
||||
#include "mamba/core/util.hpp"
|
||||
|
@ -77,7 +83,7 @@ namespace mamba
|
|||
ValidationResult error;
|
||||
};
|
||||
|
||||
PackageFetcher::PackageFetcher(const PackageInfo& pkg_info, MultiPackageCache& caches)
|
||||
PackageFetcher::PackageFetcher(const specs::PackageInfo& pkg_info, MultiPackageCache& caches)
|
||||
|
||||
: m_package_info(pkg_info)
|
||||
{
|
||||
|
@ -313,7 +319,7 @@ namespace mamba
|
|||
|
||||
const std::string& PackageFetcher::url() const
|
||||
{
|
||||
return m_package_info.url;
|
||||
return m_package_info.package_url;
|
||||
}
|
||||
|
||||
const std::string& PackageFetcher::sha256() const
|
||||
|
|
|
@ -289,9 +289,10 @@ namespace mamba
|
|||
|
||||
namespace
|
||||
{
|
||||
auto make_package_info(const solv::ObjPool& pool, solv::ObjSolvableViewConst s) -> PackageInfo
|
||||
auto make_package_info(const solv::ObjPool& pool, solv::ObjSolvableViewConst s)
|
||||
-> specs::PackageInfo
|
||||
{
|
||||
PackageInfo out = {};
|
||||
specs::PackageInfo out = {};
|
||||
|
||||
out.name = s.name();
|
||||
out.version = s.version();
|
||||
|
@ -299,7 +300,7 @@ namespace mamba
|
|||
out.noarch = s.noarch();
|
||||
out.build_number = s.build_number();
|
||||
out.channel = s.channel();
|
||||
out.url = s.url();
|
||||
out.package_url = s.url();
|
||||
out.subdir = s.subdir();
|
||||
out.filename = s.file_name();
|
||||
out.license = s.license();
|
||||
|
@ -337,7 +338,7 @@ namespace mamba
|
|||
}
|
||||
}
|
||||
|
||||
std::optional<PackageInfo> MPool::id2pkginfo(Id solv_id) const
|
||||
std::optional<specs::PackageInfo> MPool::id2pkginfo(Id solv_id) const
|
||||
{
|
||||
if (const auto solv = pool().get_solvable(solv_id))
|
||||
{
|
||||
|
|
|
@ -63,7 +63,7 @@ namespace mamba
|
|||
}
|
||||
}
|
||||
|
||||
void PrefixData::add_packages(const std::vector<PackageInfo>& packages)
|
||||
void PrefixData::add_packages(const std::vector<specs::PackageInfo>& packages)
|
||||
{
|
||||
for (const auto& pkg : packages)
|
||||
{
|
||||
|
@ -78,11 +78,11 @@ namespace mamba
|
|||
return m_package_records;
|
||||
}
|
||||
|
||||
std::vector<PackageInfo> PrefixData::sorted_records() const
|
||||
std::vector<specs::PackageInfo> PrefixData::sorted_records() const
|
||||
{
|
||||
// TODO add_pip_as_python_dependency
|
||||
|
||||
auto dep_graph = util::DiGraph<const PackageInfo*>();
|
||||
auto dep_graph = util::DiGraph<const specs::PackageInfo*>();
|
||||
using node_id = typename decltype(dep_graph)::node_id;
|
||||
|
||||
{
|
||||
|
@ -134,7 +134,7 @@ namespace mamba
|
|||
}
|
||||
}
|
||||
|
||||
auto sorted = std::vector<PackageInfo>();
|
||||
auto sorted = std::vector<specs::PackageInfo>();
|
||||
sorted.reserve(dep_graph.number_of_nodes());
|
||||
util::topological_sort_for_each_node_id(
|
||||
dep_graph,
|
||||
|
@ -160,11 +160,11 @@ namespace mamba
|
|||
auto infile = open_ifstream(path);
|
||||
nlohmann::json j;
|
||||
infile >> j;
|
||||
auto prec = j.get<PackageInfo>();
|
||||
auto prec = j.get<specs::PackageInfo>();
|
||||
|
||||
// Some versions of micromamba constructor generate repodata_record.json
|
||||
// and conda-meta json files with channel names while mamba expects
|
||||
// PackageInfo channels to be platform urls. This fixes the issue described
|
||||
// specs::PackageInfo channels to be platform urls. This fixes the issue described
|
||||
// in https://github.com/mamba-org/mamba/issues/2665
|
||||
|
||||
auto channels = m_channel_context.make_channel(prec.channel);
|
||||
|
|
|
@ -26,9 +26,9 @@ extern "C" // Incomplete header
|
|||
|
||||
#include "mamba/core/context.hpp"
|
||||
#include "mamba/core/output.hpp"
|
||||
#include "mamba/core/package_info.hpp"
|
||||
#include "mamba/core/query.hpp"
|
||||
#include "mamba/specs/conda_url.hpp"
|
||||
#include "mamba/specs/package_info.hpp"
|
||||
#include "mamba/util/string.hpp"
|
||||
#include "solv-cpp/queue.hpp"
|
||||
|
||||
|
@ -97,7 +97,7 @@ namespace mamba
|
|||
if (it == not_found.end())
|
||||
{
|
||||
auto dep_id = dep_graph.add_node(
|
||||
PackageInfo(util::concat(name, " >>> NOT FOUND <<<"))
|
||||
specs::PackageInfo(util::concat(name, " >>> NOT FOUND <<<"))
|
||||
);
|
||||
dep_graph.add_edge(parent, dep_id);
|
||||
not_found.insert(std::make_pair(name, dep_id));
|
||||
|
@ -169,7 +169,7 @@ namespace mamba
|
|||
/**
|
||||
* Prints metadata for a given package.
|
||||
*/
|
||||
auto print_metadata(std::ostream& out, const PackageInfo& pkg)
|
||||
auto print_metadata(std::ostream& out, const specs::PackageInfo& pkg)
|
||||
{
|
||||
static constexpr const char* fmtstring = " {:<15} {}\n";
|
||||
fmt::print(out, fmtstring, "Name", pkg.name);
|
||||
|
@ -181,7 +181,7 @@ namespace mamba
|
|||
fmt::print(out, fmtstring, "File Name", pkg.filename);
|
||||
|
||||
using CondaURL = typename specs::CondaURL;
|
||||
auto url = CondaURL::parse(pkg.url);
|
||||
auto url = CondaURL::parse(pkg.package_url);
|
||||
fmt::print(
|
||||
out,
|
||||
" {:<15} {}\n",
|
||||
|
@ -223,8 +223,8 @@ namespace mamba
|
|||
*/
|
||||
auto print_other_builds(
|
||||
std::ostream& out,
|
||||
const PackageInfo& pkg,
|
||||
const std::map<std::string, std::vector<PackageInfo>> groupedOtherBuilds,
|
||||
const specs::PackageInfo& pkg,
|
||||
const std::map<std::string, std::vector<specs::PackageInfo>> groupedOtherBuilds,
|
||||
bool showAllBuilds
|
||||
)
|
||||
{
|
||||
|
@ -295,13 +295,13 @@ namespace mamba
|
|||
*/
|
||||
auto print_solvable(
|
||||
std::ostream& out,
|
||||
const PackageInfo& pkg,
|
||||
const std::vector<PackageInfo>& otherBuilds,
|
||||
const specs::PackageInfo& pkg,
|
||||
const std::vector<specs::PackageInfo>& otherBuilds,
|
||||
bool showAllBuilds
|
||||
)
|
||||
{
|
||||
// Filter and group builds/versions.
|
||||
std::map<std::string, std::vector<PackageInfo>> groupedOtherBuilds;
|
||||
std::map<std::string, std::vector<specs::PackageInfo>> groupedOtherBuilds;
|
||||
auto numOtherBuildsForLatestVersion = 0;
|
||||
if (showAllBuilds)
|
||||
{
|
||||
|
@ -654,7 +654,8 @@ namespace mamba
|
|||
alignments.push_back(printers::alignment::left);
|
||||
}
|
||||
|
||||
auto format_row = [&](const PackageInfo& pkg, const std::vector<PackageInfo>& builds)
|
||||
auto format_row =
|
||||
[&](const specs::PackageInfo& pkg, const std::vector<specs::PackageInfo>& builds)
|
||||
{
|
||||
std::vector<mamba::printers::FormattedString> row;
|
||||
for (std::size_t i = 0; i < cmds.size(); ++i)
|
||||
|
@ -712,7 +713,8 @@ namespace mamba
|
|||
|
||||
if (!m_ordered_pkg_id_list.empty())
|
||||
{
|
||||
std::map<std::string, std::map<std::string, std::vector<PackageInfo>>> packageBuildsByVersion;
|
||||
std::map<std::string, std::map<std::string, std::vector<specs::PackageInfo>>>
|
||||
packageBuildsByVersion;
|
||||
std::unordered_set<std::string> distinctBuildSHAs;
|
||||
for (auto& entry : m_ordered_pkg_id_list)
|
||||
{
|
||||
|
@ -835,7 +837,7 @@ namespace mamba
|
|||
}
|
||||
}
|
||||
|
||||
std::string get_package_repr(const PackageInfo& pkg) const
|
||||
std::string get_package_repr(const specs::PackageInfo& pkg) const
|
||||
{
|
||||
return pkg.version.empty() ? pkg.name : pkg.name + '[' + pkg.version + ']';
|
||||
}
|
||||
|
@ -922,7 +924,7 @@ namespace mamba
|
|||
}
|
||||
else
|
||||
{
|
||||
std::map<std::string, std::vector<PackageInfo>> packages;
|
||||
std::map<std::string, std::vector<specs::PackageInfo>> packages;
|
||||
for (const auto& id : m_pkg_id_list)
|
||||
{
|
||||
auto package = m_dep_graph.node(id);
|
||||
|
@ -955,7 +957,7 @@ namespace mamba
|
|||
m_dep_graph.for_each_node_id([&](node_id id) { m_pkg_id_list.push_back(id); });
|
||||
}
|
||||
|
||||
std::string query_result::get_package_repr(const PackageInfo& pkg) const
|
||||
std::string query_result::get_package_repr(const specs::PackageInfo& pkg) const
|
||||
{
|
||||
return pkg.version.empty() ? pkg.name : fmt::format("{}[{}]", pkg.name, pkg.version);
|
||||
}
|
||||
|
|
|
@ -21,13 +21,13 @@ extern "C" // Incomplete header
|
|||
|
||||
#include "mamba/core/context.hpp"
|
||||
#include "mamba/core/output.hpp"
|
||||
#include "mamba/core/package_info.hpp"
|
||||
#include "mamba/core/pool.hpp"
|
||||
#include "mamba/core/prefix_data.hpp"
|
||||
#include "mamba/core/repo.hpp"
|
||||
#include "mamba/core/util.hpp"
|
||||
#include "mamba/fs/filesystem.hpp"
|
||||
#include "mamba/specs/conda_url.hpp"
|
||||
#include "mamba/specs/package_info.hpp"
|
||||
#include "mamba/util/build.hpp"
|
||||
#include "mamba/util/string.hpp"
|
||||
#include "solv-cpp/pool.hpp"
|
||||
|
@ -89,7 +89,7 @@ namespace mamba
|
|||
return solv::ObjRepoView{ *r.repo() };
|
||||
}
|
||||
|
||||
void set_solvable(MPool& pool, solv::ObjSolvableView solv, const PackageInfo& pkg)
|
||||
void set_solvable(MPool& pool, solv::ObjSolvableView solv, const specs::PackageInfo& pkg)
|
||||
{
|
||||
solv.set_name(pkg.name);
|
||||
solv.set_version(pkg.version);
|
||||
|
@ -97,7 +97,7 @@ namespace mamba
|
|||
solv.set_noarch(pkg.noarch);
|
||||
solv.set_build_number(pkg.build_number);
|
||||
solv.set_channel(pkg.channel);
|
||||
solv.set_url(pkg.url);
|
||||
solv.set_url(pkg.package_url);
|
||||
solv.set_subdir(pkg.subdir);
|
||||
solv.set_file_name(pkg.filename);
|
||||
solv.set_license(pkg.license);
|
||||
|
@ -374,7 +374,7 @@ namespace mamba
|
|||
repo.internalize();
|
||||
}
|
||||
|
||||
MRepo::MRepo(MPool& pool, const std::string& name, const std::vector<PackageInfo>& package_infos)
|
||||
MRepo::MRepo(MPool& pool, const std::string& name, const std::vector<specs::PackageInfo>& package_infos)
|
||||
: m_pool(pool)
|
||||
{
|
||||
auto [_, repo] = pool.pool().add_repo(name);
|
||||
|
|
|
@ -17,11 +17,11 @@
|
|||
#include "mamba/core/context.hpp"
|
||||
#include "mamba/core/error_handling.hpp"
|
||||
#include "mamba/core/output.hpp"
|
||||
#include "mamba/core/package_info.hpp"
|
||||
#include "mamba/core/pool.hpp"
|
||||
#include "mamba/core/satisfiability_error.hpp"
|
||||
#include "mamba/core/solver.hpp"
|
||||
#include "mamba/specs/match_spec.hpp"
|
||||
#include "mamba/specs/package_info.hpp"
|
||||
#include "solv-cpp/pool.hpp"
|
||||
#include "solv-cpp/queue.hpp"
|
||||
#include "solv-cpp/solver.hpp"
|
||||
|
@ -586,8 +586,8 @@ namespace mamba
|
|||
{
|
||||
for (auto& problem : m_solver.all_problems_structured())
|
||||
{
|
||||
std::optional<PackageInfo>& source = problem.source;
|
||||
std::optional<PackageInfo>& target = problem.target;
|
||||
std::optional<specs::PackageInfo>& source = problem.source;
|
||||
std::optional<specs::PackageInfo>& target = problem.target;
|
||||
std::optional<std::string>& dep = problem.dep;
|
||||
SolverRuleinfo type = problem.type;
|
||||
|
||||
|
|
|
@ -50,13 +50,13 @@ namespace mamba
|
|||
|
||||
namespace
|
||||
{
|
||||
bool need_pkg_download(const PackageInfo& pkg_info, MultiPackageCache& caches)
|
||||
bool need_pkg_download(const specs::PackageInfo& pkg_info, MultiPackageCache& caches)
|
||||
{
|
||||
return caches.get_extracted_dir_path(pkg_info).empty()
|
||||
&& caches.get_tarball_path(pkg_info).empty();
|
||||
}
|
||||
|
||||
auto mk_pkginfo(const MPool& pool, solv::ObjSolvableViewConst s) -> PackageInfo
|
||||
auto mk_pkginfo(const MPool& pool, solv::ObjSolvableViewConst s) -> specs::PackageInfo
|
||||
{
|
||||
const auto pkginfo = pool.id2pkginfo(s.id());
|
||||
assert(pkginfo.has_value()); // There is Solvable so the optional must no be empty
|
||||
|
@ -66,14 +66,14 @@ namespace mamba
|
|||
template <typename Range>
|
||||
auto make_pkg_info_from_explicit_match_specs(Range&& specs)
|
||||
{
|
||||
std::vector<PackageInfo> out = {};
|
||||
std::vector<specs::PackageInfo> out = {};
|
||||
out.reserve(specs.size());
|
||||
|
||||
for (auto& ms : specs)
|
||||
{
|
||||
out.emplace_back(ms.name().str());
|
||||
auto& p = out.back();
|
||||
p.url = ms.url();
|
||||
p.package_url = ms.url();
|
||||
p.build_string = ms.build_string().str();
|
||||
p.version = ms.version().str_conda_build();
|
||||
if (ms.channel().has_value())
|
||||
|
@ -431,7 +431,7 @@ namespace mamba
|
|||
// The specs to install become all the dependencies of the non intstalled specs
|
||||
for_each_to_omit(
|
||||
m_solution.actions,
|
||||
[&](const PackageInfo& pkg)
|
||||
[&](const specs::PackageInfo& pkg)
|
||||
{
|
||||
for (const auto& dep : pkg.depends)
|
||||
{
|
||||
|
@ -557,7 +557,7 @@ namespace mamba
|
|||
|
||||
MTransaction::MTransaction(
|
||||
MPool& pool,
|
||||
const std::vector<PackageInfo>& packages,
|
||||
const std::vector<specs::PackageInfo>& packages,
|
||||
MultiPackageCache& caches
|
||||
)
|
||||
: MTransaction(pool, caches)
|
||||
|
@ -677,7 +677,7 @@ namespace mamba
|
|||
{
|
||||
using Action = std::decay_t<decltype(act)>;
|
||||
|
||||
auto const link = [&](PackageInfo const& pkg)
|
||||
auto const link = [&](specs::PackageInfo const& pkg)
|
||||
{
|
||||
const fs::u8path cache_path(m_multi_cache.get_extracted_dir_path(pkg, false));
|
||||
LinkPackage lp(pkg, cache_path, &m_transaction_context);
|
||||
|
@ -685,7 +685,7 @@ namespace mamba
|
|||
rollback.record(lp);
|
||||
m_history_entry.link_dists.push_back(pkg.long_str());
|
||||
};
|
||||
auto const unlink = [&](PackageInfo const& pkg)
|
||||
auto const unlink = [&](specs::PackageInfo const& pkg)
|
||||
{
|
||||
const fs::u8path cache_path(m_multi_cache.get_extracted_dir_path(pkg));
|
||||
UnlinkPackage up(pkg, cache_path, &m_transaction_context);
|
||||
|
@ -899,9 +899,10 @@ namespace mamba
|
|||
{
|
||||
using Credentials = typename specs::CondaURL::Credentials;
|
||||
auto l_pkg = pkg;
|
||||
auto channels = channel_context.make_channel(pkg.url);
|
||||
auto channels = channel_context.make_channel(pkg.package_url);
|
||||
assert(channels.size() == 1); // A URL can only resolve to one channel
|
||||
l_pkg.url = channels.front().platform_urls().at(0).str(Credentials::Show);
|
||||
l_pkg.package_url = channels.front().platform_urls().at(0).str(Credentials::Show
|
||||
);
|
||||
fetchers.emplace_back(l_pkg, multi_cache);
|
||||
}
|
||||
else
|
||||
|
@ -1197,7 +1198,9 @@ namespace mamba
|
|||
remove
|
||||
};
|
||||
auto format_row =
|
||||
[this, &ctx, &total_size](rows& r, const PackageInfo& s, Status status, std::string diff)
|
||||
[this,
|
||||
&ctx,
|
||||
&total_size](rows& r, const specs::PackageInfo& s, Status status, std::string diff)
|
||||
{
|
||||
const std::size_t dlsize = s.size;
|
||||
printers::FormattedString dlsize_s;
|
||||
|
@ -1418,13 +1421,13 @@ namespace mamba
|
|||
|
||||
const auto lockfile_data = maybe_lockfile.value();
|
||||
|
||||
std::vector<PackageInfo> conda_packages = {};
|
||||
std::vector<PackageInfo> pip_packages = {};
|
||||
std::vector<specs::PackageInfo> conda_packages = {};
|
||||
std::vector<specs::PackageInfo> pip_packages = {};
|
||||
|
||||
const auto& context = pool.context();
|
||||
for (const auto& category : categories)
|
||||
{
|
||||
std::vector<PackageInfo> selected_packages = lockfile_data.get_packages_for(
|
||||
std::vector<specs::PackageInfo> selected_packages = lockfile_data.get_packages_for(
|
||||
category,
|
||||
context.platform,
|
||||
"conda"
|
||||
|
@ -1459,8 +1462,8 @@ namespace mamba
|
|||
pip_packages.cbegin(),
|
||||
pip_packages.cend(),
|
||||
std::back_inserter(pip_specs),
|
||||
[](const PackageInfo& pkg)
|
||||
{ return fmt::format("{} @ {}#sha256={}", pkg.name, pkg.url, pkg.sha256); }
|
||||
[](const specs::PackageInfo& pkg)
|
||||
{ return fmt::format("{} @ {}#sha256={}", pkg.name, pkg.package_url, pkg.sha256); }
|
||||
);
|
||||
other_specs.push_back(
|
||||
{ "pip --no-deps", pip_specs, fs::absolute(env_lockfile_path.parent_path()).string() }
|
||||
|
|
|
@ -145,14 +145,14 @@ namespace mamba
|
|||
return "";
|
||||
}
|
||||
|
||||
PackageInfo make_virtual_package(
|
||||
specs::PackageInfo make_virtual_package(
|
||||
const std::string& name,
|
||||
const std::string& subdir,
|
||||
const std::string& version,
|
||||
const std::string& build_string
|
||||
)
|
||||
{
|
||||
PackageInfo res(name);
|
||||
specs::PackageInfo res(name);
|
||||
res.version = version.size() ? version : "0";
|
||||
res.build_string = build_string.size() ? build_string : "0";
|
||||
res.build_number = 0;
|
||||
|
@ -213,11 +213,11 @@ namespace mamba
|
|||
}
|
||||
}
|
||||
|
||||
std::vector<PackageInfo> dist_packages(const Context& context)
|
||||
std::vector<specs::PackageInfo> dist_packages(const Context& context)
|
||||
{
|
||||
LOG_DEBUG << "Loading distribution virtual packages";
|
||||
|
||||
std::vector<PackageInfo> res;
|
||||
std::vector<specs::PackageInfo> res;
|
||||
const auto platform = context.platform;
|
||||
const auto split_platform = util::split(platform, "-", 1);
|
||||
|
||||
|
@ -276,7 +276,7 @@ namespace mamba
|
|||
}
|
||||
}
|
||||
|
||||
std::vector<PackageInfo> get_virtual_packages(const Context& context)
|
||||
std::vector<specs::PackageInfo> get_virtual_packages(const Context& context)
|
||||
{
|
||||
LOG_DEBUG << "Loading virtual packages";
|
||||
auto res = detail::dist_packages(context);
|
||||
|
|
|
@ -13,11 +13,11 @@
|
|||
#include <fmt/format.h>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
#include "mamba/core/package_info.hpp"
|
||||
#include "mamba/specs/archive.hpp"
|
||||
#include "mamba/specs/package_info.hpp"
|
||||
#include "mamba/util/string.hpp"
|
||||
|
||||
namespace mamba
|
||||
namespace mamba::specs
|
||||
{
|
||||
|
||||
PackageInfo::PackageInfo(std::string n)
|
||||
|
@ -164,7 +164,7 @@ namespace mamba
|
|||
}
|
||||
if (field_name == "url")
|
||||
{
|
||||
return invoke_field_string(*this, &PackageInfo::url);
|
||||
return invoke_field_string(*this, &PackageInfo::package_url);
|
||||
}
|
||||
if (field_name == "subdir")
|
||||
{
|
||||
|
@ -200,7 +200,7 @@ namespace mamba
|
|||
p.noarch,
|
||||
p.build_number,
|
||||
p.channel,
|
||||
p.url,
|
||||
p.package_url,
|
||||
p.subdir,
|
||||
p.filename,
|
||||
p.license,
|
||||
|
@ -232,7 +232,7 @@ namespace mamba
|
|||
j["name"] = pkg.name;
|
||||
j["version"] = pkg.version;
|
||||
j["channel"] = pkg.channel;
|
||||
j["url"] = pkg.url;
|
||||
j["url"] = pkg.package_url;
|
||||
j["subdir"] = pkg.subdir;
|
||||
j["fn"] = pkg.filename;
|
||||
j["size"] = pkg.size;
|
||||
|
@ -278,7 +278,7 @@ namespace mamba
|
|||
pkg.name = j.value("name", "");
|
||||
pkg.version = j.value("version", "");
|
||||
pkg.channel = j.value("channel", "");
|
||||
pkg.url = j.value("url", "");
|
||||
pkg.package_url = j.value("url", "");
|
||||
pkg.subdir = j.value("subdir", "");
|
||||
pkg.filename = j.value("fn", "");
|
||||
pkg.size = j.value("size", std::size_t(0));
|
|
@ -58,7 +58,7 @@ namespace mamba
|
|||
pin = python_pin(prefix_data, specs);
|
||||
CHECK_EQ(pin, "");
|
||||
|
||||
PackageInfo pkg_info("python", "3.7.10", "abcde", 0);
|
||||
specs::PackageInfo pkg_info("python", "3.7.10", "abcde", 0);
|
||||
prefix_data.add_packages({ pkg_info });
|
||||
REQUIRE_EQ(prefix_data.records().size(), 1);
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include <solv/solver.h>
|
||||
|
||||
#include "mamba/core/channel_context.hpp"
|
||||
#include "mamba/core/package_info.hpp"
|
||||
#include "mamba/core/pool.hpp"
|
||||
#include "mamba/core/prefix_data.hpp"
|
||||
#include "mamba/core/repo.hpp"
|
||||
|
@ -24,6 +23,7 @@
|
|||
#include "mamba/core/util.hpp"
|
||||
#include "mamba/core/util_random.hpp"
|
||||
#include "mamba/fs/filesystem.hpp"
|
||||
#include "mamba/specs/package_info.hpp"
|
||||
#include "mamba/util/string.hpp"
|
||||
|
||||
#include "mambatests.hpp"
|
||||
|
@ -99,12 +99,12 @@ namespace
|
|||
};
|
||||
|
||||
/**
|
||||
* Simple factory for building a PackageInfo.
|
||||
* Simple factory for building a specs::PackageInfo.
|
||||
*/
|
||||
auto mkpkg(std::string name, std::string version, std::vector<std::string> dependencies = {})
|
||||
-> PackageInfo
|
||||
-> specs::PackageInfo
|
||||
{
|
||||
auto pkg = PackageInfo(std::move(name));
|
||||
auto pkg = specs::PackageInfo(std::move(name));
|
||||
pkg.version = std::move(version);
|
||||
pkg.depends = std::move(dependencies);
|
||||
pkg.build_string = "bld";
|
||||
|
@ -372,7 +372,7 @@ namespace
|
|||
Context& ctx,
|
||||
ChannelContext& channel_context,
|
||||
std::vector<std::string>&& specs,
|
||||
const std::vector<PackageInfo>& virtual_packages = { mkpkg("__glibc", "2.17.0") },
|
||||
const std::vector<specs::PackageInfo>& virtual_packages = { mkpkg("__glibc", "2.17.0") },
|
||||
std::vector<std::string>&& channels = { "conda-forge" },
|
||||
const std::vector<std::string>& platforms = { "linux-64", "noarch" }
|
||||
) -> MSolver
|
||||
|
|
|
@ -262,8 +262,34 @@ bind_submodule_impl(pybind11::module_ m)
|
|||
{
|
||||
using namespace mamba;
|
||||
|
||||
struct PackageInfoV2Migrator
|
||||
{
|
||||
};
|
||||
|
||||
py::class_<PackageInfoV2Migrator>(m, "PackageInfo")
|
||||
.def(py::init(
|
||||
[](py::args, py::kwargs) -> PackageInfoV2Migrator
|
||||
{
|
||||
throw std::runtime_error(
|
||||
"libmambapy.PackageInfo has been moved to libmambapy.specs.PackageInfo"
|
||||
);
|
||||
}
|
||||
));
|
||||
|
||||
struct MatchSpecV2Migrator
|
||||
{
|
||||
};
|
||||
|
||||
py::class_<MatchSpecV2Migrator>(m, "MatchSpec")
|
||||
.def(py::init(
|
||||
[](py::args, py::kwargs) -> MatchSpecV2Migrator {
|
||||
throw std::runtime_error(
|
||||
"libmambapy.MatchSpec has been moved to libmambapy.specs.MatchSpec"
|
||||
);
|
||||
}
|
||||
));
|
||||
|
||||
// declare earlier to avoid C++ types in docstrings
|
||||
auto pyPackageInfo = py::class_<PackageInfo>(m, "PackageInfo");
|
||||
auto pyPrefixData = py::class_<PrefixData>(m, "PrefixData");
|
||||
auto pySolver = py::class_<MSolver>(m, "Solver");
|
||||
|
||||
|
@ -389,7 +415,7 @@ bind_submodule_impl(pybind11::module_ m)
|
|||
auto pyPbGraph = py::class_<PbGraph>(m, "ProblemsGraph");
|
||||
|
||||
py::class_<PbGraph::RootNode>(pyPbGraph, "RootNode").def(py::init<>());
|
||||
py::class_<PbGraph::PackageNode, PackageInfo>(pyPbGraph, "PackageNode");
|
||||
py::class_<PbGraph::PackageNode, specs::PackageInfo>(pyPbGraph, "PackageNode");
|
||||
py::class_<PbGraph::UnresolvedDependencyNode, specs::MatchSpec>(
|
||||
pyPbGraph,
|
||||
"UnresolvedDependencyNode"
|
||||
|
@ -1031,35 +1057,6 @@ bind_submodule_impl(pybind11::module_ m)
|
|||
.def_property_readonly("package_records", &PrefixData::records)
|
||||
.def("add_packages", &PrefixData::add_packages);
|
||||
|
||||
pyPackageInfo //
|
||||
.def(py::init<const std::string&>(), py::arg("name"))
|
||||
.def(
|
||||
py::init<const std::string&, const std::string&, const std::string&, std::size_t>(),
|
||||
py::arg("name"),
|
||||
py::arg("version"),
|
||||
py::arg("build_string"),
|
||||
py::arg("build_number")
|
||||
)
|
||||
.def_readwrite("name", &PackageInfo::name)
|
||||
.def_readwrite("version", &PackageInfo::version)
|
||||
.def_readwrite("build_string", &PackageInfo::build_string)
|
||||
.def_readwrite("build_number", &PackageInfo::build_number)
|
||||
.def_readwrite("noarch", &PackageInfo::noarch)
|
||||
.def_readwrite("channel", &PackageInfo::channel)
|
||||
.def_readwrite("url", &PackageInfo::url)
|
||||
.def_readwrite("subdir", &PackageInfo::subdir)
|
||||
.def_readwrite("fn", &PackageInfo::filename)
|
||||
.def_readwrite("license", &PackageInfo::license)
|
||||
.def_readwrite("size", &PackageInfo::size)
|
||||
.def_readwrite("timestamp", &PackageInfo::timestamp)
|
||||
.def_readwrite("md5", &PackageInfo::md5)
|
||||
.def_readwrite("sha256", &PackageInfo::sha256)
|
||||
.def_readwrite("track_features", &PackageInfo::track_features)
|
||||
.def_readwrite("depends", &PackageInfo::depends)
|
||||
.def_readwrite("constrains", &PackageInfo::constrains)
|
||||
.def_readwrite("signatures", &PackageInfo::signatures)
|
||||
.def_readwrite("defaulted_keys", &PackageInfo::defaulted_keys);
|
||||
|
||||
// Content trust - Package signature and verification
|
||||
m.def("generate_ed25519_keypair", &validation::generate_ed25519_keypair_hex);
|
||||
m.def(
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "mamba/specs/channel_spec.hpp"
|
||||
#include "mamba/specs/conda_url.hpp"
|
||||
#include "mamba/specs/match_spec.hpp"
|
||||
#include "mamba/specs/package_info.hpp"
|
||||
#include "mamba/specs/platform.hpp"
|
||||
#include "mamba/specs/version.hpp"
|
||||
#include "mamba/specs/version_spec.hpp"
|
||||
|
@ -577,6 +578,53 @@ namespace mambapy
|
|||
.def("__copy__", ©<VersionSpec>)
|
||||
.def("__deepcopy__", &deepcopy<VersionSpec>, py::arg("memo"));
|
||||
|
||||
py::class_<PackageInfo>(m, "PackageInfo")
|
||||
.def(
|
||||
py::init<std::string, std::string, std::string, std::size_t>(),
|
||||
py::arg("name") = "",
|
||||
py::arg("version") = "",
|
||||
py::arg("build_string") = "",
|
||||
py::arg("build_number") = 0
|
||||
)
|
||||
.def_readwrite("name", &PackageInfo::name)
|
||||
.def_readwrite("version", &PackageInfo::version)
|
||||
.def_readwrite("build_string", &PackageInfo::build_string)
|
||||
.def_readwrite("build_number", &PackageInfo::build_number)
|
||||
.def_readwrite("noarch", &PackageInfo::noarch)
|
||||
.def_readwrite("channel", &PackageInfo::channel)
|
||||
.def_readwrite("package_url", &PackageInfo::package_url)
|
||||
.def_property(
|
||||
// V2 migration helper
|
||||
"url",
|
||||
[](py::handle) { throw std::runtime_error("'url' has been renamed 'package_url'"); },
|
||||
[](py::handle, py::handle)
|
||||
{ throw std::runtime_error("'url' has been renamed 'package_url'"); }
|
||||
)
|
||||
.def_readwrite("subdir", &PackageInfo::subdir)
|
||||
.def_readwrite("filename", &PackageInfo::filename)
|
||||
.def_property(
|
||||
// V2 migration helper
|
||||
"fn",
|
||||
[](py::handle) { throw std::runtime_error("'fn' has been renamed 'filename'"); },
|
||||
[](py::handle, py::handle)
|
||||
{ throw std::runtime_error("'fn' has been renamed 'filename'"); }
|
||||
)
|
||||
.def_readwrite("license", &PackageInfo::license)
|
||||
.def_readwrite("size", &PackageInfo::size)
|
||||
.def_readwrite("timestamp", &PackageInfo::timestamp)
|
||||
.def_readwrite("md5", &PackageInfo::md5)
|
||||
.def_readwrite("sha256", &PackageInfo::sha256)
|
||||
.def_readwrite("track_features", &PackageInfo::track_features)
|
||||
.def_readwrite("depends", &PackageInfo::depends)
|
||||
.def_readwrite("constrains", &PackageInfo::constrains)
|
||||
.def_readwrite("signatures", &PackageInfo::signatures)
|
||||
.def_readwrite("defaulted_keys", &PackageInfo::defaulted_keys)
|
||||
.def(py::self == py::self)
|
||||
.def(py::self != py::self)
|
||||
.def("__str__", &PackageInfo::str)
|
||||
.def("__copy__", ©<PackageInfo>)
|
||||
.def("__deepcopy__", &deepcopy<PackageInfo>, py::arg("memo"));
|
||||
|
||||
// WIP MatchSpec class
|
||||
py::class_<MatchSpec>(m, "MatchSpec")
|
||||
.def_static("parse", &MatchSpec::parse)
|
||||
|
|
|
@ -219,6 +219,7 @@ def test_CondaURL_op():
|
|||
# Copy
|
||||
other = copy.deepcopy(url)
|
||||
assert other.str() == url.str()
|
||||
assert other is not url
|
||||
|
||||
# Comparison
|
||||
assert hash(url) != 0
|
||||
|
@ -270,6 +271,7 @@ def test_ChannelSpec():
|
|||
# Copy
|
||||
other = copy.deepcopy(spec)
|
||||
assert other.location == spec.location
|
||||
assert other is not spec
|
||||
|
||||
|
||||
def test_BasicHTTPAuthentication():
|
||||
|
@ -289,6 +291,7 @@ def test_BasicHTTPAuthentication():
|
|||
other = copy.deepcopy(auth)
|
||||
assert other is not auth
|
||||
assert other.user == auth.user
|
||||
assert other is not auth
|
||||
|
||||
# Comparion
|
||||
assert auth == auth
|
||||
|
@ -565,7 +568,9 @@ def test_VersionPartAtom():
|
|||
assert b > a
|
||||
|
||||
# Copy
|
||||
assert copy.deepcopy(a) == a
|
||||
other = copy.deepcopy(a)
|
||||
assert other == a
|
||||
assert other is not a
|
||||
|
||||
|
||||
def test_VersionPart():
|
||||
|
@ -623,7 +628,9 @@ def test_Version():
|
|||
assert v.str(level=1) == "3!1+42"
|
||||
|
||||
# Copy
|
||||
assert copy.deepcopy(v) == v
|
||||
other = copy.deepcopy(v)
|
||||
assert other == v
|
||||
assert other is not v
|
||||
|
||||
# Comparison
|
||||
v1 = Version.parse("1.0.1")
|
||||
|
@ -673,7 +680,89 @@ def test_VersionSpec():
|
|||
assert str(vs) == ">2.0,<3.0"
|
||||
|
||||
# Copy, no easy comparison, this may not work for all specs
|
||||
assert str(copy.deepcopy(vs)) == str(vs)
|
||||
other = copy.deepcopy(vs)
|
||||
assert str(other) == str(vs)
|
||||
assert other is not vs
|
||||
|
||||
|
||||
def test_PackageInfo():
|
||||
PackageInfo = libmambapy.specs.PackageInfo
|
||||
|
||||
pkg = PackageInfo(name="pkg", version="1.0", build_string="bld", build_number=2)
|
||||
|
||||
assert pkg.name == "pkg"
|
||||
assert pkg.version == "1.0"
|
||||
assert pkg.build_string == "bld"
|
||||
assert pkg.build_number == 2
|
||||
|
||||
# str
|
||||
assert str(pkg) == "pkg-1.0-bld"
|
||||
|
||||
# getters and setters
|
||||
pkg.name = "foo"
|
||||
assert pkg.name == "foo"
|
||||
pkg.version = "4.0"
|
||||
assert pkg.version == "4.0"
|
||||
pkg.build_string = "mybld"
|
||||
assert pkg.build_string == "mybld"
|
||||
pkg.build_number = 5
|
||||
assert pkg.build_number == 5
|
||||
pkg.noarch = "generic"
|
||||
assert pkg.noarch == "generic"
|
||||
pkg.channel = "conda-forge"
|
||||
assert pkg.channel == "conda-forge"
|
||||
pkg.package_url = "https://repo.mamba.pm/conda-forge/linux-64/foo-4.0-mybld.conda"
|
||||
assert pkg.package_url == "https://repo.mamba.pm/conda-forge/linux-64/foo-4.0-mybld.conda"
|
||||
pkg.subdir = "linux-64"
|
||||
assert pkg.subdir == "linux-64"
|
||||
pkg.filename = "foo-4.0-mybld.conda"
|
||||
assert pkg.filename == "foo-4.0-mybld.conda"
|
||||
pkg.license = "MIT"
|
||||
assert pkg.license == "MIT"
|
||||
pkg.size = 3200
|
||||
assert pkg.size == 3200
|
||||
pkg.timestamp = 4532
|
||||
assert pkg.timestamp == 4532
|
||||
pkg.sha256 = "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b"
|
||||
assert pkg.sha256 == "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b"
|
||||
pkg.md5 = "68b329da9893e34099c7d8ad5cb9c940"
|
||||
assert pkg.md5 == "68b329da9893e34099c7d8ad5cb9c940"
|
||||
pkg.track_features = ["mkl"]
|
||||
assert pkg.track_features == ["mkl"]
|
||||
pkg.depends = ["python>=3.7"]
|
||||
assert pkg.depends == ["python>=3.7"]
|
||||
pkg.constrains = ["pip>=2.1"]
|
||||
assert pkg.constrains == ["pip>=2.1"]
|
||||
|
||||
# Equality
|
||||
assert PackageInfo() == PackageInfo()
|
||||
assert pkg == pkg
|
||||
assert pkg != PackageInfo()
|
||||
|
||||
# Copy
|
||||
other = copy.deepcopy(pkg)
|
||||
assert other == pkg
|
||||
assert other is not pkg
|
||||
|
||||
|
||||
def test_PackageInfo_V2Migrator():
|
||||
"""Explicit migration help added from v1 to v2."""
|
||||
import libmambapy
|
||||
|
||||
with pytest.raises(Exception, match=r"libmambapy\.specs"):
|
||||
libmambapy.PackageInfo()
|
||||
|
||||
pkg = libmambapy.specs.PackageInfo()
|
||||
|
||||
with pytest.raises(Exception, match=r"filename"):
|
||||
pkg.fn
|
||||
with pytest.raises(Exception, match=r"filename"):
|
||||
pkg.fn = "foo"
|
||||
|
||||
with pytest.raises(Exception, match=r"package_url"):
|
||||
pkg.url
|
||||
with pytest.raises(Exception, match=r"package_url"):
|
||||
pkg.url = "https://repo.mamba.pm/conda-forge/linux-64/foo-4.0-mybld.conda"
|
||||
|
||||
|
||||
def test_MatchSpec():
|
||||
|
@ -683,3 +772,11 @@ def test_MatchSpec():
|
|||
|
||||
# str
|
||||
assert str(ms) == "conda-forge::python=3.7[build='*pypy']"
|
||||
|
||||
|
||||
def test_MatchSpec_V2Migrator():
|
||||
"""Explicit migration help added from v1 to v2."""
|
||||
import libmambapy
|
||||
|
||||
with pytest.raises(Exception, match=r"libmambapy\.specs"):
|
||||
libmambapy.MatchSpec()
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#include "mamba/api/configuration.hpp"
|
||||
#include "mamba/api/install.hpp"
|
||||
#include "mamba/core/package_handling.hpp"
|
||||
#include "mamba/core/package_info.hpp"
|
||||
#include "mamba/core/subdirdata.hpp"
|
||||
#include "mamba/core/util.hpp"
|
||||
#include "mamba/util/string.hpp"
|
||||
|
@ -115,9 +114,12 @@ construct(Configuration& config, const fs::u8path& prefix, bool extract_conda_pk
|
|||
fs::u8path index_path = base_path / "info" / "index.json";
|
||||
|
||||
std::string channel_url;
|
||||
if (pkg_info.url.size() > pkg_info.filename.size())
|
||||
if (pkg_info.package_url.size() > pkg_info.filename.size())
|
||||
{
|
||||
channel_url = pkg_info.url.substr(0, pkg_info.url.size() - pkg_info.filename.size());
|
||||
channel_url = pkg_info.package_url.substr(
|
||||
0,
|
||||
pkg_info.package_url.size() - pkg_info.filename.size()
|
||||
);
|
||||
}
|
||||
std::string repodata_cache_name = util::concat(cache_name_from_url(channel_url), ".json");
|
||||
fs::u8path repodata_location = pkgs_dir / "cache" / repodata_cache_name;
|
||||
|
@ -148,7 +150,7 @@ construct(Configuration& config, const fs::u8path& prefix, bool extract_conda_pk
|
|||
}
|
||||
else
|
||||
{
|
||||
LOG_WARNING << "Did not find a repodata record for " << pkg_info.url;
|
||||
LOG_WARNING << "Did not find a repodata record for " << pkg_info.package_url;
|
||||
repodata_record = index;
|
||||
|
||||
repodata_record["size"] = fs::file_size(entry);
|
||||
|
@ -163,7 +165,7 @@ construct(Configuration& config, const fs::u8path& prefix, bool extract_conda_pk
|
|||
}
|
||||
|
||||
repodata_record["fn"] = pkg_info.filename;
|
||||
repodata_record["url"] = pkg_info.url;
|
||||
repodata_record["url"] = pkg_info.package_url;
|
||||
repodata_record["channel"] = pkg_info.channel;
|
||||
|
||||
if (repodata_record.find("size") == repodata_record.end() || repodata_record["size"] == 0)
|
||||
|
|
|
@ -144,7 +144,7 @@ set_env_command(CLI::App* com, Configuration& config)
|
|||
for (const auto& record : records)
|
||||
{
|
||||
using Credentials = typename specs::CondaURL::Credentials;
|
||||
std::cout << specs::CondaURL::parse(record.url).str(Credentials::Remove);
|
||||
std::cout << specs::CondaURL::parse(record.package_url).str(Credentials::Remove);
|
||||
if (no_md5 != 1)
|
||||
{
|
||||
std::cout << "#" << record.md5;
|
||||
|
|
|
@ -74,7 +74,7 @@ update_self(Configuration& config, const std::optional<std::string>& version)
|
|||
}
|
||||
}
|
||||
|
||||
std::optional<PackageInfo> latest_micromamba = pool.id2pkginfo(solvable_ids[0]);
|
||||
std::optional<specs::PackageInfo> latest_micromamba = pool.id2pkginfo(solvable_ids[0]);
|
||||
if (!latest_micromamba)
|
||||
{
|
||||
throw mamba::mamba_error(
|
||||
|
@ -90,7 +90,7 @@ update_self(Configuration& config, const std::optional<std::string>& version)
|
|||
);
|
||||
|
||||
Console::instance().print(
|
||||
fmt::format(" Fetching micromamba from {}\n", latest_micromamba.value().url)
|
||||
fmt::format(" Fetching micromamba from {}\n", latest_micromamba.value().package_url)
|
||||
);
|
||||
|
||||
ctx.download_only = true;
|
||||
|
|
Loading…
Reference in New Issue