[M5+] wire resolver::discover into cargoxx add
This commit is contained in:
@@ -71,16 +71,6 @@ auto load_curated(const std::filesystem::path& path)
|
||||
return out;
|
||||
}
|
||||
|
||||
auto default_overlay_path() -> std::filesystem::path {
|
||||
namespace fs = std::filesystem;
|
||||
if (auto* xdg = std::getenv("XDG_CACHE_HOME"); xdg && *xdg) {
|
||||
return fs::path{xdg} / "cargoxx" / "linkdb.sqlite";
|
||||
}
|
||||
if (auto* home = std::getenv("HOME"); home && *home) {
|
||||
return fs::path{home} / ".cache" / "cargoxx" / "linkdb.sqlite";
|
||||
}
|
||||
return fs::current_path() / ".cargoxx-linkdb.sqlite";
|
||||
}
|
||||
|
||||
auto resolve_curated(const std::map<std::string, std::vector<detail::CuratedRecipe>>& curated,
|
||||
const std::string& package, const std::string& version,
|
||||
@@ -136,6 +126,17 @@ auto resolve_curated(const std::map<std::string, std::vector<detail::CuratedReci
|
||||
|
||||
} // namespace
|
||||
|
||||
auto default_overlay_path() -> std::filesystem::path {
|
||||
namespace fs = std::filesystem;
|
||||
if (auto* xdg = std::getenv("XDG_CACHE_HOME"); xdg && *xdg) {
|
||||
return fs::path{xdg} / "cargoxx" / "linkdb.sqlite";
|
||||
}
|
||||
if (auto* home = std::getenv("HOME"); home && *home) {
|
||||
return fs::path{home} / ".cache" / "cargoxx" / "linkdb.sqlite";
|
||||
}
|
||||
return fs::current_path() / ".cargoxx-linkdb.sqlite";
|
||||
}
|
||||
|
||||
auto Database::open(std::optional<std::filesystem::path> overlay_path) -> util::Result<Database> {
|
||||
Database db;
|
||||
|
||||
|
||||
@@ -131,6 +131,12 @@ class Database {
|
||||
std::unique_ptr<detail::OverlayState> overlay_;
|
||||
};
|
||||
|
||||
// Returns the default overlay-database path:
|
||||
// $XDG_CACHE_HOME/cargoxx/linkdb.sqlite (if XDG_CACHE_HOME is set)
|
||||
// $HOME/.cache/cargoxx/linkdb.sqlite (else if HOME is set)
|
||||
// <cwd>/.cargoxx-linkdb.sqlite (final fallback)
|
||||
auto default_overlay_path() -> std::filesystem::path;
|
||||
|
||||
// Pure helpers exported for unit testing.
|
||||
auto substitute_components(std::string find_package, const std::vector<std::string>& components)
|
||||
-> std::string;
|
||||
|
||||
@@ -267,6 +267,14 @@ auto overlay_is_fresh(const OverlayRow& row, std::int64_t now) -> bool {
|
||||
if (row.source == "manual" || row.source == "curated") {
|
||||
return true;
|
||||
}
|
||||
// verified_at == 0 marks a provisional row — written by
|
||||
// resolver::verify_link before its build runs and either confirmed
|
||||
// (verified_at = now) or deleted afterwards. The verifying build
|
||||
// itself must see this row to surface the candidate recipe to its
|
||||
// codegen step.
|
||||
if (row.verified_at == 0) {
|
||||
return true;
|
||||
}
|
||||
return (now - row.verified_at) < THIRTY_DAYS_SECONDS;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user