From 844ed2d48f4e90f035d19799dc73e96998b26b2f Mon Sep 17 00:00:00 2001 From: Jacob Matthews Date: Mon, 19 Feb 2007 23:30:37 +0000 Subject: [PATCH] changed planet search order, now uninstalled packages are only consulted if an attempt to download from the network fails. svn: r5638 --- collects/planet/doc.txt | 18 ++++++++++++++++-- collects/planet/resolver.ss | 16 ++++++++++------ 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/collects/planet/doc.txt b/collects/planet/doc.txt index 04645d50cf..e8529ea86f 100644 --- a/collects/planet/doc.txt +++ b/collects/planet/doc.txt @@ -80,8 +80,10 @@ cache, which contains compiled files and is specific to each particular version of PLT Scheme, the uninstalled package cache is shared by all versions of PLT Scheme that use the same package repository, and it is searched if a package is not installed in the -primary cache. This behavior is intended to primarily benefit users -who upgrade their PLT Scheme installations frequently. +primary cache and cannot be downloaded from the central PLaneT repository +(for instance due to a loss of Internet connectivity). This behavior +is intended to primarily benefit users who upgrade their PLT Scheme +installations frequently. > (LINKAGE-FILE) file-string > (LINKAGE-FILE file-string) -> void @@ -235,6 +237,18 @@ the requirement. The server then finds the newest matching package and sends it back to the client, which then installs it and uses it to satisfy the original requirement. +4. Cached installation archive + +If the remote server cannot be contacted (or fails in any way to +deliver an acceptable package), the PLaneT client consults the +uninstalled-packages cache, a cache of all previously-downloaded +packages, even those that are not currently installed. PLT Scheme +users who frequently upgrade their installations may have many +packages downloaded but not installed at any given time; this step +is intended to ensure that these users can still run programs even +if they temporarily lose network connection. + + _The planet command-line tool_ ------------------------------ diff --git a/collects/planet/resolver.ss b/collects/planet/resolver.ss index f57cd18081..f0e671bf56 100644 --- a/collects/planet/resolver.ss +++ b/collects/planet/resolver.ss @@ -410,6 +410,12 @@ attempted to load version ~a.~a while version ~a.~a was already loaded" (define (get-package-from-cache pkg-spec) (lookup-package pkg-spec)) + ;; get/uninstalled-cache-dummy : pkg-getter + ;; always fails, but records the package to the uninstalled package cache + ;; upon the success of some other getter later in the chain. + (define (get/uninstalled-cache-dummy module-spec pkg-spec success-k failure-k) + (failure-k save-to-uninstalled-pkg-cache! void (λ (x) x))) + ; get/uninstalled-cache : pkg-getter ; note: this does not yet work with minimum-required-version specifiers ; if you install a package and then use an older mzscheme @@ -426,10 +432,7 @@ attempted to load version ~a.~a while version ~a.~a was already loaded" pkg-spec (pkg-maj p) (pkg-min p))) - (failure-k - save-to-uninstalled-pkg-cache! - void - (λ (x) x))))) + (failure-k void void (λ (x) x))))) ;; save-to-uninstalled-pkg-cache! : uninstalled-pkg -> path[file] ;; copies the given uninstalled package into the uninstalled-package cache, @@ -714,8 +717,9 @@ attempted to load version ~a.~a while version ~a.~a was already loaded" (list get/linkage get/installed-cache - get/uninstalled-cache - get/server))) + get/uninstalled-cache-dummy + get/server + get/uninstalled-cache))) ; ============================================================