-awk_vercmp='
+awk_version_compare='
function max(a, b) { return a > b ? a : b }
- function vercmp(v1, v2, i, a, b) {
+ function version_cmp(v1, v2, i, a, b) {
v1 = max(split(v1, a, /[-_.:]/), split(v2, b, /[-_.:]/))
for (i = 1; i <= v1; i++)
if (v2 = a[i] - b[i])
@@ -155,10 +155,10 @@ awk_vercmp='
return v2
}
'
-function vercmpgt() {
- awk "$awk_vercmp"'
+function version_compare_gt() {
+ awk "$awk_version_compare"'
BEGIN {
- exit !(vercmp(ARGV[1], ARGV[2]) > 0)
+ exit !(version_cmp(ARGV[1], ARGV[2]) > 0)
}
' "$@"
}
@@ -171,7 +171,7 @@ function find_updates() {
local tmp_queue=$1
local recheck_queue=$2
- awk -v i=$VERSION_STATUS -v verbose=$VERBOSE_QUEUING "$awk_vercmp"'
+ awk -v i=$VERSION_STATUS -v verbose=$VERBOSE_QUEUING
"$awk_version_compare"'
# decide what to print - just the spell or also the reason
function needs_update( reasons, diff) {
if (verbose == "on") {
@@ -184,7 +184,7 @@ function find_updates() {
reasons = reasons " Security update."
}
}
- if (vercmp($2, factor[2]) < 0) {
+ if (version_cmp($2, factor[2]) < 0) {
reasons = reasons " New version (" factor[2] ")."
}
if ($3 < factor[3] ) {
@@ -197,7 +197,7 @@ function find_updates() {
print $1, reasons
}
} else {
- if (vercmp($2, factor[2]) < 0 || $3 < factor[3] || $4 < factor[4] ||
$5 < factor[5]) {
+ if (version_cmp($2, factor[2]) < 0 || $3 < factor[3] || $4 <
factor[4] || $5 < factor[5]) {
print $1
}
}
@@ -268,7 +268,7 @@ function does_spell_need_update_slow() {
message="$message Security update."
fi
fi
- if vercmpgt $VERSION $curr_version; then
+ if version_compare_gt $VERSION $curr_version; then
message="$message New version ($VERSION)."
fi
if (( "${PATCHLEVEL:-0}" > "$curr_patchlevel" )); then
[SM-Commit] GIT changes to master sorcery by Ismael Luceno (298a53df5e22d764bd0ca8d8ce84a052ff5ac9d7),
Ismael Luceno, 01/05/2015