Hi Sam!<div><br></div><div>After some research I agree there are some strange things here, and it might be a good idea to do some adjustments...<br><div><br></div><div><meta http-equiv="content-type" content="text/html; charset=utf-8">>> The documentation for Releases<br>
>> (<a href="http://www.erlang.org/doc/design_principles/release_structure.html" target="_blank">http://www.erlang.org/doc/design_principles/release_structure.html</a>)<br>>> shows a sample directory structure produced by make_tar, which<br>
>> includes this part:<br>>><br>>> releases/A/start.boot<br>>> releases/ch_rel-1.rel<br>>><br>>> Where ch_rel-1 is the name of the release and A is the version of the<br>>> release.</div>
<div><br></div><div>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:</div><div><br></div><div>{release, {RelName, Vsn}, ....}</div>
<div><br></div><div>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).</div><div><br></div><div>>> Question 1: If the release file is placed in releases/ch_rel-1.rel,</div>
<div>>> then isn't installing a second version of the release (say, "B") going<br>>> to overwrite the file? Isn't this a problem? Is the addition of "-1"<br>>> to the release name supposed to address this? Shouldn't the release<br>
>> name appear somewhere in the path?<br></div><div><br></div><div>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.</div>
<div><br></div><div>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.</div>
<div><br></div><div>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.</div>
<div><br></div><div>I can only conclude that (at least) there is a bug in the documentation/example...</div><div><br></div><div>>> Question 2: If another release, say "foo", is installed with the same<br>>> version (say "A"), isn't it going to overwrite the start.boot file<br>
>> from release "ch_rel-1"?<br><br></div><div>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.</div>
<div><br></div><div>>> Question 3: Should I even be trying to install more than one release<br>>> at once? Would I need a completely new Erlang install directory (or at<br>>> least, releases directory, by using RELDIR)?</div>
<div><br></div><div>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.</div>
<div><br>>> (I have, incidentally, seen somewhere that the placement of the .rel<br>>> file directly under releases/ by make_tar is a bug. Is this so? It<br>>> certainly doesn't seem to match the structure created by<br>
>> create_target.)<br><br></div><div>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. </div>
<div><br></div><div>(What do you mean by 'create_target'?? Is it reltool:create_target/2?)</div><div><br></div><div>I hope this was of some help! Thanks for pointing out this problem. The documentation and example will be improved in R15B.</div>
<div><br></div><div>Regards</div><div>/siri</div><div><br></div></div>