aboutsummaryrefslogtreecommitdiff
path: root/bdep/sync.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-07-02 12:25:39 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2018-07-02 12:25:39 +0200
commit8663ecf31c51e5bf7fef194bb15aed0b038fb8fc (patch)
tree791085fd29e27484420cbfaa5100f5042d58535e /bdep/sync.cxx
parent93a673946ca1587126b3c108476234d93a7c5c7c (diff)
Add ability to suppress auto-synchronization via BDEP_SYNC envvar
If BDEP_SYNC is set, auto-synchronization will only be performed if its value is true or 1. So to suppress, run: $ BDEP_SYNC=0 b
Diffstat (limited to 'bdep/sync.cxx')
-rw-r--r--bdep/sync.cxx12
1 files changed, 10 insertions, 2 deletions
diff --git a/bdep/sync.cxx b/bdep/sync.cxx
index 8cfdc7a..1620555 100644
--- a/bdep/sync.cxx
+++ b/bdep/sync.cxx
@@ -436,14 +436,22 @@ namespace bdep
// if! $null($cfgs)
// cfgs = [dir_paths] $regex.split($cfgs, ' *"([^"]*)" *', '\1')
//
+ // Also note that we try to avoid setting any variables in order
+ // not to pollute the configuration's root scope.
+ //
os << "# Created automatically by bdep." << endl
<< "#" << endl
<< "if ($build.meta_operation != 'info' && \\" << endl
<< " $build.meta_operation != 'configure' && \\" << endl
<< " $build.meta_operation != 'disfigure')" << endl
- << " run '" << argv0 << "' sync --hook=1 " <<
+ << "{" << endl
+ << " if ($getenv('BDEP_SYNC') == [null] || \\" << endl
+ << " $getenv('BDEP_SYNC') == true || \\" << endl
+ << " $getenv('BDEP_SYNC') == 1)" << endl
+ << " run '" << argv0 << "' sync --hook=1 " <<
"--verbose $build.verbosity " <<
- "--config \"$out_root\"" << endl;
+ "--config \"$out_root\"" << endl
+ << "}" << endl;
os.close ();
}