aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-02-14 14:20:00 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-02-14 14:20:00 +0200
commit0736a7b0cb90b83895af6a11ae0158f2adcce321 (patch)
treecfbba455a26e0970b1ec13d78f67ae2ac15eb72a
parent2a1e0a68979db77b3c4951ac15d6abcf68d5780d (diff)
Update all packages at once in pkg-build
-rw-r--r--bpkg/pkg-build.cxx18
-rw-r--r--bpkg/pkg-command6
-rw-r--r--bpkg/pkg-command.cxx24
-rw-r--r--bpkg/pkg-update5
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<pkg_command_vars> upkgs;
+
for (const build_package& p: reverse_iterate (pkgs))
{
const shared_ptr<selected_package>& 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<selected_package>&);
-
- void
- pkg_command (const string& cmd,
- const dir_path& configuration,
- const common_options&,
const strings& common_vars,
const vector<pkg_command_vars>&);
}
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<selected_package>& 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<pkg_command_vars>& 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<selected_package>& p)
+ const strings& common_vars,
+ const vector<pkg_command_vars>& pkgs)
{
- pkg_command ("update", configuration, o, p);
+ pkg_command ("update", configuration, o, common_vars, pkgs);
}
}