Compare commits

..

10 Commits

Author SHA1 Message Date
openeuler-ci-bot
26ecb3d7a6
!12 [sync] PR-11: Compile packge devide into different architecture
From: @openeuler-sync-bot 
Reviewed-by: @wk333 
Signed-off-by: @wk333
2024-05-08 02:52:57 +00:00
yueyuankun
cabf60c9f4 Compile package devide into difference architecture
Signed-off-by: yueyuankun <yueyuankun@kylinos.cn>
(cherry picked from commit 6b3cede9b7634e830fdfe237a5664b5df898e89a)
2024-04-24 15:10:14 +08:00
openeuler-ci-bot
0d067319f7
!10 Disable two tests for erlang25
From: @wk333 
Reviewed-by: @caodongxia, @lyn1001 
Signed-off-by: @lyn1001, @caodongxia
2023-09-21 09:20:14 +00:00
wk333
1098a3d567 Disable two tests for erlang25 2023-09-18 11:25:41 +08:00
openeuler-ci-bot
342d33dbaa
!9 Fix build error
From: @wu-leilei 
Reviewed-by: @caodongxia 
Signed-off-by: @caodongxia
2023-07-24 01:32:01 +00:00
wu-leilei
ec174a34a8 Fix build error 2023-07-23 18:28:18 +08:00
openeuler-ci-bot
8d27f70b85
!8 Resolve erlang-hamcrest compilation errors
From: @dpdwaj 
Reviewed-by: @small_leek 
Signed-off-by: @small_leek
2023-06-15 12:42:35 +00:00
doupengda
f404f398b2 Resolve erlang-hamcrest compilation errors 2023-06-12 20:45:54 +08:00
openeuler-ci-bot
3cb8067ac7
!3 [sync] PR-2: 【编译失败处理】22.03:LTS:Next分支包erlang-erlsyslog,erlang-lfe, erlang-sd_notify编译失败
From: @openeuler-sync-bot 
Reviewed-by: @small_leek 
Signed-off-by: @small_leek
2022-04-22 01:23:06 +00:00
wang--ge
6c41c5a169 remove -lerl_interface flag form default LDFLAG
(cherry picked from commit 9ec59e5d4b1f333bba43b1ce37ce064cb036756f)
2022-04-12 15:30:55 +08:00
4 changed files with 369 additions and 3 deletions

View File

@ -0,0 +1,278 @@
From 2056cd6d6c5ede5fab1593639617f24e445beb70 Mon Sep 17 00:00:00 2001
From: doupengda <doupengda@loongson.cn>
Date: Mon, 12 Jun 2023 09:32:15 +0000
Subject: [PATCH] rebar Add bundled mustache
---
ebin/rebar.app | 1 +
src/rebar_mustache.erl | 231 ++++++++++++++++++++++++++++++++++++++++
src/rebar_templater.erl | 3 +-
3 files changed, 234 insertions(+), 1 deletion(-)
create mode 100644 src/rebar_mustache.erl
diff --git a/ebin/rebar.app b/ebin/rebar.app
index f1477e9..ed6538f 100644
--- a/ebin/rebar.app
+++ b/ebin/rebar.app
@@ -42,6 +42,7 @@
rebar_utils,
rebar_xref,
rebar_metacmds,
+ rebar_mustache,
rmemo ]},
{registered, []},
{applications,
diff --git a/src/rebar_mustache.erl b/src/rebar_mustache.erl
new file mode 100644
index 0000000..99732bb
--- /dev/null
+++ b/src/rebar_mustache.erl
@@ -0,0 +1,231 @@
+%% The MIT License
+%%
+%% Copyright (c) 2009 Tom Preston-Werner <tom@mojombo.com>
+%%
+%% Permission is hereby granted, free of charge, to any person obtaining a copy
+%% of this software and associated documentation files (the "Software"), to deal
+%% in the Software without restriction, including without limitation the rights
+%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+%% copies of the Software, and to permit persons to whom the Software is
+%% furnished to do so, subject to the following conditions:
+%%
+%% The above copyright notice and this permission notice shall be included in
+%% all copies or substantial portions of the Software.
+%%
+%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+%% THE SOFTWARE.
+
+%% See the README at http://github.com/mojombo/mustache.erl for additional
+%% documentation and usage examples.
+
+-module(rebar_mustache). %% v0.1.0
+-author("Tom Preston-Werner").
+-export([compile/1, compile/2, render/1, render/2, render/3, get/2, get/3, escape/1, start/1]).
+
+-record(mstate, {mod = undefined,
+ section_re = undefined,
+ tag_re = undefined}).
+
+-define(MUSTACHE_STR, "rebar_mustache").
+
+compile(Body) when is_list(Body) ->
+ State = #mstate{},
+ CompiledTemplate = pre_compile(Body, State),
+ % io:format("~p~n~n", [CompiledTemplate]),
+ % io:format(CompiledTemplate ++ "~n", []),
+ {ok, Tokens, _} = erl_scan:string(CompiledTemplate),
+ {ok, [Form]} = erl_parse:parse_exprs(Tokens),
+ Bindings = erl_eval:new_bindings(),
+ {value, Fun, _} = erl_eval:expr(Form, Bindings),
+ Fun;
+compile(Mod) ->
+ TemplatePath = template_path(Mod),
+ compile(Mod, TemplatePath).
+
+compile(Mod, File) ->
+ code:purge(Mod),
+ {module, _} = code:load_file(Mod),
+ {ok, TemplateBin} = file:read_file(File),
+ Template = re:replace(TemplateBin, "\"", "\\\\\"", [global, {return,list}]),
+ State = #mstate{mod = Mod},
+ CompiledTemplate = pre_compile(Template, State),
+ % io:format("~p~n~n", [CompiledTemplate]),
+ % io:format(CompiledTemplate ++ "~n", []),
+ {ok, Tokens, _} = erl_scan:string(CompiledTemplate),
+ {ok, [Form]} = erl_parse:parse_exprs(Tokens),
+ Bindings = erl_eval:new_bindings(),
+ {value, Fun, _} = erl_eval:expr(Form, Bindings),
+ Fun.
+
+render(Mod) ->
+ TemplatePath = template_path(Mod),
+ render(Mod, TemplatePath).
+
+render(Body, Ctx) when is_list(Body) ->
+ TFun = compile(Body),
+ render(undefined, TFun, Ctx);
+render(Mod, File) when is_list(File) ->
+ render(Mod, File, dict:new());
+render(Mod, CompiledTemplate) ->
+ render(Mod, CompiledTemplate, dict:new()).
+
+render(Mod, File, Ctx) when is_list(File) ->
+ CompiledTemplate = compile(Mod, File),
+ render(Mod, CompiledTemplate, Ctx);
+render(Mod, CompiledTemplate, Ctx) ->
+ Ctx2 = dict:store('__mod__', Mod, Ctx),
+ lists:flatten(CompiledTemplate(Ctx2)).
+
+pre_compile(T, State) ->
+ SectionRE = "\{\{\#([^\}]*)}}\s*(.+?){{\/\\1\}\}\s*",
+ {ok, CompiledSectionRE} = re:compile(SectionRE, [dotall]),
+ TagRE = "\{\{(#|=|!|<|>|\{)?(.+?)\\1?\}\}+",
+ {ok, CompiledTagRE} = re:compile(TagRE, [dotall]),
+ State2 = State#mstate{section_re = CompiledSectionRE, tag_re = CompiledTagRE},
+ "fun(Ctx) -> " ++
+ "CFun = fun(A, B) -> A end, " ++
+ compiler(T, State2) ++ " end.".
+
+compiler(T, State) ->
+ Res = re:run(T, State#mstate.section_re),
+ case Res of
+ {match, [{M0, M1}, {N0, N1}, {C0, C1}]} ->
+ Front = string:substr(T, 1, M0),
+ Back = string:substr(T, M0 + M1 + 1),
+ Name = string:substr(T, N0 + 1, N1),
+ Content = string:substr(T, C0 + 1, C1),
+ "[" ++ compile_tags(Front, State) ++
+ " | [" ++ compile_section(Name, Content, State) ++
+ " | [" ++ compiler(Back, State) ++ "]]]";
+ nomatch ->
+ compile_tags(T, State)
+ end.
+
+compile_section(Name, Content, State) ->
+ Mod = State#mstate.mod,
+ Result = compiler(Content, State),
+ "fun() -> " ++
+ "case " ++ ?MUSTACHE_STR ++ ":get(" ++ Name ++ ", Ctx, " ++ atom_to_list(Mod) ++ ") of " ++
+ "\"true\" -> " ++
+ Result ++ "; " ++
+ "\"false\" -> " ++
+ "[]; " ++
+ "List when is_list(List) -> " ++
+ "[fun(Ctx) -> " ++ Result ++ " end(dict:merge(CFun, SubCtx, Ctx)) || SubCtx <- List]; " ++
+ "Else -> " ++
+ "throw({template, io_lib:format(\"Bad context for ~p: ~p\", [" ++ Name ++ ", Else])}) " ++
+ "end " ++
+ "end()".
+
+
+compile_tags(T, State) ->
+ Res = re:run(T, State#mstate.tag_re),
+ case Res of
+ {match, [{M0, M1}, K, {C0, C1}]} ->
+ Front = string:substr(T, 1, M0),
+ Back = string:substr(T, M0 + M1 + 1),
+ Content = string:substr(T, C0 + 1, C1),
+ Kind = tag_kind(T, K),
+ Result = compile_tag(Kind, Content, State),
+ "[\"" ++ Front ++
+ "\" | [" ++ Result ++
+ " | " ++ compile_tags(Back, State) ++ "]]";
+ nomatch ->
+ "[\"" ++ T ++ "\"]"
+ end.
+
+tag_kind(_T, {-1, 0}) ->
+ none;
+tag_kind(T, {K0, K1}) ->
+ string:substr(T, K0 + 1, K1).
+
+compile_tag(none, Content, State) ->
+ Mod = State#mstate.mod,
+ ?MUSTACHE_STR ++ ":escape(" ++ ?MUSTACHE_STR ++ ":get(" ++ Content ++ ", Ctx, " ++ atom_to_list(Mod) ++ "))";
+compile_tag("{", Content, State) ->
+ Mod = State#mstate.mod,
+ ?MUSTACHE_STR ++ ":get(" ++ Content ++ ", Ctx, " ++ atom_to_list(Mod) ++ ")";
+compile_tag("!", _Content, _State) ->
+ "[]".
+
+template_dir(Mod) ->
+ DefaultDirPath = filename:dirname(code:which(Mod)),
+ case application:get_env(mustache, templates_dir) of
+ {ok, DirPath} when is_list(DirPath) ->
+ case filelib:ensure_dir(DirPath) of
+ ok -> DirPath;
+ _ -> DefaultDirPath
+ end;
+ _ ->
+ DefaultDirPath
+ end.
+template_path(Mod) ->
+ DirPath = template_dir(Mod),
+ Basename = atom_to_list(Mod),
+ filename:join(DirPath, Basename ++ ".mustache").
+
+get(Key, Ctx) when is_list(Key) ->
+ {ok, Mod} = dict:find('__mod__', Ctx),
+ get(list_to_atom(Key), Ctx, Mod);
+get(Key, Ctx) ->
+ {ok, Mod} = dict:find('__mod__', Ctx),
+ get(Key, Ctx, Mod).
+
+get(Key, Ctx, Mod) when is_list(Key) ->
+ get(list_to_atom(Key), Ctx, Mod);
+get(Key, Ctx, Mod) ->
+ case dict:find(Key, Ctx) of
+ {ok, Val} ->
+ % io:format("From Ctx {~p, ~p}~n", [Key, Val]),
+ to_s(Val);
+ error ->
+ case erlang:function_exported(Mod, Key, 1) of
+ true ->
+ Val = to_s(Mod:Key(Ctx)),
+ % io:format("From Mod/1 {~p, ~p}~n", [Key, Val]),
+ Val;
+ false ->
+ case erlang:function_exported(Mod, Key, 0) of
+ true ->
+ Val = to_s(Mod:Key()),
+ % io:format("From Mod/0 {~p, ~p}~n", [Key, Val]),
+ Val;
+ false ->
+ []
+ end
+ end
+ end.
+
+to_s(Val) when is_integer(Val) ->
+ integer_to_list(Val);
+to_s(Val) when is_float(Val) ->
+ io_lib:format("~.2f", [Val]);
+to_s(Val) when is_atom(Val) ->
+ atom_to_list(Val);
+to_s(Val) ->
+ Val.
+
+escape(HTML) ->
+ escape(HTML, []).
+escape([], Acc) ->
+ lists:reverse(Acc);
+escape(["<" | Rest], Acc) ->
+ escape(Rest, lists:reverse("&lt;", Acc));
+escape([">" | Rest], Acc) ->
+ escape(Rest, lists:reverse("&gt;", Acc));
+escape(["&" | Rest], Acc) ->
+ escape(Rest, lists:reverse("&amp;", Acc));
+escape([X | Rest], Acc) ->
+ escape(Rest, [X | Acc]).
+
+%%---------------------------------------------------------------------------
+
+start([T]) ->
+ Out = render(list_to_atom(T)),
+ io:format(Out ++ "~n", []).
+
diff --git a/src/rebar_templater.erl b/src/rebar_templater.erl
index 2d20e86..7e8554e 100644
--- a/src/rebar_templater.erl
+++ b/src/rebar_templater.erl
@@ -102,7 +102,8 @@ render(Bin, Context) ->
%% Be sure to escape any double-quotes before rendering...
ReOpts = [global, {return, list}],
Str0 = re:replace(Bin, "\\\\", "\\\\\\", ReOpts),
- mustache:render(Str0, Context).
+ Str1 = re:replace(Str0, "\"", "\\\\\"", ReOpts),
+ rebar_mustache:render(Str1, Context).
%% ===================================================================
%% Internal functions
--
2.33.0

View File

@ -0,0 +1,34 @@
From ee8f239d6b54d4a583070505b1374cdc3c05f9c7 Mon Sep 17 00:00:00 2001
From: wang--ge <wang__ge@126.com>
Date: Fri, 21 Jan 2022 12:08:54 +0800
Subject: [PATCH] remove -lerl_interface build flag
---
src/rebar_port_compiler.erl | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/rebar_port_compiler.erl b/src/rebar_port_compiler.erl
index 0ba9e84..f1d7602 100644
--- a/src/rebar_port_compiler.erl
+++ b/src/rebar_port_compiler.erl
@@ -137,7 +137,7 @@ info_help(Description) ->
" CXXFLAGS - C++ compiler~n"
" LDFLAGS - Link flags~n"
" ERL_CFLAGS - default -I paths for erts and ei~n"
- " ERL_LDFLAGS - default -L and -lerl_interface -lei~n"
+ " ERL_LDFLAGS - default -L and -lei~n"
" DRV_CFLAGS - flags that will be used for compiling~n"
" DRV_LDFLAGS - flags that will be used for linking~n"
" EXE_CFLAGS - flags that will be used for compiling~n"
@@ -679,7 +679,7 @@ default_env() ->
"\" "
])},
{"ERL_EI_LIBDIR", lists:concat(["\"", erl_interface_dir(lib), "\""])},
- {"ERL_LDFLAGS" , " -L$ERL_EI_LIBDIR -lerl_interface -lei"},
+ {"ERL_LDFLAGS" , " -L$ERL_EI_LIBDIR -lei"},
{"ERLANG_ARCH" , rebar_utils:wordsize()},
{"ERLANG_TARGET", rebar_utils:get_arch()},
--
2.30.0

View File

@ -1,11 +1,11 @@
%global debug_package %{nil}
%global realname rebar
%global upstream rebar
%global need_bootstrap_set 0
%{!?need_bootstrap: %global need_bootstrap %{need_bootstrap_set}}
Name: erlang-%{realname}
Version: 2.6.4
Release: 1
BuildArch: noarch
Release: 6
Summary: Erlang Build Tools
License: MIT
URL: https://github.com/%{upstream}/%{realname}
@ -23,8 +23,12 @@ Patch10: rebar-0010-Try-shell-variable-VSN-first.patch
Patch11: rebar-0011-Allow-ignoring-missing-deps.patch
Patch12: rebar-0012-Drop-obsolete-crypto-rand_uniform-2.patch
Patch13: rebar-0013-Remove-compat-random-modules.patch
Patch14: 0014-remove-lerl_interface-build-flag.patch
Patch15: 0001-Resolve-erlang-hamcrest-compilation-errors.patch
Patch16: rebar-0014-Disable-two-test-suites-in-Erlang-24.patch
%if 0%{?need_bootstrap} < 1
BuildRequires: erlang-rebar erlang-getopt
BuildRequires: erlang-rebar erlang-getopt erlang-eunit erlang-diameter
%else
BuildRequires: erlang-asn1 erlang-common_test erlang-compiler erlang-crypto
BuildRequires: erlang-dialyzer erlang-diameter erlang-edoc erlang-eflame
@ -64,6 +68,9 @@ EOT
%patch11 -p1 -b .skip_deps_checking
%patch12 -p1 -b .erl20
%patch13 -p1 -b .erl22_compat
%patch14 -p1
%patch15 -p1
%patch16 -p1
%build
%if 0%{?need_bootstrap} < 1
@ -92,5 +99,20 @@ sed -i -e "s,-noshell -noinput,-noshell -noinput -pa .,g" ./rebar
%{erlang_appdir}/
%changelog
* Mon Apr 22 2024 yueyuankun <yueyuankun@kylinos.cn> - 2.6.4-6
- Compile package devide into difference architecture
* Mon Sep 18 2023 wangkai <13474090681@163.com> - 2.6.4-5
- Disable two tests for erlang25
* Sun Jul 23 2023 wulei <wu_lei@hoperun.com> - 2.6.4-4
- Fix build error
* Mon Jun 12 2023 doupengda <doupengda@loongson.cn> - 2.6.4-3
- Resolve erlang-hamcrest compilation errors
* Fri Jan 21 2022 Ge Wang <wangge20huawei.com> - 2.6.4-2
- Remove -lerl_interface flag from default LDFLAG due to erlang updated to 23.3.4.9 version
* Fri Sep 4 2020 Ge Wang <wangge20@huawei.com> - 2.6.4-1
- Package init

View File

@ -0,0 +1,32 @@
From: Peter Lemenkov <lemenkov@gmail.com>
Date: Tue, 10 Aug 2021 16:09:26 +0200
Subject: [PATCH] Disable two test suites in Erlang 24
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
diff --git a/test/rebar_eunit_tests.erl b/test/rebar_eunit_tests.erl
index d481dae..872c570 100644
--- a/test/rebar_eunit_tests.erl
+++ b/test/rebar_eunit_tests.erl
@@ -297,7 +297,7 @@ expected_cover_generated_files() ->
".eunit/myapp_mymod.COVER.html",
".eunit/myapp_sup.COVER.html"].
-cover_coverage_test_() ->
+cover_coverage_test_ERLANG_24_DISABLE() ->
{"Coverage is accurately calculated",
setup, fun() -> setup_cover_project(), rebar("-v eunit") end,
fun teardown/1,
diff --git a/test/rebar_xref_eunit.erl b/test/rebar_xref_eunit.erl
index f32ea46..5f1282e 100644
--- a/test/rebar_xref_eunit.erl
+++ b/test/rebar_xref_eunit.erl
@@ -10,7 +10,7 @@
-define(TMP_DIR, "tmp_xref_eunit/").
-xref_test_() ->
+xref_test_ERLANG_24_DISABLE() ->
{"Test the various xref warnings",
setup, fun() -> setup_project(false), rebar("compile"), rebar("skip_deps=true xref") end,
fun teardown/1,