Permalink
Browse files

Make the application version optional in a target release

Added config option {app_dir_vsn,keep|strip}
Default is keep, which is the backward compatible behavior
  • Loading branch information...
1 parent 84fd7aa commit 38ca2e88f7c46ed91ab05ac29a17d188dc247aaf @hawk committed Nov 5, 2013
@@ -291,6 +291,10 @@ find_erts_vsn(char *erl_top)
}
if (strncmp("erts-", dirp->d_name, 5) == 0) {
copy_latest_vsn(latest_vsn, dirp->d_name);
+ } else if (strncmp("erts", dirp->d_name, 4) == 0) {
+ /* No erts vsn */
+ strcpy(latest_vsn, dirp->d_name);
+ break;
}
}
@@ -157,7 +157,7 @@ static char *find_erlexec_dir2(char *install_dir)
p = wildcard+length-1;
if (*p != '/' && *p != '\\')
*++p = '\\';
- strcpy(++p, "erts-*");
+ strcpy(++p, "erts*");
/* Find first dir */
dir_handle = FindFirstFile(wildcard, &find_data);
@@ -168,7 +168,8 @@ static char *find_erlexec_dir2(char *install_dir)
strcpy(latest_vsn, find_data.cFileName);
/* Find the rest */
- while(FindNextFile(dir_handle, &find_data)) {
+ while((strncmp("erts", latest_vsn, 4) /= 0) &&
+ FindNextFile(dir_handle, &find_data)) {
copy_latest_vsn(latest_vsn, find_data.cFileName);
}
@@ -223,6 +223,15 @@
and <c>strip</c>.</p>
</item>
+ <tag><c>app_dir_vsn</c></tag>
+ <item>
+ <p>This parameter controls whether application directories (and
+ archives) should have the version as a part of the name or
+ not. <c>keep</c>, which is the default, means that the version
+ should be kept (e.g. <c>mnesia-4.0</c>). <c>strip</c> means
+ that the version should be stripped (e.g. <c>mnesia</c>).</p>
+ </item>
+
<tag><c>debug_info</c></tag>
<item>
<p>The <c>debug_info</c> parameter controls whether the debug
@@ -504,6 +513,7 @@ sys() = {root_dir, root_dir()}
| {rel, rel_name(), rel_vsn(), [rel_app()]}
| {relocatable, relocatable()}
| {app_file, app_file()}
+ | {app_dir_vsn, app_dir_vsn()}
| {debug_info, debug_info()}
| {incl_sys_filters, incl_sys_filters()}
| {excl_sys_filters, excl_sys_filters()}
@@ -519,6 +529,7 @@ app() = {vsn, app_vsn()}
| {incl_cond, incl_cond()}
| {debug_info, debug_info()}
| {app_file, app_file()}
+ | {app_dir_vsn, app_dir_vsn()}
| {excl_lib, excl_lib()}
| {incl_sys_filters, incl_sys_filters()}
| {excl_sys_filters, excl_sys_filters()}
@@ -539,6 +550,7 @@ app_vsn() = string()
archive_opt = zip_create_opt()
boot_rel() = rel_name()
app_file() = keep | strip | all
+app_dir_vsn() = keep | strip
debug_info() = keep | strip
dir() = string()
escript() = {incl_cond, incl_cond()}
@@ -29,6 +29,7 @@
-type incl_cond() :: include | exclude | derived.
-type debug_info() :: keep | strip.
-type app_file() :: keep | strip | all.
+-type app_dir_vsn() :: keep | strip.
-type re_regexp() :: string(). % re:regexp()
-type regexps() :: [re_regexp()] |
{add, [re_regexp()]} |
@@ -68,6 +69,7 @@
| {mod_cond, mod_cond()}
| {incl_cond, incl_cond()}
| {app_file, app_file()}
+ | {app_dir_vsn, app_dir_vsn()}
| {debug_info, debug_info()}
| {incl_app_filters, incl_app_filters()}
| {excl_app_filters, excl_app_filters()}
@@ -78,6 +80,7 @@
| {incl_cond, incl_cond()}
| {debug_info, debug_info()}
| {app_file, app_file()}
+ | {app_dir_vsn, app_dir_vsn()}
| {profile, profile()}
| {excl_lib, excl_lib()}
| {incl_sys_filters, incl_sys_filters()}
@@ -189,6 +192,7 @@
%% Static target cond
debug_info :: '_' | debug_info() | undefined,
app_file :: '_' | app_file() | undefined,
+ app_dir_vsn :: '_' | app_dir_vsn() | undefined,
app_type :: '_' | app_type() | undefined,
incl_app_filters :: '_' | [#regexp{}],
excl_app_filters :: '_' | [#regexp{}],
@@ -247,6 +251,7 @@
rel_app_type :: app_type(),
embedded_app_type :: app_type() | undefined,
app_file :: app_file(),
+ app_dir_vsn :: app_dir_vsn(),
debug_info :: debug_info()
}).
@@ -271,6 +276,7 @@
-define(DEFAULT_REL_APP_TYPE, permanent).
-define(DEFAULT_EMBEDDED_APP_TYPE, undefined).
-define(DEFAULT_APP_FILE, keep).
+-define(DEFAULT_APP_DIR_VSN, keep).
-define(DEFAULT_DEBUG_INFO, keep).
-define(DEFAULT_INCL_ARCHIVE_FILTERS, [".*"]).
@@ -195,6 +195,7 @@ default_sys() ->
rel_app_type = ?DEFAULT_REL_APP_TYPE,
embedded_app_type = ?DEFAULT_EMBEDDED_APP_TYPE,
app_file = ?DEFAULT_APP_FILE,
+ app_dir_vsn = ?DEFAULT_APP_DIR_VSN,
incl_archive_filters = dec_re(incl_archive_filters,
?DEFAULT_INCL_ARCHIVE_FILTERS,
[]),
@@ -446,6 +447,7 @@ app_set_config_only([],#app{name = Name,
use_selected_vsn = undefined,
debug_info = undefined,
app_file = undefined,
+ app_dir_vsn = undefined,
app_type = undefined,
incl_app_filters = undefined,
excl_app_filters = undefined,
@@ -460,6 +462,7 @@ app_set_config_only(Mods,#app{name = Name,
use_selected_vsn = UseSelectedVsn,
debug_info = DebugInfo,
app_file = AppFile,
+ app_dir_vsn = AppDirVsn,
app_type = AppType,
incl_app_filters = InclAppFilters,
excl_app_filters = ExclAppFilters,
@@ -477,6 +480,7 @@ app_set_config_only(Mods,#app{name = Name,
use_selected_vsn = UseSelectedVsn,
debug_info = DebugInfo,
app_file = AppFile,
+ app_dir_vsn = AppDirVsn,
app_type = AppType,
incl_app_filters = InclAppFilters,
excl_app_filters = ExclAppFilters,
@@ -1440,7 +1444,8 @@ decode(#sys{} = Sys, [{Key, Val} | KeyVals]) ->
dec_re(Key, Val, Sys#sys.excl_archive_filters)};
archive_opts when is_list(Val) ->
Sys#sys{archive_opts = Val};
- relocatable when Val =:= true; Val =:= false ->
+ relocatable when Val =:= true;
+ Val =:= false ->
Sys#sys{relocatable = Val};
rel_app_type when Val =:= permanent;
Val =:= transient;
@@ -1455,9 +1460,15 @@ decode(#sys{} = Sys, [{Key, Val} | KeyVals]) ->
Val =:= none;
Val =:= undefined ->
Sys#sys{embedded_app_type = Val};
- app_file when Val =:= keep; Val =:= strip; Val =:= all ->
+ app_file when Val =:= keep;
+ Val =:= strip;
+ Val =:= all ->
Sys#sys{app_file = Val};
- debug_info when Val =:= keep; Val =:= strip ->
+ app_dir_vsn when Val =:= keep;
+ Val =:= strip ->
+ Sys#sys{app_dir_vsn = Val};
+ debug_info when Val =:= keep;
+ Val =:= strip ->
Sys#sys{debug_info = Val};
_ ->
reltool_utils:throw_error("Illegal option: ~p", [{Key, Val}])
@@ -1484,6 +1495,9 @@ decode(#app{} = App, [{Key, Val} | KeyVals]) ->
Val =:= strip;
Val =:= all ->
App#app{app_file = Val};
+ app_dir_vsn when Val =:= keep;
+ Val =:= strip ->
+ App#app{app_dir_vsn = Val};
app_type when Val =:= permanent;
Val =:= transient;
Val =:= temporary;
Oops, something went wrong.

0 comments on commit 38ca2e8

Please sign in to comment.