2016-03-07 77 views
2

我按照鋼筋維基頁面上的指南創建應用程序升級(https://github.com/rebar/rebar/wiki/Upgrades); 我試圖從版本0.0.1升級到0.0.2,並生成發佈0.0.1和0.0.2之後,我運行以下命令:使用鋼筋erlang生成升級時'start_erl.data is missing'錯誤

rebar generate-appups previous_release=0.0.1

,我得到了錯誤:

/rel/0.0.1/releases/start_erl.data is missing.

當我生成發行版時,不會生成文件start_erl.data。我真的不知道可能是什麼原因造成的。

我發佈0.0.1 reltool.config:

%% -*- mode: erlang -*- 
%% ex: ft=erlang 
{sys, [ 
    %%{lib_dirs, []}, 
    {erts, [{mod_cond, derived}, {app_file, strip}]}, 
    {app_file, strip}, 
    {rel, "my_app", "0.0.1", 
    [ 
     kernel, 
     stdlib, 
     sasl, 
     mnesia, 
     crypto, 
     sync, 
     ranch, 
     cowlib, 
     cowboy, 
     auth, 
     quickrand, 
     snappy, 
     lz4, 
     semver, 
     uuid, 
     re2, 
     my_app 
    ]}, 
    {rel, "start_clean", "", 
    [ 
     kernel, 
     stdlib 
    ]}, 
    {boot_rel, "my_app"}, 
    {profile, embedded}, 
    {incl_cond, derived}, 
    {excl_archive_filters, [".*"]}, %% Do not archive built libs 
    {excl_sys_filters, ["^bin/(?!start_clean.boot)", 
    "^erts.*/bin/(dialyzer|typer)", 
    "^erts.*/(doc|info|include|lib|man|src)"]}, 
    {excl_app_filters, ["\.gitignore"]}, 
    {app, hipe, [{incl_cond, exclude}]}, 
    {app, sync, [{mod_cond, app}, {incl_cond, include}, {lib_dir, "../deps/sync"}]}, 
    {app, ranch, [{mod_cond, app}, {incl_cond, include}, {lib_dir, "../deps/ranch"}]}, 
    {app, jsx, [{mod_cond, app}, {incl_cond, include}, {lib_dir, "../deps/jsx"}]}, 
    {app, cowlib, [{mod_cond, app}, {incl_cond, include}, {lib_dir, "../deps/cowlib"}]}, 
    {app, cowboy, [{mod_cond, app}, {incl_cond, include}, {lib_dir, "../deps/cowboy"}]}, 
    {app, quickrand, [{mod_cond, app}, {incl_cond, include}, {lib_dir, "../deps/quickrand"}]}, 
    {app, snappy, [{mod_cond, app}, {incl_cond, include}, {lib_dir, "../deps/snappy"}]}, 
    {app, lz4, [{mod_cond, app}, {incl_cond, include}, {lib_dir, "../deps/lz4"}]}, 
    {app, semver, [{mod_cond, app}, {incl_cond, include}, {lib_dir, "../deps/semver"}]}, 
    {app, uuid, [{mod_cond, app}, {incl_cond, include}, {lib_dir, "../deps/uuid"}]}, 
    {app, re2, [{mod_cond, app}, {incl_cond, include}, {lib_dir, "../deps/re2"}]}, 
    {app, auth, [{mod_cond, app}, {incl_cond, include}, {lib_dir, "../deps/auth"}]}, 
    {app, my_app, [{mod_cond, app}, {incl_cond, include}, {lib_dir, ".."}]} 
]}. 

{target_dir, "my_app"}. 

{overlay, [ 
    {mkdir, "log/sasl"}, 
    {copy, "files/erl", "\{\{erts_vsn\}\}/bin/erl"}, 
    {copy, "files/nodetool", "releases/\{\{rel_vsn\}\}/nodetool"}, 
    {copy, "my_app/bin/start_clean.boot", 
    "\{\{erts_vsn\}\}/bin/start_clean.boot"}, 
    {copy, "files/my_app", "bin/my_app"}, 
    {copy, "files/my_app.cmd", "bin/my_app.cmd"}, 
    {copy, "files/start_erl.cmd", "bin/start_erl.cmd"}, 
    {copy, "files/install_upgrade.escript", "bin/install_upgrade.escript"}, 
    {copy, "files/sys.config", "releases/\{\{rel_vsn\}\}/sys.config"}, 
    {copy, "files/vm.args", "releases/\{\{rel_vsn\}\}/vm.args"} 
]}. 

發佈0.0.2的reltool.config文件是除了部分相同:{rel, "my_app", "0.0.1", 其更改爲{rel, "my_app", "0.0.2", (我用R16B03 )

回答

2

我不確定是否有任何特定的Erlang或rebar命令來生成start_erl.data文件,但它可以很容易地手動生成。它只是包含erts版本和發行版名稱的一行文本。例如:

[email protected]:~/work/humbundee/releases % cat start_erl.data 
7.2.1 hbd-0.0.1 

你可以得到的erts從二郎安裝最新版本,例如:

[email protected]:~/work/humbundee/releases % l /usr/local/lib/erlang/lib/ | grep erts 
drwxr-xr-x 4 root wheel 4 17 Feb 08:46 erts-7.2.1/ 

而在你的情況下,版本名稱將是簡單的「0.0.1」。所以,你可以這樣創建:

echo "7.2.1 0.0.1" > start_erl.data 

如果你想看到這是如何以更加自動的方式來完成,在我的構建腳本我用這個write_start_erl_data功能:

write_start_erl_data(ErtsVsn, Vsn) -> 
    DataFile = filename:join("releases", "start_erl.data"), 
    io:format(" => Create file: ~s~n", [DataFile]), 
    ok = file:write_file(DataFile, io_lib:format("~s ~s~n", [ErtsVsn, Vsn])).