Changeset 127797
- Timestamp:
- Nov 4, 2014, 12:01:46 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/base/src/port1.0/portlivecheck.tcl
r127215 r127797 150 150 # single and multiline regex 151 151 ui_debug "Fetching ${livecheck.url}" 152 set updated -1 152 153 if {[catch {curl fetch {*}$curl_options ${livecheck.url} $tempfile} error]} { 153 154 ui_error "cannot check if $subport was updated ($error)" 154 set updated -1155 155 } else { 156 156 # let's extract the version from the file. 157 157 set chan [open $tempfile "r"] 158 set updated -1158 set foundmatch 0 159 159 set the_re [join ${livecheck.regex}] 160 160 ui_debug "The regex is \"$the_re\"" 161 if {${livecheck.type} =="regexm"} {161 if {${livecheck.type} eq "regexm"} { 162 162 set data [read $chan] 163 163 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}} { 165 166 set updated 1 166 167 } else { … … 171 172 } else { 172 173 set updated_version 0 173 set foundmatch 0174 174 while {[gets $chan line] >= 0} { 175 175 set lastoff 0 … … 185 185 } 186 186 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 } 191 193 } else { 192 194 set updated 0 … … 195 197 } 196 198 close $chan 197 if { $updated < 0} {199 if {!$foundmatch} { 198 200 ui_error "cannot check if $subport was updated (regex didn't match)" 199 201 } … … 208 210 # let's compute the md5 sum. 209 211 set dist_md5 [md5 file $tempfile] 210 if {$dist_md5 !=${livecheck.md5}} {212 if {$dist_md5 ne ${livecheck.md5}} { 211 213 ui_debug "md5sum for ${livecheck.url}: $dist_md5" 212 214 set updated 1 … … 234 236 file delete -force $tempfile 235 237 236 if {${livecheck.type} !="none"} {238 if {${livecheck.type} ne "none"} { 237 239 if {$updated > 0} { 238 240 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.