From e958b63712f9a0ff4b523765d2fe12b58aa97fe0 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Wed, 4 Apr 2018 16:03:04 +0300 Subject: Implement dependency up/down-grade/unhold --- bpkg/package.hxx | 42 ++++++++++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 12 deletions(-) (limited to 'bpkg/package.hxx') diff --git a/bpkg/package.hxx b/bpkg/package.hxx index 38aa3ee..f0bb6fd 100644 --- a/bpkg/package.hxx +++ b/bpkg/package.hxx @@ -20,6 +20,8 @@ #include // transaction #include +#include + #pragma db model version(4, 4, open) namespace bpkg @@ -233,8 +235,10 @@ namespace bpkg // Note that the type() call fails for an empty repository location. // #pragma db map type(repository_location) as(_repository_location) \ - to({(?).url (), \ - (?).empty () ? bpkg::repository_type::pkg : (?).type ()}) \ + to(bpkg::_repository_location {(?).url (), \ + (?).empty () \ + ? bpkg::repository_type::pkg \ + : (?).type ()}) \ from(bpkg::repository_location (std::move ((?).url), (?).type)) // repository @@ -512,11 +516,20 @@ namespace bpkg const shared_ptr&, bool prereq = true); - vector> + vector, shared_ptr>> filter (const vector>&, odb::result&&, bool prereq = true); + // Check if there are packages available in the configuration. If that's not + // the case then print the info message into the diag record or, if it is + // NULL, print the error message and fail. + // + void + check_any_available (const dir_path& configuration, + transaction&, + const diag_record* = nullptr); + // package_state // enum class package_state @@ -564,6 +577,13 @@ namespace bpkg // package // + // Return the package name in the [sys:][/] form. The version + // component is represented with the "/*" string for the wildcard version and + // is omitted for the empty one. + // + string + package_string (const string& name, const version&, bool system = false); + // A map of "effective" prerequisites (i.e., pointers to other selected // packages) to optional dependency constraint. Note that because it is a // single constraint, we don't support multiple dependencies on the same @@ -677,10 +697,7 @@ namespace bpkg version_string () const; std::string - string () const - { - return (system () ? "sys:" : "") + name + "/" + version_string (); - } + string () const {return package_string (name, version, system ());} // Return the relative source directory completed using the configuration // directory. Return the absolute source directory as is. @@ -688,7 +705,9 @@ namespace bpkg dir_path effective_src_root (const dir_path& configuration) const { - assert (src_root); + // Cast for compiling with ODB (see above). + // + assert (static_cast (src_root)); return src_root->absolute () ? *src_root : configuration / *src_root; } @@ -698,7 +717,9 @@ namespace bpkg dir_path effective_out_root (const dir_path& configuration) const { - assert (out_root); + // Cast for compiling with ODB (see above). + // + assert (static_cast (out_root)); return configuration / *out_root; } @@ -714,9 +735,6 @@ namespace bpkg selected_package () = default; }; - // Print the package name, version and the 'sys:' prefix for the system - // substate. The wildcard version is represented with the "*" string. - // inline ostream& operator<< (ostream& os, const selected_package& p) { -- cgit v1.1