distro-build: add "versionless" option

Versionless mode avoids putting a version number in an installer's
name or in installation paths.
This commit is contained in:
Matthew Flatt 2014-06-23 17:15:20 +01:00
parent 1e67fb16e6
commit 133d7a3c41
8 changed files with 58 additions and 19 deletions

View File

@ -302,9 +302,10 @@ configuration file there and omit the `CONFIG' argument to
your site-configuration module (accessible via the `current-mode' your site-configuration module (accessible via the `current-mode'
parameter). Supply `CLEAN_MODE=--clean' to make the default `#:clean?' parameter). Supply `CLEAN_MODE=--clean' to make the default `#:clean?'
configuration for a client #t instead of #f, supply configuration for a client #t instead of #f, supply
`RELEASE_MODE=--release' to make thde default `#:release?' `RELEASE_MODE=--release' to make the default `#:release?'
configuration #t, and supply `SOURCE_MODE=--source to make the default configuration #t, supply `SOURCE_MODE=--source` to make the default
`#:source?' configuration #t. `#:source?' configuration #t, and supply `VERSIONLESS_MODE=--version`
to make the default `#:versionless?' configuration #t.
A configuration file can specify the packages to include, host address A configuration file can specify the packages to include, host address
of the server, distribution name, installer directory, and of the server, distribution name, installer directory, and
@ -485,6 +486,10 @@ In more detail:
To create a source archive, provide `SOURCE_MODE' as "--source" To create a source archive, provide `SOURCE_MODE' as "--source"
to `make'. to `make'.
To create an archive that omits the version number and also omit
and version number in installer paths, provide `VERSIONLESS_MODE' as
"--versionless" to `make'.
To change the human-readable name of the distribution as embedded To change the human-readable name of the distribution as embedded
in the installer, provide `DIST_NAME' to `make'. The default in the installer, provide `DIST_NAME' to `make'. The default
distribution name is "Racket". Whatever name you pick, the Racket distribution name is "Racket". Whatever name you pick, the Racket

View File

@ -191,6 +191,10 @@ RELEASE_MODE =
# proper) on a client that has the run-time system in source form: # proper) on a client that has the run-time system in source form:
SOURCE_MODE = SOURCE_MODE =
# Set to "--versionless" to avoid a version number in an installer's
# name or installation path:
VERSIONLESS_MODE =
# Set to "--mac-pkg" to create ".pkg"-based installers for Mac OS X, # Set to "--mac-pkg" to create ".pkg"-based installers for Mac OS X,
# instead of a ".dmg" for drag-and-drop installation: # instead of a ".dmg" for drag-and-drop installation:
MAC_PKG_MODE = MAC_PKG_MODE =
@ -447,7 +451,8 @@ binary-catalog-server:
PROP_ARGS = SERVER=$(SERVER) SERVER_PORT=$(SERVER_PORT) SERVER_HOSTS="$(SERVER_HOSTS)" \ PROP_ARGS = SERVER=$(SERVER) SERVER_PORT=$(SERVER_PORT) SERVER_HOSTS="$(SERVER_HOSTS)" \
PKGS="$(PKGS)" BUILD_STAMP="$(BUILD_STAMP)" \ PKGS="$(PKGS)" BUILD_STAMP="$(BUILD_STAMP)" \
RELEASE_MODE=$(RELEASE_MODE) SOURCE_MODE=$(SOURCE_MODE) MAC_PKG_MODE=$(MAC_PKG_MODE) \ RELEASE_MODE=$(RELEASE_MODE) SOURCE_MODE=$(SOURCE_MODE) \
VERSIONLESS_MODE=$(VERSIONLESS_MODE) MAC_PKG_MODE=$(MAC_PKG_MODE) \
PKG_SOURCE_MODE="$(PKG_SOURCE_MODE)" INSTALL_NAME="$(INSTALL_NAME)"\ PKG_SOURCE_MODE="$(PKG_SOURCE_MODE)" INSTALL_NAME="$(INSTALL_NAME)"\
DIST_NAME="$(DIST_NAME)" DIST_BASE=$(DIST_BASE) \ DIST_NAME="$(DIST_NAME)" DIST_BASE=$(DIST_BASE) \
DIST_DIR=$(DIST_DIR) DIST_SUFFIX=$(DIST_SUFFIX) UPLOAD="$(UPLOAD)" \ DIST_DIR=$(DIST_DIR) DIST_SUFFIX=$(DIST_SUFFIX) UPLOAD="$(UPLOAD)" \
@ -499,7 +504,7 @@ bundle-from-server:
$(RACKET) -l setup/unixstyle-install post-adjust "$(SOURCE_MODE)" "$(PKG_SOURCE_MODE)" racket bundle/racket $(RACKET) -l setup/unixstyle-install post-adjust "$(SOURCE_MODE)" "$(PKG_SOURCE_MODE)" racket bundle/racket
UPLOAD_q = --readme "$(README)" --upload "$(UPLOAD)" --desc "$(DIST_DESC)" UPLOAD_q = --readme "$(README)" --upload "$(UPLOAD)" --desc "$(DIST_DESC)"
DIST_ARGS_q = $(UPLOAD_q) $(RELEASE_MODE) $(SOURCE_MODE) $(MAC_PKG_MODE) \ DIST_ARGS_q = $(UPLOAD_q) $(RELEASE_MODE) $(SOURCE_MODE) $(VERSIONLESS_MODE) $(MAC_PKG_MODE) \
"$(DIST_NAME)" $(DIST_BASE) $(DIST_DIR) "$(DIST_SUFFIX)" \ "$(DIST_NAME)" $(DIST_BASE) $(DIST_DIR) "$(DIST_SUFFIX)" \
"$(SIGN_IDENTITY)" "$(SIGN_IDENTITY)"
@ -549,7 +554,8 @@ client-from-site:
# ------------------------------------------------------------ # ------------------------------------------------------------
# Drive installer build across server and clients: # Drive installer build across server and clients:
DRIVE_ARGS_q = $(RELEASE_MODE) $(SOURCE_MODE) $(CLEAN_MODE) "$(CONFIG)" "$(CONFIG_MODE)" \ DRIVE_ARGS_q = $(RELEASE_MODE) $(VERSIONLESS_MODE) $(SOURCE_MODE) \
$(CLEAN_MODE) "$(CONFIG)" "$(CONFIG_MODE)" \
$(SERVER) $(SERVER_PORT) "$(SERVER_HOSTS)" \ $(SERVER) $(SERVER_PORT) "$(SERVER_HOSTS)" \
"$(PKGS)" "$(DOC_SEARCH)" "$(DIST_NAME)" $(DIST_BASE) $(DIST_DIR) "$(PKGS)" "$(DOC_SEARCH)" "$(DIST_NAME)" $(DIST_BASE) $(DIST_DIR)
DRIVE_CMD_q = $(RACKET) -l- distro-build/drive-clients $(DRIVE_ARGS_q) DRIVE_CMD_q = $(RACKET) -l- distro-build/drive-clients $(DRIVE_ARGS_q)

View File

@ -257,10 +257,15 @@ Site-configuration keywords (where <string*> means no spaces, etc.):
the value of `#:source?' the value of `#:source?'
#:source-pkgs? <boolean> --- if true, then packages are included in #:source-pkgs? <boolean> --- if true, then packages are included in
th installer/archive only in source form; a true value works best the installer/archive only in source form; a true value works best
when the `#:source-runtime?' value is also #t; the default is the when the `#:source-runtime?' value is also #t; the default is the
value of `#:source?' value of `#:source?'
#:versionless? <boolean> --- if true, avoids including the Racket
version number in an installer's name or in the installation path;
the default is determined by the `VERSIONLESS_MODE' makefile
variable
#:mac-pkg? <boolean> --- if true, creates a ".pkg" for Mac OS X (in #:mac-pkg? <boolean> --- if true, creates a ".pkg" for Mac OS X (in
single-file format) instead of a ".dmg"; the default is #f single-file format) instead of a ".dmg"; the default is #f

View File

@ -45,7 +45,7 @@
makensis makensis
#:extension-registers [extregs null] #:extension-registers [extregs null]
#:start-menus [startmenus null] #:start-menus [startmenus null]
#:release [release? #t] #:versionless [versionless? #t]
#:simple? [simple? #f] #:simple? [simple? #f]
#:auto-launch [auto-launch #f]) #:auto-launch [auto-launch #f])
(define distdir (regexp-replace* #rx" " distname "-")) (define distdir (regexp-replace* #rx" " distname "-"))
@ -77,8 +77,8 @@
;; Full name for the package, and a short name for installer texts ;; Full name for the package, and a short name for installer texts
!define RKTHumanName "@|distname| v@|version| (@|winplatform|)" !define RKTHumanName "@|distname| v@|version| (@|winplatform|)"
!define RKTShortName "@|distname|" !define RKTShortName "@|distname|"
!define RKTStartName "@|distname|@(if release? "" @~a{ v@|version|})" !define RKTStartName "@|distname|@(if versionless? "" @~a{ v@|version|})"
!define RKTDirName "@|distdir|@(if release? "" @~a{-@|version|})" !define RKTDirName "@|distdir|@(if versionless? "" @~a{-@|version|})"
!define RKTRegName "@|distdir|-@|winplatform|-@|version|" !define RKTRegName "@|distdir|-@|winplatform|-@|version|"
!define RKTProgFiles "$PROGRAMFILES@(if (equal? winplatform "x86_64") "64" "")" !define RKTProgFiles "$PROGRAMFILES@(if (equal? winplatform "x86_64") "64" "")"
@(if simple? @~a{!define SimpleInstaller} "") @(if simple? @~a{!define SimpleInstaller} "")
@ -406,7 +406,7 @@ SectionEnd
(parameterize ([current-directory "bundle"]) (parameterize ([current-directory "bundle"])
(system* makensis "/V3" "installer.nsi"))) (system* makensis "/V3" "installer.nsi")))
(define (installer-exe human-name base-name release? dist-suffix readme) (define (installer-exe human-name base-name versionless? dist-suffix readme)
(define makensis (or (find-executable-path "makensis.exe") (define makensis (or (find-executable-path "makensis.exe")
(try-exe "c:\\Program Files\\NSIS\\makensis.exe") (try-exe "c:\\Program Files\\NSIS\\makensis.exe")
(try-exe "c:\\Program Files (x86)\\NSIS\\makensis.exe") (try-exe "c:\\Program Files (x86)\\NSIS\\makensis.exe")
@ -426,7 +426,7 @@ SectionEnd
(version) (version)
platform platform
makensis makensis
#:release release? #:versionless versionless?
#:extension-registers (get-extreg "bundle/racket") #:extension-registers (get-extreg "bundle/racket")
#:start-menus (get-startmenu "bundle/racket") #:start-menus (get-startmenu "bundle/racket")
#:auto-launch (get-auto-launch "bundle/racket")) #:auto-launch (get-auto-launch "bundle/racket"))

View File

@ -15,6 +15,7 @@
(define release? #f) (define release? #f)
(define source? #f) (define source? #f)
(define versionless? #f)
(define mac-pkg? #f) (define mac-pkg? #f)
(define upload-to #f) (define upload-to #f)
(define upload-desc "") (define upload-desc "")
@ -27,6 +28,8 @@
(set! release? #t)] (set! release? #t)]
[("--source") "Create a source installer" [("--source") "Create a source installer"
(set! source? #t)] (set! source? #t)]
[("--versionless") "Avoid version number in names and paths"
(set! versionless? #t)]
[("--mac-pkg") "Create a \".pkg\" installer on Mac OS X" [("--mac-pkg") "Create a \".pkg\" installer on Mac OS X"
(set! mac-pkg? #t)] (set! mac-pkg? #t)]
[("--upload") url "Upload installer" [("--upload") url "Upload installer"
@ -41,8 +44,11 @@
(human-name base-name dir-name dist-suffix sign-identity) (human-name base-name dir-name dist-suffix sign-identity)
(values human-name (values human-name
(format "~a v~a" human-name (version)) (format "~a v~a" human-name (version))
(format "~a-~a" base-name (version)) (if versionless?
(if (and release? (not source?)) base-name
(format "~a-~a" base-name (version)))
(if (or (and release? (not source?))
versionless?)
dir-name dir-name
(format "~a-~a" dir-name (version))) (format "~a-~a" dir-name (version)))
(if (string=? dist-suffix "") (if (string=? dist-suffix "")
@ -67,10 +73,16 @@
(case (system-type) (case (system-type)
[(unix) (installer-sh human-name base-name dir-name release? dist-suffix readme)] [(unix) (installer-sh human-name base-name dir-name release? dist-suffix readme)]
[(macosx) (if mac-pkg? [(macosx) (if mac-pkg?
(installer-pkg (if release? short-human-name human-name) (installer-pkg (if (or release? versionless?)
short-human-name
human-name)
base-name dist-suffix readme sign-identity) base-name dist-suffix readme sign-identity)
(installer-dmg human-name base-name dist-suffix readme sign-identity))] (installer-dmg (if versionless?
[(windows) (installer-exe short-human-name base-name release? dist-suffix readme)]))) short-human-name
human-name)
base-name dist-suffix readme sign-identity))]
[(windows) (installer-exe short-human-name base-name (or release? versionless?)
dist-suffix readme)])))
(call-with-output-file* (call-with-output-file*
(build-path "bundle" "installer.txt") (build-path "bundle" "installer.txt")

View File

@ -145,6 +145,7 @@
[(#:source?) (boolean? val)] [(#:source?) (boolean? val)]
[(#:source-runtime?) (boolean? val)] [(#:source-runtime?) (boolean? val)]
[(#:source-pkgs?) (boolean? val)] [(#:source-pkgs?) (boolean? val)]
[(#:versionless?) (boolean? val)]
[(#:mac-pkg?) (boolean? val)] [(#:mac-pkg?) (boolean? val)]
[(#:site-dest) (path-string? val)] [(#:site-dest) (path-string? val)]
[(#:site-help) (hash? val)] [(#:site-help) (hash? val)]

View File

@ -25,6 +25,7 @@
(define default-release? #f) (define default-release? #f)
(define default-source? #f) (define default-source? #f)
(define default-versionless? #f)
(define default-clean? #f) (define default-clean? #f)
(define dry-run #f) (define dry-run #f)
@ -40,6 +41,8 @@
(set! default-release? #t)] (set! default-release? #t)]
[("--source") "Create source installers" [("--source") "Create source installers"
(set! default-source? #t)] (set! default-source? #t)]
[("--versionless") "Avoid version number in names and paths"
(set! default-versionless? #t)]
[("--clean") "Erase client directories before building" [("--clean") "Erase client directories before building"
(set! default-clean? #t)] (set! default-clean? #t)]
[("--dry-run") mode [("--dry-run") mode
@ -239,6 +242,7 @@
(define sign-identity (get-opt c '#:sign-identity "")) (define sign-identity (get-opt c '#:sign-identity ""))
(define release? (get-opt c '#:release? default-release?)) (define release? (get-opt c '#:release? default-release?))
(define source? (get-opt c '#:source? default-source?)) (define source? (get-opt c '#:source? default-source?))
(define versionless? (get-opt c '#:versionless? default-versionless?))
(define source-pkgs? (get-opt c '#:source-pkgs? source?)) (define source-pkgs? (get-opt c '#:source-pkgs? source?))
(define source-runtime? (get-opt c '#:source-runtime? source?)) (define source-runtime? (get-opt c '#:source-runtime? source?))
(define mac-pkg? (get-opt c '#:mac-pkg? #f)) (define mac-pkg? (get-opt c '#:mac-pkg? #f))
@ -263,6 +267,7 @@
" BUILD_STAMP=" (q build-stamp) " BUILD_STAMP=" (q build-stamp)
" RELEASE_MODE=" (if release? "--release" (q "")) " RELEASE_MODE=" (if release? "--release" (q ""))
" SOURCE_MODE=" (if source-runtime? "--source" (q "")) " SOURCE_MODE=" (if source-runtime? "--source" (q ""))
" VERSIONLESS_MODE=" (if versionless? "--versionless" (q ""))
" PKG_SOURCE_MODE=" (if source-pkgs? " PKG_SOURCE_MODE=" (if source-pkgs?
(q "--source --no-setup") (q "--source --no-setup")
(q "")) (q ""))
@ -340,6 +345,7 @@
(rdme (add-defaults c (rdme (add-defaults c
'#:release? default-release? '#:release? default-release?
'#:source? default-source? '#:source? default-source?
'#:versionless? default-versionless?
'#:pkgs (string-split default-pkgs) '#:pkgs (string-split default-pkgs)
'#:install-name (if (get-opt c '#:release? default-release?) '#:install-name (if (get-opt c '#:release? default-release?)
"" ""

View File

@ -105,18 +105,22 @@
@~a{The distribution includes any pre-installed packages in source form.}])) @~a{The distribution includes any pre-installed packages in source form.}]))
(define (make-macosx-notes config) (define (make-macosx-notes config)
(define vers-suffix
(if (hash-ref config '#:versionless? #f)
""
@~a{ v@(version)}))
(if (hash-ref config '#:mac-pkg? #f) (if (hash-ref config '#:mac-pkg? #f)
@~a{The installation directory is @~a{The installation directory is
/Applications/@(string-append /Applications/@(string-append
(hash-ref config '#:dist-name "Racket") (hash-ref config '#:dist-name "Racket")
(if (hash-ref config '#:release? #f) (if (hash-ref config '#:release? #f)
"" ""
(string-append " v" (version)))) vers-suffix))
The installer also adjusts "/etc/paths.d/racket" to point to that The installer also adjusts "/etc/paths.d/racket" to point to that
directory's "bin" directory, which adjusts the default PATH directory's "bin" directory, which adjusts the default PATH
environment variable for all users.} environment variable for all users.}
@~a{Install by dragging the enclosing @~a{Install by dragging the enclosing
@|(hash-ref config '#:dist-name "Racket")| v@(version) @|(hash-ref config '#:dist-name "Racket")|@|vers-suffix|
folder to your Applications folder --- or wherever you like. You can folder to your Applications folder --- or wherever you like. You can
move the folder at any time, but do not move applications or other move the folder at any time, but do not move applications or other
files within the folder. If you want to use the Racket command-line files within the folder. If you want to use the Racket command-line