[erlang-getopt] Ver. 0.4.4

Peter Lemenkov peter at fedoraproject.org
Sat Jun 2 05:36:09 UTC 2012


commit fb02c99c1c8ff768b2a40328a35217b23092741e
Author: Peter Lemenkov <lemenkov at gmail.com>
Date:   Sat Jun 2 09:36:00 2012 +0400

    Ver. 0.4.4
    
    Signed-off-by: Peter Lemenkov <lemenkov at gmail.com>

 .gitignore                                         |    1 +
 ...-getopt-0001-No-such-type-boolean-in-R12B.patch |  105 ++++++++++----------
 ...No-such-function-lists-keyfind-3-in-R12B5.patch |    4 +-
 erlang-getopt.spec                                 |   19 ++--
 sources                                            |    2 +-
 5 files changed, 67 insertions(+), 64 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 0c8e255..9fdc836 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
 /jcomellas-getopt-v0.3-0-g8f54692.tar.gz
 /jcomellas-getopt-v0.4.3-0-g659a28f.tar.gz
+/jcomellas-getopt-v0.4.4-0-geb4a5be.tar.gz
diff --git a/erlang-getopt-0001-No-such-type-boolean-in-R12B.patch b/erlang-getopt-0001-No-such-type-boolean-in-R12B.patch
index eb8ded1..4ba3341 100644
--- a/erlang-getopt-0001-No-such-type-boolean-in-R12B.patch
+++ b/erlang-getopt-0001-No-such-type-boolean-in-R12B.patch
@@ -1,61 +1,27 @@
-From 7e20fa4755eaddc684e72ef29b1c4f21d57f3c70 Mon Sep 17 00:00:00 2001
+From de20f7669f0d1a5dc7c9a3388c4a2ff878cc75d3 Mon Sep 17 00:00:00 2001
 From: Peter Lemenkov <lemenkov at gmail.com>
 Date: Tue, 15 May 2012 22:42:30 +0400
 Subject: [PATCH 1/2] No such type - boolean() in R12B
 
 Signed-off-by: Peter Lemenkov <lemenkov at gmail.com>
 ---
- src/getopt.erl |   33 ++++++++++++++++-----------------
- 1 file changed, 16 insertions(+), 17 deletions(-)
+ src/getopt.erl       |   19 +++++++++----------
+ test/getopt_test.erl |   10 +++++-----
+ 2 files changed, 14 insertions(+), 15 deletions(-)
 
 diff --git a/src/getopt.erl b/src/getopt.erl
-index 175b7a5..b3088a6 100644
+index 175b7a5..36410f3 100644
 --- a/src/getopt.erl
 +++ b/src/getopt.erl
-@@ -36,9 +36,9 @@
- 
- 
+@@ -38,7 +38,7 @@
  %% Atom indicating the data type that an argument can be converted to.
---type arg_type() :: 'atom' | 'binary' | 'boolean' | 'float' | 'integer' | 'string'.
-+-type arg_type() :: 'atom' | 'binary' | 'bool' | 'float' | 'integer' | 'string'.
+ -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.
-@@ -316,11 +316,11 @@ add_option_with_assigned_arg({Name, _Short, _Long, ArgSpec, _Help}, Arg, OptAcc)
- 
- 
- %% @doc Add an option that required an argument but did not have one. Some data
--%%      types (boolean, integer) allow implicit or assumed arguments.
-+%%      types (bool, integer) allow implicit or assumed arguments.
- -spec add_option_with_implicit_arg(option_spec(), [option()]) -> [option()].
- add_option_with_implicit_arg({Name, _Short, _Long, ArgSpec, _Help}, OptAcc) ->
-     case arg_spec_type(ArgSpec) of
--        boolean ->
-+        bool ->
-             %% Special case for boolean arguments: if there is no argument we
-             %% set the value to 'true'.
-             [{Name, true} | OptAcc];
-@@ -338,7 +338,7 @@ add_option_with_implicit_arg({Name, _Short, _Long, ArgSpec, _Help}, OptAcc) ->
- -spec add_option_with_implicit_incrementable_arg(option_spec() | arg_spec(), [option()]) -> [option()].
- add_option_with_implicit_incrementable_arg({Name, _Short, _Long, ArgSpec, _Help}, OptAcc) ->
-     case arg_spec_type(ArgSpec) of
--        boolean ->
-+        bool ->
-             %% Special case for boolean arguments: if there is no argument we
-             %% set the value to 'true'.
-             [{Name, true} | OptAcc];
-@@ -378,7 +378,7 @@ to_type(integer, Arg) ->
-     list_to_integer(Arg);
- to_type(float, Arg) ->
-     list_to_float(Arg);
--to_type(boolean, Arg) ->
-+to_type(bool, Arg) ->
-     LowerArg = string:to_lower(Arg),
-     case is_arg_true(LowerArg) of
-         true ->
 @@ -395,15 +395,14 @@ to_type(_Type, Arg) ->
      Arg.
  
@@ -74,7 +40,7 @@ index 175b7a5..b3088a6 100644
  is_arg_false(Arg) ->
      (Arg =:= "false") orelse (Arg =:= "f") orelse
      (Arg =:= "no") orelse (Arg =:= "n") orelse
-@@ -411,10 +410,10 @@ is_arg_false(Arg) ->
+@@ -411,7 +410,7 @@ is_arg_false(Arg) ->
      (Arg =:= "0").
  
  
@@ -82,12 +48,8 @@ index 175b7a5..b3088a6 100644
 +-spec is_valid_arg(arg_spec(), nonempty_string()) -> bool().
  is_valid_arg({Type, _DefaultArg}, Arg) ->
      is_valid_arg(Type, Arg);
--is_valid_arg(boolean, Arg) ->
-+is_valid_arg(bool, Arg) ->
-     is_boolean_arg(Arg);
- is_valid_arg(integer, Arg) ->
-     is_non_neg_integer_arg(Arg);
-@@ -424,10 +423,10 @@ is_valid_arg(_Type, _Arg) ->
+ is_valid_arg(boolean, Arg) ->
+@@ -424,7 +423,7 @@ is_valid_arg(_Type, _Arg) ->
      true.
  
  
@@ -95,11 +57,7 @@ index 175b7a5..b3088a6 100644
 +-spec is_implicit_arg(arg_spec(), nonempty_string()) -> bool().
  is_implicit_arg({Type, _DefaultArg}, Arg) ->
      is_implicit_arg(Type, Arg);
--is_implicit_arg(boolean, Arg) ->
-+is_implicit_arg(bool, Arg) ->
-     not is_boolean_arg(Arg);
- is_implicit_arg(integer, Arg) ->
-     not is_integer_arg(Arg);
+ is_implicit_arg(boolean, Arg) ->
 @@ -435,20 +434,20 @@ is_implicit_arg(_Type, _Arg) ->
      false.
  
@@ -133,6 +91,47 @@ index 175b7a5..b3088a6 100644
  is_non_neg_float_arg([Head | Tail]) when (Head >= $0 andalso Head =< $9) orelse Head =:= $. ->
      is_non_neg_float_arg(Tail);
  is_non_neg_float_arg([_Head | _Tail]) ->
+diff --git a/test/getopt_test.erl b/test/getopt_test.erl
+index fa1b67d..cd17162 100644
+--- a/test/getopt_test.erl
++++ b/test/getopt_test.erl
+@@ -33,23 +33,23 @@ parse_1_test_() ->
+     Short3          = {short3,             $c,        undefined,            undefined,                      "Third option with only short form and no argument"},
+     ShortArg        = {short_arg,          $d,        undefined,            string,                         "Option with only short form and argument"},
+     ShortDefArg     = {short_def_arg,      $e,        undefined,            {string, "default-short"},      "Option with only short form and default argument"},
+-    ShortBool       = {short_bool,         $f,        undefined,            boolean,                        "Option with only short form and boolean argument"},
++    ShortBool       = {short_bool,         $f,        undefined,            bool,                        "Option with only short form and bool argument"},
+     ShortInt        = {short_int,          $g,        undefined,            integer,                        "Option with only short form and integer argument"},
+     ShortFloat      = {short_float,        $h,        undefined,            float,                          "Option with only short form and float argument"},
+     Long            = {long,               undefined, "long",               undefined,                      "Option with only long form and no argument"},
+     LongArg         = {long_arg,           undefined, "long-arg",           string,                         "Option with only long form and argument"},
+     LongDefArg      = {long_def_arg,       undefined, "long-def-arg",       {string, "default-long"},       "Option with only long form and default argument"},
+-    LongBool        = {long_bool,          undefined, "long-bool",          boolean,                        "Option with only long form and boolean argument"},
++    LongBool        = {long_bool,          undefined, "long-bool",          bool,                        "Option with only long form and bool argument"},
+     LongInt         = {long_int,           undefined, "long-int",           integer,                        "Option with only long form and integer argument"},
+     LongFloat       = {long_float,         undefined, "long-float",         float,                          "Option with only long form and float argument"},
+     ShortLong       = {short_long,         $i,        "short-long",         undefined,                      "Option with short form, long form and no argument"},
+     ShortLongArg    = {short_long_arg,     $j,        "short-long-arg",     string,                         "Option with short form, long form and argument"},
+     ShortLongDefArg = {short_long_def_arg, $k,        "short-long-def-arg", {string, "default-short-long"}, "Option with short form, long form and default argument"},
+-    ShortLongBool   = {short_long_bool,    $l,        "short-long-bool",    boolean,                        "Option with short form, long form and boolean argument"},
++    ShortLongBool   = {short_long_bool,    $l,        "short-long-bool",    bool,                        "Option with short form, long form and bool argument"},
+     ShortLongInt    = {short_long_int,     $m,        "short-long-int",     integer,                        "Option with short form, long form and integer argument"},
+     ShortLongFloat  = {short_long_float,   $n,        "short-long-float",   float,                          "Option with short form, long form and float argument"},
+     NonOptArg       = {non_opt_arg,        undefined, undefined,            undefined,                      "Non-option argument"},
+-    NonOptBool      = {non_opt_bool,       undefined, undefined,            boolean,                        "Non-option boolean argument"},
++    NonOptBool      = {non_opt_bool,       undefined, undefined,            bool,                        "Non-option bool argument"},
+     NonOptInt       = {non_opt_int,        undefined, undefined,            integer,                        "Non-option integer argument"},
+     NonOptFloat     = {non_opt_float,      undefined, undefined,            float,                          "Non-option float argument"},
+     CombinedOptSpecs =
+@@ -225,7 +225,7 @@ parse_2_test_() ->
+          {define,      $D,        "define",      string,                "Define a variable"},
+          {debug,       $d,        "debug",       integer,               "Debug level"},
+          {offset,      $o,        "offset",      float,                 "Offset"},
+-         {verbose,     $v,        "verbose",     boolean,               "Enable verbose output"}
++         {verbose,     $v,        "verbose",     bool,               "Enable verbose output"}
+         ],
+     [
+      {"Multiple repetitions of the same option",
 -- 
 1.7.10.2
 
diff --git a/erlang-getopt-0002-No-such-function-lists-keyfind-3-in-R12B5.patch b/erlang-getopt-0002-No-such-function-lists-keyfind-3-in-R12B5.patch
index 49f9a05..341a877 100644
--- a/erlang-getopt-0002-No-such-function-lists-keyfind-3-in-R12B5.patch
+++ b/erlang-getopt-0002-No-such-function-lists-keyfind-3-in-R12B5.patch
@@ -1,4 +1,4 @@
-From 857f30fa2288c3eebe46fd61ab92d89695d0737c Mon Sep 17 00:00:00 2001
+From 32a17ff108622fce2544bea43c0309cb98d9ff44 Mon Sep 17 00:00:00 2001
 From: Peter Lemenkov <lemenkov at gmail.com>
 Date: Fri, 1 Jun 2012 10:26:25 +0400
 Subject: [PATCH 2/2] No such function lists:keyfind/3 in R12B5
@@ -11,7 +11,7 @@ Signed-off-by: Peter Lemenkov <lemenkov at gmail.com>
  1 file changed, 8 insertions(+), 8 deletions(-)
 
 diff --git a/src/getopt.erl b/src/getopt.erl
-index b3088a6..27524ce 100644
+index 36410f3..556c7e6 100644
 --- a/src/getopt.erl
 +++ b/src/getopt.erl
 @@ -119,11 +119,11 @@ parse_long_option(OptSpecList, OptAcc, ArgAcc, ArgPos, Args, OptStr, OptArg) ->
diff --git a/erlang-getopt.spec b/erlang-getopt.spec
index f41e573..10bca49 100644
--- a/erlang-getopt.spec
+++ b/erlang-getopt.spec
@@ -1,23 +1,22 @@
 %global realname getopt
 %global upstream jcomellas
 %global debug_package %{nil}
-%global git_tag 659a28f
+%global git_tag eb4a5be
 %global patchnumber 0
 
 
 Name:		erlang-%{realname}
-Version:	0.4.3
-Release:	2%{?dist}
+Version:	0.4.4
+Release:	1%{?dist}
 Summary:	Erlang module to parse command line arguments using the GNU getopt syntax
 Group:		Development/Libraries
 License:	BSD
 URL:		http://github.com/jcomellas/getopt
-# wget --no-check-certificate --content-disposition https://github.com/jcomellas/getopt/tarball/v0.4.3
+# wget --no-check-certificate --content-disposition https://github.com/jcomellas/getopt/tarball/v0.4.4
 Source0:	%{upstream}-%{realname}-v%{version}-%{patchnumber}-g%{git_tag}.tar.gz
 Patch1:		erlang-getopt-0001-No-such-type-boolean-in-R12B.patch
 Patch2:		erlang-getopt-0002-No-such-function-lists-keyfind-3-in-R12B5.patch
 BuildRoot:	%(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
-BuildRequires:	erlang-erts
 BuildRequires:	erlang-rebar
 Requires:	erlang-erts >= R12B
 Requires:	erlang-stdlib >= R12B
@@ -26,6 +25,7 @@ Requires:	erlang-stdlib >= R12B
 %description
 Command-line parsing module that uses a syntax similar to that of GNU getopt.
 
+
 %prep
 %setup -q -n %{upstream}-%{realname}-%{git_tag}
 %if 0%{?el5}
@@ -36,12 +36,12 @@ chmod 0644 examples/*.escript
 
 
 %build
-make %{?_smp_mflags}
-make doc
+rebar compile -v
+rebar doc -v
 
 
 %check
-make test
+rebar eunit -v
 
 
 %install
@@ -64,6 +64,9 @@ rm -rf $RPM_BUILD_ROOT
 
 
 %changelog
+* Sat Jun 02 2012 Peter Lemenkov <lemenkov at gmail.com> - 0.4.4-1
+- Ver. 0.4.4
+
 * Fri Jun 01 2012 Peter Lemenkov <lemenkov at gmail.com> - 0.4.3-2
 - Fix building on EPEL-5 (again)
 - Enabled tests
diff --git a/sources b/sources
index 20a6044..41b0f2c 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-9562005ca3bd7422cc27233370fad48e  jcomellas-getopt-v0.4.3-0-g659a28f.tar.gz
+80503841a9ca931605910e2ec02824dc  jcomellas-getopt-v0.4.4-0-geb4a5be.tar.gz


More information about the scm-commits mailing list