rebar3_appup_plugin icon indicating copy to clipboard operation
rebar3_appup_plugin copied to clipboard

rebar3 appup fails - new release overwriting old "previous version apps"

Open Ryanauger95 opened this issue 6 years ago • 4 comments

Environment

-bash-4.2$ rebar3 report

Rebar3 report
 version 3.5.3+build.4088.refe2e7f65
 generated at 2018-06-20T14:40:40+00:00
=================
Please submit this along with your issue at https://github.com/erlang/rebar3/issues (and feel free to edit out private information, if any)
-----------------
Task: 
Entered as:
  
-----------------
Operating System: x86_64-unknown-linux-gnu
ERTS: Erlang/OTP 20 [erts-9.2] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [hipe] [kernel-poll:false]
Root Directory: /usr/local/lib/erlang
Library directory: /usr/local/lib/erlang/lib
-----------------
Loaded Applications:
bbmustache: 1.5.0
certifi: 2.0.0
cf: 0.2.2
common_test: 1.15.3
compiler: 7.1.4
crypto: 4.2
cth_readable: 1.4.1
dialyzer: 3.2.3
edoc: 0.9.2
erlware_commons: 1.1.0
eunit: 2.3.5
eunit_formatters: 0.5.0
getopt: 1.0.1
hipe: 3.17
inets: 6.4.5
kernel: 5.4.1
providers: 1.7.0
public_key: 1.5.2
relx: 3.24.4
sasl: 3.1.1
snmp: 5.2.9
ssl_verify_fun: 1.1.3
stdlib: 3.4.3
syntax_tools: 2.1.4
tools: 2.11.1

-----------------
Escript path: /usr/local/bin/rebar3
Providers:
  app_discovery as clean clean compile compile compile cover ct deps dialyzer do edoc escriptize eunit generate get-deps help install install_deps list lock new path pkgs release relup report shell state tar tar tree unlock update upgrade upgrade upgrade version xref 

Current behaviour

Attempting to generate an appup from an old release. First, I removed the whole _build directory. Then, on the most up-to-date version, 0.4.1, I ran rebar3 release:

... (building and compiling deps)
===> Starting relx build process ...
===> Resolving OTP Applications from directories:
          /home/rauger/repos/backend_debug_client/_build/default/lib
          /usr/local/lib/erlang/lib
===> Resolved backend_debug_client-0.4.1
===> Including Erts from /usr/local/lib/erlang
===> release successfully created!
-bash-4.2$ git branch
* (detached from v0.4.1)
  master
  refactor_as_ct_suite
-bash-4.2$ rebar3 appup generate --previous_version "0.4.0"
===> can not find .rel file for version "0.4.0"

This makes sense - we removed the whole build directory, so there should be no release for "0.4.0". So now build that release:

-bash-4.2$ git checkout "v0.4.0"
Previous HEAD position was 3f62b97... v0.5.0
HEAD is now at 62b3bcd... Added continuous test
-bash-4.2$ rebar3 release
===> Verifying dependencies...
===> Compiling backend_debug_client
===> Starting relx build process ...
===> Resolving OTP Applications from directories:
          /home/rauger/repos/backend_debug_client/_build/default/lib
          /usr/local/lib/erlang/lib
          /home/rauger/repos/backend_debug_client/_build/default/rel
===> Resolved backend_debug_client-0.4.0
===> Including Erts from /usr/local/lib/erlang
===> release successfully created!
-bash-4.2$ git checkout "v0.4.1"
Previous HEAD position was 62b3bcd... Added continuous test
HEAD is now at 3f62b97... v0.5.0
**-bash-4.2$ rebar3 appup generate --previous_version "0.4.0"
===> current ("0.4.0") and previous ("0.4.0") release versions are the same**
-bash-4.2$ rebar3 release
===> Verifying dependencies...
===> Compiling backend_debug_client
===> Starting relx build process ...
===> Resolving OTP Applications from directories:
          /home/rauger/repos/backend_debug_client/_build/default/lib
          /usr/local/lib/erlang/lib
          /home/rauger/repos/backend_debug_client/_build/default/rel
===> Resolved backend_debug_client-0.4.1
===> Including Erts from /usr/local/lib/erlang
===> release successfully created!

-bash-4.2$ DEBUG=1 rebar3 appup generate --previous_version "0.4.0"                                                                                                                                                                                                                                                
===> Expanded command sequence to be run: []
===> Provider: {default,do}
===> Expanded command sequence to be run: [{appup,generate}]
===> Provider: {appup,generate}
===> opts: [{previous_version,"0.4.0"}]
===> release name: "backend_debug_client"
===> current release, name: "backend_debug_client", version: "0.4.1"
===> previous release: "/home/rauger/repos/backend_debug_client/_build/default/rel/backend_debug_client"
===> current release: "/home/rauger/repos/backend_debug_client/_build/default/rel/backend_debug_client"
===> target dir: undefined
===> previous release, name: "backend_debug_client", version: "0.4.0"

Here is where the unexpected behaviour comes in - the previous version apps should be 0.4.0, not 0.4.1.

===> previous version apps: [{backend_debug_client,"0.4.1"},
                                    {sasl,"3.1.1"},
                                    {lager,"3.2.2"},
                                    {goldrush,"0.1.9"},
                                    {syntax_tools,"2.1.4"},
                                    {compiler,"7.1.4"},
                                    {cqerl,"1.0.4"},
                                    {ssl,"8.2.3"},
                                    {public_key,"1.5.2"},
                                    {asn1,"5.0.4"},
                                    {pooler,"1.5.2"},
                                    {re2,"1.7.5"},
                                    {semver,"0.0.1"},
                                    {snappy,"1.1.1"},
                                    {lz4,"0.2.2"},
                                    {uuid,"1.7.2"},
                                    {quickrand,"1.7.2"},
                                    {crypto,"4.2"},
                                    {emqttc,"0.8.0"},
                                    {gen_logger,"1.2"},
                                    {sim_security,"0.1.0"},
                                    {stdlib,"3.4.3"},
                                    {kernel,"5.4.1"}]
===> current version apps: [{backend_debug_client,"0.4.1"},
                                   {sasl,"3.1.1"},
                                   {lager,"3.2.2"},
                                   {goldrush,"0.1.9"},
                                   {syntax_tools,"2.1.4"},
                                   {compiler,"7.1.4"},
                                   {cqerl,"1.0.4"},
                                   {ssl,"8.2.3"},
                                   {public_key,"1.5.2"},
                                   {asn1,"5.0.4"},
                                   {pooler,"1.5.2"},
                                   {re2,"1.7.5"},
                                   {semver,"0.0.1"},
                                   {snappy,"1.1.1"},
                                   {lz4,"0.2.2"},
                                   {uuid,"1.7.2"},
                                   {quickrand,"1.7.2"},
                                   {crypto,"4.2"},
                                   {emqttc,"0.8.0"},
                                   {gen_logger,"1.2"},
                                   {sim_security,"0.1.0"},
                                   {stdlib,"3.4.3"},
                                   {kernel,"5.4.1"}]
===> added: []
===> removed: []
===> upgraded: []
===> apps that already have .appups: ["stdlib","kernel","ssl",
                                             "compiler","asn1","sasl",
                                             "syntax_tools","public_key",
                                             "crypto"]
===> generating .appup for apps: []
===> appup opts: [{purge_opts,[[]]},
                         {plugin_dir,"/home/rauger/repos/backend_debug_client/_build/default/plugins/rebar3_appup_plugin"}]

No .appup is generated. It appears that when I run rebar3 release on any newer version, the old version is overwritten. How could this be/how can I prevent this?

Expected behaviour

Expect an appup file to be generated in my _build/default/lib/backend_debug_client/ebin/ directory.

Ryanauger95 avatar Jun 20 '18 16:06 Ryanauger95

I just tried again, reversing the order:

checkout out OLDER version removed build and rebar3 release checked out NEWER version rebar3 release attempted an appup with SUCCESS I just went back and duplicated my results.

So what I am seeing is that the order of the "rebar3 release" matters - and I'm not sure why. Is this a expected behavior ?

Ryanauger95 avatar Jun 25 '18 13:06 Ryanauger95

i haven't yet had time to dig into this, i think the latest release you build is marked as the current one and this is what influences the results you're seeing, but still, i don't have confirmation yet

lrascao avatar Jun 25 '18 13:06 lrascao

@lrascao This is the "previous version" that is being overwritten though, not the current version

Ryanauger95 avatar Jun 25 '18 14:06 Ryanauger95

hey, sorry for the lag, did some more digging, found the following using relapp1 (https://github.com/lrascao/relapp1):

  • checkout 1.0.36
  • rebar3 release
  • cat _build/default/rel/relapp/releases/1.0.36/relapp.rel
{release,{"relapp","1.0.36"},
         {erts,"8.3"},
         [{kernel,"5.2"},
          {stdlib,"3.3"},
          {syntax_tools,"2.1.1"},
          {parse_trans,"3.0.0"},
          {granderl,"0.1.5"},
          {statsderl,"0.5.2"},
          {relapp,"1.0.36"},
          {sasl,"3.0.3"}]}.
  • checkout 1.0.35
  • rebar3 release
  • cat _build/default/rel/relapp/releases/1.0.35/relapp.rel
{release,{"relapp","1.0.35"},
         {erts,"8.3"},
         [{kernel,"5.2"},
          {stdlib,"3.3"},
          {syntax_tools,"2.1.1"},
          {parse_trans,"3.0.0"},
          {granderl,"0.1.5"},
          {statsderl,"0.5.2"},
          {relapp,"1.0.36"},
          {sasl,"3.0.3"}]}.

Issue is relapp's version is the same in both releases: 1.0.36

lrascao avatar Oct 03 '18 13:10 lrascao