diff options
Diffstat (limited to 'bpkg/pkg-command.cxx')
-rw-r--r-- | bpkg/pkg-command.cxx | 49 |
1 files changed, 36 insertions, 13 deletions
diff --git a/bpkg/pkg-command.cxx b/bpkg/pkg-command.cxx index 11f10f0..6bec97b 100644 --- a/bpkg/pkg-command.cxx +++ b/bpkg/pkg-command.cxx @@ -18,7 +18,6 @@ namespace bpkg { void pkg_command (const string& cmd, - const dir_path& c, const common_options& o, const string& cmd_v, const strings& cvars, @@ -78,7 +77,7 @@ namespace bpkg assert (p->state == package_state::configured); assert (p->out_root); // Should be present since configured. - dir_path out_root (p->effective_out_root (c)); + dir_path out_root (p->effective_out_root (pv.config_orig)); l4 ([&]{trace << p->name << " out_root: " << out_root;}); if (bspec.back () != '(') @@ -133,11 +132,17 @@ namespace bpkg [&d] (const pkg_command_vars& i) {return i.pkg == d;}) == ps.end ()) { + database& db (pr.first.database ()); + // Note: no package-specific variables (global ones still apply). // - ps.push_back (pkg_command_vars {d, - strings () /* vars */, - package_cwd}); + ps.push_back ( + pkg_command_vars { + db.config_orig, + db.main (), + d, + strings () /* vars */, + package_cwd}); if (recursive) collect_dependencies (d, recursive, package_cwd, ps); @@ -248,7 +253,7 @@ namespace bpkg vector<pkg_command_vars> ps; { - database db (open (c, trace)); + database db (c, trace, true /* pre_attach */); transaction t (db); // We need to suppress duplicate dependencies for the recursive command @@ -256,11 +261,16 @@ namespace bpkg // session ses; - auto add = [&ps, recursive, immediate, package_cwd] ( + auto add = [&db, &ps, recursive, immediate, package_cwd] ( const shared_ptr<selected_package>& p, strings vars) { - ps.push_back (pkg_command_vars {p, move (vars), package_cwd}); + ps.push_back ( + pkg_command_vars {db.config_orig, + db.main (), + p, + move (vars), + package_cwd}); // Note that it can only be recursive or immediate but not both. // @@ -310,13 +320,13 @@ namespace bpkg << "configuration " << c; if (p->state != package_state::configured) - fail << "package " << a.name << " is " << p->state << + fail << "package " << a.name << db << " is " << p->state << info << "expected it to be configured"; if (p->substate == package_substate::system) - fail << "cannot " << cmd << " system package " << a.name; + fail << "cannot " << cmd << " system package " << a.name << db; - l4 ([&]{trace << *p;}); + l4 ([&]{trace << *p << db;}); add (p, move (a.vars)); } @@ -325,14 +335,27 @@ namespace bpkg t.commit (); } - pkg_command (cmd, c, o, cmd_v, cvars, ps); + pkg_command (cmd, o, cmd_v, cvars, ps); if (verb && !o.no_result ()) { for (const pkg_command_vars& pv: ps) - text << cmd << (cmd.back () != 'e' ? "ed " : "d ") << *pv.pkg; + text << cmd << (cmd.back () != 'e' ? "ed " : "d ") << pv.string (); } return 0; } + + // pkg_command_vars + // + string pkg_command_vars:: + string () const + { + std::string r (pkg->string ()); + + if (!config_main) + r += " [" + config_orig.representation () + ']'; + + return r; + } } |