diff options
author | Siri Hansen <[email protected]> | 2011-10-10 11:30:17 +0200 |
---|---|---|
committer | Siri Hansen <[email protected]> | 2011-11-17 16:47:28 +0100 |
commit | 8a013f1f16fd4730c24839127afdf46f96a45b0b (patch) | |
tree | c5292d1a21ddd714ceb26593e7d8c8895a1b7d39 /lib/sasl/src | |
parent | 19a46c5c9f4ed3f0f2bfb149fc1feb0b93d55379 (diff) | |
download | otp-8a013f1f16fd4730c24839127afdf46f96a45b0b.tar.gz otp-8a013f1f16fd4730c24839127afdf46f96a45b0b.tar.bz2 otp-8a013f1f16fd4730c24839127afdf46f96a45b0b.zip |
Allow regexp for version in .appup
In order to avoid duplication of upgrade instructions in .appup files,
we now allow regular expressions to specify the UpFrom and DownTo
versions. To be considered a regular expression, the version
identifier must be specified as a binary, e.g.
<<"2\\.1\\.[0-9]+">> will match versions 2.1.x, where x is any number.
Diffstat (limited to 'lib/sasl/src')
-rw-r--r-- | lib/sasl/src/systools_relup.erl | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/lib/sasl/src/systools_relup.erl b/lib/sasl/src/systools_relup.erl index 682f5f5cc9..5cfbc3aadf 100644 --- a/lib/sasl/src/systools_relup.erl +++ b/lib/sasl/src/systools_relup.erl @@ -451,13 +451,29 @@ get_script_from_appup(Mode, TopApp, BaseVsn, Ws, RUs) -> %% XXX Why is this a warning only? [{bad_vsn, {TopVsn, TopApp#application.vsn}}| Ws] end, - case lists:keysearch(BaseVsn, 1, VsnRUs) of - {value, {_, RU}} -> + case search_for_version(BaseVsn, length(BaseVsn), VsnRUs) of + {ok, RU} -> {RUs ++ [RU], Ws1}; - _ -> + error -> throw({error, ?MODULE, {no_relup, FName, TopApp, BaseVsn}}) end. +search_for_version(BaseVsn,_,[{BaseVsn,RU}|_]) -> + {ok,RU}; +search_for_version(BaseVsn,Size,[{Vsn,RU}|VsnRUs]) when is_binary(Vsn) -> + case re:run(BaseVsn,Vsn,[unicode,{capture,first,index}]) of + {match,[{0,Size}]} -> + {ok, RU}; + _ -> + search_for_version(BaseVsn,Size,VsnRUs) + end; +search_for_version(BaseVsn,Size,[_|VsnRUs]) -> + search_for_version(BaseVsn,Size,VsnRUs); +search_for_version(_,_,[]) -> + error. + + + %% Primitives for the "lists of release names" that we upgrade from %% and to. |