diff --git a/collects/planet/cachepath.rkt b/collects/planet/cachepath.rkt index fb83724caf..9d27b0f20c 100644 --- a/collects/planet/cachepath.rkt +++ b/collects/planet/cachepath.rkt @@ -1,14 +1,13 @@ -(module cachepath mzscheme +#lang racket/base +(require "config.rkt") +(provide get-planet-cache-path) - (require "config.rkt") - (provide get-planet-cache-path) - - ;; get-planet-cache-path : -> path[absolute, file] - ;; the path to the cache.rktd file for the planet installation - ;; (n.b. this used to have the side effect of creating the path - ;; if it didn't exist, but since this function may be run at - ;; setup time and setup-time programs must not create this sort - ;; of directory, it doesn't do that anymore) - (define (get-planet-cache-path) - (let ((path (build-path (PLANET-DIR) "cache.rktd"))) - path))) +;; get-planet-cache-path : -> path[absolute, file] +;; the path to the cache.rktd file for the planet installation +;; (n.b. this used to have the side effect of creating the path +;; if it didn't exist, but since this function may be run at +;; setup time and setup-time programs must not create this sort +;; of directory, it doesn't do that anymore) +(define (get-planet-cache-path) + (let ((path (build-path (PLANET-DIR) "cache.rktd"))) + path)) \ No newline at end of file diff --git a/collects/planet/lang/reader.rkt b/collects/planet/lang/reader.rkt index 2b5e5ea212..05999916f8 100644 --- a/collects/planet/lang/reader.rkt +++ b/collects/planet/lang/reader.rkt @@ -1,4 +1,4 @@ -#lang scheme/base +#lang racket/base (require syntax/module-reader "../resolver.ss") diff --git a/collects/planet/parsereq.rkt b/collects/planet/parsereq.rkt index 55890e65be..51419537c0 100644 --- a/collects/planet/parsereq.rkt +++ b/collects/planet/parsereq.rkt @@ -1,4 +1,4 @@ -#lang scheme/base +#lang racket/base (require mzlib/match "private/short-syntax-helpers.ss" diff --git a/collects/planet/planet-archives.rkt b/collects/planet/planet-archives.rkt index 7fe087b37c..dcdfa0c380 100644 --- a/collects/planet/planet-archives.rkt +++ b/collects/planet/planet-archives.rkt @@ -1,60 +1,57 @@ -(module planet-archives mzscheme - (require "private/planet-shared.ss" - mzlib/file - "config.ss" - "cachepath.ss") - - (provide repository-tree - get-installed-planet-archives - get-hard-linked-packages - get-all-planet-packages - get-planet-cache-path) - - (define (repository-tree) - (define (id x) x) - (filter-tree-by-pattern - (directory->tree - (CACHE-DIR) - (lambda (x) - (not (regexp-match? #rx"/(?:[.]git.*|[.]svn|CVS)$" (path->string x)))) - 4) - (list id id id string->number string->number))) - - ;; get-installed-planet-dirs : -> listof (list path[absolute, dir] string string (listof string) nat nat) - ;; directories of all normally-installed planet archives [excluding hard links] - (define (get-installed-planet-archives) - (with-handlers ((exn:fail:filesystem:no-directory? (lambda (e) '()))) - (tree-apply - (lambda (rep-name owner package maj min) - (let ((x (list - (build-path (CACHE-DIR) owner package (number->string maj) (number->string min)) - owner - package - '() - maj - min))) - x)) - (repository-tree) - 3))) - - ;; get-hard-linked-packages : -> listof (list path[absolute, dir] string string (listof string) nat nat) - ;; directories of all hard-linked packages - (define (get-hard-linked-packages) - (map - (lambda (row) - (map (lambda (f) (f row)) - (list assoc-table-row->dir - (lambda (r) (car (assoc-table-row->path r))) - assoc-table-row->name - (lambda (r) (cdr (assoc-table-row->path r))) - assoc-table-row->maj - assoc-table-row->min))) - (get-hard-link-table))) - - ;; get-all-planet-packages : -> listof (list path[absolute, dir] string string (listof string) nat nat) - ;; get every planet package, regardless of origin - (define (get-all-planet-packages) - (append (get-installed-planet-archives) - (get-hard-linked-packages))) - - ) +#lang racket/base +(require "private/planet-shared.ss" + "config.ss" + "cachepath.ss") + +(provide repository-tree + get-installed-planet-archives + get-hard-linked-packages + get-all-planet-packages + get-planet-cache-path) + +(define (repository-tree) + (define (id x) x) + (filter-tree-by-pattern + (directory->tree + (CACHE-DIR) + (lambda (x) + (not (regexp-match? #rx"/(?:[.]git.*|[.]svn|CVS)$" (path->string x)))) + 4) + (list id id id string->number string->number))) + +;; get-installed-planet-dirs : -> listof (list path[absolute, dir] string string (listof string) nat nat) +;; directories of all normally-installed planet archives [excluding hard links] +(define (get-installed-planet-archives) + (with-handlers ((exn:fail:filesystem:no-directory? (lambda (e) '()))) + (tree-apply + (lambda (rep-name owner package maj min) + (let ((x (list + (build-path (CACHE-DIR) owner package (number->string maj) (number->string min)) + owner + package + '() + maj + min))) + x)) + (repository-tree) + 3))) + +;; get-hard-linked-packages : -> listof (list path[absolute, dir] string string (listof string) nat nat) +;; directories of all hard-linked packages +(define (get-hard-linked-packages) + (map + (lambda (row) + (map (lambda (f) (f row)) + (list assoc-table-row->dir + (lambda (r) (car (assoc-table-row->path r))) + assoc-table-row->name + (lambda (r) (cdr (assoc-table-row->path r))) + assoc-table-row->maj + assoc-table-row->min))) + (get-hard-link-table))) + +;; get-all-planet-packages : -> listof (list path[absolute, dir] string string (listof string) nat nat) +;; get every planet package, regardless of origin +(define (get-all-planet-packages) + (append (get-installed-planet-archives) + (get-hard-linked-packages))) diff --git a/collects/planet/planet.rkt b/collects/planet/planet.rkt index 9018f1fc79..b0a9c837c0 100644 --- a/collects/planet/planet.rkt +++ b/collects/planet/planet.rkt @@ -1,4 +1,4 @@ -#lang scheme/base +#lang racket/base (require "private/cmdline-tool.rkt") (with-handlers ([exn:fail? diff --git a/collects/planet/private/cmdline-tool.rkt b/collects/planet/private/cmdline-tool.rkt index 1fc6ad35b7..210546dde2 100644 --- a/collects/planet/private/cmdline-tool.rkt +++ b/collects/planet/private/cmdline-tool.rkt @@ -1,18 +1,17 @@ -(module planet mzscheme - #| +#lang racket/base +#| This module contains code that implements the `planet' command-line tool. PLANNED FEATURES: * Disable a package without removing it (disabling meaning that if it's a tool it won't start w/ DrRacket, etc) |# - (require mzlib/string - mzlib/file - (only racket/path simple-form-path) - (only mzlib/list sort) + (require (only-in racket/path simple-form-path) net/url - mzlib/match + racket/file + racket/match raco/command-name + (only-in mzlib/string read-from-string) "../config.rkt" "planet-shared.rkt" @@ -160,7 +159,7 @@ This command does not unpack or install the named .plt file." (when (file-exists? pkg) (fail "Cannot download, there is a file named ~a in the way" pkg)) (match (download-package full-pkg-spec) - [(#t path maj min) + [(list #t path maj min) (copy-file path pkg) (printf "Downloaded ~a package version ~a.~a\n" pkg maj min)] [_ @@ -214,7 +213,9 @@ This command does not unpack or install the named .plt file." (for-each (lambda (l) (apply printf " ~a \t~a \t~a ~a\n" l)) (sort-by-criteria - (map (lambda (x) (match x [(_ owner pkg _ maj min) (list owner pkg maj min)])) normal-packages) + (map (lambda (x) (match x [(list _ owner pkg _ maj min) + (list owner pkg maj min)])) + normal-packages) (list string ~a\n" l)) (sort-by-criteria (map - (lambda (x) (match x [(dir owner pkg _ maj min) (list owner pkg maj min (path->string dir))])) + (lambda (x) (match x [(list dir owner pkg _ maj min) + (list owner pkg maj min (path->string dir))])) devel-link-packages) (list string (listof assoc-table-row) (define (hard-links pkg) @@ -302,8 +302,8 @@ Various common pieces of code that both the client and server need to access ;; version<= : mz-version mz-version -> boolean - ;; determines if a is the version string of an earlier mzscheme release than b - ;; [n.b. this relies on a guarantee from Matthew that mzscheme version + ;; determines if a is the version string of an earlier racket release than b + ;; [n.b. this relies on a guarantee from Matthew that racket version ;; x1.y1 is older than version x2.y2 iff x1 bool - ; determines if the given scheme value is a natural number + ; determines if the given value is a natural number (define (nat? obj) (and (integer? obj) (>= obj 0))) ; read-n-chars-to-file : Nat input-port string[filename] -> void diff --git a/collects/planet/private/prefix-dispatcher.rkt b/collects/planet/private/prefix-dispatcher.rkt index 732dba4b53..4aa48d88ab 100644 --- a/collects/planet/private/prefix-dispatcher.rkt +++ b/collects/planet/private/prefix-dispatcher.rkt @@ -1,6 +1,6 @@ -#lang scheme/base +#lang racket/base -(require (for-syntax scheme/base)) +(require (for-syntax racket/base)) (provide (all-defined-out)) ;; ============================================================ diff --git a/collects/planet/private/short-syntax-helpers.rkt b/collects/planet/private/short-syntax-helpers.rkt index 10c7808c9d..e736365264 100644 --- a/collects/planet/private/short-syntax-helpers.rkt +++ b/collects/planet/private/short-syntax-helpers.rkt @@ -1,4 +1,4 @@ -#lang scheme/base +#lang racket/base (provide (all-defined-out)) diff --git a/collects/planet/raco.rkt b/collects/planet/raco.rkt index a32da7c522..bc192709f3 100644 --- a/collects/planet/raco.rkt +++ b/collects/planet/raco.rkt @@ -1,4 +1,4 @@ -#lang scheme/base +#lang racket/base (require "private/cmdline-tool.rkt") (with-handlers ([exn:fail? diff --git a/collects/planet/terse-info.rkt b/collects/planet/terse-info.rkt index c4d256ae9a..615ee58f56 100644 --- a/collects/planet/terse-info.rkt +++ b/collects/planet/terse-info.rkt @@ -3,11 +3,11 @@ #| This file is shared between the original -namespace that drscheme first starts with +namespace that drracket first starts with any other namespaces that it loads, so it keeps the requirements low (it could be in the '#%kernel language, but -drscheme already shares mred/mred, so there +drracket already shares mred/mred, so there seems little point to that). |#