svn: r8813
This commit is contained in:
parent
36b05ee127
commit
7a1aaadf8d
|
@ -1,13 +1,15 @@
|
||||||
(module check mzscheme
|
#lang scheme/base
|
||||||
|
|
||||||
(define version-url "http://download.plt-scheme.org/version")
|
(define version-url "http://download.plt-scheme.org/version")
|
||||||
(define timeout 30)
|
(define timeout 30)
|
||||||
|
|
||||||
;; This file is invoked from the installer, without using zo files -- so
|
;; This file can be invoked from an installer, and in case it's
|
||||||
;; using net/url.ss is extremely slow. Instead, do things directly.
|
;; without zo files using net/url.ss is extremely slow. Instead, do
|
||||||
|
;; things directly.
|
||||||
;; (require net/url)
|
;; (require net/url)
|
||||||
;; (define (url->port url)
|
;; (define (url->port url) (get-pure-port (string->url url)))
|
||||||
;; (get-pure-port (string->url url)))
|
|
||||||
|
(require scheme/tcp)
|
||||||
(define (url->port url)
|
(define (url->port url)
|
||||||
(define-values (host path)
|
(define-values (host path)
|
||||||
(apply values (cdr (regexp-match #rx"^http://([^/:@]+)(/.*)$" url))))
|
(apply values (cdr (regexp-match #rx"^http://([^/:@]+)(/.*)$" url))))
|
||||||
|
@ -39,7 +41,7 @@
|
||||||
(thunk))))))])
|
(thunk))))))])
|
||||||
(if r result (error-value "timeout"))))
|
(if r result (error-value "timeout"))))
|
||||||
|
|
||||||
(define (check-version/timeout)
|
(define (check-version-raw)
|
||||||
(let/ec escape
|
(let/ec escape
|
||||||
(define (err . args) (escape (apply error-value args)))
|
(define (err . args) (escape (apply error-value args)))
|
||||||
(define-syntax try
|
(define-syntax try
|
||||||
|
@ -86,8 +88,8 @@
|
||||||
;; stable)
|
;; stable)
|
||||||
[else `(newer ,stable ,recent)]))))
|
[else `(newer ,stable ,recent)]))))
|
||||||
|
|
||||||
;; Check the version on the server and compare to our version.
|
;; Check the version on the server and compare to our version. Possible return
|
||||||
;; Possible return values (message is always a string):
|
;; values (message is always a string):
|
||||||
;; * `ok
|
;; * `ok
|
||||||
;; You're fine.
|
;; You're fine.
|
||||||
;; * `(ok-but ,version)
|
;; * `(ok-but ,version)
|
||||||
|
@ -95,13 +97,11 @@
|
||||||
;; * `(newer ,version)
|
;; * `(newer ,version)
|
||||||
;; You have an old version, please upgrade to `version'
|
;; You have an old version, please upgrade to `version'
|
||||||
;; * `(newer ,version ,alpha)
|
;; * `(newer ,version ,alpha)
|
||||||
;; You have an old version, please upgrade to `version' you may consider
|
;; You have an old version, please upgrade to `version' you may consider also
|
||||||
;; also the alpha version
|
;; the alpha version
|
||||||
;; * `(error ,message [,additional-info])
|
;; * `(error ,message [,additional-info])
|
||||||
;; An error occured, the third (optional) value can be shown as the system
|
;; An error occured, the third (optional) value can be shown as the system
|
||||||
;; error that happened or the value that caused an error.
|
;; error that happened or the value that caused an error.
|
||||||
(provide check-version)
|
(provide check-version)
|
||||||
(define (check-version)
|
(define (check-version)
|
||||||
(with-timeout timeout check-version/timeout))
|
(with-timeout timeout check-version-raw))
|
||||||
|
|
||||||
)
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user