aboutsummaryrefslogtreecommitdiff
path: root/bpkg
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2019-11-01 11:39:31 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2019-11-01 11:39:31 +0300
commitaf498a19d6c9c42748521225b7daae671a5f58b5 (patch)
tree42715f88e9d50bfb58c06d56ff8cb86144d75704 /bpkg
parent11bfc20a0b6c5c90d6e2efab5b871bf3c76f733f (diff)
Fix assertion failure in pkg-build for --verbose 4
Diffstat (limited to 'bpkg')
-rw-r--r--bpkg/pkg-build.cxx30
1 files changed, 22 insertions, 8 deletions
diff --git a/bpkg/pkg-build.cxx b/bpkg/pkg-build.cxx
index fa788e2..7a2168c 100644
--- a/bpkg/pkg-build.cxx
+++ b/bpkg/pkg-build.cxx
@@ -2826,15 +2826,26 @@ namespace bpkg
auto arg_string = [&arg_parsed, &arg_sys] (const pkg_arg& a,
bool options = true) -> string
{
- assert (arg_parsed (a));
-
string r (options && a.options.dependency () ? "?" : string ());
- r += package_string (a.name,
- (a.constraint && !wildcard (*a.constraint)
- ? a.constraint
- : nullopt),
- arg_sys (a));
+ // Quote an argument if empty or contains spaces.
+ //
+ auto append = [&r] (const string& a)
+ {
+ if (a.empty () || a.find (' ') != string::npos)
+ r += '"' + a + '"';
+ else
+ r += a;
+ };
+
+ if (arg_parsed (a))
+ r += package_string (a.name,
+ (a.constraint && !wildcard (*a.constraint)
+ ? a.constraint
+ : nullopt),
+ arg_sys (a));
+ else
+ append (a.value);
if (options)
{
@@ -2848,7 +2859,10 @@ namespace bpkg
r += s + ' ';
for (const string& v: a.config_vars)
- r += v + ' ';
+ {
+ append (v);
+ r += ' ';
+ }
r += '}';
}