From 47017cb8c7105d70b10a9249f5786e4c8fc2e409 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Fri, 26 Jul 2013 07:59:48 -0600 Subject: [PATCH] distro-build: support installation-name configuration for installers The default is "snapshot" for non-release builds, left as the version number for release builds. original commit: 7e6838b0af04c01411dc52ef1011b3f9662b3f8e --- pkgs/distro-build/config.rkt | 1 + pkgs/distro-build/doc.txt | 5 +++++ pkgs/distro-build/drive-clients.rkt | 11 ++++++++++- pkgs/distro-build/readme.rkt | 12 ++++++++++++ pkgs/distro-build/set-config.rkt | 15 +++++++++++---- 5 files changed, 39 insertions(+), 5 deletions(-) diff --git a/pkgs/distro-build/config.rkt b/pkgs/distro-build/config.rkt index 4d91783..9bd9a96 100644 --- a/pkgs/distro-build/config.rkt +++ b/pkgs/distro-build/config.rkt @@ -120,6 +120,7 @@ [(#:dist-suffix) (simple-string? val)] [(#:dist-catalogs) (and (list? val) (andmap string? val))] [(#:dist-base-url) (string? val)] + [(#:install-name) (string? val)] [(#:max-vm) (real? val)] [(#:server) (simple-string? val)] [(#:host) (simple-string? val)] diff --git a/pkgs/distro-build/doc.txt b/pkgs/distro-build/doc.txt index 05f7c12..9f9360d 100644 --- a/pkgs/distro-build/doc.txt +++ b/pkgs/distro-build/doc.txt @@ -141,6 +141,11 @@ Site-configuration keywords (where means no spaces, etc.): present) extended with "doc/local-redirect/index.html", or the `DOC_SEARCH' makefile variable + #:install-name --- string used as the name of the + installation for package operations in the `user' package scope, + where "" keeps the name as the Racket version; the default is + "snapshot" if the value of `#:release?' is false, "" otherwise. + #:dist-name --- the distribution name; defaults to the `DIST_NAME' makefile variable diff --git a/pkgs/distro-build/drive-clients.rkt b/pkgs/distro-build/drive-clients.rkt index 37dffc9..7db5bb0 100644 --- a/pkgs/distro-build/drive-clients.rkt +++ b/pkgs/distro-build/drive-clients.rkt @@ -21,6 +21,8 @@ (define default-release? #f) (define default-clean? #f) +(define snapshot-install-name "snapshot") + (define-values (config-file config-mode default-server default-pkgs default-doc-search default-dist-name default-dist-base default-dist-dir) @@ -252,6 +254,9 @@ (define source? (get-opt c '#:source? #f)) (define source-pkgs? (get-opt c '#:source-pkgs? source?)) (define source-runtime? (get-opt c '#:source-runtime? source?)) + (define install-name (get-opt c '#:install-name (if release? + "" + snapshot-install-name))) (~a " SERVER=" server " PKGS=" (q pkgs) " DOC_SEARCH=" (q doc-search) @@ -261,6 +266,7 @@ " DIST_DIR=" dist-dir " DIST_SUFFIX=" (q dist-suffix) " DIST_CATALOGS_q=" (qq dist-catalogs kind) + " INSTALL_NAME=" (q install-name) " RELEASE_MODE=" (if release? "--release" (q "")) " SOURCE_MODE=" (if source-runtime? "--source" (q "")) " PKG_SOURCE_MODE=" (if source-pkgs? @@ -334,7 +340,10 @@ rdme (rdme (add-defaults c '#:release? default-release? - '#:pkgs (string-split default-pkgs)))))) + '#:pkgs (string-split default-pkgs) + '#:install-name (if (get-opt c '#:release? default-release?) + "" + snapshot-install-name)))))) (make-directory* (build-path "build" "readmes")) (define readme (make-temporary-file "README-~a" diff --git a/pkgs/distro-build/readme.rkt b/pkgs/distro-build/readme.rkt index 8c4fa5b..c24bc71 100644 --- a/pkgs/distro-build/readme.rkt +++ b/pkgs/distro-build/readme.rkt @@ -48,6 +48,18 @@ @(apply ~a (for/list ([catalog (in-list catalogs)]) @~a{@"\n" @|catalog|})) @|is| consulted, first.@"\n"}))@; + @(let* ([name (hash-ref config '#:install-name "")]) + (if (or (equal? name "") + (equal? name (version))) + "" + @~a{@"\n"The distribution has been configured so that the installation + name is + @name + Multiple installations with this name share `user'-scoped packages, + which makes it easier to upgrade from such an installation to this one. + To avoid sharing (which is better for keeping multiple installations + active) use `raco pkg config --set name' to choose a different name + for this installation.@"\n"}))@; Visit http://racket-lang.org/ diff --git a/pkgs/distro-build/set-config.rkt b/pkgs/distro-build/set-config.rkt index f363ed7..eea6620 100644 --- a/pkgs/distro-build/set-config.rkt +++ b/pkgs/distro-build/set-config.rkt @@ -5,11 +5,15 @@ (only-in "config.rkt" extract-options) "url-options.rkt") -(define-values (dest-config-file config-file config-mode default-doc-search default-catalogs) +(define-values (dest-config-file config-file config-mode + install-name + default-doc-search default-catalogs) (command-line #:args - (dest-config-file config-file config-mode doc-search . catalog) - (values dest-config-file config-file config-mode doc-search catalog))) + (dest-config-file config-file config-mode install-name doc-search . catalog) + (values dest-config-file config-file config-mode + install-name + doc-search catalog))) (define config (if (equal? config-file "") (hash) @@ -35,7 +39,10 @@ (for/list ([c (in-list catalogs)]) (if (equal? c "") #f - c))))]) + c))))] + [table (if (equal? install-name "") + table + (hash-set table 'installation-name install-name))]) (unless (equal? table orig) (make-directory* (path-only dest-config-file)) (call-with-output-file dest-config-file