[127797] trunk/base/src/port1.0/portlivecheck.tcl
jmr at macports.org
jmr at macports.org
Tue Nov 4 04:01:46 PST 2014
Revision: 127797
https://trac.macports.org/changeset/127797
Author: jmr at macports.org
Date: 2014-11-04 04:01:46 -0800 (Tue, 04 Nov 2014)
Log Message:
-----------
generate an error when livecheck finds an older version than is currently in the portfile, instead of saying that the older version is newer (#17041)
Modified Paths:
--------------
trunk/base/src/port1.0/portlivecheck.tcl
Modified: trunk/base/src/port1.0/portlivecheck.tcl
===================================================================
--- trunk/base/src/port1.0/portlivecheck.tcl 2014-11-04 11:24:05 UTC (rev 127796)
+++ trunk/base/src/port1.0/portlivecheck.tcl 2014-11-04 12:01:46 UTC (rev 127797)
@@ -149,19 +149,20 @@
"regexm" {
# single and multiline regex
ui_debug "Fetching ${livecheck.url}"
+ set updated -1
if {[catch {curl fetch {*}$curl_options ${livecheck.url} $tempfile} error]} {
ui_error "cannot check if $subport was updated ($error)"
- set updated -1
} else {
# let's extract the version from the file.
set chan [open $tempfile "r"]
- set updated -1
+ set foundmatch 0
set the_re [join ${livecheck.regex}]
ui_debug "The regex is \"$the_re\""
- if {${livecheck.type} == "regexm"} {
+ if {${livecheck.type} eq "regexm"} {
set data [read $chan]
if {[regexp $the_re $data matched updated_version]} {
- if {$updated_version != ${livecheck.version}} {
+ set foundmatch 1
+ if {$updated_version ne ${livecheck.version}} {
set updated 1
} else {
set updated 0
@@ -170,7 +171,6 @@
}
} else {
set updated_version 0
- set foundmatch 0
while {[gets $chan line] >= 0} {
set lastoff 0
while {[regexp -start $lastoff -indices $the_re $line offsets]} {
@@ -184,17 +184,19 @@
}
}
if {$foundmatch == 1} {
- if {$updated_version == 0} {
- set updated -1
- } elseif {$updated_version != ${livecheck.version}} {
- set updated 1
+ if {$updated_version ne ${livecheck.version}} {
+ if {[vercmp $updated_version ${livecheck.version}] > 0} {
+ set updated 1
+ } else {
+ ui_error "livecheck failed for ${subport}: extracted version '$updated_version' is older than livecheck.version '${livecheck.version}'"
+ }
} else {
set updated 0
}
}
}
close $chan
- if {$updated < 0} {
+ if {!$foundmatch} {
ui_error "cannot check if $subport was updated (regex didn't match)"
}
}
@@ -207,7 +209,7 @@
} else {
# let's compute the md5 sum.
set dist_md5 [md5 file $tempfile]
- if {$dist_md5 != ${livecheck.md5}} {
+ if {$dist_md5 ne ${livecheck.md5}} {
ui_debug "md5sum for ${livecheck.url}: $dist_md5"
set updated 1
}
@@ -233,7 +235,7 @@
file delete -force $tempfile
- if {${livecheck.type} != "none"} {
+ if {${livecheck.type} ne "none"} {
if {$updated > 0} {
ui_msg "$subport seems to have been updated (port version: ${livecheck.version}, new version: $updated_version)"
} elseif {$updated == 0} {
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20141104/5d94076d/attachment-0001.html>
More information about the macports-changes
mailing list