build: do not allow user override PKG_VSN
We have an assertion in code, allowing user to override will compile but not run.
This commit is contained in:
parent
cd5431e71d
commit
871f23f047
|
@ -122,7 +122,14 @@ get_release() ->
|
||||||
release_in_macro();
|
release_in_macro();
|
||||||
{_, Vsn} -> %% For emqx release build
|
{_, Vsn} -> %% For emqx release build
|
||||||
VsnStr = release_in_macro(),
|
VsnStr = release_in_macro(),
|
||||||
1 = string:str(Vsn, VsnStr), %% assert
|
case string:str(Vsn, VsnStr) of
|
||||||
|
1 -> ok;
|
||||||
|
_ ->
|
||||||
|
erlang:error(#{ reason => version_mismatch
|
||||||
|
, source => VsnStr
|
||||||
|
, built_for => Vsn
|
||||||
|
})
|
||||||
|
end,
|
||||||
Vsn
|
Vsn
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
|
2
build
2
build
|
@ -12,7 +12,7 @@ ARTIFACT="$2"
|
||||||
# ensure dir
|
# ensure dir
|
||||||
cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")"
|
cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")"
|
||||||
|
|
||||||
PKG_VSN="${PKG_VSN:-$(./pkg-vsn.sh)}"
|
PKG_VSN="$(./pkg-vsn.sh)"
|
||||||
export PKG_VSN
|
export PKG_VSN
|
||||||
|
|
||||||
if [ "$(uname -s)" = 'Darwin' ]; then
|
if [ "$(uname -s)" = 'Darwin' ]; then
|
||||||
|
|
|
@ -413,18 +413,8 @@ find_conf_files(App) ->
|
||||||
false -> []
|
false -> []
|
||||||
end.
|
end.
|
||||||
|
|
||||||
env(Name, Default) ->
|
|
||||||
case os:getenv(Name) of
|
|
||||||
"" -> Default;
|
|
||||||
false -> Default;
|
|
||||||
Value -> Value
|
|
||||||
end.
|
|
||||||
|
|
||||||
get_vsn() ->
|
get_vsn() ->
|
||||||
PkgVsn = case env("PKG_VSN", false) of
|
PkgVsn = os:cmd("./pkg-vsn.sh"),
|
||||||
false -> os:cmd("./pkg-vsn.sh");
|
|
||||||
Vsn -> Vsn
|
|
||||||
end,
|
|
||||||
re:replace(PkgVsn, "\n", "", [{return ,list}]).
|
re:replace(PkgVsn, "\n", "", [{return ,list}]).
|
||||||
|
|
||||||
maybe_dump(Config) ->
|
maybe_dump(Config) ->
|
||||||
|
|
Loading…
Reference in New Issue