From 8a2757da9cc3795a3116d9fddd26486b4408e8ad Mon Sep 17 00:00:00 2001 From: Peter Lemenkov Date: Thu, 1 Sep 2016 17:52:35 +0300 Subject: [PATCH] Rebar ver. 2.6.4 - Ver. 2.6.4 (rhbz#1350988) - Re-enable upstream behaviour for get-deps (rhbz#999054) - Added erlang-eflame dependency Signed-off-by: Peter Lemenkov --- .gitignore | 1 + erlang-rebar.spec | 48 +++-- rebar-0002-Remove-bundled-mustache.patch | 6 +- rebar-0003-Remove-bundled-getopt.patch | 12 +- ...0004-Allow-discarding-building-ports.patch | 4 +- ...e-libdir-in-case-of-source-based-dep.patch | 24 --- ...s-of-long-time-obsolete-escript-fold.patch | 4 +- ...nfc.patch => rebar-0006-remove-abnfc.patch | 8 +- ...0007-Remove-support-for-gpb-compiler.patch | 4 +- ...-0008-Disable-eflame-support-for-now.patch | 64 ------- ...ar-0008-Remove-pre-R15B02-workaround.patch | 14 +- ...-No-such-function-erlang-timestamp-0.patch | 4 +- ...ar-0010-Try-shell-variable-VSN-first.patch | 0 ...bar-0011-Allow-ignoring-missing-deps.patch | 4 +- rebar-0014-Fix-windows-eunit-tests.patch | 165 ------------------ sources | 2 +- 16 files changed, 55 insertions(+), 309 deletions(-) delete mode 100644 rebar-0005-Check-system-wide-libdir-in-case-of-source-based-dep.patch rename rebar-0006-Remove-any-traces-of-long-time-obsolete-escript-fold.patch => rebar-0005-Remove-any-traces-of-long-time-obsolete-escript-fold.patch (91%) rename rebar-0007-remove-abnfc.patch => rebar-0006-remove-abnfc.patch (98%) rename rebar-0009-Remove-support-for-gpb-compiler.patch => rebar-0007-Remove-support-for-gpb-compiler.patch (99%) delete mode 100644 rebar-0008-Disable-eflame-support-for-now.patch rename rebar-0010-Remove-pre-R15B02-workaround.patch => rebar-0008-Remove-pre-R15B02-workaround.patch (83%) rename rebar-0011-No-such-function-erlang-timestamp-0.patch => rebar-0009-No-such-function-erlang-timestamp-0.patch (90%) rename rebar-0012-Try-shell-variable-VSN-first.patch => rebar-0010-Try-shell-variable-VSN-first.patch (100%) rename rebar-0013-Allow-ignoring-missing-deps.patch => rebar-0011-Allow-ignoring-missing-deps.patch (93%) delete mode 100644 rebar-0014-Fix-windows-eunit-tests.patch diff --git a/.gitignore b/.gitignore index e52a4d9..6ecd947 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ /rebar-5dea85db1b697466586877bed133748bd80fa180.tar.gz /rebar-365ac649dc818619757f96a699ddb174f004cff9.tar.gz /rebar-2.6.1.tar.gz +/rebar-2.6.4.tar.gz diff --git a/erlang-rebar.spec b/erlang-rebar.spec index d42ed32..db77894 100644 --- a/erlang-rebar.spec +++ b/erlang-rebar.spec @@ -11,8 +11,8 @@ Name: erlang-%{realname} -Version: 2.6.1 -Release: 10%{?dist} +Version: 2.6.4 +Release: 1%{?dist} Summary: Erlang Build Tools Group: Development/Tools License: MIT @@ -29,26 +29,22 @@ Patch2: rebar-0002-Remove-bundled-mustache.patch Patch3: rebar-0003-Remove-bundled-getopt.patch # Will be proposed for inclusion Patch4: rebar-0004-Allow-discarding-building-ports.patch -# Fedora/EPEL-specific -Patch5: rebar-0005-Check-system-wide-libdir-in-case-of-source-based-dep.patch # Fedora/EPEL-specific - we're using at least R16B03 -Patch6: rebar-0006-Remove-any-traces-of-long-time-obsolete-escript-fold.patch -Patch7: rebar-0007-remove-abnfc.patch -Patch8: rebar-0008-Disable-eflame-support-for-now.patch -Patch9: rebar-0009-Remove-support-for-gpb-compiler.patch +Patch5: rebar-0005-Remove-any-traces-of-long-time-obsolete-escript-fold.patch +Patch6: rebar-0006-remove-abnfc.patch +Patch7: rebar-0007-Remove-support-for-gpb-compiler.patch # Fedora/EPEL-specific - we're using at least R16B03 -Patch10: rebar-0010-Remove-pre-R15B02-workaround.patch +Patch8: rebar-0008-Remove-pre-R15B02-workaround.patch # Fedora/EPEL-specific - keep until we dump R16B03-1 and 17.x.y entirely -Patch11: rebar-0011-No-such-function-erlang-timestamp-0.patch +Patch9: rebar-0009-No-such-function-erlang-timestamp-0.patch # Fedora/EPEL-specific - allow vsn variable override -Patch12: rebar-0012-Try-shell-variable-VSN-first.patch +Patch10: rebar-0010-Try-shell-variable-VSN-first.patch # Fedora/EPEL-specific - allow overriding missind deps error (versions # mismatch) -Patch13: rebar-0013-Allow-ignoring-missing-deps.patch -# Backported from upstream -Patch14: rebar-0014-Fix-windows-eunit-tests.patch +Patch11: rebar-0011-Allow-ignoring-missing-deps.patch %if 0%{?need_bootstrap} < 1 +BuildRequires: erlang-eflame BuildRequires: erlang-rebar %else BuildRequires: erlang-asn1 @@ -58,6 +54,7 @@ BuildRequires: erlang-crypto BuildRequires: erlang-dialyzer BuildRequires: erlang-diameter BuildRequires: erlang-edoc +BuildRequires: erlang-eflame BuildRequires: erlang-erl_interface BuildRequires: erlang-erlydtl BuildRequires: erlang-erts @@ -80,7 +77,6 @@ BuildRequires: erlang-tools # FIXME wip #Requires: erlang-abnfc%{?_isa} -#Requires: erlang-eflame%{?_isa} #Requires: erlang-gpb%{?_isa} # This one cannot be picked up automatically @@ -108,16 +104,13 @@ Erlang Build Tools. %patch3 -p1 -b .remove_bundled_getopt %endif %patch4 -p1 -b .allow_discarding_ports -%patch5 -p1 -b .use_locally_installed -%patch6 -p1 -b .remove_escript_foldl_3 -%patch7 -p1 -b .remove_abnfc -%patch8 -p1 -b .remove_eflame -%patch9 -p1 -b .remove_gpb -%patch10 -p1 -b .remove_pre_R15B02 -%patch11 -p1 -b .typo_fix -%patch12 -p1 -b .vsn_override -%patch13 -p1 -b .skip_deps_checking -%patch14 -p1 -b .fix_eunit_tests +%patch5 -p1 -b .remove_escript_foldl_3 +%patch6 -p1 -b .remove_abnfc +%patch7 -p1 -b .remove_gpb +%patch8 -p1 -b .remove_pre_R15B02 +%patch9 -p1 -b .erlang_timestamp_0 +%patch10 -p1 -b .vsn_override +%patch11 -p1 -b .skip_deps_checking %build @@ -154,6 +147,11 @@ cp -a priv %{buildroot}%{_erllibdir}/%{realname}-%{version}/ %changelog +* Thu Sep 1 2016 Peter Lemenkov - 2.6.4-1 +- Ver. 2.6.4 (rhbz#1350988) +- Re-enable upstream behaviour for get-deps (rhbz#999054) +- Added erlang-eflame dependency + * Tue Mar 15 2016 Peter Lemenkov - 2.6.1-10 - Fixed tests - Fixed incompatibility with a newest erlang-mustache diff --git a/rebar-0002-Remove-bundled-mustache.patch b/rebar-0002-Remove-bundled-mustache.patch index 488d5da..0982231 100644 --- a/rebar-0002-Remove-bundled-mustache.patch +++ b/rebar-0002-Remove-bundled-mustache.patch @@ -4,7 +4,7 @@ Subject: [PATCH] Remove bundled mustache diff --git a/ebin/rebar.app b/ebin/rebar.app -index b4de616..27707c3 100644 +index 9449e1e..d3f8e42 100644 --- a/ebin/rebar.app +++ b/ebin/rebar.app @@ -45,7 +45,6 @@ @@ -12,9 +12,9 @@ index b4de616..27707c3 100644 rebar_metacmds, rebar_getopt, - rebar_mustache, - rmemo ]}, + rmemo, + rebar_rand_compat ]}, {registered, []}, - {applications, diff --git a/src/rebar_mustache.erl b/src/rebar_mustache.erl deleted file mode 100644 index 9016c0f..0000000 diff --git a/rebar-0003-Remove-bundled-getopt.patch b/rebar-0003-Remove-bundled-getopt.patch index 1f2aae8..68047d1 100644 --- a/rebar-0003-Remove-bundled-getopt.patch +++ b/rebar-0003-Remove-bundled-getopt.patch @@ -4,7 +4,7 @@ Subject: [PATCH] Remove bundled getopt diff --git a/ebin/rebar.app b/ebin/rebar.app -index 27707c3..f9b0c22 100644 +index d3f8e42..986f12f 100644 --- a/ebin/rebar.app +++ b/ebin/rebar.app @@ -44,7 +44,6 @@ @@ -12,14 +12,14 @@ index 27707c3..f9b0c22 100644 rebar_xref, rebar_metacmds, - rebar_getopt, - rmemo ]}, + rmemo, + rebar_rand_compat ]}, {registered, []}, - {applications, diff --git a/src/rebar.erl b/src/rebar.erl -index dcfb353..2040e7a 100644 +index 2eb608d..91593c2 100644 --- a/src/rebar.erl +++ b/src/rebar.erl -@@ -233,7 +233,7 @@ run_aux(BaseConfig, Commands) -> +@@ -236,7 +236,7 @@ run_aux(BaseConfig, Commands) -> %% help() -> OptSpecList = option_spec_list(), @@ -28,7 +28,7 @@ index dcfb353..2040e7a 100644 "[var=value,...] ", [{"var=value", "rebar global variables (e.g. force=1)"}, {"command", "Command to run (e.g. compile)"}]), -@@ -293,7 +293,7 @@ help() -> +@@ -301,7 +301,7 @@ help() -> parse_args(RawArgs) -> %% Parse getopt options OptSpecList = option_spec_list(), diff --git a/rebar-0004-Allow-discarding-building-ports.patch b/rebar-0004-Allow-discarding-building-ports.patch index 302ca2d..0819a2f 100644 --- a/rebar-0004-Allow-discarding-building-ports.patch +++ b/rebar-0004-Allow-discarding-building-ports.patch @@ -8,10 +8,10 @@ Conflicts: src/rebar_port_compiler.erl diff --git a/src/rebar_port_compiler.erl b/src/rebar_port_compiler.erl -index 906bcb0..9ae4778 100644 +index 9679c80..0ba9e84 100644 --- a/src/rebar_port_compiler.erl +++ b/src/rebar_port_compiler.erl -@@ -300,6 +300,12 @@ get_specs(Config, AppFile) -> +@@ -348,6 +348,12 @@ get_specs(Config, AppFile) -> %% No spec provided. Construct a spec %% from old-school so_name and sources [port_spec_from_legacy(Config, AppFile)]; diff --git a/rebar-0005-Check-system-wide-libdir-in-case-of-source-based-dep.patch b/rebar-0005-Check-system-wide-libdir-in-case-of-source-based-dep.patch deleted file mode 100644 index cc61986..0000000 --- a/rebar-0005-Check-system-wide-libdir-in-case-of-source-based-dep.patch +++ /dev/null @@ -1,24 +0,0 @@ -From: Peter Lemenkov -Date: Sat, 2 Mar 2013 10:39:15 +0400 -Subject: [PATCH] Check system-wide libdir in case of source-based dependency - -Signed-off-by: Peter Lemenkov - -diff --git a/src/rebar_deps.erl b/src/rebar_deps.erl -index a6e5b27..ba2b4e8 100644 ---- a/src/rebar_deps.erl -+++ b/src/rebar_deps.erl -@@ -393,7 +393,12 @@ find_dep(Config, Dep, _Source) -> - %% _Source is defined. Regardless of what it is, we must find it - %% locally satisfied or fetch it from the original source - %% into the project's deps -- find_dep_in_dir(Config, Dep, get_deps_dir(Config, Dep#dep.app)). -+ case find_dep_in_dir(Config, Dep, get_deps_dir(Config, Dep#dep.app)) of -+ {_Config1, {avail, _Dir}} = Avail -> -+ Avail; -+ {Config1, {missing, _}} -> -+ find_dep_in_dir(Config1, Dep, get_lib_dir(Dep#dep.app)) -+ end. - - find_dep_in_dir(Config, _Dep, {false, Dir}) -> - {Config, {missing, Dir}}; diff --git a/rebar-0006-Remove-any-traces-of-long-time-obsolete-escript-fold.patch b/rebar-0005-Remove-any-traces-of-long-time-obsolete-escript-fold.patch similarity index 91% rename from rebar-0006-Remove-any-traces-of-long-time-obsolete-escript-fold.patch rename to rebar-0005-Remove-any-traces-of-long-time-obsolete-escript-fold.patch index 76df542..5f2e722 100644 --- a/rebar-0006-Remove-any-traces-of-long-time-obsolete-escript-fold.patch +++ b/rebar-0005-Remove-any-traces-of-long-time-obsolete-escript-fold.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Remove any traces of long-time obsolete escript:foldl/3 Signed-off-by: Peter Lemenkov diff --git a/src/rebar_utils.erl b/src/rebar_utils.erl -index 64595a2..08f5b5f 100644 +index a5cc0ff..5947277 100644 --- a/src/rebar_utils.erl +++ b/src/rebar_utils.erl -@@ -222,12 +222,7 @@ abort(String, Args) -> +@@ -225,12 +225,7 @@ abort(String, Args) -> %% undocumented exported fun and has been removed in R14. escript_foldl(Fun, Acc, File) -> {module, zip} = code:ensure_loaded(zip), diff --git a/rebar-0007-remove-abnfc.patch b/rebar-0006-remove-abnfc.patch similarity index 98% rename from rebar-0007-remove-abnfc.patch rename to rebar-0006-remove-abnfc.patch index 62e76e6..ecae99e 100644 --- a/rebar-0007-remove-abnfc.patch +++ b/rebar-0006-remove-abnfc.patch @@ -4,18 +4,18 @@ Subject: [PATCH] remove abnfc diff --git a/ebin/rebar.app b/ebin/rebar.app -index f9b0c22..9f5ae44 100644 +index 986f12f..167dad8 100644 --- a/ebin/rebar.app +++ b/ebin/rebar.app @@ -5,7 +5,6 @@ [{description, "Rebar: Erlang Build Tool"}, - {vsn, "2.6.1"}, + {vsn, "2.6.4"}, {modules, [ rebar, - rebar_abnfc_compiler, rebar_app_utils, rebar_appups, rebar_asn1_compiler, -@@ -81,7 +80,6 @@ +@@ -82,7 +81,6 @@ %% Dir specific processing modules {modules, [ {app_dir, [ @@ -24,7 +24,7 @@ index f9b0c22..9f5ae44 100644 rebar_protobuffs_compiler, rebar_proto_gpb_compiler, diff --git a/rebar.config b/rebar.config -index bcd5368..6fa4f27 100644 +index eda5a2c..7d0870e 100644 --- a/rebar.config +++ b/rebar.config @@ -20,7 +20,6 @@ diff --git a/rebar-0009-Remove-support-for-gpb-compiler.patch b/rebar-0007-Remove-support-for-gpb-compiler.patch similarity index 99% rename from rebar-0009-Remove-support-for-gpb-compiler.patch rename to rebar-0007-Remove-support-for-gpb-compiler.patch index 5bdded9..40d3cec 100644 --- a/rebar-0009-Remove-support-for-gpb-compiler.patch +++ b/rebar-0007-Remove-support-for-gpb-compiler.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Remove support for gpb compiler Signed-off-by: Peter Lemenkov diff --git a/ebin/rebar.app b/ebin/rebar.app -index 9f5ae44..81aaafc 100644 +index 167dad8..e22ad72 100644 --- a/ebin/rebar.app +++ b/ebin/rebar.app @@ -31,7 +31,6 @@ @@ -16,7 +16,7 @@ index 9f5ae44..81aaafc 100644 rebar_qc, rebar_rel_utils, rebar_reltool, -@@ -82,7 +81,6 @@ +@@ -83,7 +82,6 @@ {app_dir, [ rebar_proto_compiler, rebar_protobuffs_compiler, diff --git a/rebar-0008-Disable-eflame-support-for-now.patch b/rebar-0008-Disable-eflame-support-for-now.patch deleted file mode 100644 index 61d2a3d..0000000 --- a/rebar-0008-Disable-eflame-support-for-now.patch +++ /dev/null @@ -1,64 +0,0 @@ -From: Peter Lemenkov -Date: Wed, 2 Mar 2016 14:56:59 +0300 -Subject: [PATCH] Disable eflame support for now - -Signed-off-by: Peter Lemenkov - -diff --git a/src/rebar.erl b/src/rebar.erl -index 2040e7a..b8935ac 100644 ---- a/src/rebar.erl -+++ b/src/rebar.erl -@@ -156,11 +156,7 @@ init_config1(BaseConfig) -> - rebar_config:set_xconf(BaseConfig1, base_dir, AbsCwd). - - profile(BaseConfig1, Commands) -> -- ?CONSOLE("Please take note that profiler=[fprof|eflame] is preliminary" -- " and will be~nreplaced with a different command line flag" -- " in the next release.~n", []), -- Profiler = rebar_config:get_global(BaseConfig1, profiler, "fprof"), -- profile(BaseConfig1, Commands, list_to_atom(Profiler)). -+ profile(BaseConfig1, Commands, fprof). - - profile(Config, Commands, fprof) -> - try -@@ -182,28 +178,6 @@ profile(Config, Commands, fprof) -> - ok - end - end; --profile(Config, Commands, eflame) -> -- case code:lib_dir(eflame) of -- {error, bad_name} -> -- ?ABORT("eflame not found in code path~n", []), -- ok; -- EflameDir -> -- Trace = "eflame.trace", -- try -- eflame:apply(normal_with_children, Trace, -- rebar, run, [Config, Commands]) -- after -- %% generate flame graph -- Script = filename:join(EflameDir, "stack_to_flame.sh"), -- Svg = "eflame.svg", -- %% stack_to_flame.sh < eflame.trace > eflame.png -- Cmd = ?FMT("~s < ~s > ~s", [Script, Trace, Svg]), -- {ok, []} = rebar_utils:sh(Cmd, [{use_stdout, false}, -- abort_on_error]), -- ?CONSOLE("See eflame.svg (generated from eflame.trace)~n", []), -- ok -- end -- end; - profile(_Config, _Commands, Profiler) -> - ?ABORT("Unsupported profiler: ~s~n", [Profiler]). - -@@ -499,9 +473,8 @@ option_spec_list() -> - {jobs, $j, "jobs", integer, JobsHelp}, - {config, $C, "config", string, "Rebar config file to use"}, - {profile, $p, "profile", undefined, -- "Profile this run of rebar. Via profiler= you can optionally select " -- "either fprof (default) or eflame. The result can be found in " -- "fprof.analysis or eflame.svg."}, -+ "Profile this run of rebar. The result can be found in " -+ "fprof.analysis."}, - {keep_going, $k, "keep-going", undefined, - "Keep running after a command fails"}, - {recursive, $r, "recursive", boolean, diff --git a/rebar-0010-Remove-pre-R15B02-workaround.patch b/rebar-0008-Remove-pre-R15B02-workaround.patch similarity index 83% rename from rebar-0010-Remove-pre-R15B02-workaround.patch rename to rebar-0008-Remove-pre-R15B02-workaround.patch index 99ade27..74fce14 100644 --- a/rebar-0010-Remove-pre-R15B02-workaround.patch +++ b/rebar-0008-Remove-pre-R15B02-workaround.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Remove pre-R15B02 workaround Signed-off-by: Peter Lemenkov diff --git a/src/rebar_eunit.erl b/src/rebar_eunit.erl -index 913f2f9..287cc84 100644 +index f4d7b76..63f8c31 100644 --- a/src/rebar_eunit.erl +++ b/src/rebar_eunit.erl -@@ -435,18 +435,6 @@ get_beam_test_exports(ModuleStr) -> +@@ -436,18 +436,6 @@ get_beam_test_exports(ModuleStr) -> end. make_test_primitives(RawTests) -> @@ -27,7 +27,7 @@ index 913f2f9..287cc84 100644 ?CONSOLE(" Running test function(s):~n", []), F = fun({M, F2}, Acc) -> ?CONSOLE(" ~p:~p/0~n", [M, F2]), -@@ -455,23 +443,15 @@ make_test_primitives(RawTests) -> +@@ -456,23 +444,15 @@ make_test_primitives(RawTests) -> case re:run(FNameStr, "_test_") of nomatch -> %% Normal test @@ -38,7 +38,7 @@ index 913f2f9..287cc84 100644 - MakePrimitive(generator, M, F2) + {generator, M, F2} end, - [NewFunction|Acc] + [eunit_module_suite(M, NewFunction)|Acc] end, lists:foldl(F, [], RawTests). @@ -50,6 +50,6 @@ index 913f2f9..287cc84 100644 -pre15b02_eunit_primitive(generator, M, F) -> - {generator, eunit_test:function_wrapper(M, F)}. - - %% - %% == run tests == - %% + % Add a test group for eunit_surefire to be able to deduce the testsuite. + % Calling eunit:test({module, M}) does exactly this as well. + eunit_module_suite(M, X) -> diff --git a/rebar-0011-No-such-function-erlang-timestamp-0.patch b/rebar-0009-No-such-function-erlang-timestamp-0.patch similarity index 90% rename from rebar-0011-No-such-function-erlang-timestamp-0.patch rename to rebar-0009-No-such-function-erlang-timestamp-0.patch index 710883b..1cfc5bb 100644 --- a/rebar-0011-No-such-function-erlang-timestamp-0.patch +++ b/rebar-0009-No-such-function-erlang-timestamp-0.patch @@ -5,10 +5,10 @@ Subject: [PATCH] No such function erlang:timestamp/0 Signed-off-by: Peter Lemenkov diff --git a/src/rebar_utils.erl b/src/rebar_utils.erl -index 08f5b5f..348d06d 100644 +index 5947277..047594d 100644 --- a/src/rebar_utils.erl +++ b/src/rebar_utils.erl -@@ -795,9 +795,9 @@ windows_temp_dir() -> +@@ -816,9 +816,9 @@ windows_temp_dir() -> end. rebar_now() -> diff --git a/rebar-0012-Try-shell-variable-VSN-first.patch b/rebar-0010-Try-shell-variable-VSN-first.patch similarity index 100% rename from rebar-0012-Try-shell-variable-VSN-first.patch rename to rebar-0010-Try-shell-variable-VSN-first.patch diff --git a/rebar-0013-Allow-ignoring-missing-deps.patch b/rebar-0011-Allow-ignoring-missing-deps.patch similarity index 93% rename from rebar-0013-Allow-ignoring-missing-deps.patch rename to rebar-0011-Allow-ignoring-missing-deps.patch index a3e574c..8c89a78 100644 --- a/rebar-0013-Allow-ignoring-missing-deps.patch +++ b/rebar-0011-Allow-ignoring-missing-deps.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Allow ignoring missing deps Signed-off-by: Peter Lemenkov diff --git a/src/rebar_deps.erl b/src/rebar_deps.erl -index ba2b4e8..0f90e0f 100644 +index 251bdee..577db64 100644 --- a/src/rebar_deps.erl +++ b/src/rebar_deps.erl -@@ -160,12 +160,17 @@ do_check_deps(Config) -> +@@ -163,12 +163,17 @@ do_check_deps(Config) -> {Config1, {AvailDeps, []}} -> %% No missing deps {Config1, AvailDeps}; diff --git a/rebar-0014-Fix-windows-eunit-tests.patch b/rebar-0014-Fix-windows-eunit-tests.patch deleted file mode 100644 index 2d7edef..0000000 --- a/rebar-0014-Fix-windows-eunit-tests.patch +++ /dev/null @@ -1,165 +0,0 @@ -From: =?UTF-8?q?Luis=20Rasc=C3=A3o?= -Date: Mon, 12 Oct 2015 13:48:09 +0100 -Subject: [PATCH] Fix windows eunit tests - -File tests: windows file operations should abort on error -the same as unix operations invoked through sh. Also -windows does not support the '?' character in filenames. - -Eunit tests: the 'All' prefix is missing on the 'x tests passed' -message. Eunit only prints the 'All' prefix if there are more -than 2 passed tests, dropping the prefix on the match works -for all cases. - -diff --git a/src/rebar_file_utils.erl b/src/rebar_file_utils.erl -index 0fc1403..a4d3be7 100644 ---- a/src/rebar_file_utils.erl -+++ b/src/rebar_file_utils.erl -@@ -88,7 +88,7 @@ mv(Source, Dest) -> - ?FMT("move /y \"~s\" \"~s\" 1> nul", - [filename:nativename(Source), - filename:nativename(Dest)]), -- [{use_stdout, false}, return_on_error]), -+ [{use_stdout, false}, abort_on_error]), - case R of - [] -> - ok; -@@ -131,14 +131,14 @@ delete_each_dir_win32([]) -> ok; - delete_each_dir_win32([Dir | Rest]) -> - {ok, []} = rebar_utils:sh(?FMT("rd /q /s \"~s\"", - [filename:nativename(Dir)]), -- [{use_stdout, false}, return_on_error]), -+ [{use_stdout, false}, abort_on_error]), - delete_each_dir_win32(Rest). - - xcopy_win32(Source,Dest)-> - {ok, R} = rebar_utils:sh( - ?FMT("xcopy \"~s\" \"~s\" /q /y /e 2> nul", - [filename:nativename(Source), filename:nativename(Dest)]), -- [{use_stdout, false}, return_on_error]), -+ [{use_stdout, false}, abort_on_error]), - case length(R) > 0 of - %% when xcopy fails, stdout is empty and and error message is printed - %% to stderr (which is redirected to nul) -@@ -162,8 +162,10 @@ cp_r_win32({false, Source} = S,{true, DestDir}) -> - cp_r_win32(S, {false, filename:join(DestDir, filename:basename(Source))}); - cp_r_win32({false, Source},{false, Dest}) -> - %% from file to file -- {ok,_} = file:copy(Source, Dest), -- ok; -+ case file:copy(Source, Dest) of -+ {ok,_} -> ok; -+ _ -> throw(rebar_abort) -+ end; - cp_r_win32({true, SourceDir}, {false, DestDir}) -> - case filelib:is_regular(DestDir) of - true -> -diff --git a/test/rebar_compiler_tests.erl b/test/rebar_compiler_tests.erl -index 3ed600b..104a7d8 100644 ---- a/test/rebar_compiler_tests.erl -+++ b/test/rebar_compiler_tests.erl -@@ -84,11 +84,11 @@ not_keep_going_test_() -> - setup, - fun() -> - setup_basic_project(), -- setup_rebar_config(), -- rebar("compile") -+ setup_rebar_config() - end, - fun teardown/1, -- fun(RebarOut)-> -+ fun()-> -+ RebarOut = rebar("compile"), - [ - {"Exit after error", - ?_assert(string:str(RebarOut, "ERROR: compile failed") =/= 0)} -diff --git a/test/rebar_eunit_tests.erl b/test/rebar_eunit_tests.erl -index cb331a4..d481dae 100644 ---- a/test/rebar_eunit_tests.erl -+++ b/test/rebar_eunit_tests.erl -@@ -56,7 +56,7 @@ eunit_test_() -> - ?_assert(string:str(RebarOut, "myapp_mymod:") =/= 0)}, - - {"Tests are only run once", -- ?_assert(string:str(RebarOut, "All 2 tests passed") =/= 0)}] -+ ?_assert(string:str(RebarOut, "2 tests passed") =/= 0)}] - end}. - - eunit_with_suites_and_tests_test_() -> -@@ -80,7 +80,7 @@ eunit_with_suites_and_tests_test_() -> - ?_assert(string:str(RebarOut, "myapp_mymod:") =:= 0)}, - - {"Selected suite tests are only run once", -- ?_assert(string:str(RebarOut, "All 4 tests passed") =/= 0)}] -+ ?_assert(string:str(RebarOut, "4 tests passed") =/= 0)}] - end}, - {"Ensure EUnit runs selected _tests suites", - setup, fun() -> -@@ -102,7 +102,7 @@ eunit_with_suites_and_tests_test_() -> - ?_assert(string:str(RebarOut, "myapp_mymod:") =:= 0)}, - - {"Selected suite tests are only run once", -- ?_assert(string:str(RebarOut, "All 2 tests passed") =/= 0)}] -+ ?_assert(string:str(RebarOut, "2 tests passed") =/= 0)}] - end}, - {"Ensure EUnit runs a specific test defined in a selected suite", - setup, fun() -> -@@ -154,7 +154,7 @@ eunit_with_suites_and_tests_test_() -> - "myapp_mymod2_tests:myfunc2_test/0") =/= 0)]}, - - {"Selected suite tests are run once", -- ?_assert(string:str(RebarOut, "All 3 tests passed") =/= 0)}] -+ ?_assert(string:str(RebarOut, "3 tests passed") =/= 0)}] - end}, - {"Ensure EUnit runs specific test in a _tests suite", - setup, -@@ -190,7 +190,7 @@ eunit_with_suites_and_tests_test_() -> - =/= 0)]}, - - {"Selected suite tests is run once", -- ?_assert(string:str(RebarOut, "All 2 tests passed") =/= 0)}] -+ ?_assert(string:str(RebarOut, "2 tests passed") =/= 0)}] - end}, - {"Ensure EUnit runs a specific test by qualified function name", - setup, -@@ -325,7 +325,11 @@ environment_test_() -> - - assert_rebar_runs() -> - prepare_rebar_script(), -- ?assert(string:str(os:cmd(filename:nativename("./" ++ ?TMP_DIR ++ "rebar")), -+ {ok, Cwd} = file:get_cwd(), -+ ok = file:set_cwd(?TMP_DIR), -+ RebarOut = os:cmd(filename:nativename("./rebar")), -+ ok = file:set_cwd(Cwd), -+ ?assert(string:str(RebarOut, - "No command to run specified!") =/= 0). - - basic_setup_test_() -> -diff --git a/test/rebar_file_utils_tests.erl b/test/rebar_file_utils_tests.erl -index fc76d58..c9b4192 100644 ---- a/test/rebar_file_utils_tests.erl -+++ b/test/rebar_file_utils_tests.erl -@@ -36,7 +36,7 @@ - - -define(TMP_DIR, "tmp_file_utils"). - ---define(SRC, "source dir?"). -+-define(SRC, "source dir"). - -define(DST, "dest (dir)"). - -define(FILE1, "file 1"). - -define(FILE2, "file(2)"). -diff --git a/test/rebar_xref_eunit.erl b/test/rebar_xref_eunit.erl -index 341fe2e..f32ea46 100644 ---- a/test/rebar_xref_eunit.erl -+++ b/test/rebar_xref_eunit.erl -@@ -192,8 +192,8 @@ prepare_rebar_script() -> - {unix, _} -> - [] = os:cmd("chmod u+x " ++ Rebar); - {win32, _} -> -- {ok, _} = file:copy(?REBAR_SCRIPT ++ ".bat", -- ?TMP_DIR ++ "rebar.bat") -+ {ok, _} = file:copy(?REBAR_SCRIPT ++ ".cmd", -+ ?TMP_DIR ++ "rebar.cmd") - end. - - rebar() -> diff --git a/sources b/sources index ae15541..62a944d 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -1ae17dd671c0434012c7a688d4cf60e4 rebar-2.6.1.tar.gz +5704a54547096b9b910e840db4c61caf rebar-2.6.4.tar.gz