From 03c40ed68ce10b26a5f9f509e914b1b54f060215 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Sat, 4 Sep 2021 15:41:41 +0300 Subject: Add --backlink, --dangling, and --recursive options to cfg-info --- bpkg/database.cxx | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) (limited to 'bpkg/database.cxx') diff --git a/bpkg/database.cxx b/bpkg/database.cxx index ab2bcfc..451ade3 100644 --- a/bpkg/database.cxx +++ b/bpkg/database.cxx @@ -697,7 +697,7 @@ namespace bpkg if (!lc.expl && !exists (d)) { if (verb > 1) - info << "skipping dangling implicit back-link " << lc.path << + info << "skipping dangling implicit backlink " << lc.path << info << "use 'cfg-unlink --dangling' to clean up"; continue; @@ -714,17 +714,7 @@ namespace bpkg // if (lc.expl) { - shared_ptr cf ( - db.query_one (q::uuid == uuid.string ())); - - if (cf == nullptr) - fail << "configuration " << db.config_orig << " is linked with " - << config_orig << " but latter is not implicitly linked " - << "with former"; - - // While at it, verify the integrity of the other end of the link. - // - db.verify_link (*cf, *this); + shared_ptr cf (backlink (db)); if (!cf->expl) continue; @@ -746,6 +736,25 @@ namespace bpkg return implicit_links_; } + shared_ptr database:: + backlink (database& db) + { + using q = odb::query; + + shared_ptr cf ( + db.query_one (q::uuid == uuid.string ())); + + if (cf == nullptr) + fail << "configuration " << db.config_orig << " is linked with " + << config_orig << " but latter is not implicitly linked " + << "with former"; + + // While at it, verify the integrity of the other end of the link. + // + db.verify_link (*cf, *this); + return cf; + } + linked_databases database:: dependent_configs (bool sys_rep) { -- cgit v1.1