ANDROID: ltp: post_update.sh: Support stable release updates

When external_updater updates to a tag (e.g. --custom-version
20260930), it stores the commit SHA in METADATA "version" and the tag
in "closest_version". post_update.sh only read "version", so a stable
release update was handled as a SHA update: the title became
"LTP <today> update" and VERSION was set to today's date.

Prefer "closest_version" when it is present, so that tag updates get
the "LTP <tag> release update" title and VERSION=<tag>.

Also keep the UPSTREAM_REV_ID trailer added by external_updater when
rebuilding the commit message, since Copybara/CaaS relies on it, and
emit Change-Id as the last trailer.

Bug: None
Test: bash -n post_update.sh
Test: ran post_update.sh in scratch repos with tag and SHA METADATA,
      checked title, VERSION and trailers
Signed-off-by: Wake Liu <[email protected]>
Change-Id: Id87d60ed0e4c9a16905a3efac65dc291ca97cbf7
1 file changed