Skip to content

Commit

Permalink
Merge branch 'master' into auto-publish
Browse files Browse the repository at this point in the history
  • Loading branch information
jdavisp3 committed Jul 26, 2008
2 parents d44f5d6 + 5fdfd18 commit 0b2bf08
Show file tree
Hide file tree
Showing 12 changed files with 91 additions and 29 deletions.
2 changes: 1 addition & 1 deletion _build.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
project : {
name : faxien
vsn : "0.31.0.0"
vsn : "0.31.0.2"
},

repositories : ["http://repo.martinjlogan.com/pub", "http://repo.erlware.org/pub"],
4 changes: 2 additions & 2 deletions bin/epkg
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ PREFIX=$(cd $(dirname $(dirname $PROG)); pwd)

#### Fill in values for these variables ####
REL_NAME=faxien
REL_VSN=0.31.0.0
ERTS_VSN=5.6.2
REL_VSN=0.31.0.2
ERTS_VSN=5.6.3
INVOCATION_SUFFIX="-s epkg cmdln_apply epkg $@ -s init stop -noshell -prefix $PREFIX"
###########################################

Expand Down
4 changes: 2 additions & 2 deletions bin/faxien
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ PREFIX=$(cd $(dirname $(dirname $PROG)); pwd)

#### Fill in values for these variables ####
REL_NAME=faxien
REL_VSN=0.31.0.0
ERTS_VSN=5.6.2
REL_VSN=0.31.0.2
ERTS_VSN=5.6.3
INVOCATION_SUFFIX="-s faxien cmdln_apply faxien $@ -s init stop -noshell -prefix $PREFIX"
###########################################

Expand Down
2 changes: 1 addition & 1 deletion lib/epkg/ebin/epkg.app
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{description, "Manages local erlang/OTP packages. Faxien depends on this for local operations."},

% The version of the applicaton
{vsn, "0.4.2.1"},
{vsn, "0.5.0.0"},

% All modules used by the application.
{modules,
Expand Down
11 changes: 5 additions & 6 deletions lib/epkg/src/epkg.erl
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,9 @@ list_help() ->
list_lib() ->
{ok, InstallationPath} = epkg_installed_paths:get_installation_path(),
{ok, TargetErtsVsn} = gas:get_env(epkg, target_erts_vsn, ewr_util:erts_version()),
LowerBoundErtsVsn = epkg_util:erts_lower_bound_from_target(TargetErtsVsn),
Series = epkg_util:erts_series(TargetErtsVsn),
Series = epkg_util:all_erts_vsns(TargetErtsVsn),
NameVsnsPairs = collect_dups(epkg_manage:list_lib(InstallationPath, Series)),
io:format("~nInstalled Applications for ERTS versions between ~s and ~s:~n", [LowerBoundErtsVsn, TargetErtsVsn]),
io:format("~nInstalled Applications for ERTS versions between ~s and ~s:~n", [hd(Series), hd(lists:reverse(Series))]),
print_installed(NameVsnsPairs).

%%--------------------------------------------------------------------
Expand All @@ -224,10 +223,10 @@ list_lib() ->
list_releases() ->
{ok, InstallationPath} = epkg_installed_paths:get_installation_path(),
{ok, TargetErtsVsn} = gas:get_env(epkg, target_erts_vsn, ewr_util:erts_version()),
LowerBoundErtsVsn = epkg_util:erts_lower_bound_from_target(TargetErtsVsn),
NameVsnsPairs = collect_dups(epkg_manage:list_releases(InstallationPath, TargetErtsVsn)),
Series = epkg_util:all_erts_vsns(TargetErtsVsn),
NameVsnsPairs = collect_dups(epkg_manage:list_releases(InstallationPath, Series)),
io:format("~nInstalled Releases (Erlang standalone services) for ERTS versions between ~s and ~s:~n",
[LowerBoundErtsVsn, TargetErtsVsn]),
[hd(Series), hd(lists:reverse(Series))]),
print_installed(NameVsnsPairs).

%%--------------------------------------------------------------------
Expand Down
19 changes: 14 additions & 5 deletions lib/epkg/src/epkg_manage.erl
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ list_lib_for_erts_vsn(InstallationPath, ErtsVsn) ->
%% @doc
%% Returns a list of all releases currently installed.
%% @spec list_all_releases(InstallationPath) -> [{Name, Vsn}]
%% where
%% TargetErtsVsns = [TargetErtsVsn] | TargetErtsVsns
%% TargetErtsVsn = string()
%% @end
%%--------------------------------------------------------------------
list_all_releases(InstallationPath) ->
Expand All @@ -74,14 +77,20 @@ list_all_releases(InstallationPath) ->
%%--------------------------------------------------------------------
%% @doc
%% Returns a list of all releases currently installed.
%% @spec list_releases(InstallationPath, TargetErtsVsn) -> [{Name, Vsn}]
%% @spec list_releases(InstallationPath, TargetErtsVsns) -> [{Name, Vsn}]
%% where
%% TargetErtsVsns = [TargetErtsVsn] | TargetErtsVsns
%% TargetErtsVsn = string()
%% @end
%%--------------------------------------------------------------------
list_releases(InstallationPath, TargetErtsVsn) ->
Series = epkg_util:erts_series(TargetErtsVsn),
?INFO_MSG("listing lib dirs for erts vsns ~p~n", [Series]),
list_releases(InstallationPath, [A|_] = TargetErtsVsn) when is_integer(A) ->
list_releases(InstallationPath, [TargetErtsVsn]);
list_releases(InstallationPath, TargetErtsVsns) ->
?INFO_MSG("listing lib dirs for erts vsns ~p~n", [TargetErtsVsns]),
lists:sort(fun({N, _}, {N1, _}) -> N > N1 end,
lists:flatten([lists:map(fun(ErtsVsn) -> list_releases_for_erts_vsn(InstallationPath, ErtsVsn) end, Series)])).
lists:flatten([
lists:map(fun(ErtsVsn) -> list_releases_for_erts_vsn(InstallationPath, ErtsVsn) end, TargetErtsVsns)
])).

list_releases_for_erts_vsn(InstallationPath, ErtsVsn) ->
RelDir = ewl_installed_paths:release_container_path(InstallationPath),
Expand Down
19 changes: 19 additions & 0 deletions lib/epkg/src/epkg_util.erl
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
unpack_to_tmp_if_archive/1,
foreach_erts_vsn/3,
foreach_erts_vsn/2,
all_erts_vsns/0,
all_erts_vsns/1,
erts_series/2,
erts_series/1,
erts_lower_bound_from_target/1,
Expand Down Expand Up @@ -221,6 +223,23 @@ erts_lower_bound_from_target(TargetErtsVsn) ->
[MajorErtsVsn, MinorErtsVsn|_] = string:tokens(TargetErtsVsn, "."),
lists:flatten([MajorErtsVsn,".", MinorErtsVsn]).

%%--------------------------------------------------------------------
%% @doc return all known erts vsns
%% @spec () -> string()
%% @end
%%--------------------------------------------------------------------
all_erts_vsns() ->
[ErtsVsn || {_, ErtsVsn, _} <- ?COMPILER_VSN_TO_ERTS_VSN_TO_ERLANG_VSN].

%%--------------------------------------------------------------------
%% @doc return all known erts vsns where the versions are greater or
%% equal to the LowBound
%% @spec (LowBound::string()) -> string()
%% @end
%%--------------------------------------------------------------------
all_erts_vsns(LowBound) ->
[ErtsVsn || ErtsVsn <- all_erts_vsns(), ewr_util:is_version_greater(ErtsVsn, LowBound) orelse LowBound == ErtsVsn].

%%----------------------------------------------------------------------------
%% @doc Checks to see if a list is a string.
%% @spec is_string(List) -> bool()
Expand Down
2 changes: 1 addition & 1 deletion lib/faxien/ebin/faxien.app
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{description, "The erlang package management tool."},

% The version of the applicaton
{vsn, "0.31.0.0"},
{vsn, "0.31.0.2"},

% All modules used by the application.
{modules,
Expand Down
3 changes: 3 additions & 0 deletions lib/faxien/include/faxien.hrl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
%% Must be a list of tuples of strings. Commands can use either the _ or the - separator notation.
-define(ALIAS_LIST, [
{"upgrade", "upgrade-release"},
{"env", "environment"},
{"uar", "upgrade-all-releases"},
{"uaa", "upgrade-all-apps"},
{"ur", "upgrade-release"},
Expand All @@ -16,10 +17,12 @@
{"p", "publish"},
{"ar", "add-repo"},
{"sr", "show-repos"},
{"rrp", "remove-repo"},
{"apr", "add-publish-repo"},
{"spr", "show-publish-repos"},
{"rpr", "remove-publish-repo"},
{"stev", "set-target-erts-vsn"},
{"shtev", "show-target-erts-vsn"},
{"or", "outdated-releases"},
{"rr", "remove-release"},
{"ra", "remove-app"}
Expand Down
20 changes: 19 additions & 1 deletion lib/faxien/overview.edoc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@title Welcome to the Faxien application
@title Welcome to Faxien
@doc

<p>
Expand All @@ -10,5 +10,23 @@ provides elegant Erlang/OTP package management which at its heart comes down to
Faxien deals with two distinct types of packages. The first is the OTP application which consists of src, ebin, etc... The second is an OTP release which is essentially a standalone erlang service comprised of a number of applications combined with configuration, .script and .boot files, and executable scripts.
</p>

<h2>Example development Cycle using Faxien and Sinan</h2>

From within a Sinan project here is an example dev cycle from coding through to publishing.

1. code code code

2. sinan

3. sinan doc # want to make sure my docs work of course

4. sinan dist # build a distribution tarball - a full release essentially

5. faxien install-release # running this with no args from within a sinan project automatically installs from any dist tarball you have built.(overwrites any previously installed code of the same version.)

6. run my release and test it if there are problems go back to step 1

7. faxien publish # called with no argsfrom within a sinan project this will prompt the user to publish the appropriate artifacts to repos

@author Martin Logan
@copyright 2007, 2008 Erlware
25 changes: 16 additions & 9 deletions lib/faxien/src/fax_util.erl
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ find_highest_vsn(Repos, TargetErtsVsns, PackageName, Side) ->

find_highest_vsn2(Repos, TargetErtsVsns, PackageName, Side, VsnThreshold) ->
?INFO_MSG("Target erts versions to search are ~p~n", [TargetErtsVsns]),
VsnLists =
VsnList =
lists:flatten(
lists:foldl(fun(Repo, Acc) ->
SysInfo = ewr_util:system_info(),
Expand All @@ -131,32 +131,32 @@ find_highest_vsn2(Repos, TargetErtsVsns, PackageName, Side, VsnThreshold) ->
end
end, Acc, Suffixes)
end, [], Repos)),
find_highest_remote_vsn_under_threshold(VsnThreshold, VsnLists).
find_highest_remote_vsn_under_threshold(VsnThreshold, VsnList).

suffixes(ErtsVsns, PackageName, Areas, Side) ->
lists:foldr(fun(ErtsVsn, Acc) ->
Acc ++ ewr_util:gen_repo_stub_suffix(ErtsVsn, PackageName, Areas, Side)
end, [], ErtsVsns).

find_highest_remote_vsn_under_threshold(VsnThreshold, VsnLists) ->
?INFO_MSG("find_highest_vsn list of remote versions ~p with threshold of ~p~n", [VsnLists, VsnThreshold]),
find_highest_remote_vsn_under_threshold(VsnThreshold, VsnList) ->
?INFO_MSG("find_highest_vsn list of remote versions ~p with threshold of ~p~n", [VsnList, VsnThreshold]),
case VsnThreshold of
infinity ->
{ok, hd(lists:sort(fun({_, V1, _}, {_, V2, _}) -> ewr_util:is_version_greater(V1, V2) end, VsnLists))};
{ok, hd(sort_vsn_list(VsnList))};
VsnThreshold ->
case lop_off_top(VsnLists, VsnThreshold) of
case lop_off_top(VsnList, VsnThreshold) of
{ok, {Repo, HighVsn, _HighErtsVsn}} = Res ->
?INFO_MSG("find_highest_vsn list of remote versions ~p with threshold of ~p found highest ~p at vsn ~s~n",
[VsnLists, VsnThreshold, Repo, HighVsn]),
[VsnList, VsnThreshold, Repo, HighVsn]),
Res;
{error, _Reason} = Error ->
?INFO_MSG("Failed to find a version lower than ~p~n", [VsnThreshold]),
Error
end
end.

lop_off_top(VsnLists, VsnThreshold) ->
SortedVsnLists = lists:sort(fun({_, V1, _}, {_, V2, _}) -> ewr_util:is_version_greater(V1, V2) end, VsnLists),
lop_off_top(VsnList, VsnThreshold) ->
SortedVsnLists = sort_vsn_list(VsnList),
lop_off_top2(SortedVsnLists, VsnThreshold).

lop_off_top2([{Repo, Vsn, ErtsVsn}|T], VsnThreshold) ->
Expand All @@ -167,6 +167,13 @@ lop_off_top2([{Repo, Vsn, ErtsVsn}|T], VsnThreshold) ->
lop_off_top2([], VsnThreshold) ->
{error, {"no packages with version less than ", VsnThreshold}}.

sort_vsn_list(VsnList) ->
lists:sort(fun({_,_V, EV1}, {_, _V, EV2}) ->
ewr_util:is_version_greater(EV1, EV2);
({_, V1, _}, {_, V2, _}) ->
ewr_util:is_version_greater(V1, V2)
end, VsnList).


%%--------------------------------------------------------------------
%% @doc take a directory and copy it into a temporary directory.
Expand Down
9 changes: 8 additions & 1 deletion lib/faxien/src/faxien.erl
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@
-export([
outdated_release_help/0,
outdated_apps_help/0,
alias_help/0,
examples_help/0,
commands_help/0,
translate_version_help/0,
Expand Down Expand Up @@ -697,12 +698,17 @@ help() ->
"faxien help commands: Lists all faxien commands",
"faxien help <command>: Gives help on an individual command",
"faxien help examples: Lists example usages of faxien",
"faxien alias: lists faxien command aliases",
"\nShort Examples:",
"faxien install-release sinan",
"faxien search yaws",
"faxien help search"
]).

%% @private
alias_help() ->
[lists:flatten([Alias, " -> ", Command]) || {Alias, Command} <- ?ALIAS_LIST].

%% @private
examples_help() ->
[
Expand Down Expand Up @@ -806,7 +812,8 @@ search(Repos, Side, SearchType, SearchString) when is_atom(SearchString) ->
search(Repos, Side, SearchType, atom_to_list(SearchString));
search(Repos, Side, SearchType, SearchString) ->
{ok, TargetErtsVsn} = gas:get_env(epkg, target_erts_vsn, ewr_util:erts_version()),
fax_manage:search(Repos, Side, SearchType, SearchString, TargetErtsVsn).
Series = epkg_util:all_erts_vsns(TargetErtsVsn),
fax_manage:search(Repos, Side, SearchType, SearchString, Series).

%% @spec search(SearchType, SearchString) -> string()
%% @equiv search(Repos, both, SearchType, SearchString)
Expand Down

0 comments on commit 0b2bf08

Please sign in to comment.