aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2016-09-17 00:39:40 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2016-09-17 23:49:15 +0300
commit145adc9d4bc338657ce6f609dcac67682eb329e3 (patch)
tree3e87bcb76f693a0aa2284a4916a54519be6ae1a4
parentaaf0d51b8ba50f2614313bf098ee6695235db676 (diff)
Audit all print_process()/process ctor for path_search()
-rw-r--r--build2/cli/rule.cxx7
-rw-r--r--build2/dist/init.cxx6
-rw-r--r--build2/dist/operation.cxx32
-rw-r--r--build2/install/rule.cxx66
-rw-r--r--build2/test/rule.cxx9
-rw-r--r--build2/utility.cxx2
6 files changed, 70 insertions, 52 deletions
diff --git a/build2/cli/rule.cxx b/build2/cli/rule.cxx
index 26c17cd..cec8a60 100644
--- a/build2/cli/rule.cxx
+++ b/build2/cli/rule.cxx
@@ -245,9 +245,10 @@ namespace build2
path rels (relative (s->path ()));
scope& rs (t.root_scope ());
- const path& cli (cast<path> (rs["config.cli"]));
- cstrings args {cli.string ().c_str ()};
+ const process_path& cli (cast<process_path> (rs["cli.path"]));
+
+ cstrings args {cli.recall_string ()};
// See if we need to pass --output-{prefix,suffix}
//
@@ -291,7 +292,7 @@ namespace build2
try
{
- process pr (args.data ());
+ process pr (cli, args.data ());
if (!pr.wait ())
throw failed ();
diff --git a/build2/dist/init.cxx b/build2/dist/init.cxx
index 428ca5c..923c18f 100644
--- a/build2/dist/init.cxx
+++ b/build2/dist/init.cxx
@@ -51,7 +51,7 @@ namespace build2
v.insert<path> ("config.dist.cmd", true);
v.insert<dir_path> ("dist.root");
- v.insert<path> ("dist.cmd");
+ v.insert<process_path> ("dist.cmd");
v.insert<paths> ("dist.archives");
v.insert<bool> ("dist", variable_visibility::target); // Flag.
@@ -120,14 +120,14 @@ namespace build2
// dist.cmd
//
{
- value& v (r.assign ("dist.cmd"));
+ value& v (r.assign<process_path> ("dist.cmd"));
if (s)
{
if (const value& cv = config::required (r,
"config.dist.cmd",
path ("install")).first)
- v = cv;
+ v = run_search (cast<path> (cv), true);
}
}
diff --git a/build2/dist/operation.cxx b/build2/dist/operation.cxx
index b5ca906..e2d283c 100644
--- a/build2/dist/operation.cxx
+++ b/build2/dist/operation.cxx
@@ -38,12 +38,12 @@ namespace build2
// install -d <dir>
//
static void
- install (const path& cmd, const dir_path&);
+ install (const process_path& cmd, const dir_path&);
// install <file> <dir>
//
static void
- install (const path& cmd, file&, const dir_path&);
+ install (const process_path& cmd, file&, const dir_path&);
// cd <root> && tar|zip ... <dir>/<pkg>.<ext> <pkg>
//
@@ -95,7 +95,7 @@ namespace build2
info << "did you forget to set dist.package?";
const string& dist_package (cast<string> (l));
- const path& dist_cmd (cast<path> (rs->vars["dist.cmd"]));
+ const process_path& dist_cmd (cast<process_path> (rs->vars["dist.cmd"]));
// Get the list of operations supported by this project. Skip
// default_id.
@@ -314,11 +314,11 @@ namespace build2
// install -d <dir>
//
static void
- install (const path& cmd, const dir_path& d)
+ install (const process_path& cmd, const dir_path& d)
{
path reld (relative (d));
- cstrings args {cmd.string ().c_str (), "-d"};
+ cstrings args {cmd.recall_string (), "-d"};
args.push_back ("-m");
args.push_back ("755");
@@ -332,7 +332,7 @@ namespace build2
try
{
- process pr (args.data ());
+ process pr (cmd, args.data ());
if (!pr.wait ())
throw failed ();
@@ -351,12 +351,12 @@ namespace build2
// install <file> <dir>
//
static void
- install (const path& cmd, file& t, const dir_path& d)
+ install (const process_path& cmd, file& t, const dir_path& d)
{
dir_path reld (relative (d));
path relf (relative (t.path ()));
- cstrings args {cmd.string ().c_str ()};
+ cstrings args {cmd.recall_string ()};
// Preserve timestamps. This could becomes important if, for
// example, we have pre-generated sources. Note that the
@@ -386,7 +386,7 @@ namespace build2
try
{
- process pr (args.data ());
+ process pr (cmd, args.data ());
if (!pr.wait ())
throw failed ();
@@ -427,16 +427,18 @@ namespace build2
args = {"tar", "-a", "-cf",
ap.string ().c_str (), pkg.c_str (), nullptr};
- if (verb >= 2)
- print_process (args);
- else if (verb)
- text << args[0] << " " << ap;
-
try
{
+ process_path pp (process::path_search (args[0]));
+
+ if (verb >= 2)
+ print_process (args);
+ else if (verb)
+ text << args[0] << " " << ap;
+
// Change child's working directory to dist_root.
//
- process pr (root.string ().c_str (), args.data ());
+ process pr (root.string ().c_str (), pp, args.data ());
if (!pr.wait ())
throw failed ();
diff --git a/build2/install/rule.cxx b/build2/install/rule.cxx
index 038b53c..fd88699 100644
--- a/build2/install/rule.cxx
+++ b/build2/install/rule.cxx
@@ -437,14 +437,16 @@ namespace build2
args.push_back (reld.string ().c_str ());
args.push_back (nullptr);
- if (verb >= 2)
- print_process (args);
- else if (verb && verbose)
- text << "install " << d;
-
try
{
- process pr (args.data ());
+ process_path pp (process::path_search (args[0]));
+
+ if (verb >= 2)
+ print_process (args);
+ else if (verb && verbose)
+ text << "install " << d;
+
+ process pr (pp, args.data ());
if (!pr.wait ())
throw failed ();
@@ -498,14 +500,16 @@ namespace build2
args.push_back (reld.string ().c_str ());
args.push_back (nullptr);
- if (verb >= 2)
- print_process (args);
- else if (verb && verbose)
- text << "install " << t;
-
try
{
- process pr (args.data ());
+ process_path pp (process::path_search (args[0]));
+
+ if (verb >= 2)
+ print_process (args);
+ else if (verb && verbose)
+ text << "install " << t;
+
+ process pr (pp, args.data ());
if (!pr.wait ())
throw failed ();
@@ -545,14 +549,16 @@ namespace build2
const char** args (&args_a[base.sudo == nullptr ? 1 : 0]);
- if (verb >= 2)
- print_process (args);
- else if (verb && verbose)
- text << "install " << rell << " -> " << target;
-
try
{
- process pr (args);
+ process_path pp (process::path_search (args[0]));
+
+ if (verb >= 2)
+ print_process (args);
+ else if (verb && verbose)
+ text << "install " << rell << " -> " << target;
+
+ process pr (pp, args);
if (!pr.wait ())
throw failed ();
@@ -699,14 +705,16 @@ namespace build2
const char** args (&args_a[base.sudo == nullptr ? 1 : 0]);
- if (verb >= 2)
- print_process (args);
- else if (verb && verbose)
- text << "uninstall " << reld;
-
try
{
- process pr (args);
+ process_path pp (process::path_search (args[0]));
+
+ if (verb >= 2)
+ print_process (args);
+ else if (verb && verbose)
+ text << "uninstall " << reld;
+
+ process pr (pp, args);
if (!pr.wait ())
throw failed ();
@@ -798,12 +806,14 @@ namespace build2
const char** args (&args_a[base.sudo == nullptr ? 1 : 0]);
- if (verb >= 2)
- print_process (args);
-
try
{
- process pr (args);
+ process_path pp (process::path_search (args[0]));
+
+ if (verb >= 2)
+ print_process (args);
+
+ process pr (pp, args);
if (!pr.wait ())
throw failed ();
diff --git a/build2/test/rule.cxx b/build2/test/rule.cxx
index 2dc4abd..4cd91d4 100644
--- a/build2/test/rule.cxx
+++ b/build2/test/rule.cxx
@@ -304,7 +304,8 @@ namespace build2
file& ft (static_cast<file&> (t));
assert (!ft.path ().empty ()); // Should have been assigned by update.
- cstrings args {ft.path ().string ().c_str ()};
+ process_path fpp (run_search (ft.path (), true));
+ cstrings args {fpp.recall_string ()};
// Do we have options?
//
@@ -332,12 +333,16 @@ namespace build2
// Do we have output?
//
+ path dp ("diff");
+ process_path dpp;
if (pts.size () != 0 && pts[1] != nullptr)
{
file& ot (static_cast<file&> (*pts[1]));
assert (!ot.path ().empty ()); // Should have been assigned by update.
- args.push_back ("diff");
+ dpp = run_search (dp, true);
+
+ args.push_back (dpp.recall_string ());
args.push_back ("--strip-trailing-cr"); //@@ TMP: see module.cxx
args.push_back ("-u");
args.push_back (ot.path ().string ().c_str ());
diff --git a/build2/utility.cxx b/build2/utility.cxx
index bb26b9d..1383729 100644
--- a/build2/utility.cxx
+++ b/build2/utility.cxx
@@ -135,7 +135,7 @@ namespace build2
throw failed ();
}
- };
+ }
bool
run_finish (const char* args[], bool err, process& pr, const string& l)