[build2] Feature Requestion: "Hard-Reset" All Configuration Directories

Boris Kolpackov boris at codesynthesis.com
Mon Nov 26 12:44:59 UTC 2018

Klaim - Joël Lamotte <mjklaim at gmail.com> writes:

> short summary: I would like a command to recreate all the config
> directories that I just deleted.

Short answer: we can't do that since we don't have the configuration
variables you used to create them (the only place they are stored is
in the configuration itself).

> > bdep config remove default
> error: no configurations specified
> > bdep config remove 1
> error: no configurations specified
> > bdep config remove E:\Projects\build2-libs\build-modules\
> error: no configurations specified
> > bdep config remove "E:\Projects\build2-libs\build-modules\"
> error: no configurations specified

Why not try:

  bdep help config

We go to great pains to write decent (IMO) documentation and
it is really demotivating so see the users go to great pains
(like trying their luck with a bunch of commands or sending
questions to the mailing list) to avoid spending a couple of
minutes reading the fine manual.

> Suggestion:
> Assuming that most of the time I want no special config setup for my
> config directory, I think it would be useful to be able to "reset
> hard" a configuration that should exist but doesn't anymore.
> Something like
> > bdep init --force
> Then it create a configuration exactly like if I did:
> > bdep init -C <path-to-default-config>

As I said above, we can't do that since after "-C <...>" you normally
have "cc config.cxx=clang++ ...". Which we don't store (for good
reasons) in the bdep database.

> Also, I understand that deleting the configuration directories makes
> me lose the specific config I setup there, but I'm totally fine with
> that [...]

Others might not be, thought. Generally, we don't automatically remove
files that may have user-made changes (like config.build).

What we could probably do is provide something like 'bdep config reset' 
(along with the --all option) which will remove everything (packages,
bpkg database, etc) except for the build2 configuration (essentially
leaving just the build2/config.build file) and then re-initialize an
empty bpkg database. After this you should be able to do 'bdep sync'
to re-initialize your project (i.e., fetch dependencies, etc).

One problem with this is that if you have initialized multiple projects
in the same configuration, then you will have to manually sync each of
them (and in the correct order, if they depend on each other). We could
probably do sync automatically as part of the reset to help with that.

Would something like this work for you?

More information about the users mailing list