From c413c28e70b7ebccef91eb914d26136e5ea7103b Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Sun, 30 Jun 2013 08:59:39 -0600 Subject: [PATCH] add configuration for a distribution name suffix The suffix is intended for OS variants, such as "precise" for a Linux variant that is build with Ubuntu 12.04 (Precise Pangolin). --- INSTALL.txt | 22 ++++++++++++++++++++++ Makefile | 9 ++++++--- pkgs/distro-build/drive-clients.rkt | 21 +++++++++++++-------- pkgs/distro-build/installer-dmg.rkt | 7 +++++-- pkgs/distro-build/installer-exe.rkt | 4 ++-- pkgs/distro-build/installer-sh.rkt | 7 +++++-- pkgs/distro-build/installer.rkt | 15 +++++++++------ 7 files changed, 62 insertions(+), 23 deletions(-) diff --git a/INSTALL.txt b/INSTALL.txt index bef600e93e..16263d59fe 100644 --- a/INSTALL.txt +++ b/INSTALL.txt @@ -186,6 +186,19 @@ in a configure file affects the clients, but it does not affect the packages prepared by the server; only `PKGS' affects the server (and the client's packages must be a subset of the server's packages). +For each installer written to "build/installers", the installer's name +is + + ---. + +where defaults to "racket" (but can be set via +`DIST_NAME'), is from `(system-library-subpath #f)' but +normalizing the Windows results to "i386-win32" and "x86_63-win32", +- is omitted unless a `#:dist-suffix' string is specified +for the client in the farm configuration, and is +platform-specific: ".sh" for Unix, ".dmg" for Mac Os X, and ".exe" for +Windows. + Separate Server and Clients --------------------------- @@ -212,6 +225,10 @@ Roughly, the steps are use a different directory name on installation, instead of "racket". + Add `DIST_SUFFIX="..."' to the `client' line to add a suffix + string for the installer's name, such as an identifier for a + particular variant of Linux. + In more detail: 1a. Build "racket" on a server. @@ -274,6 +291,11 @@ In more detail: the base name of the installer file for all platforms, provide `DIST_DIR' to `make'. The default is "racket". + To add an extra piece to the installer's name, such as an + identifier for a variant of Linux, provide `DIST_SUFFIX to + `make'. The default is "", which omits the prefix and its + preceding hyphen. + On each client, step 2b produces a "bundle/installer.txt" file that contains the path to the generated installer, but the installer is also uploaded to the server, which leaves the installer in a diff --git a/Makefile b/Makefile index 405a894fe0..bb98a6e855 100644 --- a/Makefile +++ b/Makefile @@ -85,6 +85,9 @@ RELEASE_MODE = # generated installers: DIST_NAME = Racket DIST_DIR = racket +# An extra suffix for the installer name, usually used to specify +# a variant of an OS +DIST_SUFFIX = # Configuration of clients to run for a build farm: FARM_CONFIG = build/farm-config.rktd @@ -235,7 +238,7 @@ client: $(MAKE) bundle-from-server $(MAKE) installer-from-bundle -COPY_ARGS = SERVER=$(SERVER) PKGS="$(PKGS)" RELEASE_MODE=$(RELEASE_MODE) DIST_NAME="$(DIST_NAME)" DIST_DIR=$(DIST_DIR) +COPY_ARGS = SERVER=$(SERVER) PKGS="$(PKGS)" RELEASE_MODE=$(RELEASE_MODE) DIST_NAME="$(DIST_NAME)" DIST_DIR=$(DIST_DIR) DIST_SUFFIX=$(DIST_SUFFIX) win32-client: IF EXIST build\user cmd /c rmdir /S /Q build\user @@ -265,7 +268,7 @@ UPLOAD = --upload http://$(SERVER):9440/ # Create an installer from the build (with installed packages) that's # in "bundle/racket": installer-from-bundle: - $(RACKET) -l- distro-build/installer $(UPLOAD) $(RELEASE_MODE) "$(DIST_NAME)" $(DIST_DIR) + $(RACKET) -l- distro-build/installer $(UPLOAD) $(RELEASE_MODE) "$(DIST_NAME)" $(DIST_DIR) "$(DIST_SUFFIX)" win32-distro-build-from-server: $(WIN32_RACO) pkg install $(REMOTE_USER_AUTO) distro-build @@ -284,7 +287,7 @@ win32-bundle-from-server: bundle\racket\raco pkg install $(REMOTE_INST_AUTO) $(PKGS) win32-installer-from-bundle: - $(WIN32_RACKET) -l- distro-build/installer $(UPLOAD) $(RELEASE_MODE) "$(DIST_NAME)" $(DIST_DIR) + $(WIN32_RACKET) -l- distro-build/installer $(UPLOAD) $(RELEASE_MODE) "$(DIST_NAME)" $(DIST_DIR) "$(DIST_SUFFIX)" # ------------------------------------------------------------ # Drive installer build: diff --git a/pkgs/distro-build/drive-clients.rkt b/pkgs/distro-build/drive-clients.rkt index e6e45ce07e..55847437e0 100644 --- a/pkgs/distro-build/drive-clients.rkt +++ b/pkgs/distro-build/drive-clients.rkt @@ -70,8 +70,10 @@ ;; defaults to `server' command-line argument ;; #:dist-name --- the distribution name; defaults to the ;; `dist-name' command-line argument -;; #:dist-dir --- the distribution's installation directory; -;; defaults to `dist-dir' command-line argument +;; #:dist-dir --- the distribution's installation directory; +;; defaults to `dist-dir' command-line argument +;; #:dist-suffix --- a suffix for the installer's name, usually +;; used for an OS variant; defaults to "" ;; #:max-vm --- max number of VMs allowed to run with this ;; machine, counting the machine; defaults to 1 ;; #:port --- ssh port for the client; defaults to 22 @@ -135,6 +137,7 @@ [(#:pkgs) (and (list? val) (andmap simple-string? val))] [(#:dist-name) (string? val)] [(#:dist-dir) (simple-string? val)] + [(#:dist-suffix) (simple-string? val)] [(#:max-vm) (real? val)] [(#:server) (simple-string? val)] [(#:host) (simple-string? val)] @@ -353,15 +356,16 @@ (define (q s) (~a "\"" s "\"")) -(define (client-args server pkgs dist-name dist-dir) +(define (client-args server pkgs dist-name dist-dir dist-suffix) (~a " SERVER=" server " PKGS=" (q pkgs) " DIST_NAME=" (q dist-name) " DIST_DIR=" dist-dir + " DIST_SUFFIX=" (q dist-suffix) " RELEASE_MODE=" (if release? "--release" (q "")))) (define (unix-build c host port user server repo clean? - pkgs dist-name dist-dir) + pkgs dist-name dist-dir dist-suffix) (define dir (or (get-opt c '#:dir) "build/plt")) (define (sh . args) @@ -378,12 +382,12 @@ "git pull") (sh "cd " (q dir) " ; " "make -j " j " client" - (client-args server pkgs dist-name dist-dir) + (client-args server pkgs dist-name dist-dir dist-suffix) " CORE_CONFIGURE_ARGS=" (q (apply ~a #:separator " " (get-opt c '#:configure null)))))) (define (windows-build c host port user server repo clean? - pkgs dist-name dist-dir) + pkgs dist-name dist-dir dist-suffix) (define dir (or (get-opt c '#:dir) "build\\plt")) (define bits (or (get-opt c '#:bits) 64)) @@ -403,7 +407,7 @@ (cmd "cd " (q dir) " && \"c:\\Program Files" (if (= bits 64) " (x86)" "") "\\Microsoft Visual Studio 9.0\\vc\\vcvarsall.bat\"" " " vc - " && nmake win32-client" (client-args server pkgs dist-name dist-dir)))) + " && nmake win32-client" (client-args server pkgs dist-name dist-dir dist-suffix)))) (define (client-build c) (define host (or (get-opt c '#:host) @@ -419,6 +423,7 @@ default-dist-name)) (define dist-dir (or (get-opt c '#:dist-dir) default-dist-dir)) + (define dist-suffix (get-opt c '#:dist-suffix "")) (define repo (or (get-opt c '#:repo) (~a "http://" server ":9440/.git"))) (define clean? (let ([v (get-opt c '#:clean? 'none)]) @@ -429,7 +434,7 @@ [(unix) unix-build] [else windows-build]) c host port user server repo clean? - pkgs dist-name dist-dir)) + pkgs dist-name dist-dir dist-suffix)) ;; ---------------------------------------- diff --git a/pkgs/distro-build/installer-dmg.rkt b/pkgs/distro-build/installer-dmg.rkt index f073977a47..bf7154a789 100644 --- a/pkgs/distro-build/installer-dmg.rkt +++ b/pkgs/distro-build/installer-dmg.rkt @@ -108,7 +108,10 @@ (system*/show hdiutil "detach" mnt) (delete-directory mnt)) -(define (installer-dmg human-name dir-name) - (define dmg-name (format "bundle/~a-~a.dmg" dir-name (system-library-subpath #f))) +(define (installer-dmg human-name dir-name dist-suffix) + (define dmg-name (format "bundle/~a-~a~a.dmg" + dir-name + (system-library-subpath #f) + dist-suffix)) (make-dmg human-name "bundle/racket" dmg-name bg-image) dmg-name) diff --git a/pkgs/distro-build/installer-exe.rkt b/pkgs/distro-build/installer-exe.rkt index 38e1418e06..284462b667 100644 --- a/pkgs/distro-build/installer-exe.rkt +++ b/pkgs/distro-build/installer-exe.rkt @@ -397,14 +397,14 @@ SectionEnd (parameterize ([current-directory "bundle"]) (system* makensis "/V3" "installer.nsi"))) -(define (installer-exe human-name dir-name release?) +(define (installer-exe human-name dir-name release? dist-suffix) (define makensis (or (find-executable-path "makensis.exe") (try-exe "c:\\Program Files\\NSIS\\makensis.exe") (try-exe "c:\\Program Files (x86)\\NSIS\\makensis.exe") (error 'installer-exe "cannot find \"makensis.exe\""))) (define platform (let-values ([(base name dir?) (split-path (system-library-subpath #f))]) (path->string name))) - (define exe-path (format "bundle/~a-~a-win32.exe" dir-name platform)) + (define exe-path (format "bundle/~a-~a-win32~a.exe" dir-name platform dist-suffix)) (nsis-generate exe-path human-name (version) diff --git a/pkgs/distro-build/installer-sh.rkt b/pkgs/distro-build/installer-sh.rkt index deb2dfddd6..391630cbdb 100644 --- a/pkgs/distro-build/installer-sh.rkt +++ b/pkgs/distro-build/installer-sh.rkt @@ -69,8 +69,11 @@ (system/show "chmod" "+x" dest) (delete-file tmp-tgz)) -(define (installer-sh human-name dir-name release?) - (define sh-path (format "bundle/~a-~a.sh" dir-name (system-library-subpath #f))) +(define (installer-sh human-name dir-name release? dist-suffix) + (define sh-path (format "bundle/~a-~a~a.sh" + dir-name + (system-library-subpath #f) + dist-suffix)) (generate-installer-sh "bundle/racket" sh-path dir-name human-name release?) diff --git a/pkgs/distro-build/installer.rkt b/pkgs/distro-build/installer.rkt index e6066b9951..67f16493c5 100644 --- a/pkgs/distro-build/installer.rkt +++ b/pkgs/distro-build/installer.rkt @@ -10,7 +10,7 @@ (define release? #f) (define upload-to #f) -(define-values (short-human-name human-name dir-name) +(define-values (short-human-name human-name dir-name dist-suffix) (command-line #:once-each [("--release") "Create a release installer" @@ -18,18 +18,21 @@ [("--upload") url "Upload installer" (set! upload-to url)] #:args - (human-name dir-name) + (human-name dir-name dist-suffix) (values human-name (format "~a v~a" human-name (version)) (if release? dir-name - (format "~a-~a" dir-name (version)))))) + (format "~a-~a" dir-name (version))) + (if (string=? dist-suffix "") + "" + (string-append "-" dist-suffix))))) (define installer-file (case (system-type) - [(unix) (installer-sh human-name dir-name release?)] - [(macosx) (installer-dmg human-name dir-name)] - [(windows) (installer-exe short-human-name dir-name release?)])) + [(unix) (installer-sh human-name dir-name release? dist-suffix)] + [(macosx) (installer-dmg human-name dir-name dist-suffix)] + [(windows) (installer-exe short-human-name dir-name release? dist-suffix)])) (call-with-output-file* (build-path "bundle" "installer.txt")