Skip to content

Commit

Permalink
When local specification is specified (--spec), it should also be nor…
Browse files Browse the repository at this point in the history
…malized.
  • Loading branch information
yrashk committed Feb 13, 2011
1 parent 4a98fa0 commit e1123c2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/agner_fetch.erl
Expand Up @@ -118,7 +118,7 @@ handle_state(fetchable, #state{ opts = #opts_rec{ spec = Spec, package_path = un
%% Read specification if supplied with --spec
handle_state(fetchable, #state{ opts = #opts_rec{ spec = Spec, package_path = PackagePath } = Opts
} = State) when is_list(Spec) andalso is_list(PackagePath) ->
{ok, Spec0} = file:consult(Spec),
{ok, Spec0} = agner_spec:normalize(file:consult(Spec)),
handle_state(fetchable, State#state{ opts = Opts#opts_rec{ spec = {spec, Spec0} }, repo_dir = PackagePath } );

%% Everything is ready to go, fetch
Expand Down
9 changes: 5 additions & 4 deletions src/agner_main.erl
Expand Up @@ -210,7 +210,7 @@ handle_command(spec, Opts) ->
agner:spec(Package, Version);
File ->
{ok, T} = file:consult(File),
T
agner_spec:normalize(T)
end,
case Spec of
{error, not_found} ->
Expand Down Expand Up @@ -328,8 +328,8 @@ handle_command(uninstall, Opts) ->
undefined ->
agner:spec(Package, Version);
File ->
{ok, T} = file:consult(File),
T
{ok, T} = file:consult(File),
agner_spec:normalize(T)
end,
os:cmd("rm -rf " ++ InstallPrefix),
case proplists:get_value(bin_files, Spec) of
Expand Down Expand Up @@ -389,7 +389,8 @@ handle_command(verify, Opts) ->
case file:consult(SpecFile) of
{error, Reason} ->
io:format("ERROR: Can't read ~s: ~p~n",[SpecFile, Reason]);
{ok, Spec} ->
{ok, Spec0} ->
Spec = agner_spec:normalize(Spec0),
URL = proplists:get_value(url, Spec),
TmpFile = temp_name(),
case (catch agner_download:fetch(Spec,TmpFile)) of
Expand Down

0 comments on commit e1123c2

Please sign in to comment.