aboutsummaryrefslogtreecommitdiffstats
path: root/lib/sasl
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sasl')
-rw-r--r--lib/sasl/examples/src/target_system.erl8
-rw-r--r--lib/sasl/src/release_handler.erl5
-rw-r--r--lib/sasl/src/systools_make.erl18
-rw-r--r--lib/sasl/test/release_handler_SUITE.erl5
4 files changed, 27 insertions, 9 deletions
diff --git a/lib/sasl/examples/src/target_system.erl b/lib/sasl/examples/src/target_system.erl
index 0e1e0b2324..ffc0fcf443 100644
--- a/lib/sasl/examples/src/target_system.erl
+++ b/lib/sasl/examples/src/target_system.erl
@@ -16,6 +16,7 @@
%%
%% %CopyrightEnd%
%%
+%module
-module(target_system).
-export([create/1, create/2, install/2]).
@@ -130,14 +131,14 @@ install(RelFileName, RootDir) ->
[ErlVsn, _RelVsn| _] = string:tokens(StartErlData, " \n"),
ErtsBinDir = filename:join([RootDir, "erts-" ++ ErlVsn, "bin"]),
BinDir = filename:join([RootDir, "bin"]),
- io:fwrite("Substituting in erl.src, start.src and start_erl.src to\n"
+ io:fwrite("Substituting in erl.src, start.src and start_erl.src to "
"form erl, start and start_erl ...\n"),
subst_src_scripts(["erl", "start", "start_erl"], ErtsBinDir, BinDir,
[{"FINAL_ROOTDIR", RootDir}, {"EMU", "beam"}],
[preserve]),
io:fwrite("Creating the RELEASES file ...\n"),
- create_RELEASES(RootDir,
- filename:join([RootDir, "releases", RelFileName])).
+ create_RELEASES(RootDir, filename:join([RootDir, "releases",
+ filename:basename(RelFileName)])).
%% LOCALS
@@ -257,3 +258,4 @@ remove_all_files(Dir, Files) ->
file:delete(FilePath)
end
end, Files).
+%module
diff --git a/lib/sasl/src/release_handler.erl b/lib/sasl/src/release_handler.erl
index b6ef8582c4..522c7b496b 100644
--- a/lib/sasl/src/release_handler.erl
+++ b/lib/sasl/src/release_handler.erl
@@ -842,8 +842,13 @@ do_unpack_release(Root, RelDir, ReleaseName, Releases) ->
extract_tar(Root, Tar),
NewReleases = [Release#release{status = unpacked} | Releases],
write_releases(RelDir, NewReleases, false),
+
+ %% Keeping this for backwards compatibility reasons with older
+ %% systools:make_tar, where there is no copy of the .rel file in
+ %% the releases/<vsn> dir. See OTP-9746.
Dir = filename:join([RelDir, Vsn]),
copy_file(RelFile, Dir, false),
+
{ok, NewReleases, Vsn}.
%% Note that this function is not executed by a client
diff --git a/lib/sasl/src/systools_make.erl b/lib/sasl/src/systools_make.erl
index 1c14027805..8fd90c50f9 100644
--- a/lib/sasl/src/systools_make.erl
+++ b/lib/sasl/src/systools_make.erl
@@ -1638,8 +1638,19 @@ add_system_files(Tar, RelName, Release, Path1) ->
SVsn = Release#release.vsn,
RelName0 = filename:basename(RelName),
+ RelVsnDir = filename:join("releases", SVsn),
+
+ %% OTP-9746: store rel file in releases/<vsn>
+ %% Adding rel file to
+ %% 1) releases directory - so it can be easily extracted
+ %% separately (see release_handler:unpack_release)
+ %% 2) releases/<vsn> - so the file must not be explicitly moved
+ %% after unpack.
add_to_tar(Tar, RelName ++ ".rel",
filename:join("releases", RelName0 ++ ".rel")),
+ add_to_tar(Tar, RelName ++ ".rel",
+ filename:join(RelVsnDir, RelName0 ++ ".rel")),
+
%% OTP-6226 Look for the system files not only in cwd
%% --
@@ -1655,26 +1666,25 @@ add_system_files(Tar, RelName, Release, Path1) ->
[RelDir, "."|Path1]
end,
- ToDir = filename:join("releases", SVsn),
case lookup_file(RelName0 ++ ".boot", Path) of
false ->
throw({error, {tar_error,{add, RelName0++".boot",enoent}}});
Boot ->
- add_to_tar(Tar, Boot, filename:join(ToDir, "start.boot"))
+ add_to_tar(Tar, Boot, filename:join(RelVsnDir, "start.boot"))
end,
case lookup_file("relup", Path) of
false ->
ignore;
Relup ->
- add_to_tar(Tar, Relup, filename:join(ToDir, "relup"))
+ add_to_tar(Tar, Relup, filename:join(RelVsnDir, "relup"))
end,
case lookup_file("sys.config", Path) of
false ->
ignore;
Sys ->
- add_to_tar(Tar, Sys, filename:join(ToDir, "sys.config"))
+ add_to_tar(Tar, Sys, filename:join(RelVsnDir, "sys.config"))
end,
ok.
diff --git a/lib/sasl/test/release_handler_SUITE.erl b/lib/sasl/test/release_handler_SUITE.erl
index 45a1e7640c..ac616dab72 100644
--- a/lib/sasl/test/release_handler_SUITE.erl
+++ b/lib/sasl/test/release_handler_SUITE.erl
@@ -1499,6 +1499,7 @@ target_system(Conf) when is_list(Conf) ->
KernelVsn = vsn(kernel,current),
StdlibVsn = vsn(stdlib,current),
SaslVsn = vsn(sasl,current),
+ RelFileBasename = filename:basename(RelFile),
true = filelib:is_dir(filename:join(LibDir,"kernel-"++KernelVsn)),
true = filelib:is_dir(filename:join(LibDir,"stdlib-"++StdlibVsn)),
true = filelib:is_dir(filename:join(LibDir,"sasl-"++SaslVsn)),
@@ -1506,10 +1507,10 @@ target_system(Conf) when is_list(Conf) ->
RelDir = filename:join(TargetInstallDir,releases),
true = filelib:is_regular(filename:join(RelDir,"RELEASES")),
true = filelib:is_regular(filename:join(RelDir,"start_erl.data")),
- true = filelib:is_regular(filename:join(RelDir,
- filename:basename(RelFile))),
+ true = filelib:is_regular(filename:join(RelDir,RelFileBasename)),
true = filelib:is_dir(filename:join(RelDir,RelVsn)),
true = filelib:is_regular(filename:join([RelDir,RelVsn,"start.boot"])),
+ true = filelib:is_regular(filename:join([RelDir,RelVsn,RelFileBasename])),
BinDir = filename:join(TargetInstallDir,bin),
true = filelib:is_regular(filename:join(BinDir,"start.boot")),
true = filelib:is_regular(filename:join(BinDir,erl)),