Ticket #44894: patch-base-src-port1.0-portlivecheck.tcl.diff
File patch-base-src-port1.0-portlivecheck.tcl.diff, 3.4 KB (added by pixilla (Bradley Giesbrecht), 10 years ago) |
---|
-
base/src/port1.0/portlivecheck.tcl
47 47 } 48 48 49 49 # define options 50 options livecheck.url livecheck.type livecheck.md5 livecheck.regex livecheck.name livecheck.distname livecheck.version livecheck. ignore_sslcert50 options livecheck.url livecheck.type livecheck.md5 livecheck.regex livecheck.name livecheck.distname livecheck.version livecheck.version_display livecheck.moddate livecheck.ignore_sslcert 51 51 52 52 # defaults 53 53 default livecheck.url {$homepage} … … 57 57 default livecheck.name default 58 58 default livecheck.distname default 59 59 default livecheck.version {$version} 60 default livecheck.version_display {${livecheck.version}} 61 default livecheck.moddate {[file mtime ${portpath}/Portfile]} 60 62 default livecheck.ignore_sslcert yes 61 63 62 64 proc portlivecheck::livecheck_main {args} { 63 65 global livecheck.url livecheck.type livecheck.md5 livecheck.regex livecheck.name livecheck.distname livecheck.version \ 64 livecheck. ignore_sslcert \65 homepage portpathworkpath \66 livecheck.moddate livecheck.version_display livecheck.ignore_sslcert \ 67 homepage workpath \ 66 68 master_sites name subport distfiles 67 69 68 70 set updated 0 … … 71 73 set has_homepage [info exists homepage] 72 74 73 75 set tempfile [mktemp "/tmp/mports.livecheck.XXXXXXXX"] 74 set port_moddate [file mtime ${portpath}/Portfile]75 76 76 ui_debug "Portfile modification date is [clock format $ port_moddate]"77 ui_debug "Portfile modification date is [clock format ${livecheck.moddate}]" 77 78 ui_debug "Port (livecheck) version is ${livecheck.version}" 78 79 79 80 set curl_options {} … … 211 212 } 212 213 } 213 214 "moddate" { 214 set port_moddate [file mtime ${portpath}/Portfile] 215 if {[catch {set updated [curl isnewer ${livecheck.url} $port_moddate]} error]} { 215 if {[catch {set updated [curl isnewer ${livecheck.url} ${livecheck.moddate}]} error]} { 216 216 ui_error "cannot check if $subport was updated ($error)" 217 217 set updated -1 218 218 } else { … … 221 221 } 222 222 } 223 223 } 224 "moddate2" { 225 if {[catch {set moddate [curl getmoddate ${livecheck.url} ${livecheck.moddate}]} error]} { 226 ui_error "cannot check if $subport was updated ($error)" 227 set updated -1 228 } else { 229 if {$moddate < ${livecheck.moddate}} { 230 ui_debug "${livecheck.url} is older than Portfile" 231 set updated 0 232 } else { 233 set updated 1 234 set updated_version [clock format ${moddate}] 235 livecheck.version_display [clock format ${livecheck.moddate}] 236 } 237 } 238 } 224 239 "none" { 225 240 } 226 241 default { … … 232 247 233 248 if {${livecheck.type} != "none"} { 234 249 if {$updated > 0} { 235 ui_msg "$subport seems to have been updated (port version: ${livecheck.version}, new version: $updated_version)"250 ui_msg "$subport seems to have been updated (port version: [join ${livecheck.version_display} { }], new version: $updated_version)" 236 251 } elseif {$updated == 0} { 237 252 ui_info "$subport seems to be up to date" 238 253 }