' start_erl.data缺失'使用rebar erlang生成升级时出错

时间:2016-03-07 14:22:21

标签: erlang rebar

我正在关注rebar wiki页面上的指南,以创建应用程序升级(https://github.com/rebar/rebar/wiki/Upgrades); 我试图从版本0.0.1升级到0.0.2,在生成版本0.0.1和0.0.2后,我运行命令:

rebar generate-appups previous_release=0.0.1

我得到了错误:

  

/rel/0.0.1/releases/start_erl.data缺失。

生成版本时,不会在任何地方生成文件start_erl.data。我真的不知道是什么原因引起的。

我的reltool.config for release 0.0.1:

%% -*- 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)

1 个答案:

答案 0 :(得分:2)

我不确定是否有任何特定的Erlang或rebar命令来生成start_erl.data文件,但可以轻松手动生成。它只包含erts版本和版本名称的一行文本。例如:

g@crayon2:~/work/humbundee/releases % cat start_erl.data 
7.2.1 hbd-0.0.1

您可以从Erlang安装中获取当前版本的erts,例如:

g@crayon2:~/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])).