<div dir="ltr"><div>I just discovered this behavior accidentally.<br><br>It caught me off guard and feels unintuitive. And the negative of accidentally running it doesnt seem to outweigh having to type an extra "--link <dirname>" (especially after cloning, when you are not in the directory you just created anyways).<br>
<br></div>I doubt I'm going to change any minds though so at the very least this behavior should be mentioned in raco pkg install --help.<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Oct 14, 2013 at 2:08 PM, <span dir="ltr"><<a href="mailto:samth@racket-lang.org" target="_blank">samth@racket-lang.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">samth has updated `master' from eca9e16b96 to 4a542969c7.<br>
<a href="http://git.racket-lang.org/plt/eca9e16b96..4a542969c7" target="_blank">http://git.racket-lang.org/plt/eca9e16b96..4a542969c7</a><br>
<br>
=====[ One Commit ]=====================================================<br>
Directory summary:<br>
27.7% pkgs/racket-pkgs/racket-doc/pkg/scribblings/<br>
54.1% racket/collects/pkg/<br>
10.4% racket/collects/racket/<br>
<br>
~~~~~~~~~~<br>
<br>
4a54296 Sam Tobin-Hochstadt <<a href="mailto:samth@racket-lang.org">samth@racket-lang.org</a>> 2013-09-26 17:37<br>
:<br>
| Make 'raco pkg install' with no arguments install the current directory.<br>
|<br>
| This is useful for telling people how to install a new pkg, from<br>
| GitHub or elsewhere: just get the files, and then do<br>
| `raco pkg install` in the relevant directory.<br>
|<br>
| Also, both cabal (the Haskell package manager) and npm (the node.js<br>
| package manager) behave this way.<br>
|<br>
| To explicitly get the old behavior, specify the sources as<br>
| `--pkgs pkg-srcs ...`. This is useful in scripts, when `pkg-srcs`<br>
| might be empty.<br>
:<br>
M Makefile | 2 +-<br>
M pkgs/racket-pkgs/racket-doc/pkg/scribblings/pkg.scrbl | 6 ++++++<br>
M racket/collects/pkg/main.rkt | 15 +++++++++++++--<br>
M racket/collects/racket/HISTORY.txt | 3 ++-<br>
M .../racket-doc/pkg/scribblings/getting-started.scrbl | 5 ++---<br>
<br>
=====[ Overall Diff ]===================================================<br>
<br>
Makefile<br>
~~~~~~~~<br>
--- OLD/Makefile<br>
+++ NEW/Makefile<br>
@@ -199,7 +199,7 @@ RACKET = racket/bin/racket $(USER_CONFIG)<br>
RACO = racket/bin/racket $(USER_CONFIG) -N raco -l- raco<br>
WIN32_RACKET = racket\racket $(USER_CONFIG)<br>
WIN32_RACO = racket\racket $(USER_CONFIG) -N raco -l- raco<br>
-X_AUTO_OPTIONS = --skip-installed --deps search-auto $(JOB_OPTIONS)<br>
+X_AUTO_OPTIONS = --skip-installed --deps search-auto --pkgs $(JOB_OPTIONS)<br>
USER_AUTO_OPTIONS = --scope user $(X_AUTO_OPTIONS)<br>
LOCAL_USER_AUTO = --catalog build/local/catalog $(USER_AUTO_OPTIONS)<br>
SOURCE_USER_AUTO_q = --catalog "$(SRC_CATALOG)" $(USER_AUTO_OPTIONS)<br>
<br>
pkgs/racket-pkgs/racket-doc/pkg/scribblings/getting-started.scrbl<br>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>
--- OLD/pkgs/racket-pkgs/racket-doc/pkg/scribblings/getting-started.scrbl<br>
+++ NEW/pkgs/racket-pkgs/racket-doc/pkg/scribblings/getting-started.scrbl<br>
@@ -300,10 +300,9 @@ get started.<br>
Whether creating a @tech{single-collection package} or a<br>
@tech{multi-collection package}, the next step is to link your<br>
development directory as a locally installed package. Use<br>
-@command-ref{install} in the directory where you created the<br>
-@nonterm{pkg-name} directory:<br>
+@command-ref{install} in the @nonterm{pkg-name} directory:<br>
<br>
-@commandline{raco pkg install --link @nonterm{pkg-name}}<br>
+@commandline{raco pkg install}<br>
<br>
If you use @command-ref{show} at this point, you'll see a line for<br>
@nonterm{pkg-name}. The ``Source'' column will show that it's a<br>
<br>
pkgs/racket-pkgs/racket-doc/pkg/scribblings/pkg.scrbl<br>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>
--- OLD/pkgs/racket-pkgs/racket-doc/pkg/scribblings/pkg.scrbl<br>
+++ NEW/pkgs/racket-pkgs/racket-doc/pkg/scribblings/pkg.scrbl<br>
@@ -322,6 +322,9 @@ sub-commands.<br>
If a given @nonterm{pkg-source} is ``auto-installed'' (to satisfy some other package's<br>
dependency), then it is promoted to explicitly installed.<br>
<br>
+ If no @nonterm{pkg-source}s are supplied, the current directory is<br>
+ installed as a link. See the @DFlag{link} flag below for more details.<br>
+<br>
The @exec{install} sub-command accepts<br>
the following @nonterm{option}s:<br>
<br>
@@ -377,6 +380,9 @@ sub-commands.<br>
of the given directory will not change for each given directory that implements a<br>
@tech{multi-collection package}.}<br>
<br>
+ @item{@DFlag{pkgs} --- Disables default installation of the current directory when no @nonterm{pkg-source}s<br>
+ are supplied.}<br>
+<br>
@item{@DFlag{copy} --- Disables default handling of directory @tech{package sources} as links,<br>
and instead treats them like other sources: package content is copied to install.}<br>
<br>
<br>
racket/collects/pkg/main.rkt<br>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>
--- OLD/racket/collects/pkg/main.rkt<br>
+++ NEW/racket/collects/pkg/main.rkt<br>
@@ -151,6 +151,7 @@<br>
#:once-each<br>
catalog-flags ...<br>
[#:bool skip-installed () ("Skip a <pkg-source> if already installed")]<br>
+ [#:bool pkgs () ("Install only the specified packages, even when none are provided")]<br>
install-force-flags ...<br>
job-flags ...<br>
#:args pkg-source<br>
@@ -159,8 +160,18 @@<br>
'install<br>
scope scope-dir installation user #f a-type<br>
(lambda ()<br>
+ (when (and name (> (length pkg-source) 1))<br>
+ ((current-pkg-error) (format "the --name flag only makes sense with a single package source")))<br>
(unless (or (not name) (package-source->name name))<br>
((current-pkg-error) (format "~e is an invalid package name" name)))<br>
+ ;; if no sources were supplied, and `--pkgs` was not<br>
+ ;; explicitly specified, install the current directory<br>
+ ;; as a linked directory<br>
+ (define-values (sources a-type*)<br>
+ (if (and (not pkgs) (null? pkg-source))<br>
+ (values (list (path->string (current-directory)))<br>
+ 'link)<br>
+ (values pkg-source a-type)))<br>
(define setup-collects<br>
(with-pkg-lock<br>
(parameterize ([current-pkg-catalogs (and catalog<br>
@@ -173,8 +184,8 @@<br>
#:update-deps? update-deps<br>
#:strip (or (and source 'source) (and binary 'binary))<br>
#:link-dirs? link-dirs?<br>
- (for/list ([p (in-list pkg-source)])<br>
- (pkg-desc p a-type name checksum #f))))))<br>
+ (for/list ([p (in-list sources)])<br>
+ (pkg-desc p a-type* name checksum #f))))))<br>
(setup no-setup setup-collects jobs)))]<br>
;; ----------------------------------------<br>
[update<br>
<br>
racket/collects/racket/HISTORY.txt<br>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>
--- OLD/racket/collects/racket/HISTORY.txt<br>
+++ NEW/racket/collects/racket/HISTORY.txt<br>
@@ -1,8 +1,9 @@<br>
Version 5.90.0.9<br>
-Allow hash table chaperones and impersonators to Support efficient<br>
+Allow hash table chaperones and impersonators to support efficient<br>
hash-clear and hash-clear!<br>
setup/collection-name: added<br>
syntax/unsafe/for-transform: added<br>
+raco pkg install with no arguments installs the current directory.<br>
<br>
Version 5.90.0.6<br>
Added path<?, symbol<?<br>
</blockquote></div><br></div>