diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2022-05-19 11:24:29 +0200 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2022-06-07 21:14:14 +0300 |
commit | 5754ef6aca5ccab95476a159a1da7b41effdd03d (patch) | |
tree | 3275a402ba011ccc2cad8c2e1903e728c4ad2afc /bpkg/pkg-configure.cxx | |
parent | 5350c443ad722b273d287e3523c3e06fded642b7 (diff) |
Drag configuration sources into package skeleton
Diffstat (limited to 'bpkg/pkg-configure.cxx')
-rw-r--r-- | bpkg/pkg-configure.cxx | 39 |
1 files changed, 16 insertions, 23 deletions
diff --git a/bpkg/pkg-configure.cxx b/bpkg/pkg-configure.cxx index ee123d5..49570c2 100644 --- a/bpkg/pkg-configure.cxx +++ b/bpkg/pkg-configure.cxx @@ -36,7 +36,7 @@ namespace bpkg // package skeleton, excluding those user-specified variables which are // not the project variables for the specified package (module // configuration variables, etc). Thus, it is not parallel to the - // variables member. + // config_variables member. // vector<config_variable> config_sources; // Note: name and source. }; @@ -54,9 +54,8 @@ namespace bpkg bool simulate, const function<find_database_function>& fdb) { - package_prerequisites prereqs; - strings vars; - vector<config_variable> srcs; + package_prerequisites prereqs; + strings vars; // Alternatives argument must be parallel to the dependencies argument if // specified. @@ -286,34 +285,28 @@ namespace bpkg } } - // Add the configuration variables collected from the reflect clauses, if - // any. + // Add the rest of the configuration variables (user overrides, reflects, + // etc) as well as their sources. // + vector<config_variable> srcs; + if (!simulate) { - auto rvs (move (ps).collect_config ()); + pair<strings, vector<config_variable>> rvs (move (ps).collect_config ()); - strings& vs (rvs.first); - vector<optional<config_source>>& ss (rvs.second); + strings& vs (rvs.first); + srcs = move (rvs.second); if (!vs.empty ()) { - vars.reserve (vars.size () + vs.size ()); - - for (size_t i (0); i != vs.size (); ++i) + if (vars.empty ()) + vars = move (vs); + else { - string& v (vs[i]); - const optional<config_source>& s (ss[i]); - - if (s) - { - size_t p (v.find_first_of ("=+ \t")); - assert (p != string::npos); - - srcs.push_back (config_variable {string (v, 0, p), *s}); - } + vars.reserve (vars.size () + vs.size ()); - vars.push_back (move (v)); + for (string& v: vs) + vars.push_back (move (v)); } } } |