erlware / relx

Sane, simple release creation for Erlang
http://erlware.github.io/relx
Apache License 2.0
697 stars 232 forks source link

Add preinstalled_lib_dir #728

Closed Zalastax closed 2 years ago

Zalastax commented 5 years ago

Solves #689

TODO: Automatically add from preinstalled_lib_dir to lib_dirs. TODO: Extend templates/bin*

tsloughter commented 5 years ago

Something I forgot to ask about this in the issue. Is your plan to continue using this feature forever? Is there some important benefit to doing this that you want to keep. Or is this to ease your initial use rebar3/relx and intend to drop it once you've completed a move to using relx instead of internal tooling?

Zalastax commented 5 years ago

Thanks for asking! The plan is to continue using this essentially forever. Moving completely to rebar3 is not in the foreseeable future. What we need to keep working is having OTP applications that are resolved by relx but not included in the release :smiley:

tsloughter commented 5 years ago

It doesn't look like this is using the variable support in systools I suggested here https://github.com/erlware/relx/issues/689#issuecomment-483020021 ?

Zalastax commented 5 years ago

It is! I've added a new systool variable PREINSTALLED_LIB_DIR. I also used {var_tar, omit}. The solution completely hinges on your comment!

tsloughter commented 5 years ago

Oh, hah, now I see :). My only concern is it would be better if the configuration wasn't specific to preinstalled libs but more the ability to directly configure the variables and var_tar. I need to look closer later to see if that is possible.

Zalastax commented 5 years ago

That would definitely be possible. The tricky thing is how to configure multiple vars+paths via the CLI and how to include them in the start scripts.

Zalastax commented 5 years ago

Ping @tsloughter 😃

Zalastax commented 5 years ago

The format used by erl is -boot_var Var Dir. getopt does not support that directly but we can quote the parameter --boot_var "Var Dir".

Left to think about then is the start scripts. The boot variables need to be populated in the start scripts. Should that be by convention (e.g. each boot variable has to have a corresponding environment variable) or be separately configurable?

tsloughter commented 5 years ago

Hm, I've lost context on this again I guess because I don't know how getopt is related to any of this, hehe. I'll have to go over the PR again.

Zalastax commented 4 years ago

Hi again,

getopt is related to this in that there should be a way to specify the boot vars on the CLI. At least I think so. Are all options specifiable on the command line or are some only possible via a config file?

Regarding start scripts, the boot vars that are configured need to be passed in (as it's done here). My main alternatives are to either populate them via environment variables with the same name (-boot_var MY_VAR "$MY_VAR") or that they should be passed in as extra arguments, i.e. the user has to type out -boot_var MY_VAR "$MY_VAR" themselves.

tsloughter commented 4 years ago

A lot has changed in relx so this will need to be reworked. An option to leave out specific apps but have them still included in the boot and pointed to on the install target -- through var_tar which is no how system libs are omitted in rlx_tar:

{variables, [{"SYSTEM_LIB_DIR", code:lib_dir()}]},
             {var_tar, omit}]

would be great.