From: Martin Logan <[EMAIL PROTECTED]>
warming prompt when installing a release with a different erts vsn than the
target configurable and off by default. The configuration is erts_prompt which
is a bool and is under the faxien application heading.
Also now the erts vsn for a release and for each app installed is printed along
side it.
---
_build.cfg | 2 +-
bin/epkg | 2 +-
bin/faxien | 2 +-
config/sys.config | 2 +-
lib/epkg/ebin/epkg.app | 2 +-
lib/epkg/src/epkg.erl | 8 ++--
lib/epkg/src/epkg_install.erl | 14 ++++++---
lib/faxien/ebin/faxien.app | 2 +-
lib/faxien/src/fax_install.erl | 60 ++++++++++++++++++++++++---------------
lib/faxien/src/faxien.erl | 13 +++++++-
10 files changed, 67 insertions(+), 40 deletions(-)
diff --git a/_build.cfg b/_build.cfg
index 8369959..a18a588 100644
--- a/_build.cfg
+++ b/_build.cfg
@@ -1,6 +1,6 @@
project : {
name : faxien
- vsn : "0.34.0.0"
+ vsn : "0.34.1.0"
},
repositories : ["http://repo.erlware.org/pub"],
diff --git a/bin/epkg b/bin/epkg
index c4eb3f0..c945dcd 100644
--- a/bin/epkg
+++ b/bin/epkg
@@ -6,7 +6,7 @@ PREFIX=$(cd $(dirname $(dirname $PROG)); pwd)
#### Fill in values for these variables ####
REL_NAME=faxien
-REL_VSN=0.34.0.0
+REL_VSN=0.34.1.0
ERTS_VSN=5.6.3
INVOCATION_SUFFIX="-s epkg cmdln_apply epkg $@ -noshell -prefix $PREFIX"
###########################################
diff --git a/bin/faxien b/bin/faxien
index ced4ee0..130d1c0 100644
--- a/bin/faxien
+++ b/bin/faxien
@@ -6,7 +6,7 @@ PREFIX=$(cd $(dirname $(dirname $PROG)); pwd)
#### Fill in values for these variables ####
REL_NAME=faxien
-REL_VSN=0.34.0.0
+REL_VSN=0.34.1.0
ERTS_VSN=5.6.3
INVOCATION_SUFFIX="-s faxien cmdln_apply faxien $@ -noshell -prefix $PREFIX"
###########################################
diff --git a/config/sys.config b/config/sys.config
index 387cbf9..ffa3014 100755
--- a/config/sys.config
+++ b/config/sys.config
@@ -37,7 +37,7 @@
%% faxien add-publish-repo
{repos_to_publish_to, ["http://repo.erlware.org/writable"]},
{request_timeout, 120000},
- {erts_prompt, true},
+ {erts_prompt, false},
{is_local_boot, false}
]
}
diff --git a/lib/epkg/ebin/epkg.app b/lib/epkg/ebin/epkg.app
index 5d7566c..a66c5b4 100755
--- a/lib/epkg/ebin/epkg.app
+++ b/lib/epkg/ebin/epkg.app
@@ -5,7 +5,7 @@
{description, "Manages local erlang/OTP packages. Faxien depends on this for
local operations."},
% The version of the applicaton
- {vsn, "0.6.1.0"},
+ {vsn, "0.7.0.0"},
% All modules used by the application.
{modules,
diff --git a/lib/epkg/src/epkg.erl b/lib/epkg/src/epkg.erl
index 42ec593..b44118b 100644
--- a/lib/epkg/src/epkg.erl
+++ b/lib/epkg/src/epkg.erl
@@ -78,7 +78,7 @@ cmdln_apply([Mod, RawFunc|Args]) ->
%% @doc
%% Determine the type of a package and then install it appropriately. You
must specify the erts vsn the package was created
%% with or for.
-%% @spec install(RelPackagePath, InstallationPath) -> ok | {error, Reason}
+%% @spec install(RelPackagePath, InstallationPath) -> ok | {ok, ErtsVsn} |
{error, Reason}
%% where
%% ErtsVsn = string()
%% Reason = badly_formatted_or_missing_package | {failed_to_install,
[{AppName, AppVsn}]}
@@ -147,7 +147,7 @@ install_release_help() ->
%% @doc
%% Install an application package or package archive. Including the erts vsn
means that this should be installed for use
%% with erts vsn X no matter the erts vsn this was compiled with.
-%% @spec install_app(AppPackagePath, ErtsVsn, InstallationPath) -> ok |
{error, Reason}
+%% @spec install_app(AppPackagePath, ErtsVsn, InstallationPath) -> {ok,
ErtsVsn} | {error, Reason}
%% where
%% Reason = badly_formatted_or_missing_app_package
%% @end
@@ -158,7 +158,7 @@ install_app(AppPackagePath, ErtsVsn, InstallationPath) ->
%%--------------------------------------------------------------------
%% @doc
%% Install an application package or package archive. The erts version will
be determined automatically.
-%% @spec install_app(AppPackagePath, InstallationPath) -> ok | {error, Reason}
+%% @spec install_app(AppPackagePath, InstallationPath) -> {ok, ErtsVsn} |
{error, Reason}
%% where
%% Reason = badly_formatted_or_missing_app_package
%% @end
@@ -166,7 +166,7 @@ install_app(AppPackagePath, ErtsVsn, InstallationPath) ->
install_app(AppPackagePath, InstallationPath) ->
epkg_install:install_application(AppPackagePath,
epkg_util:if_atom_or_integer_to_string(InstallationPath)).
-%% @spec install_app(AppPackagePath) -> ok | {error, Reason}
+%% @spec install_app(AppPackagePath) -> {ok, ErtsVsn} | {error, Reason}
%% @equiv install_app(AppPackagePath, InstallationPath)
install_app(AppPackagePath) ->
{ok, InstallationPath} = epkg_installed_paths:get_installation_path(),
diff --git a/lib/epkg/src/epkg_install.erl b/lib/epkg/src/epkg_install.erl
index 015ea86..9465135 100644
--- a/lib/epkg/src/epkg_install.erl
+++ b/lib/epkg/src/epkg_install.erl
@@ -58,7 +58,7 @@ install_sinan_release(CWD, InstallationPath, IsLocalBoot) ->
%%--------------------------------------------------------------------
%% @doc Install an application from a complte local application package.
-%% @spec install_application(AppPackageDirOrArchive, InstallationPath) -> ok |
{error, Reason}
+%% @spec install_application(AppPackageDirOrArchive, InstallationPath) -> {ok,
ErtsVsn} | {error, Reason}
%% @end
%%--------------------------------------------------------------------
install_application(AppPackageDirOrArchive, InstallationPath) ->
@@ -73,8 +73,8 @@ install_application(AppPackageDirOrArchive, InstallationPath)
->
end.
%%--------------------------------------------------------------------
-%% @doc Install an application from a complte local application package.
-%% @spec install_application(AppPackageDirOrArchive, ErtsVsn,
InstallationPath) -> ok | {error, Reason}
+%% @doc Install an application from a complete local application package.
+%% @spec install_application(AppPackageDirOrArchive, ErtsVsn,
InstallationPath) -> {ok, ErtsVsn} | {error, Reason}
%% @end
%%--------------------------------------------------------------------
install_application(AppPackageDirOrArchive, ErtsVsn, InstallationPath) ->
@@ -94,8 +94,12 @@ install_application(AppPackageDirOrArchive, ErtsVsn,
InstallationPath) ->
InstalledPackageDir =
ewl_installed_paths:installed_app_dir_path(InstallationPath, ErtsVsn, AppName,
AppVsn),
install_non_release_package(AppPackageDirPath,
InstalledPackageDir, AppInstallationPath)
end,
- ?INFO_MSG("returned ~p~n", [Res]),
- Res.
+
+ case Res of
+ ok -> {ok, ActualErtsVsn};
+ Error -> Error
+ end.
+
print_erts_warning(_AppName, ErtsVsn, ErtsVsn) ->
ok;
diff --git a/lib/faxien/ebin/faxien.app b/lib/faxien/ebin/faxien.app
index 9eeb11a..74d5775 100755
--- a/lib/faxien/ebin/faxien.app
+++ b/lib/faxien/ebin/faxien.app
@@ -5,7 +5,7 @@
{description, "The erlang package management tool."},
% The version of the applicaton
- {vsn, "0.34.0.0"},
+ {vsn, "0.34.1.0"},
% All modules used by the application.
{modules,
diff --git a/lib/faxien/src/fax_install.erl b/lib/faxien/src/fax_install.erl
index 14aa5a6..a028add 100644
--- a/lib/faxien/src/fax_install.erl
+++ b/lib/faxien/src/fax_install.erl
@@ -40,7 +40,7 @@
fetch_latest_remote_release/6,
fetch_remote_release/7,
fetch_latest_remote_application/6,
- fetch_remote_application/6
+ fetch_remote_application/7
]).
%%====================================================================
@@ -104,14 +104,21 @@ install_remote_application(Repos, [TargetErtsVsn|_] =
TargetErtsVsns, AppName, A
AppDir = epkg_installed_paths:installed_app_dir_path(hd(TargetErtsVsns),
AppName, AppVsn),
case epkg_validation:is_package_an_app(AppDir) of
false ->
- io:format("Pulling down ~s-~s -> ", [AppName, AppVsn]),
+ io:format("Pulling down ~s-~s ", [AppName, AppVsn]),
{ok, AppPackageDirPath} = fetch_app_to_tmp(Repos, TargetErtsVsns,
AppName, AppVsn, Timeout),
%% XXX Get rid of installation path here
{ok, InstallationPath} =
epkg_installed_paths:get_installation_path(),
Res = epkg:install_app(AppPackageDirPath,
TargetErtsVsn, InstallationPath),
ok = ewl_file:delete_dir(AppPackageDirPath),
- io:format("~p~n", [Res]),
- Res;
+ case Res of
+ {ok, ActualErtsVsn} ->
+ {ok, ErlangVersion} = faxien:translate_version(erts,
erlang, ActualErtsVsn),
+ io:format("for ~s -> ok~n", [ErlangVersion]),
+ ok;
+ Error ->
+ io:format("~p~n", [Error]),
+ Error
+ end;
true ->
epkg_util:overwrite_yes_no(
fun() -> install_remote_application(Repos, TargetErtsVsns,
AppName, AppVsn, Force, Timeout) end,
@@ -235,7 +242,7 @@ install_remote_release(Repos, TargetErtsVsns, RelName,
RelVsn, IsLocalBoot, Opti
case epkg_validation:is_package_a_release(ReleaseDir) of
false ->
io:format("~nInitiating Install for Remote Release ~s-~s~n",
[RelName, RelVsn]),
- {ok, ReleasePackageDirPath} = fetch_release(Repos, TargetErtsVsns,
RelName, RelVsn, Timeout),
+ {ok, ReleasePackageDirPath} = fetch_release(Repos, TargetErtsVsns,
RelName, RelVsn, Options, Timeout),
Res = install_from_local_release_package(Repos,
ReleasePackageDirPath, IsLocalBoot, Options, Timeout),
io:format("Installation of ~s-~s resulted in ~p~n", [RelName,
RelVsn, Res]),
Res;
@@ -271,18 +278,19 @@ fetch_latest_remote_application(Repos, TargetErtsVsns,
AppName, ToDir, Options,
ErtsPrompt = fs_lists:get_val(erts_prompt, Options),
Fun = fun(Repo, AppVsn, ErtsVsn) ->
- fetch_remote_application([Repo], ErtsVsn, AppName, AppVsn,
ToDir, Timeout)
+ fetch_remote_application([Repo], ErtsVsn, AppName, AppVsn,
ToDir, Options, Timeout)
end,
fax_util:execute_on_latest_package_version(Repos, TargetErtsVsns, AppName,
Fun, lib, ErtsPrompt).
%%--------------------------------------------------------------------
%% @doc pull down an application from a repo into the ToDir
-%% @spec fetch_remote_application(Repos, TargetErtsVsns::target_erts_vsns(),
AppName, AppVsn, ToDir, Timeout) -> ok | {error, Reason}
+%% @spec fetch_remote_application(Repos, TargetErtsVsns::target_erts_vsns(),
AppName, AppVsn, ToDir, Options, Timeout) ->
+%% ok | {error, Reason}
%% @end
%%--------------------------------------------------------------------
-fetch_remote_application(Repos, [_H|_] = TargetErtsVsn, AppName, AppVsn,
ToDir, Timeout) when is_integer(_H) ->
- fetch_remote_application(Repos, [TargetErtsVsn], AppName, AppVsn, ToDir,
Timeout);
-fetch_remote_application(Repos, TargetErtsVsns, AppName, AppVsn, ToDir,
Timeout) ->
+fetch_remote_application(Repos, [_H|_] = TargetErtsVsn, AppName, AppVsn,
ToDir, Options, Timeout) when is_integer(_H) ->
+ fetch_remote_application(Repos, [TargetErtsVsn], AppName, AppVsn, ToDir,
Options, Timeout);
+fetch_remote_application(Repos, TargetErtsVsns, AppName, AppVsn, ToDir,
Options, Timeout) ->
try
fetch_package_interactively(
AppName,
@@ -290,7 +298,8 @@ fetch_remote_application(Repos, TargetErtsVsns, AppName,
AppVsn, ToDir, Timeout)
TargetErtsVsns,
fun(ErtsVsn) ->
ewr_fetch:fetch_binary_package(Repos, ErtsVsn, AppName,
AppVsn, ToDir, Timeout)
- end)
+ end,
+ Options)
catch
_Class:_Exception = {badmatch, {error, _} = Error} ->
Error
@@ -343,7 +352,7 @@ fetch_remote_release(Repos, TargetErtsVsns, RelName,
RelVsn, ToDir, Options, Tim
ErtsPolicy = fs_lists:get_val(erts_policy, Options),
?INFO_MSG("(~p, ~p, ~p, ~p)~n", [Repos, TargetErtsVsns, RelName, RelVsn]),
io:format("~nFetching for Remote Release Package ~s-~s~n", [RelName,
RelVsn]),
- Res = fetch_release(Repos, TargetErtsVsns, RelName, RelVsn,
ToDir, Timeout),
+ Res = fetch_release(Repos, TargetErtsVsns, RelName, RelVsn,
ToDir, Options, Timeout),
RelDirPath = ewl_package_paths:package_dir_path(ToDir, RelName,
RelVsn),
RelFilePath =
ewl_package_paths:release_package_rel_file_path(RelDirPath, RelName, RelVsn),
RelLibDirPath =
ewl_package_paths:release_package_library_path(RelDirPath),
@@ -359,7 +368,8 @@ fetch_remote_release(Repos, TargetErtsVsns, RelName,
RelVsn, ToDir, Options, Tim
AppAndVsns = get_app_and_vsns(RelFilePath),
lists:foreach(fun({AppName, AppVsn}) ->
io:format("Pulling down ~s-~s -> ", [AppName,
AppVsn]),
- Res = fetch_remote_application(Repos,
ReleaseErtsVsns, AppName, AppVsn, RelLibDirPath, Timeout),
+ Res = fetch_remote_application(Repos,
ReleaseErtsVsns, AppName, AppVsn,
+ RelLibDirPath,
Options, Timeout),
io:format("~p~n", [Res])
end, AppAndVsns),
%Res = fetch_from_local_release_package(Repos, ReleasePackageDirPath,
ToDir, Timeout),
@@ -393,6 +403,8 @@ install_from_local_release_package(Repos,
ReleasePackageArchiveOrDirPath, IsLoca
get_erts_vsns_to_search_in_release(
epkg_util:consult_rel_file(erts_vsn, RelFilePath),
ErtsPolicy),
+ {ok, ErlangVersion} = faxien:translate_version(erts, erlang,
ReleaseErtsVsn),
+ io:format("Release compiled for ~s~n", [ErlangVersion]),
case catch epkg:install_release(ReleasePackageDirPath) of
{error, {failed_to_install, AppAndVsns}} ->
@@ -477,16 +489,16 @@ fetch_erts(Repos, ErtsVsn, Timeout) ->
%%--------------------------------------------------------------------
%% @private
%% @doc pull down a release from a repo.
-%% @spec fetch_release(Repos, TargetErtsVsns, RelName, RelVsn, Timeout) ->
{ok, ReleasePackageDirPath} | {error, Reason}
+%% @spec fetch_release(Repos, TargetErtsVsns, RelName, RelVsn, Options,
Timeout) -> {ok, ReleasePackageDirPath} | {error, Reason}
%% @end
%%--------------------------------------------------------------------
-fetch_release(Repos, [_H|_] = TargetErtsVsn, RelName, RelVsn, Timeout) when
is_integer(_H) ->
- fetch_release(Repos, [TargetErtsVsn], RelName, RelVsn, Timeout);
-fetch_release(Repos, TargetErtsVsns, RelName, RelVsn, Timeout) ->
+fetch_release(Repos, [_H|_] = TargetErtsVsn, RelName, RelVsn, Options,
Timeout) when is_integer(_H) ->
+ fetch_release(Repos, [TargetErtsVsn], RelName, RelVsn, Options, Timeout);
+fetch_release(Repos, TargetErtsVsns, RelName, RelVsn, Options, Timeout) ->
ReleaseDirPath =
epkg_installed_paths:installed_release_dir_path(RelName, RelVsn),
ok = ewl_file:delete_dir(ReleaseDirPath),
{ok, TmpPackageDir} = epkg_util:create_unique_tmp_dir(),
- case fetch_release(Repos, TargetErtsVsns, RelName, RelVsn, TmpPackageDir,
Timeout) of
+ case fetch_release(Repos, TargetErtsVsns, RelName, RelVsn, TmpPackageDir,
Options, Timeout) of
ok ->
ReleasePackageDirPath =
ewl_package_paths:package_dir_path(TmpPackageDir, RelName, RelVsn),
{ok, ReleasePackageDirPath};
@@ -494,7 +506,7 @@ fetch_release(Repos, TargetErtsVsns, RelName, RelVsn,
Timeout) ->
Error
end.
-fetch_release(Repos, TargetErtsVsns, RelName, RelVsn, ToDir, Timeout) ->
+fetch_release(Repos, TargetErtsVsns, RelName, RelVsn, ToDir, Options, Timeout)
->
try
fetch_package_interactively(
RelName,
@@ -502,17 +514,19 @@ fetch_release(Repos, TargetErtsVsns, RelName, RelVsn,
ToDir, Timeout) ->
TargetErtsVsns,
fun(ErtsVsn) ->
ewr_fetch:fetch_release_package(Repos, ErtsVsn, RelName,
RelVsn, ToDir, Timeout)
- end)
+ end,
+ Options)
catch
_Class:_Exception = {badmatch, {error, _} = Error} ->
Error
end.
-fetch_package_interactively(PackageName, PackageVsn, [TargetErtsVsn|_] =
TargetErtsVsns, Fun) ->
+fetch_package_interactively(PackageName, PackageVsn, [TargetErtsVsn|_] =
TargetErtsVsns, Fun, Options) ->
+ ErtsPrompt = fs_lists:get_val(erts_prompt, Options),
fs_lists:do_until(
fun(ErtsVsn) when ErtsVsn /= TargetErtsVsn ->
case fax_util:ask_about_switching_target_erts_vsns(PackageName,
PackageVsn, TargetErtsVsn, ErtsVsn) of
- true ->
+ true when ErtsPrompt == false ->
case catch Fun(ErtsVsn) of
ok ->
ok;
@@ -520,7 +534,7 @@ fetch_package_interactively(PackageName, PackageVsn,
[TargetErtsVsn|_] = TargetE
io:format("~nerror - ~p~n", [Error]),
Error
end;
- false ->
+ _ ->
ok = Fun(TargetErtsVsn),
ok
end;
diff --git a/lib/faxien/src/faxien.erl b/lib/faxien/src/faxien.erl
index 6fb6853..90da289 100644
--- a/lib/faxien/src/faxien.erl
+++ b/lib/faxien/src/faxien.erl
@@ -13,6 +13,10 @@
%%% Example: http://www.erlware.org/stable
%%% @type repo_suffix() = string(). Contains
ErtsVsn/Area/Application/Vsn/TarFile.
%%% @type timeout() = integer() | infinity. Timeouts are specified in
milliseconds.
+%%% @type erts_policy() = strict | loose. Strict erts policy means only apps
of strictly the same erts version
+%%% as specified with in a release will
be installed for that release. Loose
+%%% indicates that if needed minor
version compatible apps can be used
+%%% i.e 5.6.1 for 5.6.2
%%% @type options() = [Option]
%%% where
%%% Options = {force, force()} | {erts_prompt, erts_prompt()} |
{erts_policy, ErtsPolicy}
@@ -562,7 +566,10 @@ install_app(AppNameOrPath) ->
case filelib:is_file(AppNameOrPath) of
true ->
AppDirPath = epkg_util:unpack_to_tmp_if_archive(AppNameOrPath),
- epkg:install_app(AppDirPath);
+ case epkg:install_app(AppDirPath) of
+ {ok, _ErtsVsn} -> ok;
+ Error -> Error
+ end;
false ->
{ok, TargetErtsVsn} = gas:get_env(epkg, target_erts_vsn,
ewr_util:erts_version()),
TargetErtsVsns = epkg_util:all_erts_vsns(TargetErtsVsn),
@@ -600,7 +607,9 @@ fetch_app(Repos, AppName, AppVsn, ToDir) ->
[A,B,C] = epkg_util:if_atom_or_integer_to_string([AppName, AppVsn,
ToDir]),
{ok, TargetErtsVsn} = gas:get_env(epkg, target_erts_vsn,
ewr_util:erts_version()),
TargetErtsVsns = epkg_util:all_erts_vsns(TargetErtsVsn),
- fax_install:fetch_remote_application(Repos, TargetErtsVsns, A, B, C,
?REQUEST_TIMEOUT).
+ {ok, ErtsPrompt} = gas:get_env(faxien, erts_prompt, false),
+ Options = [{force, false}, {erts_prompt, ErtsPrompt}],
+ fax_install:fetch_remote_application(Repos, TargetErtsVsns, A, B, C,
Options, ?REQUEST_TIMEOUT).
%% @spec fetch_app(AppName, AppVsn, ToDir) -> ok | {error, Reason}
%% @equiv fetch_app(ERLWARE, AppName, AppVsn, ToDir)
--
1.5.3.5
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"erlware-dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/erlware-dev?hl=en
-~----------~----~----~----~------~----~------~--~---