From 6c6e8f684a357298de2b8e85a43b533ff157f8c0 Mon Sep 17 00:00:00 2001 From: Ivan Dyachkov Date: Wed, 7 Sep 2022 20:50:42 +0200 Subject: [PATCH] build: take into account PKG_VSN env variable in rebar.config.erl --- rebar.config.erl | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/rebar.config.erl b/rebar.config.erl index c6ab19818..ce1930ed6 100644 --- a/rebar.config.erl +++ b/rebar.config.erl @@ -482,11 +482,16 @@ emqx_etc_overlay_per_edition(ee) -> ]. get_vsn(Profile) -> - %% to make it compatible to Linux and Windows, - %% we must use bash to execute the bash file - %% because "./" will not be recognized as an internal or external command - os_cmd("pkg-vsn.sh " ++ atom_to_list(Profile)). + case os:getenv("PKG_VSN") of + false -> + os_cmd("pkg-vsn.sh " ++ atom_to_list(Profile)); + Vsn -> + Vsn + end. +%% to make it compatible to Linux and Windows, +%% we must use bash to execute the bash file +%% because "./" will not be recognized as an internal or external command os_cmd(Cmd) -> Output = os:cmd("bash " ++ Cmd), re:replace(Output, "\n", "", [{return, list}]).