[erlang-getopt] Fix building on EPEL-5

Peter Lemenkov peter at fedoraproject.org
Wed Oct 6 08:10:21 UTC 2010


commit 03c151804536ac3636b9be51a50aba49473a88a8
Author: Peter Lemenkov <lemenkov at gmail.com>
Date:   Wed Oct 6 12:10:21 2010 +0400

    Fix building on EPEL-5
    
    Signed-off-by: Peter Lemenkov <lemenkov at gmail.com>

 ...-getopt-0001-No-such-type-boolean-in-R12B.patch |   78 ++++++++++++++++++++
 erlang-getopt.spec                                 |    9 ++-
 2 files changed, 86 insertions(+), 1 deletions(-)
---
diff --git a/erlang-getopt-0001-No-such-type-boolean-in-R12B.patch b/erlang-getopt-0001-No-such-type-boolean-in-R12B.patch
new file mode 100644
index 0000000..32456e5
--- /dev/null
+++ b/erlang-getopt-0001-No-such-type-boolean-in-R12B.patch
@@ -0,0 +1,78 @@
+From 56adf996e35ec04d950ae18f91660ef04210da69 Mon Sep 17 00:00:00 2001
+From: Peter Lemenkov <lemenkov at gmail.com>
+Date: Wed, 6 Oct 2010 12:02:19 +0400
+Subject: [PATCH] No such type - boolean() in R12B
+
+Signed-off-by: Peter Lemenkov <lemenkov at gmail.com>
+---
+ src/getopt.erl |   14 +++++++-------
+ 1 files changed, 7 insertions(+), 7 deletions(-)
+
+diff --git a/src/getopt.erl b/src/getopt.erl
+index 25ceab5..0ae1625 100644
+--- a/src/getopt.erl
++++ b/src/getopt.erl
+@@ -31,7 +31,7 @@
+ %% Atom indicating the data type that an argument can be converted to.
+ -type arg_type() :: 'atom' | 'binary' | 'boolean' | 'float' | 'integer' | 'string'.
+ %% Data type that an argument can be converted to.
+--type arg_value() :: atom() | binary() | boolean() | float() | integer() | string().
++-type arg_value() :: atom() | binary() | bool() | float() | integer() | string().
+ %% Argument specification.
+ -type arg_spec() :: arg_type() | {arg_type(), arg_value()} | undefined.
+ %% Option type and optional default argument.
+@@ -311,7 +311,7 @@ to_type(_Type, Arg) ->
+     Arg.
+ 
+ 
+--spec is_arg_true(string()) -> boolean().
++-spec is_arg_true(string()) -> bool().
+ is_arg_true(Arg) ->
+     (Arg =:= "true") orelse (Arg =:= "t") orelse
+     (Arg =:= "yes") orelse (Arg =:= "y") orelse
+@@ -319,7 +319,7 @@ is_arg_true(Arg) ->
+     (Arg =:= "1").
+ 
+     
+--spec is_arg_false(string()) -> boolean().
++-spec is_arg_false(string()) -> bool().
+ is_arg_false(Arg) ->
+     (Arg =:= "false") orelse (Arg =:= "f") orelse
+     (Arg =:= "no") orelse (Arg =:= "n") orelse
+@@ -327,7 +327,7 @@ is_arg_false(Arg) ->
+     (Arg =:= "0").
+ 
+ 
+--spec is_valid_arg(arg_spec() | arg_type(), string()) -> boolean().
++-spec is_valid_arg(arg_spec() | arg_type(), string()) -> bool().
+ is_valid_arg({Type, _DefaultArg}, Arg) ->
+     is_valid_arg(Type, Arg);
+ is_valid_arg(boolean, Arg) ->
+@@ -340,13 +340,13 @@ is_valid_arg(_Type, _Arg) ->
+     true.
+ 
+ 
+--spec is_boolean_arg(string()) -> boolean().
++-spec is_boolean_arg(string()) -> bool().
+ is_boolean_arg(Arg) ->
+     LowerArg = string:to_lower(Arg),
+     is_arg_true(LowerArg) orelse is_arg_false(LowerArg).
+ 
+ 
+--spec is_integer_arg(string()) -> boolean().
++-spec is_integer_arg(string()) -> bool().
+ is_integer_arg([Head | Tail]) when Head >= $0, Head =< $9 ->
+     is_integer_arg(Tail);
+ is_integer_arg([_Head | _Tail]) ->
+@@ -355,7 +355,7 @@ is_integer_arg([]) ->
+     true.
+ 
+ 
+--spec is_float_arg(string()) -> boolean().
++-spec is_float_arg(string()) -> bool().
+ is_float_arg([Head | Tail]) when (Head >= $0 andalso Head =< $9) orelse Head =:= $. ->
+     is_float_arg(Tail);
+ is_float_arg([_Head | _Tail]) ->
+-- 
+1.7.2.3
+
diff --git a/erlang-getopt.spec b/erlang-getopt.spec
index 59fafc5..db47826 100644
--- a/erlang-getopt.spec
+++ b/erlang-getopt.spec
@@ -5,7 +5,7 @@
 
 Name:		erlang-%{realname}
 Version:	0.3
-Release:	2%{?dist}
+Release:	3%{?dist}
 Summary:	Erlang module to parse command line arguments using the GNU getopt syntax
 
 Group:		Development/Libraries
@@ -13,6 +13,7 @@ License:	BSD
 URL:		http://github.com/jcomellas/getopt
 # wget http://github.com/jcomellas/getopt/tarball/v0.3
 Source0:	jcomellas-%{realname}-v%{version}-0-g%{git_tag}.tar.gz
+Patch1:		erlang-getopt-0001-No-such-type-boolean-in-R12B.patch
 BuildRoot:	%(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
 
 BuildRequires:	erlang-erts
@@ -27,6 +28,9 @@ Command-line parsing module that uses a syntax similar to that of GNU getopt.
 
 %prep
 %setup -q -n jcomellas-%{realname}-8f54692
+%if 0%{?el5}
+%patch1 -p1 -b .unknown_type_boolean
+%endif
 chmod 0644 examples/*.escript
 
 
@@ -59,6 +63,9 @@ rm -rf $RPM_BUILD_ROOT
 
 
 %changelog
+* Wed Oct  6 2010 Peter Lemenkov <lemenkov at gmail.com> - 0.3-3
+- Fix building on EPEL-5
+
 * Tue Oct  5 2010 Peter Lemenkov <lemenkov at gmail.com> - 0.3-2
 - Fixed License tag
 - Doc-files now have 644 mode


More information about the scm-commits mailing list