aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-03-16 16:17:07 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2018-03-16 16:17:07 +0200
commit12857770f878e385e83cb76e39e2f99a09d1b043 (patch)
treea2d843eac07ae2d1a16de219ae64f803f53a42d0
parentf3c57d0941ead602ff8f2936cd30019567ff42de (diff)
Don't prompt and automatically drop unused prerequisites in sync
-rw-r--r--bdep/sync.cli5
-rw-r--r--bdep/sync.cxx14
-rw-r--r--bdep/sync.hxx5
3 files changed, 21 insertions, 3 deletions
diff --git a/bdep/sync.cli b/bdep/sync.cli
index e6c5d37..0a3965d 100644
--- a/bdep/sync.cli
+++ b/bdep/sync.cli
@@ -36,6 +36,11 @@ namespace bdep
{
"\h|SYNC OPTIONS|"
+ bool --yes|-y
+ {
+ "Don't prompt for confirmation when up/down-grading dependencies."
+ }
+
bool --fetch|-f
{
"Perform the \cb{fetch} command prior to synchronization."
diff --git a/bdep/sync.cxx b/bdep/sync.cxx
index 6f95080..f8a5bed 100644
--- a/bdep/sync.cxx
+++ b/bdep/sync.cxx
@@ -17,7 +17,8 @@ namespace bdep
cmd_sync (const common_options& co,
const dir_path& prj,
const shared_ptr<configuration>& c,
- bool fetch)
+ bool fetch,
+ bool yes)
{
assert (!c->packages.empty ());
@@ -54,12 +55,21 @@ namespace bdep
spec += '@';
spec += prj.string ();
+ // It feels right to drop unused dependencies without any confirmation.
+ //
+ // @@ TODO: right now it is silent. Can we print a plan without the
+ // prompts? Probably also a good idea even if from build system
+ // hook... Issue: drop dependents has no "drop " prefix. Also indented
+ // stuff out of nowhere will look odd.
+ //
run_bpkg (co,
"build",
"-d", c->path,
"--no-fetch",
"--configure-only",
+ "--drop-prerequisite",
"--keep-out",
+ (yes ? "--yes" : nullptr),
spec);
}
@@ -125,6 +135,8 @@ namespace bdep
// Don't re-fetch if we just fetched.
//
cmd_sync (o, prj, c, !fetch);
+
+ //@@ TODO: sync upgrade (see status for structure ideas). Pass o.yes().
}
return 0;
diff --git a/bdep/sync.hxx b/bdep/sync.hxx
index 741e519..b397c10 100644
--- a/bdep/sync.hxx
+++ b/bdep/sync.hxx
@@ -14,13 +14,14 @@
namespace bdep
{
// If fetch is false, don't perform a (shallow) fetch of the project
- // repository.
+ // repository. If yes is false, then don't suppress bpkg prompts.
//
void
cmd_sync (const common_options&,
const dir_path& prj,
const shared_ptr<configuration>&,
- bool fetch = true);
+ bool fetch = true,
+ bool yes = true);
int
cmd_sync (const cmd_sync_options&, cli::scanner& args);