[M5+] cargoxx add evicts stale auto-discovered overlay rows

This commit is contained in:
2026-05-10 15:49:44 +00:00
parent 5f233b9fa9
commit 6e280becbe
3 changed files with 57 additions and 0 deletions

View File

@@ -139,6 +139,20 @@ auto cmd_add(const fs::path& project_root, const std::string& name,
const auto effective_overlay = overlay_path.value_or(linkdb::default_overlay_path());
// Drop any auto-discovered overlay rows for this package before
// resolving — they may have been written by an older cargoxx whose
// scanner produced a different recipe (e.g. picked the wrong
// CMake config in a multi-config tree). Manual recipes survive.
{
auto db = linkdb::Database::open(effective_overlay);
if (!db) {
return std::unexpected(db.error());
}
if (auto r = db->evict_auto_recipes(name); !r) {
return std::unexpected(r.error());
}
}
auto known = recipe_already_known(name, effective_version, components,
effective_overlay);
if (!known) {