[M5+] add resolver::verify_link + provisional overlay lifecycle
This commit is contained in:
@@ -4,6 +4,7 @@ import std;
|
||||
import cargoxx.util;
|
||||
import cargoxx.exec;
|
||||
import cargoxx.linkdb;
|
||||
import cargoxx.manifest;
|
||||
|
||||
export namespace cargoxx::resolver {
|
||||
|
||||
@@ -89,4 +90,29 @@ auto parse_vcpkg_usage(std::string_view usage_text)
|
||||
// ResolutionUnknownPackage; transport errors → ResolutionNetworkError.
|
||||
auto vcpkg_probe(const std::string& name) -> util::Result<VcpkgRecipe>;
|
||||
|
||||
// Caller-supplied closure that runs `cargoxx build` (or any equivalent
|
||||
// build) on a project rooted at the given path. Injected so the resolver
|
||||
// stays decoupled from `cargoxx.cli`.
|
||||
using BuildFn =
|
||||
std::function<util::Result<void>(const std::filesystem::path& project_root)>;
|
||||
|
||||
struct VerifyLinkRequest {
|
||||
linkdb::Recipe candidate; // recipe under test
|
||||
std::string source; // "conan" | "vcpkg" | "nix-probe"
|
||||
std::string package_name;
|
||||
std::string version_spec; // user-supplied spec (e.g. "*", "1.2")
|
||||
std::vector<std::string> components;
|
||||
std::filesystem::path overlay_path; // sqlite file we read/write
|
||||
std::filesystem::path scratch_root; // parent dir for the tmp project
|
||||
};
|
||||
|
||||
// Scaffolds a tiny Cargoxx project under `req.scratch_root`, writes a
|
||||
// provisional overlay row pointing at `req.candidate`, runs `build_fn` on
|
||||
// the project (typically `cli::cmd_build`), and depending on the build
|
||||
// result either confirms the provisional row (verified_at = now) or
|
||||
// deletes it. Cleans the tmp project regardless. Returns success only
|
||||
// when the build itself succeeded.
|
||||
auto verify_link(const VerifyLinkRequest& req, const BuildFn& build_fn)
|
||||
-> util::Result<void>;
|
||||
|
||||
} // namespace cargoxx::resolver
|
||||
|
||||
Reference in New Issue
Block a user