diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2021-08-16 09:38:16 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2021-08-16 09:38:16 +0200 |
commit | 6dcf87224a7e13550d664430bd149f42c8b12531 (patch) | |
tree | 91ee5bbfae46a8abb3133648f34b6223a10ed0ca /bpkg/pkg-build.cxx | |
parent | 97f312a1b536c92440b04ec3dd743fc2802ab150 (diff) |
Add pkg-build --noop-exit option
Diffstat (limited to 'bpkg/pkg-build.cxx')
-rw-r--r-- | bpkg/pkg-build.cxx | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/bpkg/pkg-build.cxx b/bpkg/pkg-build.cxx index 1e8e9dd..f59c2c0 100644 --- a/bpkg/pkg-build.cxx +++ b/bpkg/pkg-build.cxx @@ -3203,6 +3203,17 @@ namespace bpkg // validate_options (o, ""); // Global package options. + if (o.noop_exit_specified ()) + { + if (o.print_only ()) + fail << "--noop-exit specified with --print-only"; + + // We can probably use build2's --structured-result to support this. + // + if (!o.configure_only ()) + fail << "--noop-exit is only supported in --configure-only mode"; + } + if (o.update_dependent () && o.leave_dependent ()) fail << "both --update-dependent|-U and --leave-dependent|-L " << "specified" << @@ -4693,6 +4704,9 @@ namespace bpkg { assert (rec_pkgs.empty ()); + if (o.noop_exit_specified ()) + return o.noop_exit (); + info << "nothing to build"; return 0; } @@ -5935,10 +5949,13 @@ namespace bpkg // prerequsites got upgraded/downgraded and that the user may want to in // addition update (that update_dependents flag above). // - execute_plan (o, pkgs, false /* simulate */, find_prereq_database); + bool noop (!execute_plan (o, + pkgs, + false /* simulate */, + find_prereq_database)); if (o.configure_only ()) - return 0; + return noop && o.noop_exit_specified () ? o.noop_exit () : 0; // update // |