.
svn: r1939
This commit is contained in:
parent
aaaefa9bc3
commit
a4adc29d52
11
collects/planet/cachepath.ss
Normal file
11
collects/planet/cachepath.ss
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
(module cachepath mzscheme
|
||||||
|
|
||||||
|
(require "config.ss")
|
||||||
|
(provide get-planet-cache-path)
|
||||||
|
|
||||||
|
;; get-planet-cache-path : -> path[absolute, file]
|
||||||
|
;; the path to the cache.ss file for the planet installation
|
||||||
|
;; SIDE EFFECT: creates the directory if it doesn't already exist
|
||||||
|
(define (get-planet-cache-path)
|
||||||
|
(let ((path (build-path (PLANET-DIR) "cache.ss")))
|
||||||
|
path)))
|
|
@ -1,7 +1,8 @@
|
||||||
(module planet-archives mzscheme
|
(module planet-archives mzscheme
|
||||||
(require "private/planet-shared.ss"
|
(require "private/planet-shared.ss"
|
||||||
(lib "file.ss")
|
(lib "file.ss")
|
||||||
"config.ss")
|
"config.ss"
|
||||||
|
"cachepath.ss")
|
||||||
|
|
||||||
(provide repository-tree get-installed-planet-archives get-planet-cache-path)
|
(provide repository-tree get-installed-planet-archives get-planet-cache-path)
|
||||||
|
|
||||||
|
@ -30,11 +31,4 @@
|
||||||
min)))
|
min)))
|
||||||
x))
|
x))
|
||||||
(repository-tree)
|
(repository-tree)
|
||||||
3)))
|
3))))
|
||||||
|
|
||||||
;; get-planet-cache-path : -> path[absolute, file]
|
|
||||||
;; the path to the cache.ss file for the planet installation
|
|
||||||
;; SIDE EFFECT: creates the directory if it doesn't already exist
|
|
||||||
(define (get-planet-cache-path)
|
|
||||||
(let ((path (build-path (PLANET-DIR) "cache.ss")))
|
|
||||||
path)))
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ Various common pieces of code that both the client and server need to access
|
||||||
(lib "etc.ss")
|
(lib "etc.ss")
|
||||||
(lib "port.ss")
|
(lib "port.ss")
|
||||||
(lib "file.ss")
|
(lib "file.ss")
|
||||||
|
(lib "getinfo.ss" "setup")
|
||||||
"../config.ss")
|
"../config.ss")
|
||||||
|
|
||||||
(provide (all-defined))
|
(provide (all-defined))
|
||||||
|
@ -56,6 +57,17 @@ Various common pieces of code that both the client and server need to access
|
||||||
;; assoc-table ::= (listof (list n n path))
|
;; assoc-table ::= (listof (list n n path))
|
||||||
(define empty-table '())
|
(define empty-table '())
|
||||||
|
|
||||||
|
;; get-min-core-version : path -> string | #f
|
||||||
|
(define (get-min-core-version p)
|
||||||
|
(let ((info (with-handlers ([exn:fail? (lambda (e) #f)])
|
||||||
|
(get-info/full p))))
|
||||||
|
(if info
|
||||||
|
(let ((core (info 'required-core-version (lambda () #f))))
|
||||||
|
(if (and core (string? core))
|
||||||
|
core
|
||||||
|
#f))
|
||||||
|
#f)))
|
||||||
|
|
||||||
; dir->assoc-table : FULL-PKG-SPEC -> assoc-table
|
; dir->assoc-table : FULL-PKG-SPEC -> assoc-table
|
||||||
; returns the on-disk packages for the given planet dir
|
; returns the on-disk packages for the given planet dir
|
||||||
(define (dir->assoc-table pkg)
|
(define (dir->assoc-table pkg)
|
||||||
|
@ -66,17 +78,13 @@ Various common pieces of code that both the client and server need to access
|
||||||
(min (string->number mins)))
|
(min (string->number mins)))
|
||||||
(if (and (path? p) maj min)
|
(if (and (path? p) maj min)
|
||||||
(let* ((the-path (build-path path majs mins))
|
(let* ((the-path (build-path path majs mins))
|
||||||
(minimum-core-version
|
(min-core-version (get-min-core-version the-path)))
|
||||||
(if (file-exists? (build-path the-path "minimum-core-version"))
|
|
||||||
(with-input-from-file (build-path the-path "minimum-core-version")
|
|
||||||
read-line)
|
|
||||||
#f)))
|
|
||||||
(make-assoc-table-row
|
(make-assoc-table-row
|
||||||
(pkg-spec-name pkg)
|
(pkg-spec-name pkg)
|
||||||
(pkg-spec-path pkg)
|
(pkg-spec-path pkg)
|
||||||
maj min
|
maj min
|
||||||
the-path
|
the-path
|
||||||
minimum-core-version))
|
min-core-version))
|
||||||
#f)))
|
#f)))
|
||||||
|
|
||||||
(if (directory-exists? path)
|
(if (directory-exists? path)
|
||||||
|
@ -195,7 +203,7 @@ Various common pieces of code that both the client and server need to access
|
||||||
(define (string->mz-version str)
|
(define (string->mz-version str)
|
||||||
(let ((ver (regexp-match #rx"^([0-9]+)(\\.([0-9]+))?$" str)))
|
(let ((ver (regexp-match #rx"^([0-9]+)(\\.([0-9]+))?$" str)))
|
||||||
(if ver
|
(if ver
|
||||||
(make-mz-version (list-ref ver 1) (list-ref ver 3))
|
(make-mz-version (string->number (list-ref ver 1)) (string->number (list-ref ver 3)))
|
||||||
#f)))
|
#f)))
|
||||||
|
|
||||||
;; version<= : mz-version mz-version -> boolean
|
;; version<= : mz-version mz-version -> boolean
|
||||||
|
|
Loading…
Reference in New Issue
Block a user