aboutsummaryrefslogtreecommitdiff
path: root/bbot/worker/worker.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'bbot/worker/worker.cxx')
-rw-r--r--bbot/worker/worker.cxx52
1 files changed, 41 insertions, 11 deletions
diff --git a/bbot/worker/worker.cxx b/bbot/worker/worker.cxx
index d8f2ae4..6c96b5b 100644
--- a/bbot/worker/worker.cxx
+++ b/bbot/worker/worker.cxx
@@ -1117,12 +1117,14 @@ build (size_t argc, const char* argv[])
// separated list of the following potentially quoted bpkg-pkg-build
// command arguments:
//
- // <config-var>... ({ <config-var>... }+ ?[sys:]<pkg-name>[<version-spec>])...
+ // <option>... <config-var>... ({ <config-var>... }+ (?[sys:]|sys:)<pkg-name>[<version-spec>])...
//
- // If the package configuration is specified, then parse it into the main
- // package-specific configuration variables list and the dependency
- // packages list, potentially with their own configuration variables.
+ // If the package configuration is specified, then parse it into the
+ // options list, the main package-specific configuration variables list,
+ // and the dependency packages list, potentially with their own
+ // configuration variables (but not options).
//
+ strings pkg_config_opts;
strings pkg_config_vars;
vector<pair<string, strings>> pkg_config_deps;
@@ -1153,6 +1155,20 @@ build (size_t argc, const char* argv[])
while (args.more ())
{
+ // Return true if the argument is an option.
+ //
+ // Note that options with values can only be specified using
+ // the single argument notation.
+ //
+ auto opt = [] (const string& a)
+ {
+ // Make sure that -- or - is always followed by some characters.
+ //
+ return a.compare (0, 2, "--") == 0 ? a.size () > 2 :
+ a[0] == '-' ? a.size () > 1 :
+ false ;
+ };
+
// Return true if the argument is a configuration variable.
//
auto var = [] (const string& a)
@@ -1165,15 +1181,27 @@ build (size_t argc, const char* argv[])
};
string a (args.next ());
+ bool o (opt (a));
bool v (var (a));
- // Fail if this is not a configuration variable nor a dependency.
+ // Fail if this is not an option, configuration variable, nor
+ // dependency.
//
- if (v || a[0] == '?')
+ // Note that we always allow a system package regardless whether it
+ // is a dependency or not.
+ //
+ if (o || v || a[0] == '?' || a.compare (0, 4, "sys:") == 0)
{
cli::scanner& ag (args.group ());
- if (v) // Configuration variable.
+ if (o) // Option.
+ {
+ if (ag.more ())
+ fail ("unexpected options group for option '" + a + '\'');
+
+ pkg_config_opts.push_back (move (a));
+ }
+ else if (v) // Configuration variable.
{
if (ag.more ())
fail ("unexpected options group for configuration variable '" +
@@ -1181,7 +1209,7 @@ build (size_t argc, const char* argv[])
pkg_config_vars.push_back (move (a));
}
- else // Dependency.
+ else // Dependency.
{
strings vars;
while (ag.more ())
@@ -1198,7 +1226,8 @@ build (size_t argc, const char* argv[])
}
}
else
- fail ("not a configuration variable nor dependency: '" + a + '\'');
+ fail ("not an option, configuration variable, nor dependency: '" +
+ a + '\'');
}
}
catch (const string_parser::invalid_string& e)
@@ -2063,7 +2092,7 @@ build (size_t argc, const char* argv[])
{
// The overall command looks like this (but some parts may be omitted):
//
- // bpkg build --configure-only <env-config-args> <tgt-config-args> --
+ // bpkg build --configure-only <pkg-config-opts> <env-config-args> <tgt-config-args> --
// { <pkg-config-vars>|config.<pkg-name>.develop=false }+ <pkg>
// { config.<runtime-test-name>.develop=false }+ <runtime-test>...
// { <dep-config-vars> }+ <dep>...
@@ -2141,7 +2170,7 @@ build (size_t argc, const char* argv[])
{
// The overall command looks like this (but some parts may be omitted):
//
- // bpkg build --configure-only <env-config-args> <tgt-config-args> --
+ // bpkg build --configure-only <pkg-config-opts> <env-config-args> <tgt-config-args> --
// { <build-config> <env-config-args> <tgt-config-args> <pkg-config-vars>|config.<pkg-name>.develop=false }+ <pkg>
// { <build-config> <env-config-args> <tgt-config-args> config.<runtime-test-name>.develop=false }+ <runtime-test>...
// { <install-config> <env-config-args> <tgt-config-args> <pkg-config-vars> }+ <pkg>
@@ -2452,6 +2481,7 @@ build (size_t argc, const char* argv[])
"-v",
"build",
"--configure-only",
+ pkg_config_opts,
"--rebuild-checksum",
tm.dependency_checksum ? *tm.dependency_checksum : "",
"--yes",