From ebe1537450cb80038bc5721320e657aade573f56 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Sun, 30 Nov 2014 11:37:48 -0700 Subject: [PATCH] raco pkg update --clone: offer advice on converting directory links --- racket/collects/pkg/private/clone-path.rkt | 21 ++++++++++++++++++--- racket/collects/pkg/private/install.rkt | 4 +++- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/racket/collects/pkg/private/clone-path.rkt b/racket/collects/pkg/private/clone-path.rkt index 9ffeea8cdb..9e3dfce60a 100644 --- a/racket/collects/pkg/private/clone-path.rkt +++ b/racket/collects/pkg/private/clone-path.rkt @@ -240,7 +240,7 @@ ;; If `pkg-name` is a description with the type 'clone, but its syntax ;; matches a package name, then infer a repo from the current package ;; installation and return an alternate description. -(define ((convert-clone-name-to-clone-repo/update db) pkg-name) +(define ((convert-clone-name-to-clone-repo/update db from-command-line?) pkg-name) (cond [(and (pkg-desc? pkg-name) (eq? 'clone (pkg-desc-type pkg-name)) @@ -259,12 +259,27 @@ #:auto? (pkg-desc-auto? pkg-name) #:extra-path (pkg-desc-extra-path pkg-name) #:reject-existing-clone? #t)) + (define current-orig-pkg (pkg-info-orig-pkg info)) (unless new-pkg-name (pkg-error (~a "package is not currently installed from a repository\n" " package: ~a\n" - " current installation: ~a") + " current installation: ~a" + (cond + [from-command-line? + (case (car current-orig-pkg) + [(link static-link) + (~a "\n extra advice:\n" + " Your current installation is a directory link, and the directory might\n" + " be a Git repostory checkout, but the package system doesn't know that.\n" + " If so, try\n" + " cd " (normalize-path + (path->complete-path (cadr current-orig-pkg) (pkg-installed-dir))) + "\n" + " raco pkg update --clone . ")] + [else ""])] + [else ""])) name - (pkg-info-orig-pkg info))) + current-orig-pkg)) new-pkg-name)] [else pkg-name])) diff --git a/racket/collects/pkg/private/install.rkt b/racket/collects/pkg/private/install.rkt index cf294e8a26..6f89c2938f 100644 --- a/racket/collects/pkg/private/install.rkt +++ b/racket/collects/pkg/private/install.rkt @@ -1103,7 +1103,9 @@ #:use-cache? use-cache? #:from-command-line? from-command-line? #:link-dirs? link-dirs?) - (map (convert-clone-name-to-clone-repo/update db) + (map (convert-clone-name-to-clone-repo/update + db + from-command-line?) pkgs))) (cond [(empty? pkgs)