From 2df57d72b65012674e6bc64dec66d9b3fd7f993b Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Mon, 14 May 2018 14:10:56 +0300 Subject: Fallback to output directory removal for --keep-out on disfigure failure --- bpkg/utility.cxx | 114 ------------------------------------------------------- 1 file changed, 114 deletions(-) (limited to 'bpkg/utility.cxx') diff --git a/bpkg/utility.cxx b/bpkg/utility.cxx index 693c07e..a990d32 100644 --- a/bpkg/utility.cxx +++ b/bpkg/utility.cxx @@ -277,42 +277,6 @@ namespace bpkg dir_path exec_dir; - void - run (const char* args[], const dir_path& fallback) - { - try - { - process_path pp (process::path_search (args[0], fallback)); - - if (verb >= 2) - print_process (args); - - process pr (pp, args); - - if (pr.wait ()) - return; - - assert (pr.exit); - const process_exit& pe (*pr.exit); - - if (pe.normal ()) - throw failed (); // Assume the child issued diagnostics. - - diag_record dr (fail); - print_process (dr, args); - dr << " " << pe; - } - catch (const process_error& e) - { - error << "unable to execute " << args[0] << ": " << e; - - if (e.child) - exit (1); - - throw failed (); - } - } - const char* name_b (const common_options& co) { @@ -320,82 +284,4 @@ namespace bpkg ? co.build ().string ().c_str () : "b" BPKG_EXE_SUFFIX; } - - void - run_b (const common_options& co, - const dir_path& c, - const string& bspec, - verb_b v, - const strings& pvars, - const strings& cvars) - { - cstrings args {name_b (co)}; - - // Map verbosity level. If we are running quiet or at level 1, - // then run build2 quiet. Otherwise, run it at the same level - // as us. - // - string vl; - - if (verb == 0) - args.push_back ("-q"); - else if (verb == 1) - { - if (v != verb_b::normal) - { - args.push_back ("-q"); - - if (v == verb_b::progress && stderr_term) - args.push_back ("--progress"); - } - } - else if (verb == 2) - args.push_back ("-v"); - else - { - vl = to_string (verb); - args.push_back ("--verbose"); - args.push_back (vl.c_str ()); - } - - // Add user options. - // - for (const string& o: co.build_option ()) - args.push_back (o.c_str ()); - - // Add config vars. - // - strings storage; - storage.reserve (cvars.size ()); - for (const string& v: cvars) - { - // Don't scope-qualify global variables. - // - if (v[0] != '!') - { - // Use path representation to get canonical trailing slash. - // - storage.push_back (c.representation () + ':' + v); - args.push_back (storage.back ().c_str ()); - } - else - args.push_back (v.c_str ()); - } - - for (const string& v: pvars) - args.push_back (v.c_str ()); - - // Add buildspec. - // - args.push_back (bspec.c_str ()); - - args.push_back (nullptr); - - // Use our executable directory as a fallback search since normally the - // entire toolchain is installed into one directory. This way, for - // example, if we installed into /opt/build2 and run bpkg with absolute - // path (and without PATH), then bpkg will be able to find "its" b. - // - run (args, exec_dir); - } } -- cgit v1.1