diff --git a/lib/ulib/ptools b/lib/ulib/ptools index f90af63..f02ce62 100644 --- a/lib/ulib/ptools +++ b/lib/ulib/ptools @@ -244,6 +244,7 @@ function nbdot(s) { return length(s) } BEGIN { + ### utools, legacy if (version ~ /[0-9]+(\.[0-9]+)*(-r[0-9][0-9]\/[0-9][0-9]\/[0-9][0-9][0-9][0-9])?$/) { metadata = "" # traiter release date @@ -268,6 +269,32 @@ BEGIN { # afficher la version migrée au format semver if (metadata != "") print version "+" metadata else print version + + ### maven, pom.xml + } else if (version ~ /[0-9]+(\.[0-9]+)*(-[sS][nN][aA][pP][sS][hH][oO][tT])?$/) { + + prerelease = "" + # traiter prerelease + pos = length(version) - 9 + if (pos > 0) { + prerelease = substr(version, pos + 2) + version = substr(version, 1, pos) + } + # traiter prerelease + match(version, /[0-9]+(\.[0-9]+(\.[0-9]+)?)?/) + pos = RLENGTH + if (pos < length(version)) { + if (prerelease != "") prerelease = prerelease "." + prerelease = prerelease substr(version, pos + 2) + } + version = substr(version, 1, pos) + # ajouter les éléments manquants + while (nbdot(version) < 2) { + version = version ".0" + } + # afficher la version migrée au format semver + if (prerelease != "") print version "-" prerelease + else print version } }')" if [ -n "$mversion" ]; then