planet2: installation-wide config of default `raco pkg' scope

With either
  configure --enable-pkgscope=installation
or
  raco pkg config -i --set default-scope installation
the default scope of `raco pkg' actions can be changed from
user-specific to installation-wide.

We considered trying to guess when someone building Racket would prefer
installation-wide package scope by default. In particular, someone
building from source for in-place use seems likely to want
installation-wide scope by default. Then again, we don't want to
discourage in-place builds for Unix installations that are intended
for multiple users. So, no guessing for now.

Also, add a `--scope' argument to `raco pkg' commands, which is more in
line with other options, but keep `-i', etc., as shorthands.
This commit is contained in:
Matthew Flatt 2013-01-06 09:21:18 -07:00
parent dd161bb821
commit 05837fac1b
8 changed files with 313 additions and 111 deletions

View File

@ -285,6 +285,16 @@
(pkg-config-file) (pkg-config-file)
(hash-set (read-pkg-cfg) key val))) (hash-set (read-pkg-cfg) key val)))
(define (get-default-package-scope)
(match (get-default-package-scope-as-string)
["installation" 'i]
["shared" 's]
[else 'u]))
(define (get-default-package-scope-as-string)
(parameterize ([current-install-system-wide? #t])
(define cfg (read-pkg-cfg))
(hash-ref cfg "default-scope" "user")))
(struct pkg-info (orig-pkg checksum auto?) #:prefab) (struct pkg-info (orig-pkg checksum auto?) #:prefab)
(struct install-info (name orig-pkg directory clean? checksum)) (struct install-info (name orig-pkg directory clean? checksum))
@ -1038,6 +1048,21 @@
(match key+vals (match key+vals
[(list* (and key "indexes") val) [(list* (and key "indexes") val)
(update-pkg-cfg! "indexes" val)] (update-pkg-cfg! "indexes" val)]
[(list (and key "default-scope") val)
(unless (member val '("installation" "user" "shared"))
(pkg-error (~a "invliad value for config key\n"
" config key: ~a\n"
" given value: ~a\n"
" valid values: installation, user, or shared")
key
val))
(if (current-install-system-wide?)
(update-pkg-cfg! "default-scope" val)
(pkg-error (~a "config key makes sense only with --installation/-i\n"
" config key: ~a\n"
" given value: ~a")
key
val))]
[(list key) [(list key)
(pkg-error "unsupported config key\n key: ~e" key)] (pkg-error "unsupported config key\n key: ~e" key)]
[(list) [(list)
@ -1049,6 +1074,12 @@
["indexes" ["indexes"
(for ([s (in-list (read-pkg-cfg/def "indexes"))]) (for ([s (in-list (read-pkg-cfg/def "indexes"))])
(printf "~a\n" s))] (printf "~a\n" s))]
["default-scope"
(if (current-install-system-wide?)
(printf "~a\n" (get-default-package-scope-as-string))
(pkg-error (~a "config key makes sense only with --installation/-i\n"
" config key: ~a")
key))]
[_ [_
(pkg-error "unsupported config key\n key: ~e" key)])] (pkg-error "unsupported config key\n key: ~e" key)])]
[(list) [(list)
@ -1160,4 +1191,6 @@
(#:dep-behavior dep-behavior/c (#:dep-behavior dep-behavior/c
#:force? boolean? #:force? boolean?
#:ignore-checksums? boolean?) #:ignore-checksums? boolean?)
(or/c #f (listof (or/c path-string? (non-empty-listof path-string?)))))])) (or/c #f (listof (or/c path-string? (non-empty-listof path-string?)))))]
[get-default-package-scope
(-> (or/c 'i 'u 's))]))

View File

@ -23,6 +23,23 @@
(string->symbol (format "~a ~a" (short-program+command-name) cmd)) (string->symbol (format "~a ~a" (short-program+command-name) cmd))
args)) args))
(define (call-with-package-scope who given-scope installation shared user thunk)
(define scope
(case given-scope
[(installation) 'i]
[(user) 'u]
[(shared) 's]
[else
(cond
[installation 'i]
[user 'u]
[shared 's]
[else (get-default-package-scope)])]))
(parameterize ([current-install-system-wide? (eq? scope 'i)]
[current-install-version-specific? (not (eq? scope 's))]
[current-pkg-error (pkg-error who)])
(thunk)))
(commands (commands
"This tool is used for managing installed packages." "This tool is used for managing installed packages."
[install [install
@ -36,14 +53,9 @@
"(makes sense only when a single <pkg-source> is given)")] "(makes sense only when a single <pkg-source> is given)")]
[#:bool no-setup () ("Don't run `raco setup' after changing packages" [#:bool no-setup () ("Don't run `raco setup' after changing packages"
"(generally not a good idea)")] "(generally not a good idea)")]
#:once-any
[#:bool installation ("-i") "Install for all users of the Racket installation"]
[#:bool shared ("-s") "Install as user-specific but shared for all Racket versions"]
[#:bool user ("-u") "Install as user- and version-specific (the default)"]
#:once-each #:once-each
[(#:sym mode [fail force search-ask search-auto] #f) deps () [(#:sym mode [fail force search-ask search-auto] #f) deps ()
("Specify the behavior for dependencies;" ("Specify the behavior for dependencies, with <mode> as one of"
"valid <mode>s are:"
" fail: cancels the installation if dependencies are unmet" " fail: cancels the installation if dependencies are unmet"
" (default for most packages)" " (default for most packages)"
" force: installs the package despite missing dependencies" " force: installs the package despite missing dependencies"
@ -54,33 +66,37 @@
[#:bool force () "Ignores conflicts"] [#:bool force () "Ignores conflicts"]
[#:bool ignore-checksums () "Ignores checksums"] [#:bool ignore-checksums () "Ignores checksums"]
[#:bool link () ("Link a directory package source in place")] [#:bool link () ("Link a directory package source in place")]
#:once-any
[(#:sym scope [installation user shared] #f) scope ()
("Select package <scope>, one of"
" installation: Install for all users of the Racket installation"
" user: Install as user- and version-specific"
" shared: Install as user-specific but shared for all Racket versions")]
[#:bool installation ("-i") "shorthand for `--scope installation'"]
[#:bool user ("-u") "shorthand for `--scope user'"]
[#:bool shared ("-s") "shorthand for `--scope shared'"]
#:args pkg-source #:args pkg-source
(parameterize ([current-install-system-wide? installation] (call-with-package-scope
[current-install-version-specific? (not shared)] 'install
[current-pkg-error (pkg-error 'install)]) scope installation shared user
(with-package-lock (lambda ()
(define setup-collects (with-package-lock
(install-cmd #:dep-behavior deps (define setup-collects
#:force? force (install-cmd #:dep-behavior deps
#:ignore-checksums? ignore-checksums #:force? force
(for/list ([p (in-list pkg-source)]) #:ignore-checksums? ignore-checksums
(pkg-desc p (or (and link 'link) type) name #f)))) (for/list ([p (in-list pkg-source)])
(setup no-setup installation setup-collects)))] (pkg-desc p (or (and link 'link) type) name #f))))
(setup no-setup installation setup-collects))))]
[update [update
"Update packages" "Update packages"
#:once-each #:once-each
[#:bool no-setup () ("Don't run `raco setup' after changing packages" [#:bool no-setup () ("Don't run `raco setup' after changing packages"
"(generally not a good idea)")] "(generally not a good idea)")]
#:once-any
[#:bool installation ("-i") "Update only for all users of the Racket installation"]
[#:bool shared ("-s") "Update only user-specific packages for all Racket versions"]
[#:bool user ("-u") "Update only user- and version-specific packages (the default)"]
#:once-each
[#:bool all ("-a") ("Update all packages;" [#:bool all ("-a") ("Update all packages;"
"only if no packages are given on the command line")] "only if no packages are given on the command line")]
[(#:sym mode [fail force search-ask search-auto] #f) deps () [(#:sym mode [fail force search-ask search-auto] #f) deps ()
("Specify the behavior for dependencies;" ("Specify the behavior for dependencies, with <mode> as one of"
"valid <mods>s are:"
" fail: cancels the installation if dependencies are unmet" " fail: cancels the installation if dependencies are unmet"
" (default for most packages)" " (default for most packages)"
" force: installs the package despite missing dependencies" " force: installs the package despite missing dependencies"
@ -89,10 +105,20 @@
" like it installed" " like it installed"
" search-auto: like 'search-ask' but does not ask for permission to install")] " search-auto: like 'search-ask' but does not ask for permission to install")]
[#:bool update-deps () "Check named packages' dependencies for updates"] [#:bool update-deps () "Check named packages' dependencies for updates"]
#:once-any
[(#:sym scope [installation user shared] #f) scope ()
("Select package scope, one of"
" installation: Update only for all users of the Racket installation"
" user: Update only user- and version-specific packages"
" shared: Update only user-specific packages for all Racket versions")]
[#:bool installation ("-i") "shorthand for `--scope installation'"]
[#:bool user ("-u") "shorthand for `--scope user'"]
[#:bool shared ("-s") "shorthand for `--scope shared'"]
#:args pkgs #:args pkgs
(parameterize ([current-install-system-wide? installation] (call-with-package-scope
[current-install-version-specific? (not shared)] 'update
[current-pkg-error (pkg-error 'update)]) scope installation shared user
(lambda ()
(with-package-lock (with-package-lock
(define setup-collects (define setup-collects
(update-packages pkgs (update-packages pkgs
@ -100,41 +126,56 @@
#:dep-behavior deps #:dep-behavior deps
#:deps? update-deps)) #:deps? update-deps))
(when setup-collects (when setup-collects
(setup no-setup installation setup-collects))))] (setup no-setup installation setup-collects)))))]
[remove [remove
"Remove packages" "Remove packages"
#:once-each #:once-each
[#:bool no-setup () ("Don't run `raco setup' after changing packages" [#:bool no-setup () ("Don't run `raco setup' after changing packages"
"(generally not a good idea)")] "(generally not a good idea)")]
#:once-any
[#:bool installation ("-i") "Remove packages for all users of the Racket installation"]
[#:bool shared ("-s") "Remove user-specific packages for all Racket versions"]
[#:bool user ("-u") "Remove user- and version-specific packages (the default)"]
#:once-each
[#:bool force () "Force removal of packages"] [#:bool force () "Force removal of packages"]
[#:bool auto () "Remove automatically installed packages with no dependencies"] [#:bool auto () "Remove automatically installed packages with no dependencies"]
#:once-any
[(#:sym scope [installation user shared] #f) scope ()
("Select package <scope>, one of"
" installation: Remove packages for all users of the Racket installation"
" user: Remove user- and version-specific packages"
" shared: Remove user-specific packages for all Racket versions")]
[#:bool installation ("-i") "shorthand for `--scope installation'"]
[#:bool user ("-u") "shorthand for `--scope user'"]
[#:bool shared ("-s") "shorthand for `--scope shared'"]
#:args pkgs #:args pkgs
(parameterize ([current-install-system-wide? installation] (call-with-package-scope
[current-install-version-specific? (not shared)] 'remove
[current-pkg-error (pkg-error 'remove)]) scope installation shared user
(with-package-lock (lambda ()
(remove-packages pkgs (with-package-lock
#:auto? auto (remove-packages pkgs
#:force? force) #:auto? auto
(setup no-setup installation #f)))] #:force? force)
(setup no-setup installation #f))))]
[show [show
"Show information about installed packages" "Show information about installed packages"
#:once-any #:once-any
[#:bool installation ("-i") "Show only for all users of the Racket installation"] [(#:sym scope [installation user shared] #f) scope ()
[#:bool shared ("-s") "Show only user-specific for all Racket versions"] ("Show only for package <scope>, one of"
[#:bool user ("-u") "Show only the user- and version-specific"] " installation: Show only for all users of the Racket installation"
" user: Show only user- and version-specific"
" shared: Show only user-specific for all Racket versions")]
[(#:str vers #f) version ("-v") "Show only user-specific for Racket <vers>"] [(#:str vers #f) version ("-v") "Show only user-specific for Racket <vers>"]
[#:bool installation ("-i") "shorthand for `--scope installation'"]
[#:bool user ("-u") "shorthand for `--scope user'"]
[#:bool shared ("-s") "shorthand for `--scope shared'"]
#:args () #:args ()
(define only-mode (cond (define only-mode (case scope
[installation 'i] [(installation) 'i]
[shared 's] [(user) 'u]
[user 'u] [(shared) 's]
[else (if version 'u #f)])) [else
(cond
[installation 'i]
[shared 's]
[user 'u]
[else (if version 'u #f)])]))
(for ([mode '(i s u)]) (for ([mode '(i s u)])
(when (or (eq? mode only-mode) (not only-mode)) (when (or (eq? mode only-mode) (not only-mode))
(unless only-mode (unless only-mode
@ -150,18 +191,24 @@
(show-cmd (if only-mode "" " "))))))] (show-cmd (if only-mode "" " "))))))]
[config [config
"View and modify the package configuration" "View and modify the package configuration"
#:once-any
[#:bool installation ("-i") "Operate on the installation-wide package database"]
[#:bool shared ("-s") "Operate on the user-specific all-version package database"]
[#:bool user ("-u") "Operate on the user-specific, version-specific package database"]
#:once-each #:once-each
[#:bool set () "Completely replace the value"] [#:bool set () "Completely replace the value"]
#:args key+vals #:once-any
(parameterize ([current-install-system-wide? installation] [(#:sym scope [installation user shared] #f) scope ()
[current-install-version-specific? (not shared)] ("Select configuration <scope>, one of"
[current-pkg-error (pkg-error 'config)]) " installation: Operate on the installation-wide package configuration"
(with-package-lock " user: Operate on the user-specific, version-specific package configuration"
(config-cmd set key+vals)))] " shared: Operate on the user-specific all-version package configuration")]
[#:bool installation ("-i") "shorthand for `--scope installation'"]
[#:bool user ("-u") "shorthand for `--scope user'"]
[#:bool shared ("-s") "shorthand for `--scope shared'"]
#:args key/val
(call-with-package-scope
'config
scope installation shared user
(lambda ()
(with-package-lock
(config-cmd set key/val))))]
[create [create
"Bundle a new package" "Bundle a new package"
#:once-any #:once-any

View File

@ -1,5 +1,6 @@
#lang scribble/manual #lang scribble/manual
@(require scribble/bnf @(require scribble/bnf
scribble/core
(for-label planet2 (for-label planet2
(except-in racket/base remove) (except-in racket/base remove)
setup/dirs)) setup/dirs))
@ -21,6 +22,16 @@
@(define (gtech s) @(define (gtech s)
@tech[#:doc '(lib "scribblings/guide/guide.scrbl") s]) @tech[#:doc '(lib "scribblings/guide/guide.scrbl") s])
@(define (command s)
@exec{raco pkg @|s|})
@(define (command-ref s)
@(link-element "plainlink" @command[s] `(raco-pkg-cmd ,s)))
@(define (command/toc s)
@(toc-target-element #f @command[s] `(raco-pkg-cmd ,s)))
@; ---------------------------------------- @; ----------------------------------------
@title{Package Management in Racket (Beta)} @title{Package Management in Racket (Beta)}
@ -213,6 +224,17 @@ into account when determining a @tech{package update}, although a change
in a package's @tech{version} (in either direction) should normally in a package's @tech{version} (in either direction) should normally
imply a change in the @tech{checksum}. imply a change in the @tech{checksum}.
A @deftech{package scope} determines the effect of package installations,
updates, @|etc|, with respect to different users, Racket versions, and
Racket installations. The default @tech{package scope} can be configured, but it is
normally @exec{user}, which is user-specific and version-specific;
that is, package installation makes the package visible only for the
installing user and with the installing version of Racket. The
@exec{installation} scope means that package installation makes the
package visible to all users of the specific Racket installation that
is used to install the package. Finally, the @exec{shared} scope means
user-specific, but for all versions and installations of Racket.
@; ---------------------------------------- @; ----------------------------------------
@section{Managing Packages} @section{Managing Packages}
@ -223,14 +245,14 @@ sub-command and a library. They have the exact same capabilities, as
the command line interface invokes the library functions and the command line interface invokes the library functions and
reprovides all their options. reprovides all their options.
@subsection{Command Line} @subsection[#:tag "cmdline"]{Command Line}
The @as-index{@exec{raco pkg}} sub-command provides the following The @as-index{@exec{raco pkg}} sub-command provides the following
sub-sub-commands: sub-sub-commands:
@itemlist[ @itemlist[
@item{@exec{install} @nonterm{option} ... @nonterm{pkg-source} ... @item{@command/toc{install} @nonterm{option} ... @nonterm{pkg-source} ...
--- Installs the given @tech{package sources} with the given --- Installs the given @tech{package sources} with the given
@nonterm{option}s: @nonterm{option}s:
@ -244,13 +266,6 @@ sub-sub-commands:
which makes sense only when a single @nonterm{pkg-source} is provided. The name is normally which makes sense only when a single @nonterm{pkg-source} is provided. The name is normally
inferred for each @nonterm{pkg-source}.} inferred for each @nonterm{pkg-source}.}
@item{@DFlag{no-setup} --- Does not run @exec{raco setup} after installation. This behavior is also the case if the
environment variable @envvar{PLT_PLANET2_NOSETUP} is set to any non-empty value.}
@item{@DFlag{installation} or @Flag{i} --- Install packages for all users of a Racket installation, rather than user-specific.}
@item{@DFlag{shared} or @Flag{s} --- Install packages as user-specific, but for all Racket versions.}
@item{@DFlag{user} or @Flag{u} --- Install packages as user-specific and Racket version-specific (the default).}
@item{@DFlag{deps} @nonterm{behavior} --- Selects the behavior for dependencies, where @nonterm{behavior} is one of @item{@DFlag{deps} @nonterm{behavior} --- Selects the behavior for dependencies, where @nonterm{behavior} is one of
@itemlist[ @itemlist[
@item{@exec{fail} --- Cancels the installation if dependencies are version requirements are unmet (default for most packages)} @item{@exec{fail} --- Cancels the installation if dependencies are version requirements are unmet (default for most packages)}
@ -264,13 +279,28 @@ sub-sub-commands:
@item{@DFlag{ignore-checksums} --- Ignores errors verifying package @tech{checksums} (unsafe).} @item{@DFlag{ignore-checksums} --- Ignores errors verifying package @tech{checksums} (unsafe).}
@item{@DFlag{no-setup} --- Does not run @exec{raco setup} after installation. This behavior is also the case if the
environment variable @envvar{PLT_PLANET2_NOSETUP} is set to any non-empty value.}
@item{@DFlag{link} --- Implies @exec{--type dir} (and overrides any specified type), @item{@DFlag{link} --- Implies @exec{--type dir} (and overrides any specified type),
and links the existing directory as an installed package.} and links the existing directory as an installed package.}
@item{@DFlag{scope} @nonterm{scope} --- Selects the @tech{package scope} for installation, where @nonterm{scope} is one of
@itemlist[
@item{@exec{installation} --- Install packages for all users of a Racket installation, rather than user-specific.}
@item{@exec{user} --- Install packages as user-specific and Racket version-specific.}
@item{@exec{shared} --- Install packages as user-specific, but for all Racket versions.}
]
The default package scope is normally @exec{user}, but it can be configured with
@command-ref{config}@exec{ -i --set default-scope @nonterm{scope}}.}
@item{@Flag{i} or @DFlag{installation} --- Shorthand for @exec{--scope installation}.}
@item{@Flag{u} or @DFlag{user} --- Shorthand for @exec{--scope user}.}
@item{@Flag{s} or @DFlag{shared} --- Shorthand for @exec{--scope shared}.}
] ]
} }
@item{@exec{update} @nonterm{option} ... @nonterm{pkg} ... @item{@command/toc{update} @nonterm{option} ... @nonterm{pkg} ...
--- Checks the specified packages for --- Checks the specified packages for
@tech{package updates}. If an update is found, but it cannot be @tech{package updates}. If an update is found, but it cannot be
installed (e.g. it is conflicted with another installed package), then installed (e.g. it is conflicted with another installed package), then
@ -278,61 +308,75 @@ this command fails atomically. The @exec{update} sub-command accepts
the following @nonterm{option}s: the following @nonterm{option}s:
@itemlist[ @itemlist[
@item{@DFlag{no-setup} --- Same as for @exec{install}.} @item{@DFlag{deps} @nonterm{behavior} --- Same as for @command-ref{install}.}
@item{@DFlag{installation} or @Flag{i} --- Same as for @exec{install}.}
@item{@DFlag{shared} or @Flag{s} --- Same as for @exec{install}.}
@item{@DFlag{user} or @Flag{u} --- Same as for @exec{install} (the default).}
@item{@DFlag{deps} @nonterm{behavior} --- Same as for @exec{install}.}
@item{@DFlag{all} or @Flag{a} --- Update all packages, if no packages are given in the argument list.} @item{@DFlag{all} or @Flag{a} --- Update all packages, if no packages are given in the argument list.}
@item{@DFlag{update-deps} --- Checks the named packages, and their dependencies (transitively) for updates.} @item{@DFlag{update-deps} --- Checks the named packages, and their dependencies (transitively) for updates.}
@item{@DFlag{no-setup} --- Same as for @command-ref{install}.}
@item{@DFlag{scope} @nonterm{scope} --- Selects a @tech{package scope}, the same as for @command-ref{install}.}
@item{@Flag{i} or @DFlag{installation} --- Shorthand for @exec{--scope installation}.}
@item{@Flag{u} or @DFlag{user} --- Shorthand for @exec{--scope user}.}
@item{@Flag{s} or @DFlag{shared} --- Shorthand for @exec{--scope shared}.}
] ]
} }
@item{@exec{remove} @nonterm{option} ... @nonterm{pkg} ... @item{@command/toc{remove} @nonterm{option} ... @nonterm{pkg} ...
--- Attempts to remove the given packages. If a package is the dependency of another package that is not --- Attempts to remove the given packages. If a package is the dependency of another package that is not
listed, this command fails atomically. It accepts the following @nonterm{option}s: listed, this command fails atomically. It accepts the following @nonterm{option}s:
@itemlist[ @itemlist[
@item{@DFlag{no-setup} --- Same as for @exec{install}.}
@item{@DFlag{installation} or @Flag{i} --- Same as for @exec{install}.}
@item{@DFlag{shared} or @Flag{s} --- Same as for @exec{install}.}
@item{@DFlag{user} or @Flag{u} --- Same as for @exec{install} (the default).}
@item{@DFlag{force} --- Ignore dependencies when removing packages.} @item{@DFlag{force} --- Ignore dependencies when removing packages.}
@item{@DFlag{no-setup} --- Same as for @command-ref{install}.}
@item{@DFlag{auto} --- Remove packages that were installed by the @exec{search-auto} or @exec{search-ask} @item{@DFlag{auto} --- Remove packages that were installed by the @exec{search-auto} or @exec{search-ask}
dependency behavior and are no longer required.} dependency behavior and are no longer required.}
@item{@DFlag{scope} @nonterm{scope} --- Selects a @tech{package scope}, the same as for @command-ref{install}.}
@item{@Flag{i} or @DFlag{installation} --- Shorthand for @exec{--scope installation}.}
@item{@Flag{u} or @DFlag{user} --- Shorthand for @exec{--scope user}.}
@item{@Flag{s} or @DFlag{shared} --- Shorthand for @exec{--scope shared}.}
] ]
} }
@item{@exec{show} @nonterm{option} ... --- Print information about currently installed packages. @item{@command/toc{show} @nonterm{option} ... --- Print information about currently installed packages.
By default, packages are shown for all installation modes (installation-wide, By default, packages are shown for all installation modes (installation-wide,
user- and Racket-version-specific, and user-specific all-version). user- and Racket-version-specific, and user-specific all-version).
The command accepts the following @nonterm{option}s: The command accepts the following @nonterm{option}s:
@itemlist[ @itemlist[
@item{@DFlag{installation} or @Flag{i} --- Show only installation-wide packages.}
@item{@DFlag{shared} or @Flag{s} --- Show only user-specific, all-version packages.} @item{@DFlag{scope} @nonterm{scope} --- Shows only packages in @nonterm{scope}, which is one of
@item{@DFlag{user} or @Flag{u} --- Show only user-specific, version-specific packages.} @itemlist[
@item{@exec{installation} --- Show only installation-wide packages.}
@item{@exec{user} --- Show only user-specific, version-specific packages.}
@item{@exec{shared} --- Show only user-specific, all-version packages.}
]
The default is to show packages for all @tech{package scopes}.}
@item{@Flag{i} or @DFlag{installation} --- Shorthand for @exec{--scope installation}.}
@item{@Flag{u} or @DFlag{user} --- Shorthand for @exec{--scope user}.}
@item{@Flag{s} or @DFlag{shared} --- Shorthand for @exec{--scope shared}.}
@item{@DFlag{version} @nonterm{vers} or @Flag{v} @nonterm{vers} --- Show only user-specific packages for Racket version @nonterm{vers}.} @item{@DFlag{version} @nonterm{vers} or @Flag{v} @nonterm{vers} --- Show only user-specific packages for Racket version @nonterm{vers}.}
] ]
} }
@item{@exec{config} @nonterm{option} ... @nonterm{key} @nonterm{val} ... --- @item{@command/toc{config} @nonterm{option} ... @nonterm{key} @nonterm{val} ... ---
View and modify package configuration options. It accepts the following @nonterm{option}s: View and modify package configuration options. It accepts the following @nonterm{option}s:
@itemlist[ @itemlist[
@item{@DFlag{installation} or @Flag{i} --- Same as for @exec{install}.}
@item{@DFlag{shared} or @Flag{s} --- Same as for @exec{install}.}
@item{@DFlag{user} or @Flag{u} --- Same as for @exec{install} (the default).}
@item{@DFlag{set} --- Sets an option, rather than printing it.} @item{@DFlag{set} --- Sets an option, rather than printing it.}
@item{@DFlag{scope} @nonterm{scope} --- Selects a @tech{package scope}, the same as for @command-ref{install}.}
@item{@Flag{i} or @DFlag{installation} --- Shorthand for @exec{--scope installation}.}
@item{@Flag{u} or @DFlag{user} --- Shorthand for @exec{--scope user}.}
@item{@Flag{s} or @DFlag{shared} --- Shorthand for @exec{--scope shared}.}
] ]
The valid keys are: The valid keys are:
@itemlist[ @itemlist[
@item{@exec{indexes} --- A list of URLs for @tech{package name resolvers}.} @item{@exec{indexes} --- A list of URLs for @tech{package name resolvers}.}
@item{@exec{default-scope} --- Either @exec{installation}, @exec{user}, or @exec{shared}.
This configuration option exists only with the @exec{installation} scope
(i.e., it's an installation-wide configuration of the default @tech{package scope} for @exec{raco pkg} commands).}
] ]
} }
@item{@exec{create} @nonterm{option} ... @nonterm{package-directory} @item{@command/toc{create} @nonterm{option} ... @nonterm{package-directory}
--- Bundles a package. It accepts the following @nonterm{option}s: --- Bundles a package. It accepts the following @nonterm{option}s:
@itemlist[ @itemlist[
@ -349,10 +393,7 @@ View and modify package configuration options. It accepts the following @nonterm
@defmodule[planet2] @defmodule[planet2]
The @racketmodname[planet2] module provides a programmatic interface The @racketmodname[planet2] module provides a programmatic interface
to the command sub-sub-commands. Each long form option is keyword to the command sub-sub-commands.
argument. An argument corresponding to @DFlag{type}, @DFlag{deps}, or @DFlag{format}
accepts its argument as a symbol. All other options accept booleans, where
@racket[#t] is equivalent to the presence of the option.
@deftogether[ @deftogether[
(@defthing[install procedure?] (@defthing[install procedure?]
@ -362,8 +403,13 @@ accepts its argument as a symbol. All other options accept booleans, where
@defthing[config procedure?] @defthing[config procedure?]
@defthing[create procedure?]) @defthing[create procedure?])
]{ ]{
Duplicates the command line interface. Duplicates the @seclink["cmdline"]{command line interface}.
}
Each long form option of the command-line interface is keyword
argument. An argument corresponding to @DFlag{type}, @DFlag{deps},
@DFlag{format}, or @DFlag{scope} accepts its argument as a symbol. All other options
accept booleans, where @racket[#t] is equivalent to the presence of
the option.}
@; ---------------------------------------- @; ----------------------------------------
@ -630,32 +676,43 @@ the package manager.
Racket version?} Racket version?}
By default, when you install a package, it is installed for a specific By default, when you install a package, it is installed for a specific
user and a specific version of Racket. user and a specific version of Racket. That is, the @tech{package
scope} is user- and version-specific.
You can use the @DFlag{installation} or @Flag{i} flag to install for You can change the default @tech{package scope} (for a particular
all users of a particular Racket installation; an installation-wide Racket installation) with @command-ref{config}@exec{ -i --set
package is not exactly version-specific, because the version of an default-scope installation}, in which case package operations apply
installation can change if it corresponds to a source-code checkout for all users of a Racket installation. You can also use the @Flag{i}
that is periodically updated and rebuilt. or @DFlag{installation} flag with a specific @exec{raco pkg} command,
instead of changing the default scope for all uses of @exec{raco
pkg}. Note that an installation-wide package is not exactly
version-specific, because the version of an installation can change if
it corresponds to a source-code checkout that is periodically updated
and rebuilt.
Finally, you can use the @DFlag{shared} or @Flag{s} flag If you change the default @tech{package scope}, you can use the
@Flag{u} or @DFlag{user} flag with a specific @exec{raco pkg} command
to perform the command with user- and version-specific @tech{package
scope}.
Finally, you can use the @Flag{s} or @DFlag{shared} flag
with @exec{raco pkg} commands to install user-specific packages that with @exec{raco pkg} commands to install user-specific packages that
apply to all Racket versions that you run. (In contrast, @|Planet1| apply to all Racket versions that you run. (In contrast, @|Planet1|
requires reinstallation of all packages every version change.) requires reinstallation of all packages every version change.)
@subsection{Where and how are packages installed?} @subsection{Where and how are packages installed?}
User-local and Racket-version-specific packages are in @racket[(build-path User-specific and Racket-version-specific packages are in @racket[(build-path
(find-system-path 'addon-dir) (version) "pkgs")], user-local and (find-system-path 'addon-dir) (version) "pkgs")], user-specific and
all-version packages are in @racket[(build-path (find-system-path all-version packages are in @racket[(build-path (find-system-path
'addon-dir) "pkgs")], and installation-wide packages are in 'addon-dir) "pkgs")], and installation-wide packages are in
@racket[(build-path (find-lib-dir) "pkgs")]. They are linked as @racket[(build-path (find-lib-dir) "pkgs")]. They are linked as
collection roots with @exec{raco link}. collection roots with @exec{raco link}.
@subsection{How are user-local and installation-wide packages @subsection{How are user-specific and installation-wide @tech{package scopes}
related?} related for conflict checking?}
User-local packages are checked against installation-wide packages User-specific packages are checked against installation-wide packages
for conflicts. Installation-wide packages are checked only against for conflicts. Installation-wide packages are checked only against
other installation-wide packages. other installation-wide packages.

View File

@ -93,6 +93,7 @@ install-common-middle:
install-common-last: install-common-last:
$(MAKE) fix-paths $(MAKE) fix-paths
$(MAKE) @MAKE_INSTALL_PKGSCOPE@-raco-pkg-default-scope
install-no: install-no:
$(NOOP) $(NOOP)
@ -111,6 +112,12 @@ copytree-run:
make-install-copytree "$(srcdir)/.." \ make-install-copytree "$(srcdir)/.." \
$(ALLDIRINFO) "@INSTALL_ORIG_TREE@" $(ALLDIRINFO) "@INSTALL_ORIG_TREE@"
adjust-raco-pkg-default-scope:
@RUN_RACKET_CGC@ -l raco pkg config -i --set default-scope @INSTALL_PKGSCOPE@
preserve-raco-pkg-default-scope:
$(NOOP)
install-gracket-post-collects: install-gracket-post-collects:
cd gracket; $(MAKE) install-post-collects cd gracket; $(MAKE) install-post-collects

View File

@ -170,7 +170,7 @@ Detailed instructions:
and/or GRacket. The current directory at the time `configure' is and/or GRacket. The current directory at the time `configure' is
run will be used as working space for building the executables run will be used as working space for building the executables
(independent of `--prefix'). This build directory does not have to (independent of `--prefix'). This build directory does not have to
be in the source tree, even for an "in-place" build. It's ok to run be in the source tree, even for an in-place build. It's ok to run
`configure' from its own directory (as in the first example above), `configure' from its own directory (as in the first example above),
but it's better to pick a separate build directory that is otherwise but it's better to pick a separate build directory that is otherwise
empty (as in the second example). empty (as in the second example).

36
src/configure vendored
View File

@ -714,6 +714,8 @@ FRAMEWORK_INSTALL_DIR
FRAMEWORK_REL_INSTALL FRAMEWORK_REL_INSTALL
FRAMEWORK_PREFIX FRAMEWORK_PREFIX
INSTALL_ORIG_TREE INSTALL_ORIG_TREE
INSTALL_PKGSCOPE
MAKE_INSTALL_PKGSCOPE
EXE_SUFFIX EXE_SUFFIX
SO_SUFFIX SO_SUFFIX
OWN_LIBFFI OWN_LIBFFI
@ -1343,6 +1345,7 @@ Optional Features:
--enable-floatinstead use single-precision by default --enable-floatinstead use single-precision by default
--enable-racket=<path> use <path> as Racket executable to build Racket --enable-racket=<path> use <path> as Racket executable to build Racket
--enable-origtree install with original directory structure --enable-origtree install with original directory structure
--enable-pkgscope=<s> set `raco pkg' default: installation, user, or shared
--enable-docs build docs on install (enabled by default) --enable-docs build docs on install (enabled by default)
--enable-usersetup setup user-specific files on install --enable-usersetup setup user-specific files on install
--enable-shared create shared libraries --enable-shared create shared libraries
@ -2015,6 +2018,11 @@ if test "${enable_origtree+set}" = set; then
enableval=$enable_origtree; enableval=$enable_origtree;
fi fi
# Check whether --enable-pkgscope was given.
if test "${enable_pkgscope+set}" = set; then
enableval=$enable_pkgscope;
fi
# Check whether --enable-docs was given. # Check whether --enable-docs was given.
if test "${enable_docs+set}" = set; then if test "${enable_docs+set}" = set; then
@ -2370,6 +2378,28 @@ if test "${enable_racket}" != "" ; then
echo "=== Using Racket executable ${enable_racket}" echo "=== Using Racket executable ${enable_racket}"
fi fi
INSTALL_PKGSCOPE=user
MAKE_INSTALL_PKGSCOPE=preserve
if test "${enable_pkgscope}" != "" ; then
case "${enable_pkgscope}" in
installation)
INSTALL_PKGSCOPE=installation
;;
user)
INSTALL_PKGSCOPE=user
;;
shared)
INSTALL_PKGSCOPE=shared
;;
*)
echo "Unrecognized package scope: ${enable_pkgscope}"
exit 1
;;
esac
echo "=== Package scope: " $INSTALL_PKGSCOPE
MAKE_INSTALL_PKGSCOPE=adjust
fi
###### Some defaults ####### ###### Some defaults #######
OPTIONS= OPTIONS=
@ -9106,6 +9136,8 @@ LIBS="$LIBS $EXTRALIBS"
@ -9938,6 +9970,8 @@ for ac_last_try in false false false false false :; do
FRAMEWORK_REL_INSTALL!$FRAMEWORK_REL_INSTALL$ac_delim FRAMEWORK_REL_INSTALL!$FRAMEWORK_REL_INSTALL$ac_delim
FRAMEWORK_PREFIX!$FRAMEWORK_PREFIX$ac_delim FRAMEWORK_PREFIX!$FRAMEWORK_PREFIX$ac_delim
INSTALL_ORIG_TREE!$INSTALL_ORIG_TREE$ac_delim INSTALL_ORIG_TREE!$INSTALL_ORIG_TREE$ac_delim
INSTALL_PKGSCOPE!$INSTALL_PKGSCOPE$ac_delim
MAKE_INSTALL_PKGSCOPE!$MAKE_INSTALL_PKGSCOPE$ac_delim
EXE_SUFFIX!$EXE_SUFFIX$ac_delim EXE_SUFFIX!$EXE_SUFFIX$ac_delim
SO_SUFFIX!$SO_SUFFIX$ac_delim SO_SUFFIX!$SO_SUFFIX$ac_delim
OWN_LIBFFI!$OWN_LIBFFI$ac_delim OWN_LIBFFI!$OWN_LIBFFI$ac_delim
@ -9989,7 +10023,7 @@ LIBOBJS!$LIBOBJS$ac_delim
LTLIBOBJS!$LTLIBOBJS$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim
_ACEOF _ACEOF
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 52; then if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 54; then
break break
elif $ac_last_try; then elif $ac_last_try; then
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5

View File

@ -37,6 +37,7 @@ AC_ARG_ENABLE(floatinstead, [ --enable-floatinstead use single-precision by d
AC_ARG_ENABLE(racket, [ --enable-racket=<path> use <path> as Racket executable to build Racket]) AC_ARG_ENABLE(racket, [ --enable-racket=<path> use <path> as Racket executable to build Racket])
AC_ARG_ENABLE(origtree,[ --enable-origtree install with original directory structure]) AC_ARG_ENABLE(origtree,[ --enable-origtree install with original directory structure])
AC_ARG_ENABLE(pkgscope,[ --enable-pkgscope=<s> set `raco pkg' default: installation, user, or shared])
AC_ARG_ENABLE(docs, [ --enable-docs build docs on install (enabled by default)], , enable_docs=yes) AC_ARG_ENABLE(docs, [ --enable-docs build docs on install (enabled by default)], , enable_docs=yes)
AC_ARG_ENABLE(usersetup, [ --enable-usersetup setup user-specific files on install]) AC_ARG_ENABLE(usersetup, [ --enable-usersetup setup user-specific files on install])
@ -296,6 +297,28 @@ if test "${enable_racket}" != "" ; then
echo "=== Using Racket executable ${enable_racket}" echo "=== Using Racket executable ${enable_racket}"
fi fi
INSTALL_PKGSCOPE=user
MAKE_INSTALL_PKGSCOPE=preserve
if test "${enable_pkgscope}" != "" ; then
case "${enable_pkgscope}" in
installation)
INSTALL_PKGSCOPE=installation
;;
user)
INSTALL_PKGSCOPE=user
;;
shared)
INSTALL_PKGSCOPE=shared
;;
*)
echo "Unrecognized package scope: ${enable_pkgscope}"
exit 1
;;
esac
echo "=== Package scope: " $INSTALL_PKGSCOPE
MAKE_INSTALL_PKGSCOPE=adjust
fi
###### Some defaults ####### ###### Some defaults #######
OPTIONS= OPTIONS=
@ -1354,6 +1377,8 @@ AC_SUBST(FRAMEWORK_INSTALL_DIR)
AC_SUBST(FRAMEWORK_REL_INSTALL) AC_SUBST(FRAMEWORK_REL_INSTALL)
AC_SUBST(FRAMEWORK_PREFIX) AC_SUBST(FRAMEWORK_PREFIX)
AC_SUBST(INSTALL_ORIG_TREE) AC_SUBST(INSTALL_ORIG_TREE)
AC_SUBST(INSTALL_PKGSCOPE)
AC_SUBST(MAKE_INSTALL_PKGSCOPE)
AC_SUBST(EXE_SUFFIX) AC_SUBST(EXE_SUFFIX)
AC_SUBST(SO_SUFFIX) AC_SUBST(SO_SUFFIX)
AC_SUBST(OWN_LIBFFI) AC_SUBST(OWN_LIBFFI)

View File

@ -135,7 +135,6 @@ pre-built binary by modifying the machine code: change a comparison
to 2, which is SYMBOL_CHARSET, to a comparsion to 3, which doesn't to 2, which is SYMBOL_CHARSET, to a comparsion to 3, which doesn't
correspond to any CHARSET. correspond to any CHARSET.
Building Racket3m and GRacket3m Building Racket3m and GRacket3m
------------------------------- -------------------------------