From 3ce44330cca9dbc4314feebb27403ebc3175b6c2 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 28 Mar 2016 09:14:31 +0200 Subject: New variable architecture --- build2/install/module.cxx | 2 +- build2/install/rule.cxx | 29 ++++++++++++++++------------- 2 files changed, 17 insertions(+), 14 deletions(-) (limited to 'build2/install') diff --git a/build2/install/module.cxx b/build2/install/module.cxx index 579d454..8e3d6fd 100644 --- a/build2/install/module.cxx +++ b/build2/install/module.cxx @@ -154,7 +154,7 @@ namespace build2 if (first) { bool s (config::specified (r, "config.install")); - const string& n (as (*r["project"])); + const string& n (cast (*r["project"])); set_dir (s, r, "root", "", "", "755", "install"); set_dir (s, r, "data_root", "root", "644"); diff --git a/build2/install/rule.cxx b/build2/install/rule.cxx index 6933828..89463f8 100644 --- a/build2/install/rule.cxx +++ b/build2/install/rule.cxx @@ -31,7 +31,7 @@ namespace build2 if (!l) return nullptr; - const dir_path& r (as (*l)); + const dir_path& r (cast (*l)); return r.simple () && r.string () == "false" ? nullptr : &r; } @@ -64,7 +64,7 @@ namespace build2 // auto l (pt["install"]); - if (l && as (*l).string () == "false") + if (l && cast (*l).string () == "false") { l5 ([&]{trace << "ignoring " << pt;}); continue; @@ -148,7 +148,7 @@ namespace build2 // See if the user instructed us not to install it. // auto l ((*pt)["install"]); - if (l && as (*l).string () == "false") + if (l && cast (*l).string () == "false") continue; build2::match (a, *pt); @@ -216,10 +216,13 @@ namespace build2 struct install_dir { + // @@ Why do we copy these? Why not just point to the values in vars? + // + dir_path dir; string sudo; string cmd; //@@ VAR type - const_strings_value options {nullptr}; + strings options; string mode; string dir_mode; }; @@ -239,7 +242,7 @@ namespace build2 args.push_back (base.cmd.c_str ()); args.push_back ("-d"); - if (base.options.d != nullptr) //@@ VAR + if (!base.options.empty ()) append_options (args, base.options); args.push_back ("-m"); @@ -285,7 +288,7 @@ namespace build2 args.push_back (base.cmd.c_str ()); - if (base.options.d != nullptr) //@@ VAR + if (!base.options.empty ()) append_options (args, base.options); args.push_back ("-m"); @@ -355,11 +358,11 @@ namespace build2 // if (var != nullptr) { - if (auto l = s[*var + ".sudo"]) r.sudo = as (*l); - if (auto l = s[*var + ".cmd"]) r.cmd = as (*l); - if (auto l = s[*var + ".mode"]) r.mode = as (*l); - if (auto l = s[*var + ".dir_mode"]) r.dir_mode = as (*l); - if (auto l = s[*var + ".options"]) r.options = as (*l); + if (auto l = s[*var + ".sudo"]) r.sudo = cast (*l); + if (auto l = s[*var + ".cmd"]) r.cmd = cast (*l); + if (auto l = s[*var + ".mode"]) r.mode = cast (*l); + if (auto l = s[*var + ".dir_mode"]) r.dir_mode = cast (*l); + if (auto l = s[*var + ".options"]) r.options = cast (*l); } // Set defaults for unspecified components. @@ -400,12 +403,12 @@ namespace build2 // install_dir d ( resolve (t.base_scope (), - as (*t["install"]))); // We know it's there. + cast (*t["install"]))); // We know it's there. // Override mode if one was specified. // if (auto l = t["install.mode"]) - d.mode = as (*l); + d.mode = cast (*l); install (d, ft); return (r |= target_state::changed); -- cgit v1.1