aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bbot/worker/worker.cxx52
-rw-r--r--doc/manual.cli39
-rw-r--r--tests/integration/testscript9
3 files changed, 68 insertions, 32 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",
diff --git a/doc/manual.cli b/doc/manual.cli
index 59b20c7..4e5a3c0 100644
--- a/doc/manual.cli
+++ b/doc/manual.cli
@@ -174,13 +174,14 @@ configuration, this information is best conveyed as part of \c{<target>} as
described in \l{#arch-controller Controller Logic}.
A package can be built in multiple package configurations per target
-configuration. A build package configuration normally specifies the package
-configuration variables that need to be used for the build. It may also
-include the information regarding the dependency packages which need to
-additionally be configured. The build package configurations originate from
-the package manifest \c{*-build-config}, \c{*-builds}, \c{*-build-include},
-and \c{*-build-exclude} values. See \l{bpkg#manifest-package Package Manifest}
-for more information on these values.
+configuration. A build package configuration normally specifies the options
+and/or the package configuration variables that need to be used for the
+build. It may also include the information regarding the dependency packages
+which need to additionally be configured. The build package configurations
+originate from the package manifest \c{*-build-config}, \c{*-builds},
+\c{*-build-include}, and \c{*-build-exclude} values. See
+\l{bpkg#manifest-package Package Manifest} for more information on these
+values.
\h#arch-machine-header|Machine Header Manifest|
@@ -966,7 +967,7 @@ breakpoint and normally as a prefix in the \c{<tgt-config-args>},
\l{#arch-controller Controller Logic}. The \c{<>}-values are from the task
manifest and the environment though some are assigned by the worker during the
script execution (configuration directories, UUIDs, etc). In particular, the
-\c{<pkg-config-vars>}, \c{<dependency-name>},
+\c{<pkg-config-opts>}, \c{<pkg-config-vars>}, \c{<dependency-name>},
\c{<dependency-version-constraint>}, and \c{<dep-config-vars>} values result
from parsing the \l{#arch-task-package-config \c{package-config}} task
manifest value.
@@ -1021,11 +1022,13 @@ bpkg -v fetch --trust <repository-fp>
# bpkg.global.configure.build,
# (bpkg.target.configure.build : b.configure, bpkg.configure.build))
#
-bpkg -v build --configure-only <env-config-args> <tgt-config-args> \\
+bpkg -v build --configure-only \\
+ [<pkg-config-opts>] <env-config-args> <tgt-config-args> \\
[{ <pkg-config-vars> }+] <package-name>/<package-version> \\
[<test-package-name>[ <test-version-constraint>]...] \\
[([{ <dep-config-vars> }+] \\
- ?[sys:]<dependency-name>[ <dependency-version-constraint>])...]
+ (?[sys:]|sys:)<dependency-name> \\
+ [<dependency-version-constraint>])...]
# bpkg.update
#
@@ -1107,7 +1110,7 @@ bpkg -v update <package-name>
#
bpkg -v build --configure-only <env-config-args> <tgt-config-args> \\
<test-package-name>[ <test-version-constraint>]... \\
- ?sys:<package-name>
+ ?sys:<package-name>/<package-version>
# For each (runtime) tests, examples, or benchmarks package
# referred to by the task manifest:
@@ -1237,7 +1240,8 @@ bpkg -v fetch -d <host-conf> --trust <repository-fp>
# - All parts have the same fallback step ids: b.configure and
# bpkg.configure.build.
#
-bpkg -v build --configure-only <env-config-args> <tgt-config-args> \\
+bpkg -v build --configure-only \\
+[<pkg-config-opts>] <env-config-args> <tgt-config-args> \\
\\
{ --config-uuid <host-uuid> \\
<env-config-args> <tgt-config-args> [<pkg-config-vars>] }+ \\
@@ -1255,7 +1259,7 @@ bpkg -v build --configure-only <env-config-args> <tgt-config-args> \\
\\
({ --config-uuid <host-uuid> [--config-uuid <install-uuid>] \\
[<dep-config-vars>] }+ \\
- ?[sys:]<dependency-name>[ <dependency-version-constraint>])...
+ (?[sys:]|sys:)<dependency-name>[ <dependency-version-constraint>])...
# bpkg.update
#
@@ -1398,7 +1402,7 @@ bpkg -v update -d <host-conf> <package-name>
{ --config-name <target-conf> }+ \\
<buildtime-test-package-name>[ <test-version-constraint>]... \\
\\
- ?sys:<package-name>
+ ?sys:<package-name>/<package-version>
# For each tests, examples, or benchmarks package referred
# to by the task manifest:
@@ -1517,7 +1521,8 @@ bpkg -v fetch -d <module-conf> --trust <repository-fp>
# - All parts have the same fallback step ids: b.configure and
# bpkg.configure.build.
#
-bpkg -v build --configure-only <env-config-args> <tgt-config-args> \\
+bpkg -v build --configure-only \\
+[<pkg-config-opts>] <env-config-args> <tgt-config-args> \\
\\
{ --config-uuid <module-uuid> \\
<env-config-args> <tgt-config-args> [<pkg-config-vars>] }+ \\
@@ -1532,7 +1537,7 @@ bpkg -v build --configure-only <env-config-args> <tgt-config-args> \\
\\
({ --config-uuid <host-uuid> [--config-uuid <install-uuid>] \\
[<dep-config-vars>] }+ \\
- ?[sys:]<dependency-name>[ <dependency-version-constraint>])...
+ (?[sys:]|sys:)<dependency-name>[ <dependency-version-constraint>])...
# bpkg.update
#
@@ -1615,7 +1620,7 @@ bpkg -v update -d <module-conf> <package-name>
{ --config-name <target-conf> }+ \\
<buildtime-test-package-name>[ <test-version-constraint>]... \\
\\
- ?sys:<package-name>
+ ?sys:<package-name>/<package-version>
# For each (build-time) tests, examples, or benchmarks package
# referred to by the task manifest:
diff --git a/tests/integration/testscript b/tests/integration/testscript
index e518e45..31cf54c 100644
--- a/tests/integration/testscript
+++ b/tests/integration/testscript
@@ -60,6 +60,7 @@ rep_type = pkg
rfp = yes
#host='host: true'
#dependency_checksum = 'dependency-checksum: e6f10587696020674c260669f4e7000a0139df72467bff9770aea2f2b8b57ba0'
+#package_config = 'package-config: sys:libuuid-c++ --sys-install --sys-no-stub --sys-yes'
#\
pkg = hello
@@ -133,7 +134,7 @@ rfp = yes
#\
pkg = bpkg
-ver = 0.16.0-a.0.20221118054047.a6c6065d5c2a
+ver = 0.16.0-a.0.20230201123204.d956e69e8b55
rep_url = https://stage.build2.org/1
rep_type = pkg
rfp = yes
@@ -142,7 +143,7 @@ package_config = 'package-config:
config.bpkg.tests.remote=true
?libodb-sqlite +{ config.libodb_sqlite.develop=true }
?cli +{ config.cli.develop=true }
-?sys:libsqlite3
+?sys:libsqlite3 --sys-install
\'
#\
@@ -188,7 +189,7 @@ package_config = 'package-config:
\
?libxerces-c +{ config.libxerces_c.network=true }
?libcurl/7.76.0
-?sys:libz
+?sys:libz/*
\'
#dependency_checksum = 'dependency-checksum: 40a0ad4546d836a3afc83a9e7da22f2b5d224af4e62996d88f7103eaee23e9e1'
#\
@@ -203,7 +204,7 @@ package_config = 'package-config:
\
config.libxerces_c.network=true
"?libcurl ~7.76.0"
-?sys:libz
+sys:libz/*
\'
#\