From eb48ea6e1f5354d6b94fef6a53cf7201c72a85cd 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). original commit: c413c28e70b7ebccef91eb914d26136e5ea7103b --- 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 +++++++++------ 5 files changed, 34 insertions(+), 20 deletions(-) diff --git a/pkgs/distro-build/drive-clients.rkt b/pkgs/distro-build/drive-clients.rkt index e6e45ce..5584743 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 f073977..bf7154a 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 38e1418..284462b 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 deb2dfd..391630c 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 e6066b9..67f1649 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")