Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

relx opt should not sort #2490

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

DualHappiness
Copy link

relx options should not be sort, otherwise, the right override strategy will not work.

@ferd
Copy link
Collaborator

ferd commented Feb 7, 2021

This can't be accepted without tests at least showing the behaviour you wish to change

@tsloughter
Copy link
Collaborator

Yea, and I'd be surprised if this was an accurate fix to your issue. I know we've had issues with sorting before but really thought at this point we had it right -- though certainly possible that the relx 4.0 changes could have messed something up.

So you may want to provide an example of your config you are having issues with before writing tests, so we can go over it and make sure this is the right direction.

@DualHappiness
Copy link
Author

DualHappiness commented Feb 20, 2021

With the example of this page

You can override options that the modes expand to by including explicit setting them. For example, if you did want to keep the debug info in the BEAM modules then you can use a configuration like:

[
  {mode, prod},
  {debug_info, keep}
]

Create a new release with simple rebar.config

{erl_opts, [debug_info]}.
{deps, []}.

{relx, [{release, {rlex_test, "0.1.0"},
         [rlex_test,
          sasl]},

        {mode, dev},

        %% automatically picked up if the files
        %% exist but can be set manually, which
        %% is required if the names aren't exactly
        %% sys.config and vm.args
        {sys_config, "./config/sys.config"},
        {vm_args, "./config/vm.args"}

        %% the .src form of the configuration files do
        %% not require setting RELX_REPLACE_OS_VARS
        %% {sys_config_src, "./config/sys.config.src"},
        %% {vm_args_src, "./config/vm.args.src"}
]}.

{profiles, [{prod, [{relx,
                     [%% prod is the default mode when prod
                      %% profile is used, so does not have
                      %% to be explicitly included like this
                      {mode, prod},
                      {debug_info, keep}
                      %% use minimal mode to exclude ERTS
                      %% {mode, minimal}
                     ]
            }]}]}.

If sort opts, the reabr3 as prod release final RelxState is

{state_t,"/home/dual/learn/rlex_test",
         "/home/dual/learn/rlex_test/_build/prod/rel",[],[],#{},
         "/home/dual/learn/rlex_test/config/vm.args",undefined,
         "/home/dual/learn/rlex_test/config/sys.config",undefined,[],[],[],
         strip,
         #{{rlex_test,"0.1.0"} =>
               {release_t,rlex_test,"0.1.0",undefined,
                          [{rlex_test,#{included_applications => undefined,
                                        name => rlex_test,type => undefined,
                                        vsn => undefined}},
                           {sasl,#{included_applications => undefined,
                                   name => sasl,type => undefined,
                                   vsn => undefined}}],
                          false,[],[],undefined,[]}},
         #{},false,true,true,undefined,false,true,true,false,[],true,
         [{profile_string,"prod"}],
         [{base_dir,"/home/dual/learn/rlex_test/_build/prod"}],
         true,[],[],true,undefined,false,prod,true}

and the debug_info option is ===> rlx_state:debug_info(RelxState):strip. It's not work as the doc say.

@ferd ferd added the awaiting update requiring action from submitter label May 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting update requiring action from submitter
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants