aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bdep/build.txx2
-rw-r--r--bdep/sync.cxx23
2 files changed, 20 insertions, 5 deletions
diff --git a/bdep/build.txx b/bdep/build.txx
index cdf7237..a9b237c 100644
--- a/bdep/build.txx
+++ b/bdep/build.txx
@@ -32,7 +32,7 @@ namespace bdep
if (strchr (a , '=') == nullptr)
fail << "'" << a << "' does not look like a variable assignment";
- cfg_vars.push_back (a);
+ cfg_vars.push_back (trim (a));
}
// The same ignore/load story as in sync.
diff --git a/bdep/sync.cxx b/bdep/sync.cxx
index f419892..113cb04 100644
--- a/bdep/sync.cxx
+++ b/bdep/sync.cxx
@@ -4,7 +4,7 @@
#include <bdep/sync.hxx>
#include <list>
-#include <cstring> // strchr(), strcmp()
+#include <cstring> // strchr(), strcmp(), strspn()
#include <libbpkg/manifest.hxx>
@@ -987,6 +987,13 @@ namespace bdep
bool multi_cfg (cfgs.size () != 1);
+ // Position the pointer to the first non-whitespace character.
+ //
+ auto ltrim = [] (const char*& s)
+ {
+ s += strspn (s, " \t");
+ };
+
// Start by adding configuration variables from pkg_args, if any.
//
// If we have dep_pkgs (third form), then non-global configuration
@@ -1025,6 +1032,8 @@ namespace bdep
continue;
}
+ ltrim (a);
+
if (*a != '!')
{
if (!dep_pkgs.empty ())
@@ -1046,7 +1055,7 @@ namespace bdep
continue;
}
- args.push_back (a);
+ args.push_back (trim (a));
// Note: we let diagnostics for unhandled groups cover groups for
// configuration variables.
@@ -1139,6 +1148,8 @@ namespace bdep
continue;
}
+ ltrim (a);
+
if (*a == '!')
++a;
@@ -1199,8 +1210,10 @@ namespace bdep
const char* a (s.next ());
if (strchr (a, '=') != nullptr)
{
+ ltrim (a);
+
if (*a != '!')
- args.push_back (a);
+ args.push_back (trim (a));
}
else
s.skip_group ();
@@ -1293,8 +1306,10 @@ namespace bdep
const char* a (s.next ());
if (strchr (a, '=') != nullptr)
{
+ ltrim (a);
+
if (*a != '!')
- args.push_back (a);
+ args.push_back (trim (a));
}
else
s.skip_group ();