aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric <[email protected]>2012-10-23 09:49:06 -0500
committerJordan Wilberding <[email protected]>2012-10-24 11:30:00 -0600
commitd880e6e385ac49ecfe67449a25c1fd95b4e1f882 (patch)
tree475033c35342f91e926cbed7dbd3354e0d71b722
parentfa52e19b4990a17eb7efbafc0364c0c686d7b770 (diff)
downloadrelx-d880e6e385ac49ecfe67449a25c1fd95b4e1f882.tar.gz
relx-d880e6e385ac49ecfe67449a25c1fd95b4e1f882.tar.bz2
relx-d880e6e385ac49ecfe67449a25c1fd95b4e1f882.zip
fix bug in goal parsing and handling
Signed-off-by: Jordan Wilberding <[email protected]>
-rw-r--r--src/rcl_goal.peg9
-rw-r--r--src/rcl_release.erl4
-rw-r--r--test/rclt_command_SUITE.erl8
-rw-r--r--test/rclt_goal.erl30
4 files changed, 26 insertions, 25 deletions
diff --git a/src/rcl_goal.peg b/src/rcl_goal.peg
index 24e78a8..bfac607 100644
--- a/src/rcl_goal.peg
+++ b/src/rcl_goal.peg
@@ -6,15 +6,15 @@ constraint <- ws? app_name ws? between_op ws? version ws? "," ws? version ws?
`
case Node of
[_,AppName,_, _] ->
- {ok, erlang:iolist_to_binary(AppName)};
+ {ok, AppName};
[_,AppName,_,Op,_,Vsn,_, _] ->
{ok,
- {erlang:iolist_to_binary(AppName),
+ {AppName,
rcl_goal_utils:to_vsn(Vsn),
rcl_goal_utils:to_op(Op)}};
[_,AppName,_,Op,_,Vsn1,_,_,_,Vsn2,_,_] ->
{ok,
- {erlang:iolist_to_binary(AppName),
+ {AppName,
rcl_goal_utils:to_vsn(Vsn1),
rcl_goal_utils:to_vsn(Vsn2),
rcl_goal_utils:to_op(Op)}};
@@ -25,7 +25,8 @@ constraint <- ws? app_name ws? between_op ws? version ws? "," ws? version ws?
ws <- [ \t\n\s\r] ;
-app_name <- [a-zA-Z0-9_]+ ;
+app_name <- [a-zA-Z0-9_]+
+ ` erlang:list_to_atom(erlang:binary_to_list(erlang:iolist_to_binary(Node))) ` ;
between_op <-
":" ws? ( "btwn" / "between" ) ws? ":"
diff --git a/src/rcl_release.erl b/src/rcl_release.erl
index f1a439c..dd3e479 100644
--- a/src/rcl_release.erl
+++ b/src/rcl_release.erl
@@ -288,9 +288,9 @@ parse_goal0(Constraint0, {ok, Release = #release_t{goals=Goals}})
parse_goal0(Constraint0, {ok, Release = #release_t{goals=Goals}})
when erlang:is_list(Constraint0) ->
case rcl_goal:parse(Constraint0) of
- {error, _Detail} ->
+ {fail, _Detail} ->
?RCL_ERROR({failed_to_parse, Constraint0});
- Constraint1 ->
+ {ok, Constraint1} ->
{ok, Release#release_t{goals = [Constraint1 | Goals]}}
end;
parse_goal0(_, E = {error, _}) ->
diff --git a/test/rclt_command_SUITE.erl b/test/rclt_command_SUITE.erl
index fa4fc23..46449e9 100644
--- a/test/rclt_command_SUITE.erl
+++ b/test/rclt_command_SUITE.erl
@@ -65,11 +65,11 @@ normal_passing_case(Config) ->
rcl_state:lib_dirs(State)),
?assertMatch(Outdir, rcl_state:output_dir(State)),
- ?assertMatch([{<<"app1">>,{{33,33},{[],[<<"build4">>]}},lte},
- {<<"app2">>,
+ ?assertMatch([{app1,{{33,33},{[],[<<"build4">>]}},lte},
+ {app2,
{{33,22},{[],[]}},
- {{45,22},{[],[<<"build">>,21]}},
- between}], rcl_state:goals(State)).
+ {{45,22},{[],[<<"build">>,21]}}, between}],
+ rcl_state:goals(State)).
lib_fail_case(Config) ->
diff --git a/test/rclt_goal.erl b/test/rclt_goal.erl
index 9fd31ae..9bf6028 100644
--- a/test/rclt_goal.erl
+++ b/test/rclt_goal.erl
@@ -23,35 +23,35 @@
-include_lib("eunit/include/eunit.hrl").
parse_test() ->
- ?assertMatch({ok, <<"getopt">>},
+ ?assertMatch({ok, getopt},
rcl_goal:parse("getopt")),
- ?assertMatch({ok, {<<"getopt">>, {{0,5,1},{[],[]}}, '='}},
+ ?assertMatch({ok, {getopt, {{0,5,1},{[],[]}}, '='}},
rcl_goal:parse("getopt=0.5.1")),
- ?assertMatch({ok, {<<"getopt">>, {{0,5,1},{[],[]}}, '='}},
+ ?assertMatch({ok, {getopt, {{0,5,1},{[],[]}}, '='}},
rcl_goal:parse("getopt:0.5.1")),
- ?assertMatch({ok, {<<"getopt">>, {{0,5,1},{[],[]}}, '='}},
+ ?assertMatch({ok, {getopt, {{0,5,1},{[],[]}}, '='}},
rcl_goal:parse("getopt-0.5.1")),
- ?assertMatch({ok, {<<"getopt">>, {{0,5,1},{[],[]}}, gte}},
+ ?assertMatch({ok, {getopt, {{0,5,1},{[],[]}}, gte}},
rcl_goal:parse("getopt >= 0.5.1")),
- ?assertMatch({ok, {<<"getopt">>, {{0,5,1},{[],[]}}, gte}},
+ ?assertMatch({ok, {getopt, {{0,5,1},{[],[]}}, gte}},
rcl_goal:parse("getopt:gte:0.5.1")),
- ?assertMatch({ok, {<<"getopt">>, {{0,5,1},{[],[]}}, gt}},
+ ?assertMatch({ok, {getopt, {{0,5,1},{[],[]}}, gt}},
rcl_goal:parse("getopt>0.5.1")),
- ?assertMatch({ok, {<<"getopt">>, {{0,5,1},{[],[]}}, gt}},
+ ?assertMatch({ok, {getopt, {{0,5,1},{[],[]}}, gt}},
rcl_goal:parse("getopt:gt:0.5.1")),
- ?assertMatch({ok, {<<"getopt">>, {{0,5,1},{[],[]}}, lte}},
+ ?assertMatch({ok, {getopt, {{0,5,1},{[],[]}}, lte}},
rcl_goal:parse("getopt<= 0.5.1")),
- ?assertMatch({ok, {<<"getopt">>, {{0,5,1},{[],[]}}, lte}},
+ ?assertMatch({ok, {getopt, {{0,5,1},{[],[]}}, lte}},
rcl_goal:parse("getopt:lte:0.5.1")),
- ?assertMatch({ok, {<<"getopt">>, {{0,5,1},{[],[]}}, lt}},
+ ?assertMatch({ok, {getopt, {{0,5,1},{[],[]}}, lt}},
rcl_goal:parse("getopt<0.5.1")),
- ?assertMatch({ok, {<<"getopt">>, {{0,5,1},{[],[]}}, pes}},
+ ?assertMatch({ok, {getopt, {{0,5,1},{[],[]}}, pes}},
rcl_goal:parse("getopt ~>0.5.1")),
- ?assertMatch({ok, {<<"getopt">>, {{0,5,1},{[],[]}}, pes}},
+ ?assertMatch({ok, {getopt, {{0,5,1},{[],[]}}, pes}},
rcl_goal:parse("getopt: pes:0.5.1")),
- ?assertMatch({ok, {<<"getopt">>, {{0,5,1},{[],[]}}, {{0,6,1},{[],[]}}, between}},
+ ?assertMatch({ok, {getopt, {{0,5,1},{[],[]}}, {{0,6,1},{[],[]}}, between}},
rcl_goal:parse("getopt:btwn:0.5.1,0.6.1")),
- ?assertMatch({ok, {<<"getopt">>, {{0,5,1},{[],[]}}, {{0,6,1},{[],[]}}, between}},
+ ?assertMatch({ok, {getopt, {{0,5,1},{[],[]}}, {{0,6,1},{[],[]}}, between}},
rcl_goal:parse("getopt:between :0.5.1,0.6.1")).
fail_test() ->