From 7e6838b0af04c01411dc52ef1011b3f9662b3f8e 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. --- Makefile | 15 +++++++++++---- 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 +++++++++++---- 6 files changed, 50 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index a505a39018..5f2ada4688 100644 --- a/Makefile +++ b/Makefile @@ -143,6 +143,11 @@ DIST_DESC = # installers, where "" is replaced by the default configuration: DIST_CATALOGS_q = "" +# "Name" of the installation used for `user' package scope by default +# in an installation from an installer, where an empty value leaves +# the default as the version number: +INSTALL_NAME = + # A README file to download from the server for the client: README = README.txt @@ -267,7 +272,7 @@ fresh-user: rm -rf build/user set-config: - $(RACKET) -l distro-build/set-config racket/etc/config.rktd $(CONFIG_MODE_q) "$(DOC_SEARCH)" "" + $(RACKET) -l distro-build/set-config racket/etc/config.rktd $(CONFIG_MODE_q) "$(DOC_SEARCH)" "" "" # Install packages from the source copies in this directory. The # packages are installed in user scope, but we set the add-on @@ -337,18 +342,20 @@ client: COPY_ARGS = SERVER=$(SERVER) PKGS="$(PKGS)" \ RELEASE_MODE=$(RELEASE_MODE) SOURCE_MODE=$(SOURCE_MODE) \ - PKG_SOURCE_MODE=$(PKG_SOURCE_MODE) \ + PKG_SOURCE_MODE=$(PKG_SOURCE_MODE) INSTALL_NAME="$(INSTALL_NAME)"\ DIST_NAME="$(DIST_NAME)" DIST_BASE=$(DIST_BASE) \ DIST_DIR=$(DIST_DIR) DIST_SUFFIX=$(DIST_SUFFIX) \ DIST_DESC="$(DIST_DESC)" README="$(README)" \ JOB_OPTIONS="$(JOB_OPTIONS)" +SET_BUNDLE_CONFIG_q = $(BUNDLE_CONFIG) "" "" "$(INSTALL_NAME)" "$(DOC_SEARCH)" $(DIST_CATALOGS_q) + win32-client: IF EXIST build\user cmd /c rmdir /S /Q build\user $(MAKE) win32-core $(COPY_ARGS) $(MAKE) win32-distro-build-from-server $(COPY_ARGS) $(MAKE) win32-bundle-from-server $(COPY_ARGS) - $(WIN32_RACKET) -l distro-build/set-config $(BUNDLE_CONFIG) "" "" "$(DOC_SEARCH)" $(DIST_CATALOGS_q) + $(WIN32_RACKET) -l distro-build/set-config $(SET_BUNDLE_CONFIG_q) $(MAKE) win32-installer-from-bundle $(COPY_ARGS) # Install the "distro-build" package from the server into @@ -369,7 +376,7 @@ bundle-from-server: $(RACKET) -l setup/unixstyle-install post-adjust "$(SOURCE_MODE)" "$(PKG_SOURCE_MODE)" racket bundle/racket bundle-config: - $(RACKET) -l distro-build/set-config $(BUNDLE_CONFIG) "" "" "$(DOC_SEARCH)" $(DIST_CATALOGS_q) + $(RACKET) -l distro-build/set-config $(SET_BUNDLE_CONFIG_q) UPLOAD_q = --readme http://$(SERVER):9440/$(README) --upload http://$(SERVER):9440/ --desc "$(DIST_DESC)" DIST_ARGS_q = $(UPLOAD_q) $(RELEASE_MODE) $(SOURCE_MODE) "$(DIST_NAME)" $(DIST_BASE) $(DIST_DIR) "$(DIST_SUFFIX)" diff --git a/pkgs/distro-build/config.rkt b/pkgs/distro-build/config.rkt index 4d917836ef..9bd9a96472 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 05f7c121a5..9f9360d208 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 37dffc9e39..7db5bb0572 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 8c4fa5ba08..c24bc71f24 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 f363ed7ea9..eea6620100 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