[erlang-meck] Update to 0.7.2 (see rhbz #854546)

Peter Lemenkov peter at fedoraproject.org
Wed Sep 5 11:55:56 UTC 2012


commit 94d4307d8ca0991ace59dcc06dd6a2c164211334
Author: Fedora Build <lemenkov at gmail.com>
Date:   Wed Sep 5 15:55:39 2012 +0400

    Update to 0.7.2 (see rhbz #854546)
    
    Signed-off-by: Fedora Build <lemenkov at gmail.com>

 .gitignore                                         |    1 +
 ...01-No-such-types-in-R12B-dict-and-boolean.patch |   77 ++++++++++++++++++++
 ...-No-such-function-in-R12B-lists-keyfind-3.patch |   26 +++++++
 erlang-meck.spec                                   |   50 +++++++++-----
 sources                                            |    2 +-
 5 files changed, 138 insertions(+), 18 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 5574daf..d6cc1f2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
 /eproxus-meck-0.7.1-0-g916844d.tar.gz
+/eproxus-meck-0.7.2-0-g2447206.tar.gz
diff --git a/erlang-meck-0001-No-such-types-in-R12B-dict-and-boolean.patch b/erlang-meck-0001-No-such-types-in-R12B-dict-and-boolean.patch
new file mode 100644
index 0000000..dee86cf
--- /dev/null
+++ b/erlang-meck-0001-No-such-types-in-R12B-dict-and-boolean.patch
@@ -0,0 +1,77 @@
+From 4211bdd9d68cd32c9ffbdc77a5443b97eba999b4 Mon Sep 17 00:00:00 2001
+From: Fedora Build <lemenkov at gmail.com>
+Date: Wed, 5 Sep 2012 15:13:22 +0400
+Subject: [PATCH 1/2] No such types in R12B - dict() and boolean()
+
+Signed-off-by: Fedora Build <lemenkov at gmail.com>
+---
+ src/meck.erl | 16 ++++++++--------
+ 1 file changed, 8 insertions(+), 8 deletions(-)
+
+diff --git a/src/meck.erl b/src/meck.erl
+index 1669c32..3e9c136 100644
+--- a/src/meck.erl
++++ b/src/meck.erl
+@@ -68,11 +68,11 @@
+ 
+ %% Records
+ -record(state, {mod :: atom(),
+-                expects :: dict(),
+-                valid = true :: boolean(),
++                expects :: term(),
++                valid = true :: bool(),
+                 history = [] :: history(),
+                 original :: term(),
+-                was_sticky :: boolean()}).
++                was_sticky :: bool()}).
+ 
+ %% Includes
+ -include("meck_abstract.hrl").
+@@ -233,7 +233,7 @@ exception(Class, Reason) when Class == throw; Class == error; Class == exit ->
+ -spec passthrough(Args::[term()]) -> no_return().
+ passthrough(Args) -> throw(passthrough_fun(Args)).
+ 
+-%% @spec validate(Mod:: atom() | list(atom())) -> boolean()
++%% @spec validate(Mod:: atom() | list(atom())) -> bool()
+ %% @doc Validate the state of the mock module(s).
+ %%
+ %% The function returns `true' if the mocked module(s) has been used
+@@ -243,7 +243,7 @@ passthrough(Args) -> throw(passthrough_fun(Args)).
+ %% (function clause) or unexpected exceptions.
+ %%
+ %% Use the {@link history/1} or {@link history/2} function to analyze errors.
+--spec validate(Mod:: atom() | [atom()]) -> boolean().
++-spec validate(Mod:: atom() | [atom()]) -> bool().
+ validate(Mod) when is_atom(Mod) ->
+     call(Mod, validate);
+ validate(Mod) when is_list(Mod) ->
+@@ -291,7 +291,7 @@ unload() -> lists:foldl(fun unload_if_mocked/2, [], registered()).
+ unload(Mod) when is_atom(Mod) -> call(Mod, stop), wait_for_exit(Mod);
+ unload(Mods) when is_list(Mods) -> lists:foreach(fun unload/1, Mods), ok.
+ 
+-%% @spec called(Mod:: atom(), Fun:: atom(), Args:: list(term())) -> boolean()
++%% @spec called(Mod:: atom(), Fun:: atom(), Args:: list(term())) -> bool()
+ %% @doc Returns whether `Mod:Func' has been called with `Args'.
+ %%
+ %% @equiv called(Mod, Fun, Args, '_')
+@@ -299,7 +299,7 @@ called(Mod, Fun, Args) ->
+     has_call({Mod, Fun, Args}, meck:history(Mod)).
+ 
+ %% @spec called(Mod:: atom(), Fun:: atom(), Args:: list(term()),
+-%%              Pid::pid()) -> boolean()
++%%              Pid::pid()) -> bool()
+ %% @doc Returns whether `Pid' has called `Mod:Func' with `Args'.
+ %%
+ %% This will check the history for the module, `Mod', to determine
+@@ -310,7 +310,7 @@ called(Mod, Fun, Args) ->
+ %% atom: ``'_' ''
+ %%
+ %% @see called/3
+--spec called(Mod::atom(), Fun::atom(), Args::list(), Pid::pid()) -> boolean().
++-spec called(Mod::atom(), Fun::atom(), Args::list(), Pid::pid()) -> bool().
+ called(Mod, Fun, Args, Pid) ->
+     has_call({Mod, Fun, Args}, meck:history(Mod, Pid)).
+ 
+-- 
+1.7.11.5
+
diff --git a/erlang-meck-0002-No-such-function-in-R12B-lists-keyfind-3.patch b/erlang-meck-0002-No-such-function-in-R12B-lists-keyfind-3.patch
new file mode 100644
index 0000000..ed8aa91
--- /dev/null
+++ b/erlang-meck-0002-No-such-function-in-R12B-lists-keyfind-3.patch
@@ -0,0 +1,26 @@
+From dcf66877aae2a1473721c399a2eb59c91feb36cb Mon Sep 17 00:00:00 2001
+From: Fedora Build <lemenkov at gmail.com>
+Date: Wed, 5 Sep 2012 15:15:35 +0400
+Subject: [PATCH 2/2] No such function in R12B - lists:keyfind/3
+
+Signed-off-by: Fedora Build <lemenkov at gmail.com>
+---
+ src/meck_mod.erl | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/meck_mod.erl b/src/meck_mod.erl
+index 22a237d..35ee3e7 100644
+--- a/src/meck_mod.erl
++++ b/src/meck_mod.erl
+@@ -50,7 +50,7 @@ abstract_code(BeamFile) ->
+ 
+ -spec add_exports([export()], erlang_form()) -> erlang_form().
+ add_exports(Exports, AbsCode) ->
+-    {attribute, Line, export, OrigExports} = lists:keyfind(export, 3, AbsCode),
++    {value, {attribute, Line, export, OrigExports}} = lists:keysearch(export, 3, AbsCode),
+     Attr = {attribute, Line, export, OrigExports ++ Exports},
+     lists:keyreplace(export, 3, AbsCode, Attr).
+ 
+-- 
+1.7.11.5
+
diff --git a/erlang-meck.spec b/erlang-meck.spec
index c3c3ac2..952b997 100644
--- a/erlang-meck.spec
+++ b/erlang-meck.spec
@@ -1,41 +1,50 @@
+%global realname meck
+%global upstream eproxus
 # Techincally, we're noarch; but erlang whose directories we install into is not.
 %global debug_package %{nil}
+%global git_tag 2447206
+%global patchnumber 0
 
-Name:           erlang-meck
-Version:        0.7.1
-Release:        4%{?dist}
+
+Name:		erlang-%{realname}
+Version:        0.7.2
+Release:        1%{?dist}
 Summary:        A mocking library for Erlang
 Group:          Development/Libraries
 License:        ASL 2.0
 URL:            http://eproxus.github.com/meck/
-# wget -O eproxus-meck-0.7.1-0-g916844d.tar.gz https://github.com/eproxus/meck/tarball/0.7.1
-Source0:        eproxus-meck-0.7.1-0-g916844d.tar.gz
+# wget --content-disposition https://github.com/eproxus/meck/tarball/0.7.2
+Source0:	%{upstream}-%{realname}-%{version}-%{patchnumber}-g%{git_tag}.tar.gz
+Patch1:		erlang-meck-0001-No-such-types-in-R12B-dict-and-boolean.patch
+Patch2:		erlang-meck-0002-No-such-function-in-R12B-lists-keyfind-3.patch
 BuildRoot:      %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
-BuildRequires:  erlang-erts
 BuildRequires:  erlang-rebar
-Requires:       erlang-compiler
-Requires:       erlang-erts
-Requires:       erlang-kernel
-Requires:       erlang-stdlib
-Requires:       erlang-tools
+Requires:       erlang-compiler%{?_isa}
+Requires:       erlang-erts%{?_isa}
+Requires:       erlang-kernel%{?_isa}
+Requires:       erlang-stdlib%{?_isa}
+# Error:erlang(cover:compile_beam/2)
+# Error:erlang(cover:get_term/1)
+# Error:erlang(cover:write/2)
+Requires:       erlang-tools%{?_isa}
 
 
 %description
-With meck you can easily mock modules in Erlang. Since meck is intended to be 
-used in testing, you can also perform some basic validations on the mocked 
+With meck you can easily mock modules in Erlang. Since meck is intended to be
+used in testing, you can also perform some basic validations on the mocked
 modules, such as making sure no function is called in a way it should not.
 
 
 %prep
-%setup -q -n eproxus-meck-a757081
+%setup -q -n %{upstream}-%{realname}-37715e6
 %if 0%{?el5}
-sed -i -e "s,boolean(),bool(),g;s,dict(),term(),g" src/meck.erl
+%patch1 -p1 -b .missing_types
+%patch2 -p1 -b .no_lists_keyfind_3
 %endif
 
 
 %build
-make %{?_smp_mflags}
-
+rebar compile -v
 
 %install
 rm -rf %{buildroot}
@@ -48,6 +57,10 @@ install -m 644 ebin/*.beam %{buildroot}%{_libdir}/erlang/lib/meck-%{version}/ebi
 rm -rf %{buildroot}
 
 
+%check
+rebar eunit -v
+
+
 %files
 %doc LICENSE README.md NOTICE
 %dir %{_libdir}/erlang/lib/meck-%{version}
@@ -57,6 +70,9 @@ rm -rf %{buildroot}
 
 
 %changelog
+* Wed Sep 05 2012 Peter Lemenkov <lemenkov at gmail.com> - 0.7.2-1
+- Ver. 0.7.2
+
 * Wed Aug 15 2012 Peter Lemenkov <lemenkov at gmail.com> - 0.7.1-4
 - Fix for EL5
 
diff --git a/sources b/sources
index 5be95c1..2f90cb6 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-899444253405caea72aa9b78340add9e  eproxus-meck-0.7.1-0-g916844d.tar.gz
+bc5f623e791e1a6470580f08050c9f47  eproxus-meck-0.7.2-0-g2447206.tar.gz


More information about the scm-commits mailing list