From 05837fac1b85d5ac8b2949f1e5723c0c0a4e8a89 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Sun, 6 Jan 2013 09:21:18 -0700 Subject: [PATCH] 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. --- collects/planet2/lib.rkt | 35 ++++- collects/planet2/main.rkt | 165 +++++++++++++-------- collects/planet2/scribblings/planet2.scrbl | 153 +++++++++++++------ src/Makefile.in | 7 + src/README | 2 +- src/configure | 36 ++++- src/racket/configure.ac | 25 ++++ src/worksp/README | 1 - 8 files changed, 313 insertions(+), 111 deletions(-) diff --git a/collects/planet2/lib.rkt b/collects/planet2/lib.rkt index a7c76dc87b..a155d2f700 100644 --- a/collects/planet2/lib.rkt +++ b/collects/planet2/lib.rkt @@ -285,6 +285,16 @@ (pkg-config-file) (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 install-info (name orig-pkg directory clean? checksum)) @@ -1038,6 +1048,21 @@ (match key+vals [(list* (and key "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) (pkg-error "unsupported config key\n key: ~e" key)] [(list) @@ -1049,6 +1074,12 @@ ["indexes" (for ([s (in-list (read-pkg-cfg/def "indexes"))]) (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)])] [(list) @@ -1160,4 +1191,6 @@ (#:dep-behavior dep-behavior/c #:force? 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))])) diff --git a/collects/planet2/main.rkt b/collects/planet2/main.rkt index 52cac96ae4..151faba4fd 100644 --- a/collects/planet2/main.rkt +++ b/collects/planet2/main.rkt @@ -23,6 +23,23 @@ (string->symbol (format "~a ~a" (short-program+command-name) cmd)) 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 "This tool is used for managing installed packages." [install @@ -36,14 +53,9 @@ "(makes sense only when a single is given)")] [#:bool no-setup () ("Don't run `raco setup' after changing packages" "(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 [(#:sym mode [fail force search-ask search-auto] #f) deps () - ("Specify the behavior for dependencies;" - "valid s are:" + ("Specify the behavior for dependencies, with as one of" " fail: cancels the installation if dependencies are unmet" " (default for most packages)" " force: installs the package despite missing dependencies" @@ -54,33 +66,37 @@ [#:bool force () "Ignores conflicts"] [#:bool ignore-checksums () "Ignores checksums"] [#:bool link () ("Link a directory package source in place")] + #:once-any + [(#:sym scope [installation user shared] #f) scope () + ("Select package , 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 - (parameterize ([current-install-system-wide? installation] - [current-install-version-specific? (not shared)] - [current-pkg-error (pkg-error 'install)]) - (with-package-lock - (define setup-collects - (install-cmd #:dep-behavior deps - #:force? force - #:ignore-checksums? ignore-checksums - (for/list ([p (in-list pkg-source)]) - (pkg-desc p (or (and link 'link) type) name #f)))) - (setup no-setup installation setup-collects)))] + (call-with-package-scope + 'install + scope installation shared user + (lambda () + (with-package-lock + (define setup-collects + (install-cmd #:dep-behavior deps + #:force? force + #:ignore-checksums? ignore-checksums + (for/list ([p (in-list pkg-source)]) + (pkg-desc p (or (and link 'link) type) name #f)))) + (setup no-setup installation setup-collects))))] [update "Update packages" #:once-each [#:bool no-setup () ("Don't run `raco setup' after changing packages" "(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;" "only if no packages are given on the command line")] [(#:sym mode [fail force search-ask search-auto] #f) deps () - ("Specify the behavior for dependencies;" - "valid s are:" + ("Specify the behavior for dependencies, with as one of" " fail: cancels the installation if dependencies are unmet" " (default for most packages)" " force: installs the package despite missing dependencies" @@ -89,10 +105,20 @@ " like it installed" " search-auto: like 'search-ask' but does not ask for permission to install")] [#: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 - (parameterize ([current-install-system-wide? installation] - [current-install-version-specific? (not shared)] - [current-pkg-error (pkg-error 'update)]) + (call-with-package-scope + 'update + scope installation shared user + (lambda () (with-package-lock (define setup-collects (update-packages pkgs @@ -100,41 +126,56 @@ #:dep-behavior deps #:deps? update-deps)) (when setup-collects - (setup no-setup installation setup-collects))))] + (setup no-setup installation setup-collects)))))] [remove "Remove packages" #:once-each [#:bool no-setup () ("Don't run `raco setup' after changing packages" "(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 auto () "Remove automatically installed packages with no dependencies"] + #:once-any + [(#:sym scope [installation user shared] #f) scope () + ("Select package , 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 - (parameterize ([current-install-system-wide? installation] - [current-install-version-specific? (not shared)] - [current-pkg-error (pkg-error 'remove)]) - (with-package-lock - (remove-packages pkgs - #:auto? auto - #:force? force) - (setup no-setup installation #f)))] + (call-with-package-scope + 'remove + scope installation shared user + (lambda () + (with-package-lock + (remove-packages pkgs + #:auto? auto + #:force? force) + (setup no-setup installation #f))))] [show "Show information about installed packages" #:once-any - [#:bool installation ("-i") "Show only for all users of the Racket installation"] - [#:bool shared ("-s") "Show only user-specific for all Racket versions"] - [#:bool user ("-u") "Show only the user- and version-specific"] + [(#:sym scope [installation user shared] #f) scope () + ("Show only for package , one of" + " 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 "] + [#:bool installation ("-i") "shorthand for `--scope installation'"] + [#:bool user ("-u") "shorthand for `--scope user'"] + [#:bool shared ("-s") "shorthand for `--scope shared'"] #:args () - (define only-mode (cond - [installation 'i] - [shared 's] - [user 'u] - [else (if version 'u #f)])) + (define only-mode (case scope + [(installation) 'i] + [(user) 'u] + [(shared) 's] + [else + (cond + [installation 'i] + [shared 's] + [user 'u] + [else (if version 'u #f)])])) (for ([mode '(i s u)]) (when (or (eq? mode only-mode) (not only-mode)) (unless only-mode @@ -150,18 +191,24 @@ (show-cmd (if only-mode "" " "))))))] [config "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 [#:bool set () "Completely replace the value"] - #:args key+vals - (parameterize ([current-install-system-wide? installation] - [current-install-version-specific? (not shared)] - [current-pkg-error (pkg-error 'config)]) - (with-package-lock - (config-cmd set key+vals)))] + #:once-any + [(#:sym scope [installation user shared] #f) scope () + ("Select configuration , one of" + " installation: Operate on the installation-wide package configuration" + " user: Operate on the user-specific, version-specific package configuration" + " 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 "Bundle a new package" #:once-any diff --git a/collects/planet2/scribblings/planet2.scrbl b/collects/planet2/scribblings/planet2.scrbl index 614baac6a9..8d13c6866e 100644 --- a/collects/planet2/scribblings/planet2.scrbl +++ b/collects/planet2/scribblings/planet2.scrbl @@ -1,5 +1,6 @@ #lang scribble/manual @(require scribble/bnf + scribble/core (for-label planet2 (except-in racket/base remove) setup/dirs)) @@ -21,6 +22,16 @@ @(define (gtech 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)} @@ -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 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} @@ -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 reprovides all their options. -@subsection{Command Line} +@subsection[#:tag "cmdline"]{Command Line} The @as-index{@exec{raco pkg}} sub-command provides the following sub-sub-commands: @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 @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 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 @itemlist[ @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{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), 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 @tech{package updates}. If an update is found, but it cannot be 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: @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{deps} @nonterm{behavior} --- Same as for @exec{install}.} + @item{@DFlag{deps} @nonterm{behavior} --- Same as for @command-ref{install}.} @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{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 listed, this command fails atomically. It accepts the following @nonterm{option}s: @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{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} 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, user- and Racket-version-specific, and user-specific all-version). The command accepts the following @nonterm{option}s: @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{user} or @Flag{u} --- Show only user-specific, version-specific packages.} + + @item{@DFlag{scope} @nonterm{scope} --- Shows only packages in @nonterm{scope}, which is one of + @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{@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: @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{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: @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: @itemlist[ @@ -349,10 +393,7 @@ View and modify package configuration options. It accepts the following @nonterm @defmodule[planet2] The @racketmodname[planet2] module provides a programmatic interface -to the command sub-sub-commands. Each long form option is keyword -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. +to the command sub-sub-commands. @deftogether[ (@defthing[install procedure?] @@ -362,8 +403,13 @@ accepts its argument as a symbol. All other options accept booleans, where @defthing[config 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?} 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 -all users of a particular Racket installation; 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. +You can change the default @tech{package scope} (for a particular +Racket installation) with @command-ref{config}@exec{ -i --set +default-scope installation}, in which case package operations apply +for all users of a Racket installation. You can also use the @Flag{i} +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 apply to all Racket versions that you run. (In contrast, @|Planet1| requires reinstallation of all packages every version change.) @subsection{Where and how are packages installed?} -User-local and Racket-version-specific packages are in @racket[(build-path -(find-system-path 'addon-dir) (version) "pkgs")], user-local and +User-specific and Racket-version-specific packages are in @racket[(build-path +(find-system-path 'addon-dir) (version) "pkgs")], user-specific and all-version packages are in @racket[(build-path (find-system-path 'addon-dir) "pkgs")], and installation-wide packages are in @racket[(build-path (find-lib-dir) "pkgs")]. They are linked as collection roots with @exec{raco link}. -@subsection{How are user-local and installation-wide packages -related?} +@subsection{How are user-specific and installation-wide @tech{package scopes} +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 other installation-wide packages. diff --git a/src/Makefile.in b/src/Makefile.in index eb4196b91a..ce4bac4e2f 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -93,6 +93,7 @@ install-common-middle: install-common-last: $(MAKE) fix-paths + $(MAKE) @MAKE_INSTALL_PKGSCOPE@-raco-pkg-default-scope install-no: $(NOOP) @@ -111,6 +112,12 @@ copytree-run: make-install-copytree "$(srcdir)/.." \ $(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: cd gracket; $(MAKE) install-post-collects diff --git a/src/README b/src/README index 9b2eb52e11..df6709cbc5 100644 --- a/src/README +++ b/src/README @@ -170,7 +170,7 @@ Detailed instructions: and/or GRacket. The current directory at the time `configure' is run will be used as working space for building the executables (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), but it's better to pick a separate build directory that is otherwise empty (as in the second example). diff --git a/src/configure b/src/configure index bb6e5d7f93..e6dddf79ee 100755 --- a/src/configure +++ b/src/configure @@ -714,6 +714,8 @@ FRAMEWORK_INSTALL_DIR FRAMEWORK_REL_INSTALL FRAMEWORK_PREFIX INSTALL_ORIG_TREE +INSTALL_PKGSCOPE +MAKE_INSTALL_PKGSCOPE EXE_SUFFIX SO_SUFFIX OWN_LIBFFI @@ -1343,6 +1345,7 @@ Optional Features: --enable-floatinstead use single-precision by default --enable-racket= use as Racket executable to build Racket --enable-origtree install with original directory structure + --enable-pkgscope= set `raco pkg' default: installation, user, or shared --enable-docs build docs on install (enabled by default) --enable-usersetup setup user-specific files on install --enable-shared create shared libraries @@ -2015,6 +2018,11 @@ if test "${enable_origtree+set}" = set; then enableval=$enable_origtree; fi +# Check whether --enable-pkgscope was given. +if test "${enable_pkgscope+set}" = set; then + enableval=$enable_pkgscope; +fi + # Check whether --enable-docs was given. if test "${enable_docs+set}" = set; then @@ -2370,6 +2378,28 @@ if test "${enable_racket}" != "" ; then echo "=== Using Racket executable ${enable_racket}" 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 ####### 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_PREFIX!$FRAMEWORK_PREFIX$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 SO_SUFFIX!$SO_SUFFIX$ac_delim OWN_LIBFFI!$OWN_LIBFFI$ac_delim @@ -9989,7 +10023,7 @@ LIBOBJS!$LIBOBJS$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim _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 elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 diff --git a/src/racket/configure.ac b/src/racket/configure.ac index 10c803f530..45e3db3d10 100644 --- a/src/racket/configure.ac +++ b/src/racket/configure.ac @@ -37,6 +37,7 @@ AC_ARG_ENABLE(floatinstead, [ --enable-floatinstead use single-precision by d AC_ARG_ENABLE(racket, [ --enable-racket= use as Racket executable to build Racket]) AC_ARG_ENABLE(origtree,[ --enable-origtree install with original directory structure]) +AC_ARG_ENABLE(pkgscope,[ --enable-pkgscope= 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(usersetup, [ --enable-usersetup setup user-specific files on install]) @@ -296,6 +297,28 @@ if test "${enable_racket}" != "" ; then echo "=== Using Racket executable ${enable_racket}" 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 ####### OPTIONS= @@ -1354,6 +1377,8 @@ AC_SUBST(FRAMEWORK_INSTALL_DIR) AC_SUBST(FRAMEWORK_REL_INSTALL) AC_SUBST(FRAMEWORK_PREFIX) AC_SUBST(INSTALL_ORIG_TREE) +AC_SUBST(INSTALL_PKGSCOPE) +AC_SUBST(MAKE_INSTALL_PKGSCOPE) AC_SUBST(EXE_SUFFIX) AC_SUBST(SO_SUFFIX) AC_SUBST(OWN_LIBFFI) diff --git a/src/worksp/README b/src/worksp/README index 1c6890a148..f41229bd7b 100644 --- a/src/worksp/README +++ b/src/worksp/README @@ -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 correspond to any CHARSET. - Building Racket3m and GRacket3m -------------------------------