diff options
author | Amadeusz Żołnowski <aidecoe@gentoo.org> | 2016-06-06 23:16:09 +0100 |
---|---|---|
committer | Amadeusz Żołnowski <aidecoe@gentoo.org> | 2016-06-07 23:20:25 +0100 |
commit | 24db89a7d206227ac43e475a5642fe4fa5aeaa24 (patch) | |
tree | fcea42f8d8ed23776874aec47e17c564d6047e2d /dev-erlang/lager | |
parent | dev-erlang/jiffy: Add new package (diff) | |
download | gentoo-24db89a7d206227ac43e475a5642fe4fa5aeaa24.tar.gz gentoo-24db89a7d206227ac43e475a5642fe4fa5aeaa24.tar.bz2 gentoo-24db89a7d206227ac43e475a5642fe4fa5aeaa24.zip |
dev-erlang/lager: Add new package
It is debundled from net-im/ejabberd-16.04 and therefore inherits
keywords from ejabberd: ~amd64, ~arm, ~ppc and ~x86. ~ia64 and ~sparc
are not inherited because other dependency is missing these keywords and
there's no chance it can get them any time soon.
Package-Manager: portage-2.3.0_rc1
Diffstat (limited to 'dev-erlang/lager')
8 files changed, 328 insertions, 0 deletions
diff --git a/dev-erlang/lager/Manifest b/dev-erlang/lager/Manifest new file mode 100644 index 000000000000..a8c6ab75913c --- /dev/null +++ b/dev-erlang/lager/Manifest @@ -0,0 +1 @@ +DIST lager-3.2.0.tar.gz 244340 SHA256 cdb1c17217497ee12175f76aacbcf0346902de4da225b08cefa6015504b48c13 SHA512 136274c8d1715d996b599317e4ac02e597c084351d3f7aea806ed9f0236a47c41dfff0b42a989dd4b6404e75e66b334600643aaec20d182edc9504d123920092 WHIRLPOOL 05a6b9f1423ca313d553f4e64a5b3d255e487c2dfade6207396f16afe42b87806545d14508d4fddeb96eec5bc3ffb368d451f64b5c90bbeb0285503137bae516 diff --git a/dev-erlang/lager/files/0001-Support-typed-records-newly-exposed-in-OTP-19.patch b/dev-erlang/lager/files/0001-Support-typed-records-newly-exposed-in-OTP-19.patch new file mode 100644 index 000000000000..b9ade5f5698f --- /dev/null +++ b/dev-erlang/lager/files/0001-Support-typed-records-newly-exposed-in-OTP-19.patch @@ -0,0 +1,55 @@ +From d35670e01a3c6f9f9bcb3150217d26cc92513586 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Johannes=20Wei=C3=9Fl?= <jargon@molb.org> +Date: Sun, 21 Feb 2016 14:22:28 +0100 +Subject: [PATCH 1/5] Support typed records newly exposed in OTP 19 + +Otherwise `lager_transform` fails after https://github.com/erlang/otp/commit/de9012628a6b0e97d2f1325bf2f72817f69f84ee + +The error message is: + + test/pr_nested_record_test.erl: error in parse transform 'lager_transform': {function_clause, + [{lager_transform, + '-walk_ast/2-fun-0-', + [{typed_record_field, + {record_field,5, + {atom,5,field1}}, + {type,5,term,[]}}], + [{file, + "src/lager_transform.erl"}, + {line,62}]}, +--- + src/lager_transform.erl | 13 ++++++++----- + 1 file changed, 8 insertions(+), 5 deletions(-) + +diff --git a/src/lager_transform.erl b/src/lager_transform.erl +index 7648c46..8cea5a3 100644 +--- a/src/lager_transform.erl ++++ b/src/lager_transform.erl +@@ -59,16 +59,19 @@ walk_ast(Acc, [{function, Line, Name, Arity, Clauses}|T]) -> + walk_ast([{function, Line, Name, Arity, + walk_clauses([], Clauses)}|Acc], T); + walk_ast(Acc, [{attribute, _, record, {Name, Fields}}=H|T]) -> +- FieldNames = lists:map(fun({record_field, _, {atom, _, FieldName}}) -> +- FieldName; +- ({record_field, _, {atom, _, FieldName}, _Default}) -> +- FieldName +- end, Fields), ++ FieldNames = lists:map(fun record_field_name/1, Fields), + stash_record({Name, FieldNames}), + walk_ast([H|Acc], T); + walk_ast(Acc, [H|T]) -> + walk_ast([H|Acc], T). + ++record_field_name({record_field, _, {atom, _, FieldName}}) -> ++ FieldName; ++record_field_name({record_field, _, {atom, _, FieldName}, _Default}) -> ++ FieldName; ++record_field_name({typed_record_field, Field, _Type}) -> ++ record_field_name(Field). ++ + walk_clauses(Acc, []) -> + lists:reverse(Acc); + walk_clauses(Acc, [{clause, Line, Arguments, Guards, Body}|T]) -> +-- +2.8.3 + diff --git a/dev-erlang/lager/files/0002-Fix-get_env-bug.patch b/dev-erlang/lager/files/0002-Fix-get_env-bug.patch new file mode 100644 index 000000000000..51972d8c4fcd --- /dev/null +++ b/dev-erlang/lager/files/0002-Fix-get_env-bug.patch @@ -0,0 +1,63 @@ +From 4c87abcd4f9d70a1136fff8f573dc7adcc833e43 Mon Sep 17 00:00:00 2001 +From: Alexander Petrovsky <askjuise@gmail.com> +Date: Tue, 10 May 2016 22:37:22 +0300 +Subject: [PATCH 2/5] Fix get_env bug + +--- + src/lager_app.erl | 20 +++++++++++--------- + 1 file changed, 11 insertions(+), 9 deletions(-) + +diff --git a/src/lager_app.erl b/src/lager_app.erl +index 8f1464d..8efd26b 100644 +--- a/src/lager_app.erl ++++ b/src/lager_app.erl +@@ -138,11 +138,10 @@ maybe_install_sink_killer(_Sink, HWM, ReinstallTimer) -> + error_logger:error_msg("Invalid value for 'killer_hwm': ~p or 'killer_reinstall_after': ~p", [HWM, ReinstallTimer]), + throw({error, bad_config}). + +-start_error_logger_handler({ok, false}, _HWM, _Whitelist) -> ++-spec start_error_logger_handler(boolean(), pos_integer(), list()) -> list(). ++start_error_logger_handler(false, _HWM, _Whitelist) -> + []; +-start_error_logger_handler(_, HWM, undefined) -> +- start_error_logger_handler(ignore_me, HWM, {ok, []}); +-start_error_logger_handler(_, HWM, {ok, WhiteList}) -> ++start_error_logger_handler(true, HWM, WhiteList) -> + GlStrategy = case application:get_env(lager, error_logger_groupleader_strategy) of + undefined -> + handle; +@@ -200,13 +199,16 @@ configure_extra_sinks(Sinks) -> + lists:foreach(fun({Sink, Proplist}) -> configure_sink(Sink, Proplist) end, + Sinks). + ++-spec get_env(atom(), atom()) -> term(). + get_env(Application, Key) -> + get_env(Application, Key, undefined). ++ + %% R15 doesn't know about application:get_env/3 ++-spec get_env(atom(), atom(), term()) -> term(). + get_env(Application, Key, Default) -> +- get_env_default(application:get_env(Application, Key), +- Default). ++ get_env_default(application:get_env(Application, Key), Default). + ++-spec get_env_default('undefined' | {'ok', term()}, term()) -> term(). + get_env_default(undefined, Default) -> + Default; + get_env_default({ok, Value}, _Default) -> +@@ -235,9 +237,9 @@ boot() -> + lager:update_loglevel_config(?DEFAULT_SINK), + + SavedHandlers = start_error_logger_handler( +- get_env(lager, error_logger_redirect), +- interpret_hwm(get_env(lager, error_logger_hwm)), +- get_env(lager, error_logger_whitelist) ++ get_env(lager, error_logger_redirect, true), ++ interpret_hwm(get_env(lager, error_logger_hwm, 0)), ++ get_env(lager, error_logger_whitelist, []) + ), + + SavedHandlers. +-- +2.8.3 + diff --git a/dev-erlang/lager/files/0003-Add-get_env-unit-test.patch b/dev-erlang/lager/files/0003-Add-get_env-unit-test.patch new file mode 100644 index 000000000000..affc347fdc45 --- /dev/null +++ b/dev-erlang/lager/files/0003-Add-get_env-unit-test.patch @@ -0,0 +1,64 @@ +From 09aee4b601e0a11b31e99392bdb14ec67a79c80f Mon Sep 17 00:00:00 2001 +From: Alexander Petrovsky <askjuise@gmail.com> +Date: Wed, 11 May 2016 22:52:09 +0300 +Subject: [PATCH 3/5] Add get_env unit test + +--- + rebar.config | 4 +++- + test/lager_app_tests.erl | 22 ++++++++++++++++++++++ + 2 files changed, 25 insertions(+), 1 deletion(-) + create mode 100644 test/lager_app_tests.erl + +diff --git a/rebar.config b/rebar.config +index 77272c7..278df9c 100644 +--- a/rebar.config ++++ b/rebar.config +@@ -40,9 +40,12 @@ + + {eunit_opts, [verbose]}. + {eunit_compile_opts, [ ++ export_all, ++ + nowarn_untyped_record, + nowarn_export_all + ]}. ++ + {deps, [ + {goldrush, ".*", {git, "git://github.com/DeadZen/goldrush.git", {tag, "0.1.8"}}} + ]}. +@@ -53,4 +56,3 @@ + {cover_enabled, true}. + {edoc_opts, [{stylesheet_file, "./priv/edoc.css"}]}. + +-{eunit_opts, [verbose]}. +diff --git a/test/lager_app_tests.erl b/test/lager_app_tests.erl +new file mode 100644 +index 0000000..80fe985 +--- /dev/null ++++ b/test/lager_app_tests.erl +@@ -0,0 +1,22 @@ ++-module(lager_app_tests). ++ ++-compile([{parse_transform, lager_transform}]). ++ ++-include_lib("eunit/include/eunit.hrl"). ++ ++ ++get_env_default_test() -> ++ ?assertEqual(<<"Some">>, lager_app:get_env_default(undefined, <<"Some">>)), ++ ?assertEqual(<<"Value">>, lager_app:get_env_default({ok, <<"Value">>}, <<"Some">>)), ++ ok. ++ ++get_env_test() -> ++ application:set_env(myapp, mykey1, <<"Value">>), ++ ++ ?assertEqual(<<"Some">>, lager_app:get_env(myapp, mykey0, <<"Some">>)), ++ ?assertEqual(<<"Value">>, lager_app:get_env(myapp, mykey1, <<"Some">>)), ++ ++ ?assertEqual(undefined, lager_app:get_env(myapp, mykey0)), ++ ?assertEqual(<<"Value">>, lager_app:get_env(myapp, mykey1)), ++ ok. ++ +-- +2.8.3 + diff --git a/dev-erlang/lager/files/0004-Undo-unnecessary-whitespace.patch b/dev-erlang/lager/files/0004-Undo-unnecessary-whitespace.patch new file mode 100644 index 000000000000..cefbc7ea4203 --- /dev/null +++ b/dev-erlang/lager/files/0004-Undo-unnecessary-whitespace.patch @@ -0,0 +1,71 @@ +From 0d428368e3c71fdefab39927ca142e3bccabd543 Mon Sep 17 00:00:00 2001 +From: "John R. Daily" <git@epep.us> +Date: Thu, 19 May 2016 14:55:51 -0400 +Subject: [PATCH 4/5] * Undo unnecessary whitespace * Make + lager_handler_watcher test more resilient by scanning for messages of + interest rather than assuming we know exactly what messages will arrive at + the test backend + +--- + src/lager_app.erl | 4 ++-- + src/lager_handler_watcher.erl | 22 ++++++++++++++++------ + 2 files changed, 18 insertions(+), 8 deletions(-) + +diff --git a/src/lager_app.erl b/src/lager_app.erl +index 8efd26b..7b02e54 100644 +--- a/src/lager_app.erl ++++ b/src/lager_app.erl +@@ -237,9 +237,9 @@ boot() -> + lager:update_loglevel_config(?DEFAULT_SINK), + + SavedHandlers = start_error_logger_handler( +- get_env(lager, error_logger_redirect, true), ++ get_env(lager, error_logger_redirect, true), + interpret_hwm(get_env(lager, error_logger_hwm, 0)), +- get_env(lager, error_logger_whitelist, []) ++ get_env(lager, error_logger_whitelist, []) + ), + + SavedHandlers. +diff --git a/src/lager_handler_watcher.erl b/src/lager_handler_watcher.erl +index d5fe140..4e595e4 100644 +--- a/src/lager_handler_watcher.erl ++++ b/src/lager_handler_watcher.erl +@@ -178,12 +178,10 @@ reinstall_on_runtime_failure_test_() -> + try + ?assert(lists:member(lager_crash_backend, gen_event:which_handlers(lager_event))), + timer:sleep(6000), +- _ = lager_test_backend:pop(), %% throw away application start up message +- _ = lager_test_backend:pop(), %% throw away gen_event crash message +- {_Severity, _Date, Msg, _Metadata} = lager_test_backend:pop(), +- ?assertEqual("Lager event handler lager_crash_backend exited with reason crash", lists:flatten(Msg)), +- {_Severity2, _Date2, Msg2, _Metadata2} = lager_test_backend:pop(), +- ?assertMatch("Lager failed to install handler lager_crash_backend into lager_event, retrying later :"++_, lists:flatten(Msg2)), ++ ++ pop_until("Lager event handler lager_crash_backend exited with reason crash", fun lists:flatten/1), ++ pop_until("Lager failed to install handler lager_crash_backend into lager_event, retrying later", ++ fun(Msg) -> string:substr(lists:flatten(Msg), 1, 84) end), + ?assertEqual(false, lists:member(lager_crash_backend, gen_event:which_handlers(lager_event))) + after + application:stop(lager), +@@ -194,5 +192,17 @@ reinstall_on_runtime_failure_test_() -> + ] + }. + ++pop_until(String, Fun) -> ++ try_backend_pop(lager_test_backend:pop(), String, Fun). ++ ++try_backend_pop(undefined, String, _Fun) -> ++ throw("Not found: " ++ String); ++try_backend_pop({_Severity, _Date, Msg, _Metadata}, String, Fun) -> ++ case Fun(Msg) of ++ String -> ++ ok; ++ _ -> ++ try_backend_pop(lager_test_backend:pop(), String, Fun) ++ end. + + -endif. +-- +2.8.3 + diff --git a/dev-erlang/lager/files/0005-R15-does-not-appear-to-properly-handle-the-export.patch b/dev-erlang/lager/files/0005-R15-does-not-appear-to-properly-handle-the-export.patch new file mode 100644 index 000000000000..9c27abd5c430 --- /dev/null +++ b/dev-erlang/lager/files/0005-R15-does-not-appear-to-properly-handle-the-export.patch @@ -0,0 +1,25 @@ +From 124ba14f188fd3b63735b73828fa3d99ebfdb7af Mon Sep 17 00:00:00 2001 +From: "John R. Daily" <git@epep.us> +Date: Thu, 19 May 2016 15:26:02 -0400 +Subject: [PATCH 5/5] R15 does not appear to properly handle the export_all + directive added to rebar.config + +--- + src/lager_app.erl | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/lager_app.erl b/src/lager_app.erl +index 7b02e54..b76da53 100644 +--- a/src/lager_app.erl ++++ b/src/lager_app.erl +@@ -23,6 +23,7 @@ + -behaviour(application). + -include("lager.hrl"). + -ifdef(TEST). ++-compile([export_all]). + -include_lib("eunit/include/eunit.hrl"). + -endif. + -export([start/0, +-- +2.8.3 + diff --git a/dev-erlang/lager/lager-3.2.0.ebuild b/dev-erlang/lager/lager-3.2.0.ebuild new file mode 100644 index 000000000000..4f23bbebbc46 --- /dev/null +++ b/dev-erlang/lager/lager-3.2.0.ebuild @@ -0,0 +1,35 @@ +# Copyright 1999-2016 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI=6 + +inherit rebar + +DESCRIPTION="Logging framework for Erlang/OTP" +HOMEPAGE="https://github.com/basho/lager" +SRC_URI="https://github.com/basho/${PN}/archive/${PV}.tar.gz + -> ${P}.tar.gz" + +LICENSE="Apache-2.0" +SLOT="0" +KEYWORDS="~amd64 ~arm ~ppc ~x86" + +DEPEND=">=dev-erlang/goldrush-0.1.7 + >=dev-lang/erlang-17.1" +RDEPEND="${DEPEND}" + +DOCS=( README.md TODO ) +PATCHES=( + "${FILESDIR}/0001-Support-typed-records-newly-exposed-in-OTP-19.patch" + "${FILESDIR}/0002-Fix-get_env-bug.patch" + "${FILESDIR}/0003-Add-get_env-unit-test.patch" + "${FILESDIR}/0004-Undo-unnecessary-whitespace.patch" + "${FILESDIR}/0005-R15-does-not-appear-to-properly-handle-the-export.patch" +) + +src_prepare() { + rebar_src_prepare + # 'priv' directory contains only edoc.css, but doc isn't going to be built. + rm -r "${S}/priv" +} diff --git a/dev-erlang/lager/metadata.xml b/dev-erlang/lager/metadata.xml new file mode 100644 index 000000000000..6e33fa5bbe63 --- /dev/null +++ b/dev-erlang/lager/metadata.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="person"> + <email>aidecoe@gentoo.org</email> + <name>Amadeusz Żołnowski</name> + </maintainer> + <longdescription lang="en"> + Lager (as in the beer) is a logging framework for Erlang. Its purpose + is to provide a more traditional way to perform logging in an erlang + application that plays nicely with traditional UNIX logging tools like + logrotate and syslog. + </longdescription> +</pkgmetadata> |