Port of #6480 .
* Make the script regex-aware
This change makes the `update_appup.escript` check whether the new
version of an application (the _current_ one) is already contained in
entries in the _new_ .appup file for that application if such .appup
file contains regexes.
* Do not use `load_module` instructions if `restart_application` is present
Since the appup instruction `restart_application` already loads all
modules of a given application, there is no need to introduce those
instructions if a restart is already present.
* Do not force `.appup.src` render if contents are the same
To avoid losing comments and/or manual indentation in appup files that
are already up to date, we now check whether the contents have the
exact same terms as those we are about to write to an existint .appup
file.
* Insert `load_module`s after `application:stop`, if present
If there is already any `application:stop(Application)` call in the
appup instructions, we prefer to add `load_module` instructions after
it, so we can be sure that the load is replaced safely.
* Add expected versions check
For apps inside emqx umbrella, we try to bump only the patch part of
their version numbers, and use only 3-part version
numbers (`Major.Minor.Patch`). With those assumptions, we may infer
all versions that need to be covered in a given upgrade, and check if
those are covered in regexes.
external dependencies [5.0]
Same as #6307 .
Currently, the update_appup.escript outputs as an error the full appup
file for external dependencies, even if all the changes are already
contained in the depency. Here, we make it only output the missing
actions to be inserted, to aid in seeing what are the differences.
- Fixes clause error on `create_stub/1`.
- Small optimization: do not download the same file multiple times
with `wget`.
- Fix: remove old file extension (`.app.src`) and preserve dirname
when creating stubs for apps.