Changeset 127797


Ignore:
Timestamp:
Nov 4, 2014, 12:01:46 PM (9 years ago)
Author:
jmr@…
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)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/base/src/port1.0/portlivecheck.tcl

    r127215 r127797  
    150150            # single and multiline regex
    151151            ui_debug "Fetching ${livecheck.url}"
     152            set updated -1
    152153            if {[catch {curl fetch {*}$curl_options ${livecheck.url} $tempfile} error]} {
    153154                ui_error "cannot check if $subport was updated ($error)"
    154                 set updated -1
    155155            } else {
    156156                # let's extract the version from the file.
    157157                set chan [open $tempfile "r"]
    158                 set updated -1
     158                set foundmatch 0
    159159                set the_re [join ${livecheck.regex}]
    160160                ui_debug "The regex is \"$the_re\""
    161                 if {${livecheck.type} == "regexm"} {
     161                if {${livecheck.type} eq "regexm"} {
    162162                    set data [read $chan]
    163163                    if {[regexp $the_re $data matched updated_version]} {
    164                         if {$updated_version != ${livecheck.version}} {
     164                        set foundmatch 1
     165                        if {$updated_version ne ${livecheck.version}} {
    165166                            set updated 1
    166167                        } else {
     
    171172                } else {
    172173                    set updated_version 0
    173                     set foundmatch 0
    174174                    while {[gets $chan line] >= 0} {
    175175                        set lastoff 0
     
    185185                    }
    186186                    if {$foundmatch == 1} {
    187                         if {$updated_version == 0} {
    188                             set updated -1
    189                         } elseif {$updated_version != ${livecheck.version}} {
    190                             set updated 1
     187                        if {$updated_version ne ${livecheck.version}} {
     188                            if {[vercmp $updated_version ${livecheck.version}] > 0} {
     189                                set updated 1
     190                            } else {
     191                                ui_error "livecheck failed for ${subport}: extracted version '$updated_version' is older than livecheck.version '${livecheck.version}'"
     192                            }
    191193                        } else {
    192194                            set updated 0
     
    195197                }
    196198                close $chan
    197                 if {$updated < 0} {
     199                if {!$foundmatch} {
    198200                    ui_error "cannot check if $subport was updated (regex didn't match)"
    199201                }
     
    208210                # let's compute the md5 sum.
    209211                set dist_md5 [md5 file $tempfile]
    210                 if {$dist_md5 != ${livecheck.md5}} {
     212                if {$dist_md5 ne ${livecheck.md5}} {
    211213                    ui_debug "md5sum for ${livecheck.url}: $dist_md5"
    212214                    set updated 1
     
    234236    file delete -force $tempfile
    235237
    236     if {${livecheck.type} != "none"} {
     238    if {${livecheck.type} ne "none"} {
    237239        if {$updated > 0} {
    238240            ui_msg "$subport seems to have been updated (port version: ${livecheck.version}, new version: $updated_version)"
Note: See TracChangeset for help on using the changeset viewer.