diff options
| author | Matthias Radestock <matthias@lshift.net> | 2010-04-30 15:29:15 +0100 |
|---|---|---|
| committer | Matthias Radestock <matthias@lshift.net> | 2010-04-30 15:29:15 +0100 |
| commit | 3800c0edf4c5073bda8a6427be233021948456bb (patch) | |
| tree | 3e1e1d8288bece3e49bab52a30cabd447d81b25d /src | |
| parent | 5f9e91a36dd2836c4deb3f24784dd87f2f1e918c (diff) | |
| parent | c925bba84ec637b82f0180e9234d1e12c19fc364 (diff) | |
| download | rabbitmq-server-git-3800c0edf4c5073bda8a6427be233021948456bb.tar.gz | |
merge bug22616 into bug21673
Diffstat (limited to 'src')
| -rw-r--r-- | src/rabbit.erl | 29 | ||||
| -rw-r--r-- | src/rabbit_misc.erl | 16 |
2 files changed, 31 insertions, 14 deletions
diff --git a/src/rabbit.erl b/src/rabbit.erl index 6da8d99114..7ca5b07b4b 100644 --- a/src/rabbit.erl +++ b/src/rabbit.erl @@ -241,14 +241,18 @@ rotate_logs(BinarySuffix) -> %%-------------------------------------------------------------------- start(normal, []) -> - {ok, SupPid} = rabbit_sup:start_link(), + case erts_version_check() of + ok -> + {ok, SupPid} = rabbit_sup:start_link(), - print_banner(), - [ok = run_boot_step(Step) || Step <- boot_steps()], - io:format("~nbroker running~n"), - - {ok, SupPid}. + print_banner(), + [ok = run_boot_step(Step) || Step <- boot_steps()], + io:format("~nbroker running~n"), + {ok, SupPid}; + Error -> + Error + end. stop(_State) -> terminated_ok = error_logger:delete_report_handler(rabbit_error_logger), @@ -261,6 +265,14 @@ stop(_State) -> %%--------------------------------------------------------------------------- +erts_version_check() -> + FoundVer = erlang:system_info(version), + case rabbit_misc:version_compare(?ERTS_MINIMUM, FoundVer, lte) of + true -> ok; + false -> {error, {erlang_version_too_old, + {found, FoundVer}, {required, ?ERTS_MINIMUM}}} + end. + boot_error(Format, Args) -> io:format("BOOT ERROR: " ++ Format, Args), error_logger:error_msg(Format, Args), @@ -410,8 +422,9 @@ print_banner() -> {"cookie hash", rabbit_misc:cookie_hash()}, {"log", log_location(kernel)}, {"sasl log", log_location(sasl)}, - {"database dir", rabbit_mnesia:dir()}], - DescrLen = lists:max([length(K) || {K, _V} <- Settings]), + {"database dir", rabbit_mnesia:dir()}, + {"erlang version", erlang:system_info(version)}], + DescrLen = 1 + lists:max([length(K) || {K, _V} <- Settings]), Format = "~-" ++ integer_to_list(DescrLen) ++ "s: ~s~n", lists:foreach(fun ({K, V}) -> io:format(Format, [K, V]) end, Settings), io:nl(). diff --git a/src/rabbit_misc.erl b/src/rabbit_misc.erl index 2c1808465f..59ba277610 100644 --- a/src/rabbit_misc.erl +++ b/src/rabbit_misc.erl @@ -598,24 +598,28 @@ version_compare(A, B, gte) -> version_compare(A, B, Result) -> Result =:= version_compare(A, B). -version_compare([], []) -> +version_compare(A, A) -> eq; -version_compare([], _ ) -> +version_compare([], [$0 | B]) -> + version_compare([], dropdot(B)); +version_compare([], _) -> lt; %% 2.3 < 2.3.1 -version_compare(_ , []) -> +version_compare([$0 | A], []) -> + version_compare(dropdot(A), []); +version_compare(_, []) -> gt; %% 2.3.1 > 2.3 version_compare(A, B) -> {AStr, ATl} = lists:splitwith(fun (X) -> X =/= $. end, A), {BStr, BTl} = lists:splitwith(fun (X) -> X =/= $. end, B), ANum = list_to_integer(AStr), BNum = list_to_integer(BStr), - if ANum =:= BNum -> ATl1 = lists:dropwhile(fun (X) -> X =:= $. end, ATl), - BTl1 = lists:dropwhile(fun (X) -> X =:= $. end, BTl), - version_compare(ATl1, BTl1); + if ANum =:= BNum -> version_compare(dropdot(ATl), dropdot(BTl)); ANum < BNum -> lt; ANum > BNum -> gt end. +dropdot(A) -> lists:dropwhile(fun (X) -> X =:= $. end, A). + recursive_delete(Files) -> lists:foldl(fun (Path, ok ) -> recursive_delete1(Path); (_Path, {error, _Err} = Error) -> Error |
