diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2021-10-13 11:57:07 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2021-10-13 11:57:07 +0300 |
commit | f11e0849d09aeb3926d160d794b4b8106051e5c6 (patch) | |
tree | 74db5618bf2078f07c111372bc8e16f9e57c9824 | |
parent | e8ce49e5fda4432147aa86cf65c4c2479e52ee32 (diff) |
Fix sync command to pass configuration arguments to bpkg during automatic configuration creation
-rw-r--r-- | bdep/config.cxx | 19 | ||||
-rw-r--r-- | bdep/config.hxx | 3 | ||||
-rw-r--r-- | bdep/sync.cxx | 16 |
3 files changed, 30 insertions, 8 deletions
diff --git a/bdep/config.cxx b/bdep/config.cxx index 765032b..8b35a64 100644 --- a/bdep/config.cxx +++ b/bdep/config.cxx @@ -199,15 +199,20 @@ namespace bdep return r; } - // Quote the directory if it contains spaces. + // Quote the string/directory if it contains spaces. // - static string - quote (const dir_path& d) + static inline string + quote (const string& s) { - const string& s (d.string ()); return s.find (' ') == string::npos ? s : '"' + s + '"'; } + static inline string + quote (const dir_path& d) + { + return quote (d.string ()); + } + void cmd_config_add_print (diag_record& dr, const dir_path& prj, @@ -488,7 +493,8 @@ namespace bdep const string& type, bool def, bool fwd, - bool asy) + bool asy, + const strings& args) { dr << "bdep config create -d " << quote (prj); @@ -503,6 +509,9 @@ namespace bdep dr << (asy ? "" : " --no-auto-sync"); dr << ' ' << quote (path); + + for (const string& a: args) + dr << ' ' << quote (a); } shared_ptr<configuration> diff --git a/bdep/config.hxx b/bdep/config.hxx index b2f820c..3c66b72 100644 --- a/bdep/config.hxx +++ b/bdep/config.hxx @@ -89,7 +89,8 @@ namespace bdep const string& type, bool default_ = true, bool forward = true, - bool auto_sync = true); + bool auto_sync = true, + const strings& args = {}); void cmd_config_link (const common_options&, diff --git a/bdep/sync.cxx b/bdep/sync.cxx index 6f9670a..5c1c500 100644 --- a/bdep/sync.cxx +++ b/bdep/sync.cxx @@ -658,6 +658,8 @@ namespace bdep dep_dir += "-"; dep_dir += dep_type; + strings cfg_args {"cc", "config.config.load=~" + dep_type}; + // Unless explicitly allowed via the respective create_*_config // argument, prompt the user before performing any action. But fail if // stderr is redirected. @@ -691,7 +693,8 @@ namespace bdep dep_dir, dep_type, dep_type, - false, true, true); // See below. + false, true, true, // See below. + cfg_args); for (size_t i (1); i != dpt_prjs.size (); ++i) { @@ -738,6 +741,12 @@ namespace bdep // auto_rmdir rmd (dep_dir); + // Add to the command line the configuration variable which we omit + // from printing to make the prompt less hairy. + // + cfg_args.push_back ( + "config.config.persist+='config.*'@unused=drop"); + // Before we used to create the default configuration but that lead // to counter-intuitive behavior (like trying to run tests in a host // configuration that doesn't have any bdep-init'ed packages). After @@ -754,7 +763,10 @@ namespace bdep dep_type, false /* default */, true /* forward */, - true /* auto_sync */); + true /* auto_sync */, + false /* existing */, + false /* wipe */, + cfg_args); cmd_config_link (co, dpt_cfg, dep_cfg); |