From 22a26d9a81e5fb6af32ad7c7e8b60b9c79b0c1f3 Mon Sep 17 00:00:00 2001 From: Jephte Clain Date: Mon, 23 Mar 2015 13:33:55 +0400 Subject: [PATCH] =?UTF-8?q?support=20des=20num=C3=A9ros=20style=20maven?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/ulib/ptools | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) 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