Skip to content
This repository has been archived by the owner on Apr 29, 2019. It is now read-only.

Commit

Permalink
added the ability to handle new style release packages with name-vers…
Browse files Browse the repository at this point in the history
…ion dirs
  • Loading branch information
Martin Logan authored and Martin Logan committed Dec 25, 2009
1 parent dd24822 commit 59c46d4
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 13 deletions.
2 changes: 1 addition & 1 deletion _build.cfg
@@ -1,4 +1,4 @@
project : {
name : faxien
vsn : "0.43.0.0"
vsn : "0.43.1.0"
},
2 changes: 1 addition & 1 deletion bin/epkg
Expand Up @@ -7,7 +7,7 @@ PREFIX=$(dirname $PROG_DIR)

#### Fill in values for these variables ####
REL_NAME=faxien
REL_VSN=0.43.0.0
REL_VSN=0.43.1.0
ERTS_VSN=5.7.1
INVOCATION_SUFFIX="-s epkg cmdln_apply epkg $@ -noshell -prefix $PREFIX"
###########################################
Expand Down
2 changes: 1 addition & 1 deletion bin/faxien
Expand Up @@ -7,7 +7,7 @@ PREFIX=$(dirname $PROG_DIR)

#### Fill in values for these variables ####
REL_NAME=faxien
REL_VSN=0.43.0.0
REL_VSN=0.43.1.0
ERTS_VSN=5.7.4
INVOCATION_SUFFIX="-s faxien cmdln_apply faxien $@ -noshell -prefix $PREFIX"
###########################################
Expand Down
2 changes: 1 addition & 1 deletion lib/epkg/ebin/epkg.app
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.15.0.0"},
{vsn, "0.15.1.0"},

% All modules used by the application.
{modules,
Expand Down
17 changes: 14 additions & 3 deletions lib/epkg/src/epkg_install.erl
Expand Up @@ -225,8 +225,7 @@ execute_release_installation_steps(ReleasePackageDirPath, InstallationPath, IsLo
Error;
ok ->
{ok, {RelName, RelVsn}} = epkg_installed_paths:package_dir_to_name_and_vsn(ReleasePackageDirPath),
PackageRelFilePath = ewl_package_paths:release_package_rel_file_path(ReleasePackageDirPath,
RelName, RelVsn),
PackageRelFilePath = rel_file_path(ReleasePackageDirPath, RelName, RelVsn),
ErtsVsn = epkg_util:consult_rel_file(erts_vsn, PackageRelFilePath),
PackageErtsPackagePath = ewl_package_paths:release_package_erts_package_path(ReleasePackageDirPath, ErtsVsn),
try
Expand Down Expand Up @@ -279,7 +278,7 @@ install_release_package(PackagePath, InstallationPath) ->
%%--------------------------------------------------------------------
install_apps_for_release(ReleasePackagePath, InstallationPath) ->
{ok, {RelName, RelVsn}} = epkg_installed_paths:package_dir_to_name_and_vsn(ReleasePackagePath),
PackageRelFilePath = ewl_package_paths:release_package_rel_file_path(ReleasePackagePath, RelName, RelVsn),
PackageRelFilePath = rel_file_path(ReleasePackagePath, RelName, RelVsn),
ErtsVsn = epkg_util:consult_rel_file(erts_vsn, PackageRelFilePath),

ok = ewl_file:mkdir_p(ewl_installed_paths:application_container_path(InstallationPath, ErtsVsn)),
Expand Down Expand Up @@ -431,3 +430,15 @@ remove_existing_executable_script(ExecutableFile) ->
false ->
ok
end.

rel_file_path(ReleasePackageDirPath, RelName, RelVsn) ->
StandardRelFilePath = ewl_package_paths:release_package_rel_file_path(ReleasePackageDirPath, RelName, RelVsn),
ExtendedRelFilePath = ewl_package_paths:release_package_extended_rel_file_path(ReleasePackageDirPath, RelName, RelVsn),
case filelib:is_file(StandardRelFilePath) of
true ->
?INFO_MSG("The release is of the standard format with rel file in ~p~n", [StandardRelFilePath]),
StandardRelFilePath;
false ->
?INFO_MSG("The release is of the extended format with rel file in ~p~n", [ExtendedRelFilePath]),
ExtendedRelFilePath
end.
2 changes: 1 addition & 1 deletion lib/faxien/build.sh
Expand Up @@ -3,7 +3,7 @@
SINAN=`which sinan`
if [ -e $SINAN ];then
rm _build.cfg
echo "project : {\nname : faxien\nvsn : \"0.43.0.0\"\n},\n" > _build.cfg
echo "project : {\nname : faxien\nvsn : \"0.43.1.0\"\n},\n" > _build.cfg
sinan
cp _build/development/apps/faxien*/ebin/*beam ./ebin
rm -rf _build.cfg _build
Expand Down
2 changes: 1 addition & 1 deletion lib/faxien/ebin/faxien.app
Expand Up @@ -5,7 +5,7 @@
{description, "The erlang package management tool."},

% The version of the applicaton
{vsn, "0.43.0.0"},
{vsn, "0.43.1.0"},

% All modules used by the application.
{modules,
Expand Down
18 changes: 15 additions & 3 deletions lib/faxien/src/fax_install.erl
Expand Up @@ -352,7 +352,7 @@ fetch_remote_release(Repos, TargetErtsVsns, RelName, RelVsn, ToDir, Options, Tim
io:format("~nFetching for Remote Release Package ~s-~s~n", [RelName, RelVsn]),
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),
RelFilePath = rel_file_path(RelDirPath, RelName, RelVsn),
RelLibDirPath = ewl_package_paths:release_package_library_path(RelDirPath),
ReleaseErtsVsn = epkg_util:consult_rel_file(erts_vsn, RelFilePath),
ReleaseErtsVsns = get_erts_vsns_to_search_in_release(ReleaseErtsVsn, ErtsPolicy),
Expand All @@ -362,7 +362,6 @@ fetch_remote_release(Repos, TargetErtsVsns, RelName, RelVsn, ToDir, Options, Tim
ok -> io:format("ok~n");
_Error -> io:format("can't pull down erts - skipping~n")
end,
RelFilePath = ewl_package_paths:release_package_rel_file_path(RelDirPath, RelName, RelVsn),
AppAndVsns = get_app_and_vsns(RelFilePath),
lists:foreach(fun({AppName, AppVsn}) ->
io:format("Pulling down ~s-~s -> ", [AppName, AppVsn]),
Expand Down Expand Up @@ -395,7 +394,7 @@ install_from_local_release_package(Repos, ReleasePackageArchiveOrDirPath, IsLoca
{error, bad_package};
true ->
{ok, {RelName, RelVsn}} = epkg_installed_paths:package_dir_to_name_and_vsn(ReleasePackageDirPath),
RelFilePath = ewl_package_paths:release_package_rel_file_path(ReleasePackageDirPath, RelName, RelVsn),
RelFilePath = rel_file_path(ReleasePackageDirPath, RelName, RelVsn),
[ReleaseErtsVsn|_] = ReleaseErtsVsns =
get_erts_vsns_to_search_in_release(
epkg_util:consult_rel_file(erts_vsn, RelFilePath),
Expand Down Expand Up @@ -549,3 +548,16 @@ fetch_package_interactively(PackageName, PackageVsn, [TargetErtsVsn|_] = TargetE
end,
ok,
TargetErtsVsns).

rel_file_path(ReleasePackageDirPath, RelName, RelVsn) ->
StandardRelFilePath = ewl_package_paths:release_package_rel_file_path(ReleasePackageDirPath, RelName, RelVsn),
ExtendedRelFilePath = ewl_package_paths:release_package_extended_rel_file_path(ReleasePackageDirPath, RelName, RelVsn),
case filelib:is_file(StandardRelFilePath) of
true ->
?INFO_MSG("The release is of the standard format with rel file in ~p~n", [StandardRelFilePath]),
StandardRelFilePath;
false ->
?INFO_MSG("The release is of the extended format with rel file in ~p~n", [ExtendedRelFilePath]),
ExtendedRelFilePath
end.

12 changes: 11 additions & 1 deletion lib/faxien/src/fax_publish.erl
Expand Up @@ -164,7 +164,17 @@ publish2(Type, Repos, RawAppDirPath, Timeout) when Type == unbuilt; Type == bina
end;
publish2(release, Repos, RelDirPath, Timeout) ->
{ok, {RelName, RelVsn}} = epkg_installed_paths:package_dir_to_name_and_vsn(RelDirPath),
RelFilePath = ewl_package_paths:release_package_rel_file_path(RelDirPath, RelName, RelVsn),
StandardRelFilePath = ewl_package_paths:release_package_rel_file_path(RelDirPath, RelName, RelVsn),
ExtendedRelFilePath = ewl_package_paths:release_package_extended_rel_file_path(RelDirPath, RelName, RelVsn),
RelFilePath =
case filelib:is_file(StandardRelFilePath) of
true ->
?INFO_MSG("The release is of the standard format with rel file in ~p~n", [StandardRelFilePath]),
StandardRelFilePath;
false ->
?INFO_MSG("The release is of the extended format with rel file in ~p~n", [ExtendedRelFilePath]),
ExtendedRelFilePath
end,
ErtsVsn = epkg_util:consult_rel_file(erts_vsn, RelFilePath),
ok = handle_control(RelDirPath),
{ok, ControlFileBinary} = file:read_file(ewl_package_paths:release_package_control_file_path(RelDirPath)),
Expand Down

0 comments on commit 59c46d4

Please sign in to comment.