tsloughter / erlup

Erlang toolchain installer
14 stars 2 forks source link

Add -f/--force option to build #5

Closed tsloughter closed 3 years ago

tsloughter commented 3 years ago

There should be an option to build that allows you to force the installation of a new OTP with the same name as an existing one.

The previous install in the directory should be moved to a new name in the same directory (to prevent potentially crossing partitions which would be a major slow down) so that it can be put back if the compilation of the new install fails.

lrascao commented 3 years ago

could this new option eliminate the need for #3? if the dir is empty or the build failed for some reason the user can fix it by supplying --force

lrascao commented 3 years ago

also, would it not be simpler to just delete the install dir if --force is supplied? i would find it odd for these different named directories to appear out of nowhere

tsloughter commented 3 years ago

I was wondering that too about #3 but I think it makes sense to skip requiring the -f if its completely empty.

The reason I didn't want -f to delete the install is then if the compilation fails it would result in losing that previous build.

I guess we could instead only delete it after configure and make have successfully completed and make the assumptiong that if those suceeded it is very unlikely that make install would fail, so the failure case is very unlikely at that point.

lrascao commented 3 years ago

The reason I didn't want -f to delete the install is then if the compilation fails it would result in losing that previous build.

I don't see as that big of an issue, the user already accepted that possible outcome by passing in --force, this is saying to erlup: "i know what i'm doing, stop trying to be so protective"

tsloughter commented 3 years ago

Yea, I'd just find it annoying if it happened to me :). So I'd do the delete after make has completed successfully and that is the best of both worlds.

lrascao commented 3 years ago

so to sum up:

  1. user says erlup build <id> --force
  2. erlup finds that already exists, makes a backup of it somewhere and starts the build
  3. if successful, delete the backup, if not, restore it
tsloughter commented 3 years ago

Oh, no. I meant that it does not create a backup, it deletes the existing dir (like you suggested) but only after make, before make install is called. So a change to the build steps.

lrascao commented 3 years ago

ah right, got it