support des versions AMUE

This commit is contained in:
Jephté Clain 2024-02-08 22:26:13 +04:00
parent 2886c40aa2
commit fbb05f8dee
1 changed files with 16 additions and 7 deletions

View File

@ -1424,7 +1424,7 @@ function is_archive() {
name="${name%.jar}" name="${name%.jar}"
name="${name%.war}" name="${name%.war}"
name="${name%.ear}" name="${name%.ear}"
[ "$NUTOOLS_SH_ARCHIVE_SUPPORT" ] && name="${name%.sh}" [ -n "$NUTOOLS_SH_ARCHIVE_SUPPORT" ] && name="${name%.sh}"
[ "$name" != "$1" ] [ "$name" != "$1" ]
} }
function extract_archive() { function extract_archive() {
@ -1446,7 +1446,7 @@ function extract_archive() {
cd "$destdir" cd "$destdir"
jar xf "$arch" "$@" jar xf "$arch" "$@"
) || return ) || return
elif [ "$NUTOOLS_SH_ARCHIVE_SUPPORT" ] && endswith "$arch" .sh; then elif [ -n "$NUTOOLS_SH_ARCHIVE_SUPPORT" ] && endswith "$arch" .sh; then
( (
arch="$(abspath "$arch")" arch="$(abspath "$arch")"
cd "$destdir" cd "$destdir"
@ -1469,7 +1469,7 @@ function get_archive_basename() {
basename="${basename%.jar}" basename="${basename%.jar}"
basename="${basename%.war}" basename="${basename%.war}"
basename="${basename%.ear}" basename="${basename%.ear}"
[ "$NUTOOLS_SH_ARCHIVE_SUPPORT" ] && basename="${basename%.sh}" [ -n "$NUTOOLS_SH_ARCHIVE_SUPPORT" ] && basename="${basename%.sh}"
# résultat # résultat
echo "$basename" echo "$basename"
} }
@ -1489,10 +1489,13 @@ function get_archive_appname() {
appname="${appname%.jar}" appname="${appname%.jar}"
appname="${appname%.war}" appname="${appname%.war}"
appname="${appname%.ear}" appname="${appname%.ear}"
[ "$NUTOOLS_SH_ARCHIVE_SUPPORT" ] && appname="${appname%.sh}" [ -n "$NUTOOLS_SH_ARCHIVE_SUPPORT" ] && appname="${appname%.sh}"
# supprimer la version et afficher # supprimer la version et afficher
echo "$appname" | awk '{ echo "$appname" | awk '{
if (match($0, /[-_.]([0-9]+([-_.][0-9]+)*([a-zA-Z][0-9]*|[-_.][0-9]+[a-zA-Z][0-9]*)?)$/)) { if (match($0, /-([0-9]{5}(_(VA|VSR)[0-9]+)?)$/, vs)) {
# version style AMUE, e.g 64070 ou 64070_VA1
print substr($0, 1, RSTART - 1)
} else if (match($0, /[-_.]([0-9]+([-_.][0-9]+)*([a-zA-Z][0-9]*|[-_.][0-9]+[a-zA-Z][0-9]*)?)$/)) {
print substr($0, 1, RSTART - 1) print substr($0, 1, RSTART - 1)
} else if (match($0, /([0-9]+([-_.][0-9]+)*([a-zA-Z][0-9]*|[-_.][0-9]+[a-zA-Z][0-9]*)?)$/)) { } else if (match($0, /([0-9]+([-_.][0-9]+)*([a-zA-Z][0-9]*|[-_.][0-9]+[a-zA-Z][0-9]*)?)$/)) {
print substr($0, 1, RSTART - 1) print substr($0, 1, RSTART - 1)
@ -1511,7 +1514,10 @@ function get_archive_versionsuffix() {
# --> -0.1 # --> -0.1
local basename="$(get_archive_basename "$1")" local basename="$(get_archive_basename "$1")"
echo "$basename" | awk '{ echo "$basename" | awk '{
if (match($0, /([-_.][0-9]+([-_.][0-9]+)*([a-zA-Z][0-9]*|[-_.][0-9]+[a-zA-Z][0-9]*)?)$/, vs)) { if (match($0, /(-[0-9]{5}(_(VA|VSR)[0-9]+)?)$/, vs)) {
# version style AMUE, e.g 64070 ou 64070_VA1
print vs["1"]
} else if (match($0, /([-_.][0-9]+([-_.][0-9]+)*([a-zA-Z][0-9]*|[-_.][0-9]+[a-zA-Z][0-9]*)?)$/, vs)) {
print vs["1"] print vs["1"]
} else if (match($0, /([0-9]+([-_.][0-9]+)*([a-zA-Z][0-9]*|[-_.][0-9]+[a-zA-Z][0-9]*)?)$/, vs)) { } else if (match($0, /([0-9]+([-_.][0-9]+)*([a-zA-Z][0-9]*|[-_.][0-9]+[a-zA-Z][0-9]*)?)$/, vs)) {
print vs["1"] print vs["1"]
@ -1528,7 +1534,10 @@ function get_archive_version() {
# --> 0.1 # --> 0.1
local basename="$(get_archive_basename "$1")" local basename="$(get_archive_basename "$1")"
echo "$basename" | awk '{ echo "$basename" | awk '{
if (match($0, /[-_.]([0-9]+([-_.][0-9]+)*([a-zA-Z][0-9]*|[-_.][0-9]+[a-zA-Z][0-9]*)?)$/, vs)) { if (match($0, /-([0-9]{5}(_(VA|VSR)[0-9]+)?)$/, vs)) {
# version style AMUE, e.g 64070 ou 64070_VA1
print vs["1"]
} else if (match($0, /[-_.]([0-9]+([-_.][0-9]+)*([a-zA-Z][0-9]*|[-_.][0-9]+[a-zA-Z][0-9]*)?)$/, vs)) {
print vs["1"] print vs["1"]
} else if (match($0, /([0-9]+([-_.][0-9]+)*([a-zA-Z][0-9]*|[-_.][0-9]+[a-zA-Z][0-9]*)?)$/, vs)) { } else if (match($0, /([0-9]+([-_.][0-9]+)*([a-zA-Z][0-9]*|[-_.][0-9]+[a-zA-Z][0-9]*)?)$/, vs)) {
print vs["1"] print vs["1"]