Skip to Content.
Sympa Menu

sm-commit - [SM-Commit] GIT changes to master sorcery by Ismael Luceno (ec486fc52b559dfb41e94437fb5fb8d2389d2382)

sm-commit AT lists.ibiblio.org

Subject: Source Mage code commit list

List archive

Chronological Thread  
  • From: Ismael Luceno <scm AT sourcemage.org>
  • To: sm-commit AT lists.ibiblio.org
  • Subject: [SM-Commit] GIT changes to master sorcery by Ismael Luceno (ec486fc52b559dfb41e94437fb5fb8d2389d2382)
  • Date: Sun, 4 Jan 2015 01:16:35 -0600

GIT changes to master sorcery by Ismael Luceno <ismael AT sourcemage.org>:

var/lib/sorcery/modules/libqueue | 24 +++++++++++++++++++++---
1 file changed, 21 insertions(+), 3 deletions(-)

New commits:
commit ec486fc52b559dfb41e94437fb5fb8d2389d2382
Author: Ismael Luceno <ismael AT sourcemage.org>
Commit: Ismael Luceno <ismael AT sourcemage.org>

libqueue: Implement proper version comparison

diff --git a/var/lib/sorcery/modules/libqueue
b/var/lib/sorcery/modules/libqueue
index b5d2a63..9d4b407 100755
--- a/var/lib/sorcery/modules/libqueue
+++ b/var/lib/sorcery/modules/libqueue
@@ -145,6 +145,24 @@ function find_security_updates() {
} ' > $tmp_queue 2> $recheck_queue
}

+awk_vercmp='
+ function max(a, b) { return a > b ? a : b }
+ function vercmp(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])
+ break
+ return v2
+ }
+'
+function vercmpgt() {
+ awk "$awk_vercmp"'
+ BEGIN {
+ exit !(vercmp(ARGV[1], ARGV[2]) > 0)
+ }
+' "$@"
+}
+
#---------------------------------------------------------------------
## Find all spells that need to be updated (for any reason).
## Checks the version caches and compares them to the installed one.
@@ -153,7 +171,7 @@ function find_updates() {
local tmp_queue=$1
local recheck_queue=$2

- awk -v i=$VERSION_STATUS -v verbose=$VERBOSE_QUEUING '
+ awk -v i=$VERSION_STATUS -v verbose=$VERBOSE_QUEUING "$awk_vercmp"'
# decide what to print - just the spell or also the reason
function needs_update( reasons, diff) {
if (verbose == "on") {
@@ -166,7 +184,7 @@ function find_updates() {
reasons = reasons " Security update."
}
}
- if ($2 != factor[2]) {
+ if (vercmp($2, factor[2]) < 0) {
reasons = reasons " New version (" factor[2] ")."
}
if ($3 < factor[3] ) {
@@ -250,7 +268,7 @@ function does_spell_need_update_slow() {
message="$message Security update."
fi
fi
- if [[ $VERSION != $curr_version ]]; then
+ if vercmpgt $VERSION $curr_version; then
message="$message New version ($VERSION)."
fi
if (( "${PATCHLEVEL:-0}" > "$curr_patchlevel" )); then




Archive powered by MHonArc 2.6.24.

Top of Page