[erlang-patches] release_handler:find_script/4 to use 're' matching in .appup scripts

Ulf Wiger ulf@REDACTED
Tue May 1 14:49:04 CEST 2012


git fetch git://github.com/uwiger/otp.git uw-release_handler-find_script

commit b8259b6a0304b83007983793b9da40207f261209
Author: Ulf Wiger <ulf@REDACTED>
Date:   Tue May 1 14:35:35 2012 +0200

    release_handler:find_script/4 to use 're' matching in .appup scripts
    
    The function release_handler:find_script/4 locates an .appup script
    for a given application, and searches it for the matching up- or
    downgrade script (given OldVsn). The original implementation of this
    function used lists:keysearch/3 to find the matching script, but since
    the .appup files nowadays may contain regexps instead of distinct versions,
    that approach no longer works.
    
    This patch uses re:run/2 to find a matching script instead.
    
    Example:
    
    Stock R15B:
    
    Erlang R15B (erts-5.9) [source] [...]
    
    Eshell V5.9  (abort with ^G)
    1> release_handler:upgrade_script(stdlib,code:lib_dir(stdlib)).
    ** exception throw: {version_not_in_appup,"1.18"}
         in function  release_handler:find_script/4 (release_handler.erl, line 5
         in call from release_handler:upgrade_script/2 (release_handler.erl, lin
    
    Current patch:
    Erlang R16B (erts-5.10) [source] [...]
    
    Eshell V5.10  (abort with ^G)
    1> release_handler:upgrade_script(stdlib,code:lib_dir(stdlib)).
    {ok,"1.19",[restart_new_emulator,point_of_no_return]}


Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc.
http://feuerlabs.com






More information about the erlang-patches mailing list