From c980182b6b6240a9631485793a09df2bfdec410c Mon Sep 17 00:00:00 2001 From: Jay McCarthy Date: Wed, 27 Nov 2013 18:41:16 -0700 Subject: [PATCH] Explicitly enabling download? and install? on user initiated installs Forgot to commit earlier :( --- .../planet/private/cmdline-tool.rkt | 24 ++++++++++--------- pkgs/planet-pkgs/planet-lib/planet/util.rkt | 14 ++++++----- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/pkgs/planet-pkgs/planet-lib/planet/private/cmdline-tool.rkt b/pkgs/planet-pkgs/planet-lib/planet/private/cmdline-tool.rkt index 6e1c24b8d0..7e3f229b25 100644 --- a/pkgs/planet-pkgs/planet-lib/planet/private/cmdline-tool.rkt +++ b/pkgs/planet-pkgs/planet-lib/planet/private/cmdline-tool.rkt @@ -12,6 +12,7 @@ PLANNED FEATURES: racket/match raco/command-name + (only-in planet/resolver download?) planet/config planet/private/planet-shared planet/util @@ -160,17 +161,18 @@ This command does not unpack or install the named .plt file." (fail "Could not find matching package"))))) (define (download/no-install owner pkg majstr minstr) - (let* ([maj (read-from-string majstr)] - [min (read-from-string minstr)] - [full-pkg-spec (get-package-spec owner pkg maj min)]) - (when (file-exists? pkg) - (fail "Cannot download, there is a file named ~a in the way" pkg)) - (match (download-package full-pkg-spec) - [(list #t path maj min) - (copy-file path pkg) - (printf "Downloaded ~a package version ~a.~a\n" pkg maj min)] - [_ - (fail "Could not find matching package")]))) + (parameterize ([download? #t]) + (let* ([maj (read-from-string majstr)] + [min (read-from-string minstr)] + [full-pkg-spec (get-package-spec owner pkg maj min)]) + (when (file-exists? pkg) + (fail "Cannot download, there is a file named ~a in the way" pkg)) + (match (download-package full-pkg-spec) + [(list #t path maj min) + (copy-file path pkg) + (printf "Downloaded ~a package version ~a.~a\n" pkg maj min)] + [_ + (fail "Could not find matching package")])))) ;; params->full-pkg-spec : string string string string -> pkg ;; gets a full package specifier for the given specification diff --git a/pkgs/planet-pkgs/planet-lib/planet/util.rkt b/pkgs/planet-pkgs/planet-lib/planet/util.rkt index 33b42dc579..ff144398f6 100644 --- a/pkgs/planet-pkgs/planet-lib/planet/util.rkt +++ b/pkgs/planet-pkgs/planet-lib/planet/util.rkt @@ -90,12 +90,14 @@ ;; download/install-pkg : string string nat nat -> pkg | #f (define (download/install-pkg owner name maj min) - (let* ([pspec (pkg-spec->full-pkg-spec (list owner name maj min) #f)] - [upkg (get-package-from-server pspec)]) - (cond - [(uninstalled-pkg? upkg) - (pkg-promise->pkg upkg)] - [else #f]))) + (parameterize ([install? #t] + [download? #t]) + (let* ([pspec (pkg-spec->full-pkg-spec (list owner name maj min) #f)] + [upkg (get-package-from-server pspec)]) + (cond + [(uninstalled-pkg? upkg) + (pkg-promise->pkg upkg)] + [else #f])))) ;; current-cache-contents : -> ((string ((string ((nat (nat ...)) ...)) ...)) ...) ;; returns the packages installed in the local PLaneT cache