moved more global stuff to conf_global

This commit is contained in:
isanae
2020-12-03 17:45:31 -05:00
parent fb9cca0d1a
commit 26b6e2aa78
6 changed files with 23 additions and 21 deletions
+1 -1
View File
@@ -1139,7 +1139,7 @@ void init_options(
set_special_options();
auto log_file = conf::log_file();
auto log_file = conf().global().log_file();
if (log_file.is_relative())
log_file = conf().paths().prefix() / log_file;
+10 -9
View File
@@ -37,15 +37,6 @@ public:
static std::string version_by_name(std::string_view name);
static fs::path tool_by_name(std::string_view name);
static fs::path log_file() { return global_by_name("log_file"); }
static bool redownload() { return bool_global_by_name("redownload"); }
static bool reextract() { return bool_global_by_name("reextract"); }
static bool reconfigure() { return bool_global_by_name("reconfigure"); }
static bool rebuild() { return bool_global_by_name("rebuild"); }
static bool clean() { return bool_global_by_name("clean_task"); }
static bool fetch() { return bool_global_by_name("fetch_task"); }
static bool build() { return bool_global_by_name("build_task"); }
static bool ignore_uncommitted()
{
return bool_global_by_name("ignore_uncommitted");
@@ -170,6 +161,16 @@ public:
bool dry() const;
void set_dry(std::string_view s);
fs::path log_file() const { return get("log_file"); }
bool redownload() const { return get<bool>("redownload"); }
bool reextract() const { return get<bool>("reextract"); }
bool reconfigure() const { return get<bool>("reconfigure"); }
bool rebuild() const { return get<bool>("rebuild"); }
bool clean() const { return get<bool>("clean_task"); }
bool fetch() const { return get<bool>("fetch_task"); }
bool build() const { return get<bool>("build_task"); }
};
class conf_transifex : public conf_section
+2 -2
View File
@@ -107,7 +107,7 @@ void sip::download()
{
if (fs::exists(download_file()))
{
if (conf::redownload())
if (conf().global().redownload())
{
cx().trace(context::redownload, "deleting {}", download_file());
op::delete_file(cx(), download_file(), op::optional);
@@ -132,7 +132,7 @@ void sip::generate()
if (fs::exists(header))
{
if (conf::rebuild())
if (conf().global().rebuild())
{
cx().trace(context::rebuild, "ignoring {}", header);
}
+8 -7
View File
@@ -554,7 +554,7 @@ void task::join()
void task::clean_task()
{
if (!conf::clean())
if (!conf().global().clean())
return;
if (!enabled())
@@ -588,7 +588,7 @@ void task::fetch()
clean_task();
check_interrupted();
if (conf::fetch())
if (conf().global().fetch())
{
cx().info(context::generic, "fetching");
do_fetch();
@@ -612,7 +612,7 @@ void task::fetch()
void task::build_and_install()
{
if (!conf::build())
if (!conf().global().build())
return;
if (!enabled())
@@ -639,17 +639,18 @@ void task::build_and_install()
task::clean task::make_clean_flags() const
{
clean c = clean::nothing;
const auto g = conf().global();
if (conf::redownload())
if (g.redownload())
c |= clean::redownload;
if (conf::reextract())
if (g.reextract())
c |= clean::reextract;
if (conf::reconfigure())
if (g.reconfigure())
c |= clean::reconfigure;
if (conf::rebuild())
if (g.rebuild())
c |= clean::rebuild;
return c;
+1 -1
View File
@@ -38,7 +38,7 @@ void extractor::do_run()
}
else if (fs::exists(where_))
{
if (conf::reextract())
if (conf().global().reextract())
{
cx().debug(context::reextract, "deleting {}", where_);
op::delete_directory(cx(), where_, op::optional);
+1 -1
View File
@@ -99,7 +99,7 @@ bool bypass_file::exists() const
{
if (fs::exists(file_))
{
if (conf::rebuild())
if (conf().global().rebuild())
{
cx_.trace(context::rebuild,
"bypass file {} exists, deleting", file_);