From 0736a7b0cb90b83895af6a11ae0158f2adcce321 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sun, 14 Feb 2016 14:20:00 +0200 Subject: Update all packages at once in pkg-build --- bpkg/pkg-build.cxx | 18 +++++++++++++----- bpkg/pkg-command | 6 ------ bpkg/pkg-command.cxx | 24 ------------------------ bpkg/pkg-update | 5 +++-- 4 files changed, 16 insertions(+), 37 deletions(-) diff --git a/bpkg/pkg-build.cxx b/bpkg/pkg-build.cxx index 977c8d9..88d74cc 100644 --- a/bpkg/pkg-build.cxx +++ b/bpkg/pkg-build.cxx @@ -1348,19 +1348,27 @@ namespace bpkg // update // + // Here we want to update all the packages at once, to facilitate + // parallelism. + // + vector upkgs; + for (const build_package& p: reverse_iterate (pkgs)) { const shared_ptr& sp (p.selected); // Update the user selection only. // - if (find (names.begin (), names.end (), sp->name) == names.end ()) - continue; + if (find (names.begin (), names.end (), sp->name) != names.end ()) + upkgs.push_back (pkg_command_vars {sp, strings ()}); + } - pkg_update (c, o, sp); + pkg_update (c, o, strings (), upkgs); - if (verb) - text << "updated " << sp->name << " " << sp->version; + if (verb) + { + for (const pkg_command_vars& pv: upkgs) + text << "updated " << pv.pkg->name << " " << pv.pkg->version; } return 0; diff --git a/bpkg/pkg-command b/bpkg/pkg-command index 6790917..21699c4 100644 --- a/bpkg/pkg-command +++ b/bpkg/pkg-command @@ -30,12 +30,6 @@ namespace bpkg pkg_command (const string& cmd, const dir_path& configuration, const common_options&, - const shared_ptr&); - - void - pkg_command (const string& cmd, - const dir_path& configuration, - const common_options&, const strings& common_vars, const vector&); } diff --git a/bpkg/pkg-command.cxx b/bpkg/pkg-command.cxx index 088ad9c..c225bc1 100644 --- a/bpkg/pkg-command.cxx +++ b/bpkg/pkg-command.cxx @@ -18,30 +18,6 @@ namespace bpkg pkg_command (const string& cmd, const dir_path& c, const common_options& o, - const shared_ptr& p) - { - tracer trace ("pkg_command"); - - level4 ([&]{trace << "command: " << cmd;}); - - assert (p->state == package_state::configured); - assert (p->out_root); // Should be present since configured. - - dir_path out_root (c / *p->out_root); // Always relative. - level4 ([&]{trace << "out_root: " << out_root;}); - - // Form the buildspec. - // - string bspec (cmd + "(" + out_root.string () + "/)"); - level4 ([&]{trace << "buildspec: " << bspec;}); - - run_b (o, bspec); - } - - void - pkg_command (const string& cmd, - const dir_path& c, - const common_options& o, const strings& cvars, const vector& ps) { diff --git a/bpkg/pkg-update b/bpkg/pkg-update index 5cc28eb..5d24c49 100644 --- a/bpkg/pkg-update +++ b/bpkg/pkg-update @@ -23,9 +23,10 @@ namespace bpkg inline void pkg_update (const dir_path& configuration, const common_options& o, - const shared_ptr& p) + const strings& common_vars, + const vector& pkgs) { - pkg_command ("update", configuration, o, p); + pkg_command ("update", configuration, o, common_vars, pkgs); } } -- cgit v1.1