diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2018-03-07 22:36:57 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2018-03-08 13:35:44 +0300 |
commit | ccd8c8dadfcfd9181772b3061e7b075d88942505 (patch) | |
tree | 2e2d292deafa3e3282128c0a92ea1b9894809e6f /bpkg/rep-fetch.cxx | |
parent | d234bf4a341edb470a2c81f2533f7eb5c67c948c (diff) |
Change database parameter type to transaction for some rep_*() functions
Diffstat (limited to 'bpkg/rep-fetch.cxx')
-rw-r--r-- | bpkg/rep-fetch.cxx | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/bpkg/rep-fetch.cxx b/bpkg/rep-fetch.cxx index ab7ce55..31e7b11 100644 --- a/bpkg/rep-fetch.cxx +++ b/bpkg/rep-fetch.cxx @@ -423,7 +423,7 @@ namespace bpkg static void rep_fetch (const common_options& co, const dir_path& conf, - database& db, + transaction& t, const shared_ptr<repository>& r, repositories& fetched, repositories& removed, @@ -431,6 +431,7 @@ namespace bpkg { tracer trace ("rep_fetch(rep)"); + database& db (t.database ()); tracer_guard tg (db, trace); // Check that the repository is not fetched yet and register it as fetched @@ -494,7 +495,7 @@ namespace bpkg // Remove this repository from locations of the available packages it // contains. // - rep_remove_package_locations (db, r->name); + rep_remove_package_locations (t, r->name); // Load the repository and package manifests and use them to populate the // prerequisite and complement repository sets as well as available @@ -555,7 +556,7 @@ namespace bpkg } reason += r->name; - rep_fetch (co, conf, db, pr, fetched, removed, reason); + rep_fetch (co, conf, t, pr, fetched, removed, reason); // @@ What if we have duplicated? Ideally, we would like to check // this once and as early as possible. The original idea was to @@ -685,8 +686,6 @@ namespace bpkg transaction& t, const vector<lazy_shared_ptr<repository>>& repos) { - database& db (t.database ()); - // As a fist step we fetch repositories recursively building the list of // the former prerequisites and complements to be considered for removal. // @@ -705,12 +704,12 @@ namespace bpkg repositories removed; for (const lazy_shared_ptr<repository>& r: repos) - rep_fetch (o, conf, db, r.load (), fetched, removed); + rep_fetch (o, conf, t, r.load (), fetched, removed); // Finally, remove dangling repositories. // for (const shared_ptr<repository>& r: removed) - rep_remove (conf, db, r); + rep_remove (conf, t, r); } catch (const failed&) { @@ -724,7 +723,7 @@ namespace bpkg warn << "repository state is now broken and will be cleaned up" << info << "run 'bpkg rep-fetch' to update"; - rep_remove_clean (conf, db); + rep_remove_clean (conf, t.database ()); } throw; @@ -753,7 +752,7 @@ namespace bpkg // same location. // if (ua.find (r) == ua.end () || r.load ()->location.url () != rl.url ()) - rep_add (db, rl); + rep_add (t, rl); repos.emplace_back (r); } @@ -819,7 +818,7 @@ namespace bpkg // calling rep_add. Get rid of quiet mode. // r = lazy_shared_ptr<repository> ( - db, rep_add (db, parse_location (a, nullopt /* type */))); + db, rep_add (t, parse_location (a, nullopt /* type */))); repos.emplace_back (move (r)); } |