[erlang-questions] Erlang release names and versions

Siri Hansen erlangsiri@REDACTED
Thu Sep 22 11:35:13 CEST 2011


Hi Sam!

After some research I agree there are some strange things here, and it might
be a good idea to do some adjustments...

>> The documentation for Releases
>> (http://www.erlang.org/doc/design_principles/release_structure.html)
>> shows a sample directory structure produced by make_tar, which
>> includes this part:
>>
>> releases/A/start.boot
>> releases/ch_rel-1.rel
>>
>> Where ch_rel-1 is the name of the release and A is the version of the
>> release.

To be specific, ch_rel-1 is really only the name of the release resource
file, and not to be confused with the name of the release, which is stated
inside this file:

{release, {RelName, Vsn}, ....}

I believe that a good recommendation could be to name the release resource
file "RelName-Vsn.rel" (at least with the current handling by make_tar etc).

>> Question 1: If the release file is placed in releases/ch_rel-1.rel,
>> then isn't installing a second version of the release (say, "B") going
>> to overwrite the file? Isn't this a problem? Is the addition of "-1"
>> to the release name supposed to address this? Shouldn't the release
>> name appear somewhere in the path?

There are two situations where the .rel file is placed directly under the
releases directory. First, it is done by systools:make_tar - and second (as
a result of this) it is done by target_system.erl, which is used in the
System Principles User's Guide as an example of how to create the first
target system.

As far as I can see, the reason for make_tar to store the .rel file directly
under releases is that this makes it easier to extract only this file from
the tar before unpacking all files (see release_handler:unpack_release). The
version of the release is not known before this file is extracted - so it
would be difficult to point out the file if it was stored in releases/Vsn
... There are of course other ways to go around this problem, but I guess
this is the explanation for the strange behavior anyway.

If you study release_handler:unpack_release you will also see that it later
moves the .rel file to releases/Vsn... However, the very first release is of
course not unpacked by release_handler:unpack_release, and if you follow the
documentation/example then the .rel file of this release will be stored in
the releases directory. And obviously you are correct - if the .rel file in
the next release has the same name, it will be overwritten when the next
release is unpacked (by release_handler:unpack_release) since it is
extracted to the releases directory first before it is moved.

I can only conclude that (at least) there is a bug in the
documentation/example...

>> Question 2: If another release, say "foo", is installed with the same
>> version (say "A"), isn't it going to overwrite the start.boot file
>> from release "ch_rel-1"?

That would actually not be allowed by the release_handler - in a running
system you can only install a release version once. The release_handler does
not care about the name of the release, it only deals with the version here.
However, you can of course unpack such a release manually and then you would
have a problem.

>> Question 3: Should I even be trying to install more than one release
>> at once? Would I need a completely new Erlang install directory (or at
>> least, releases directory, by using RELDIR)?

Yes, the release_handler is intended for installing multiple releases under
one root. It will work if you make sure that your .rel files have unique
names (and you only have one release packet of a specific version). But I
would also suggest that you move the .rel file of the first installation to
releases/Vsn. This should be done by (your equivalence to)
target_system:install/2.

>> (I have, incidentally, seen somewhere that the placement of the .rel
>> file directly under releases/ by make_tar is a bug. Is this so? It
>> certainly doesn't seem to match the structure created by
>> create_target.)

I agree it is a bit confusing, but given the explanation above regarding
make_tar, I don't think it is a bug that the file is stored under releases
in the tar file. I rather think that the documentation and the
target_system.erl has a bug, and we need to correct that.

(What do you mean by 'create_target'?? Is it reltool:create_target/2?)

I hope this was of some help! Thanks for pointing out this problem. The
documentation and example will be improved in R15B.

Regards
/siri
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20110922/89a6bf4a/attachment.htm>


More information about the erlang-questions mailing list