aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bdep/deinit.cli7
-rw-r--r--bdep/deinit.cxx35
2 files changed, 30 insertions, 12 deletions
diff --git a/bdep/deinit.cli b/bdep/deinit.cli
index 72488cb..2280454 100644
--- a/bdep/deinit.cli
+++ b/bdep/deinit.cli
@@ -41,5 +41,12 @@ namespace bdep
class cmd_deinit_options: project_options
{
"\h|DEINIT OPTIONS|"
+
+ bool --force
+ {
+ "Deinitialize packages without attempting to remove them from the build
+ configuration. This mode is primarily useful when the configuration
+ directory has been removed or is otherwise unusable."
+ }
};
}
diff --git a/bdep/deinit.cxx b/bdep/deinit.cxx
index 2264d79..87f478f 100644
--- a/bdep/deinit.cxx
+++ b/bdep/deinit.cxx
@@ -21,6 +21,7 @@ namespace bdep
const shared_ptr<configuration>& c,
const strings& pkgs)
{
+ bool force (o.force ());
const dir_path& cfg (c->path);
// Remove auto-synchronization build system hook.
@@ -32,7 +33,8 @@ namespace bdep
// have been removed from the configuration's repositories if that were
// the case).
//
- if (c->auto_sync &&
+ if (!force &&
+ c->auto_sync &&
c->packages.empty () &&
configuration_projects (o, cfg, prj).empty ())
{
@@ -41,7 +43,8 @@ namespace bdep
rm (f);
}
- // Disfigure configuration forwarding.
+ // Disfigure configuration forwarding. Note that we have to do this even
+ // if forced.
//
if (c->forward)
{
@@ -76,14 +79,15 @@ namespace bdep
// that are managed by bdep, then its view of what has been initialized
// in the configuration will become invalid.
//
- run_bpkg (2,
- o,
- "drop",
- "-d", cfg,
- "--keep-dependent",
- "--plan", "synchronizing:",
- "--yes",
- pkgs);
+ if (!force)
+ run_bpkg (2,
+ o,
+ "drop",
+ "-d", cfg,
+ "--keep-dependent",
+ "--plan", "synchronizing:",
+ "--yes",
+ pkgs);
}
int
@@ -91,6 +95,8 @@ namespace bdep
{
tracer trace ("deinit");
+ bool force (o.force ());
+
// The same ignore/load story as in sync.
//
project_packages pp (
@@ -106,7 +112,12 @@ namespace bdep
database db (open (prj, trace));
transaction t (db.begin ());
- configurations cfgs (find_configurations (o, prj, t));
+ configurations cfgs (
+ find_configurations (o,
+ prj,
+ t,
+ true /* fallback_default */,
+ !force /* validate */));
t.commit ();
// If specified, verify packages are present in each configuration.
@@ -197,7 +208,7 @@ namespace bdep
// Remove our repository from the configuration if we have no more
// packages that are initialized in it.
//
- if (c->packages.empty ())
+ if (!force && c->packages.empty ())
run_bpkg (3,
o,
"remove",