[M5+] add resolver::nixpkgs_git_resolve fallback
This commit is contained in:
@@ -158,4 +158,20 @@ auto parse_devbox_resolve(std::string_view json)
|
||||
auto devbox_resolve(const std::string& name, const std::string& version)
|
||||
-> util::Result<DevboxResolution>;
|
||||
|
||||
// Pure: parse the output of
|
||||
// git log --all -S 'version = "<v>"' --pretty='%H %ct' -- pkgs/
|
||||
// (one commit per line: "<40-char-sha> <unix-epoch-seconds>") and
|
||||
// return the youngest matching SHA, or nullopt on empty input.
|
||||
auto pick_youngest_commit(std::string_view git_log_output)
|
||||
-> std::optional<std::string>;
|
||||
|
||||
// Searches a local nixpkgs clone for the youngest commit that
|
||||
// introduced `version = "<version>"` under pkgs/. `repo_path`
|
||||
// defaults to ~/.cache/cargoxx/nixpkgs/ — when the directory doesn't
|
||||
// exist the repo is cloned lazily (multi-GB, only on first miss).
|
||||
// 404-equivalent: ResolutionVersionNotFound.
|
||||
auto nixpkgs_git_resolve(const std::string& name, const std::string& version,
|
||||
std::optional<std::filesystem::path> repo_path = std::nullopt)
|
||||
-> util::Result<std::string>;
|
||||
|
||||
} // namespace cargoxx::resolver
|
||||
|
||||
Reference in New Issue
Block a user