aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bbot/worker/worker.cxx139
-rw-r--r--tests/integration/testscript7
2 files changed, 87 insertions, 59 deletions
diff --git a/bbot/worker/worker.cxx b/bbot/worker/worker.cxx
index d7222b4..b759760 100644
--- a/bbot/worker/worker.cxx
+++ b/bbot/worker/worker.cxx
@@ -1810,12 +1810,15 @@ build (size_t argc, const char* argv[])
// Return command arguments for the specified step id, complementing
// *.create[_for_*] steps with un-prefixed arguments. If no arguments are
// specified for the step then use the specified fallbacks, potentially
- // both. Arguments with more specific prefixes come last.
+ // both. Arguments with more specific prefixes come last. Optionally,
+ // search for arguments starting from the specified step id rather than
+ // from the least specific one (tool id).
//
auto step_args = [] (const multimap<string, string>& args,
step_id step,
optional<step_id> fallback1 = nullopt,
- optional<step_id> fallback2 = nullopt) -> cstrings
+ optional<step_id> fallback2 = nullopt,
+ optional<step_id> start_step = nullopt) -> cstrings
{
cstrings r;
@@ -1851,11 +1854,27 @@ build (size_t argc, const char* argv[])
default: break;
}
- auto add_step_args = [&add_args] (step_id step)
+ auto add_step_args = [&add_args] (step_id step,
+ optional<step_id> start_step = nullopt)
{
const string& s (to_string (step));
- for (size_t n (0);; ++n)
+ size_t n;
+
+ if (start_step)
+ {
+ const string& ss (to_string (*start_step));
+
+ assert (s.size () >= ss.size () &&
+ s.compare (0, ss.size (), ss) == 0 &&
+ (s.size () == ss.size () || s[ss.size ()] == '.'));
+
+ n = ss.size ();
+ }
+ else
+ n = 0;
+
+ for (;; ++n)
{
n = s.find ('.', n);
@@ -1871,7 +1890,7 @@ build (size_t argc, const char* argv[])
//
if (args.find (to_string (step)) != args.end ())
{
- add_step_args (step);
+ add_step_args (step, start_step);
}
else
{
@@ -3809,16 +3828,17 @@ build (size_t argc, const char* argv[])
{
// sudo ldconfig <env-config-args> <tgt-config-args> <pkg-config-args>
//
- step_id b (step_id::bbot_install_ldconfig);
- step_id s (step_id::bbot_install_ldconfig);
+ step_id b (step_id::bbot_install_ldconfig);
+ step_id s (step_id::bbot_install_ldconfig);
+ step_id ss (step_id::bbot_install_ldconfig);
r.status |= run_ldconfig (
b,
trace, r.log, wre,
bkp_step, bkp_status, last_cmd,
- step_args (env_args, s),
- step_args (tgt_args, s),
- step_args (pkg_args, s));
+ step_args (env_args, s, nullopt, nullopt, ss),
+ step_args (tgt_args, s, nullopt, nullopt, ss),
+ step_args (pkg_args, s, nullopt, nullopt, ss));
if (!r.status)
break;
@@ -4262,8 +4282,9 @@ build (size_t argc, const char* argv[])
// <tgt-config-args>
// <pkg-config-args>
//
- step_id b (step_id::bbot_sys_install_apt_get_update);
- step_id s (step_id::bbot_sys_install_apt_get_update);
+ step_id b (step_id::bbot_sys_install_apt_get_update);
+ step_id s (step_id::bbot_sys_install_apt_get_update);
+ step_id ss (step_id::bbot_sys_install_apt_get_update);
r.status |= run_apt_get (
b,
@@ -4271,9 +4292,9 @@ build (size_t argc, const char* argv[])
bkp_step, bkp_status, last_cmd,
"update",
"--assume-yes",
- step_args (env_args, s),
- step_args (tgt_args, s),
- step_args (pkg_args, s));
+ step_args (env_args, s, nullopt, nullopt, ss),
+ step_args (tgt_args, s, nullopt, nullopt, ss),
+ step_args (pkg_args, s, nullopt, nullopt, ss));
if (!r.status)
break;
@@ -4291,8 +4312,9 @@ build (size_t argc, const char* argv[])
// argument to be treated as a file rather than name. The paths we
// pass are absolute.
//
- step_id b (step_id::bbot_sys_install_apt_get_install);
- step_id s (step_id::bbot_sys_install_apt_get_install);
+ step_id b (step_id::bbot_sys_install_apt_get_install);
+ step_id s (step_id::bbot_sys_install_apt_get_install);
+ step_id ss (step_id::bbot_sys_install_apt_get_install);
r.status |= run_apt_get (
b,
@@ -4300,9 +4322,9 @@ build (size_t argc, const char* argv[])
bkp_step, bkp_status, last_cmd,
"install",
"--assume-yes",
- step_args (env_args, s),
- step_args (tgt_args, s),
- step_args (pkg_args, s),
+ step_args (env_args, s, nullopt, nullopt, ss),
+ step_args (tgt_args, s, nullopt, nullopt, ss),
+ step_args (pkg_args, s, nullopt, nullopt, ss),
pfs);
if (!r.status)
@@ -4330,8 +4352,9 @@ build (size_t argc, const char* argv[])
// <pkg-config-args>
// <distribution-package-file>...
//
- step_id b (step_id::bbot_sys_install_dnf_install);
- step_id s (step_id::bbot_sys_install_dnf_install);
+ step_id b (step_id::bbot_sys_install_dnf_install);
+ step_id s (step_id::bbot_sys_install_dnf_install);
+ step_id ss (step_id::bbot_sys_install_dnf_install);
r.status |= run_dnf (
b,
@@ -4340,9 +4363,9 @@ build (size_t argc, const char* argv[])
"install",
"--refresh",
"--assumeyes",
- step_args (env_args, s),
- step_args (tgt_args, s),
- step_args (pkg_args, s),
+ step_args (env_args, s, nullopt, nullopt, ss),
+ step_args (tgt_args, s, nullopt, nullopt, ss),
+ step_args (pkg_args, s, nullopt, nullopt, ss),
pfs);
if (!r.status)
@@ -4401,8 +4424,9 @@ build (size_t argc, const char* argv[])
// <tgt-config-args>
// <pkg-config-args>
//
- step_id b (step_id::bbot_sys_install_tar_extract);
- step_id s (step_id::bbot_sys_install_tar_extract);
+ step_id b (step_id::bbot_sys_install_tar_extract);
+ step_id s (step_id::bbot_sys_install_tar_extract);
+ step_id ss (step_id::bbot_sys_install_tar_extract);
r.status |= run_tar (
b,
@@ -4411,9 +4435,9 @@ build (size_t argc, const char* argv[])
true /* sudo */,
"-xf",
f,
- step_args (env_args, s),
- step_args (tgt_args, s),
- step_args (pkg_args, s));
+ step_args (env_args, s, nullopt, nullopt, ss),
+ step_args (tgt_args, s, nullopt, nullopt, ss),
+ step_args (pkg_args, s, nullopt, nullopt, ss));
if (!r.status)
break;
@@ -4430,16 +4454,17 @@ build (size_t argc, const char* argv[])
// <tgt-config-args>
// <pkg-config-args>
//
- step_id b (step_id::bbot_sys_install_ldconfig);
- step_id s (step_id::bbot_sys_install_ldconfig);
+ step_id b (step_id::bbot_sys_install_ldconfig);
+ step_id s (step_id::bbot_sys_install_ldconfig);
+ step_id ss (step_id::bbot_sys_install_ldconfig);
r.status |= run_ldconfig (
b,
trace, r.log, wre,
bkp_step, bkp_status, last_cmd,
- step_args (env_args, s),
- step_args (tgt_args, s),
- step_args (pkg_args, s));
+ step_args (env_args, s, nullopt, nullopt, ss),
+ step_args (tgt_args, s, nullopt, nullopt, ss),
+ step_args (pkg_args, s, nullopt, nullopt, ss));
if (!r.status)
break;
@@ -5359,8 +5384,9 @@ build (size_t argc, const char* argv[])
// <pkg-config-args>
// <distribution-package-name>...
//
- step_id b (step_id::bbot_sys_uninstall_apt_get_remove);
- step_id s (step_id::bbot_sys_uninstall_apt_get_remove);
+ step_id b (step_id::bbot_sys_uninstall_apt_get_remove);
+ step_id s (step_id::bbot_sys_uninstall_apt_get_remove);
+ step_id ss (step_id::bbot_sys_uninstall_apt_get_remove);
r.status |= run_apt_get (
b,
@@ -5368,9 +5394,9 @@ build (size_t argc, const char* argv[])
bkp_step, bkp_status, last_cmd,
"remove",
"--assume-yes",
- step_args (env_args, s),
- step_args (tgt_args, s),
- step_args (pkg_args, s),
+ step_args (env_args, s, nullopt, nullopt, ss),
+ step_args (tgt_args, s, nullopt, nullopt, ss),
+ step_args (pkg_args, s, nullopt, nullopt, ss),
pns);
if (!r.status)
@@ -5397,8 +5423,9 @@ build (size_t argc, const char* argv[])
// <pkg-config-args>
// <distribution-package-name>...
//
- step_id b (step_id::bbot_sys_uninstall_dnf_remove);
- step_id s (step_id::bbot_sys_uninstall_dnf_remove);
+ step_id b (step_id::bbot_sys_uninstall_dnf_remove);
+ step_id s (step_id::bbot_sys_uninstall_dnf_remove);
+ step_id ss (step_id::bbot_sys_uninstall_dnf_remove);
r.status |= run_dnf (
b,
@@ -5406,9 +5433,9 @@ build (size_t argc, const char* argv[])
bkp_step, bkp_status, last_cmd,
"remove",
"--assumeyes",
- step_args (env_args, s),
- step_args (tgt_args, s),
- step_args (pkg_args, s),
+ step_args (env_args, s, nullopt, nullopt, ss),
+ step_args (tgt_args, s, nullopt, nullopt, ss),
+ step_args (pkg_args, s, nullopt, nullopt, ss),
pns);
if (!r.status)
@@ -5648,8 +5675,9 @@ build (size_t argc, const char* argv[])
// <pkg-config-args>
// upload/
//
- step_id b (step_id::bbot_upload_tar_create);
- step_id s (step_id::bbot_upload_tar_create);
+ step_id b (step_id::bbot_upload_tar_create);
+ step_id s (step_id::bbot_upload_tar_create);
+ step_id ss (step_id::bbot_upload_tar_create);
// Make sure the archive is portable.
//
@@ -5667,9 +5695,9 @@ build (size_t argc, const char* argv[])
#endif
"-cf",
upload_archive,
- step_args (env_args, s),
- step_args (tgt_args, s),
- step_args (pkg_args, s),
+ step_args (env_args, s, nullopt, nullopt, ss),
+ step_args (tgt_args, s, nullopt, nullopt, ss),
+ step_args (pkg_args, s, nullopt, nullopt, ss),
upload_dir);
if (!r.status)
@@ -5683,8 +5711,9 @@ build (size_t argc, const char* argv[])
// <tgt-config-args>
// <pkg-config-args>
//
- step_id b (step_id::bbot_upload_tar_list);
- step_id s (step_id::bbot_upload_tar_list);
+ step_id b (step_id::bbot_upload_tar_list);
+ step_id s (step_id::bbot_upload_tar_list);
+ step_id ss (step_id::bbot_upload_tar_list);
r.status |= run_tar (
b,
@@ -5693,9 +5722,9 @@ build (size_t argc, const char* argv[])
false /* sudo */,
"-tf",
upload_archive,
- step_args (env_args, s),
- step_args (tgt_args, s),
- step_args (pkg_args, s));
+ step_args (env_args, s, nullopt, nullopt, ss),
+ step_args (tgt_args, s, nullopt, nullopt, ss),
+ step_args (pkg_args, s, nullopt, nullopt, ss));
if (!r.status)
break;
diff --git a/tests/integration/testscript b/tests/integration/testscript
index 060029e..1e78dfe 100644
--- a/tests/integration/testscript
+++ b/tests/integration/testscript
@@ -104,16 +104,15 @@ bpkg.bindist.archive:config.install.relocatable=true
+bbot.bindist.upload:
-bbot.sys-install.tar.extract:--directory=$sys_install_dir
-bbot.sys-install.tar.extract:--strip-components=3
-
b.test-installed.configure:config.cc.loptions='-L$sys_install_dir/lib'
bpkg.test-separate-installed.create:config.cc.loptions='-L$sys_install_dir/lib'
bpkg.create:config.bin.rpath=[null]
\\"
config = "$config bpkg.create:config.install.root=\"'$~/usr/local'\" \
-bbot.sys-install:config.install.root=\"'$sys_install_dir'\""
+bbot.sys-install:config.install.root=\"'$sys_install_dir'\" \
+bbot.sys-install.tar.extract:--directory=\"$sys_install_dir\" \
+bbot.sys-install.tar.extract:--strip-components=3"
+export LD_LIBRARY_PATH="$sys_install_dir/lib:$getenv('LD_LIBRARY_PATH')"
#\
#\