build-package.sh: improve version string editing for pacman format (#8384)

This commit is contained in:
Ivan Max 2021-12-29 11:55:08 +03:00 committed by GitHub
parent 3f3b0a0272
commit b2fbd905e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 6 deletions

View File

@ -68,9 +68,12 @@ termux_create_pacman_subpackages() {
fi
# Version view revisions.
local TERMUX_PKG_VERSION=$(echo $TERMUX_PKG_VERSION | sed "s|-|.|g")
local TERMUX_PKG_VERSION=${TERMUX_PKG_VERSION/[a-z]/.${TERMUX_PKG_VERSION//[0-9.]/}}
local TERMUX_PKG_FULLVERSION="${TERMUX_PKG_VERSION}"
local TERMUX_PKG_VERSION_EDITED=${TERMUX_PKG_VERSION//-/.}
local INCORRECT_SYMBOLS=$(echo $TERMUX_PKG_VERSION_EDITED | grep -o '[0-9][a-z]')
if [ -n "$INCORRECT_SYMBOLS" ]; then
local TERMUX_PKG_VERSION_EDITED=${TERMUX_PKG_VERSION_EDITED//${INCORRECT_SYMBOLS:0:1}${INCORRECT_SYMBOLS:1:1}/${INCORRECT_SYMBOLS:0:1}.${INCORRECT_SYMBOLS:1:1}}
fi
local TERMUX_PKG_FULLVERSION="${TERMUX_PKG_VERSION_EDITED}"
if [ -n "$TERMUX_PKG_REVISION" ]; then
TERMUX_PKG_FULLVERSION+="-${TERMUX_PKG_REVISION}"
else

View File

@ -36,9 +36,12 @@ termux_step_create_pacman_package() {
esac
# Version view revisions.
local TERMUX_PKG_VERSION=$(echo $TERMUX_PKG_VERSION | sed "s|-|.|g")
local TERMUX_PKG_VERSION=${TERMUX_PKG_VERSION/[a-z]/.${TERMUX_PKG_VERSION//[0-9.]/}}
local TERMUX_PKG_FULLVERSION="${TERMUX_PKG_VERSION}"
local TERMUX_PKG_VERSION_EDITED=${TERMUX_PKG_VERSION//-/.}
local INCORRECT_SYMBOLS=$(echo $TERMUX_PKG_VERSION_EDITED | grep -o '[0-9][a-z]')
if [ -n "$INCORRECT_SYMBOLS" ]; then
local TERMUX_PKG_VERSION_EDITED=${TERMUX_PKG_VERSION_EDITED//${INCORRECT_SYMBOLS:0:1}${INCORRECT_SYMBOLS:1:1}/${INCORRECT_SYMBOLS:0:1}.${INCORRECT_SYMBOLS:1:1}}
fi
local TERMUX_PKG_FULLVERSION="${TERMUX_PKG_VERSION_EDITED}"
if [ -n "$TERMUX_PKG_REVISION" ]; then
TERMUX_PKG_FULLVERSION+="-${TERMUX_PKG_REVISION}"
else