diff options
-rw-r--r-- | libbuild2/config/init.cxx | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/libbuild2/config/init.cxx b/libbuild2/config/init.cxx index 87b492c..e92db4c 100644 --- a/libbuild2/config/init.cxx +++ b/libbuild2/config/init.cxx @@ -247,6 +247,18 @@ namespace build2 auto& c_v (vp.insert<uint64_t> ("config.version", false /*ovr*/, v_p)); auto& c_l (vp.insert<paths> ("config.config.load", true /* ovr */)); + // Configuration variables to disfigure. + // + // The exact semantics is to ignore these variables when loading + // config.build (and any files specified in config.config.load), letting + // them to take on the default values (more precisely, the current + // implementation undefined them after loading config.build). + // + // Note that this variable is not saved in config.build and is expected + // to always be specified as a command line override. + // + auto& c_d (vp.insert<strings> ("config.config.disfigure", true /*ovr*/)); + // Hermetic configurations. // // A hermetic configuration stores environment variables that affect the @@ -424,6 +436,21 @@ namespace build2 } } + // Undefine variables specified with config.config.disfigure. + // + if (const strings* vs = cast_null<strings> (rs[c_d])) + { + for (const string& v: *vs) + { + // An unknown variable can't possibly be defined. + // + if (const variable* var = vp.find (v)) + { + rs.vars.erase (*var); // Undefine. + } + } + } + // Save and cache the config.config.persist value, if any. // if (m != nullptr) |