From 82c4e5663183d03d776dbccbae8ea4c6d35ac205 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Sat, 20 Jul 2013 12:09:37 -0600 Subject: [PATCH] distro-build: change `#:source?' config to mean source packages, too Use `#:source-runtime?' to make only the run-time system have source form, while packages are pre-built. --- Makefile | 16 +++++-- pkgs/distro-build/config.rkt | 2 + pkgs/distro-build/doc.txt | 19 ++++++-- pkgs/distro-build/drive-clients.rkt | 7 ++- pkgs/distro-build/readme.rkt | 37 ++++++++++---- racket/collects/setup/unixstyle-install.rkt | 53 ++++++++++++++------- 6 files changed, 95 insertions(+), 39 deletions(-) diff --git a/Makefile b/Makefile index f4214d1600..a505a39018 100644 --- a/Makefile +++ b/Makefile @@ -118,9 +118,14 @@ SERVER = localhost # snapshot installers): RELEASE_MODE = -# Set to "--source" to create a source "installer": +# Set to "--source" to create an archive (instead of an "installer" +# proper) on a client that has the run-time system in source form: SOURCE_MODE = +# Set to "--source --no-setup" to include packages in an installer +# (or archive) only in source form: +PKG_SOURCE_MODE = + # Human-readable name (spaces allowed), installation name base, and # Unix installation directory name for the generated installers: DIST_NAME = Racket @@ -332,6 +337,7 @@ client: COPY_ARGS = SERVER=$(SERVER) PKGS="$(PKGS)" \ RELEASE_MODE=$(RELEASE_MODE) SOURCE_MODE=$(SOURCE_MODE) \ + PKG_SOURCE_MODE=$(PKG_SOURCE_MODE) \ DIST_NAME="$(DIST_NAME)" DIST_BASE=$(DIST_BASE) \ DIST_DIR=$(DIST_DIR) DIST_SUFFIX=$(DIST_SUFFIX) \ DIST_DESC="$(DIST_DESC)" README="$(README)" \ @@ -359,8 +365,8 @@ bundle-from-server: mkdir -p bundle/racket $(RACKET) -l setup/unixstyle-install bundle racket bundle/racket $(RACKET) -l distro-build/unpack-collects http://$(SERVER):9440/ - bundle/racket/bin/raco pkg install $(REMOTE_INST_AUTO) $(PKGS) $(REQUIRED_PKGS) - $(RACKET) -l setup/unixstyle-install post-adjust$(SOURCE_MODE) racket bundle/racket + bundle/racket/bin/raco pkg install $(REMOTE_INST_AUTO) $(PKG_SOURCE_MODE) $(PKGS) $(REQUIRED_PKGS) + $(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) @@ -386,8 +392,8 @@ win32-bundle: win32-bundle-from-server: $(MAKE) win32-bundle $(COPY_ARGS) $(WIN32_RACKET) -l distro-build/unpack-collects http://$(SERVER):9440/ - bundle\racket\raco pkg install $(REMOTE_INST_AUTO) $(REQUIRED_PKGS) - bundle\racket\raco pkg install $(REMOTE_INST_AUTO) $(PKGS) + bundle\racket\raco pkg install $(REMOTE_INST_AUTO) $(PKG_SOURCE_MODE) $(REQUIRED_PKGS) + bundle\racket\raco pkg install $(REMOTE_INST_AUTO) $(PKG_SOURCE_MODE) $(PKGS) win32-installer-from-bundle: $(WIN32_RACKET) -l- distro-build/installer $(DIST_ARGS_q) diff --git a/pkgs/distro-build/config.rkt b/pkgs/distro-build/config.rkt index 2e5b0b6c01..4d917836ef 100644 --- a/pkgs/distro-build/config.rkt +++ b/pkgs/distro-build/config.rkt @@ -138,6 +138,8 @@ [(#:pull?) (boolean? val)] [(#:release?) (boolean? val)] [(#:source?) (boolean? val)] + [(#:source-runtime?) (boolean? val)] + [(#:source-pkgs?) (boolean? val)] [(#:site-dest) (path-string? val)] [(#:pdf-doc?) (boolean? val)] [(#:max-snapshots) (real? val)] diff --git a/pkgs/distro-build/doc.txt b/pkgs/distro-build/doc.txt index 580dacbfa9..05f7c121a5 100644 --- a/pkgs/distro-build/doc.txt +++ b/pkgs/distro-build/doc.txt @@ -204,11 +204,20 @@ Site-configuration keywords (where means no spaces, etc.): installers; the default is determined by the `RELEASE_MODE' makefile variable - #:source? --- if true, then create a kernel-source archive - (with pre-built packages), instead of a platform-specific - installer; a #t value works best when used with a Unix client - machine, since Unix clients typically have no native-library - packages; the default is #f + #:source? --- determines the default value for + `#:source-runtime' and `#:source-pkgs' + + #:source-runtime? --- if true, then create an archive that + contains the run-time system in source form (possibly with built + packages), instead of a platform-specific installer; a #t value + works best when used with a Unix client machine, since Unix + clients typically have no native-library packages; the default is + the value of `#:source?' + + #:source-pkgs? --- if true, then packages are included in the + installer/archive only in source form; a true value works best + when the `#:source-runtime?' value is also #t; the default is the + value of `#:source?' #:site-dest --- destination for completed build, used by the `site' and `snapshot-site' makefile targets; the default is diff --git a/pkgs/distro-build/drive-clients.rkt b/pkgs/distro-build/drive-clients.rkt index ea2ea266b0..5ed97c9a3e 100644 --- a/pkgs/distro-build/drive-clients.rkt +++ b/pkgs/distro-build/drive-clients.rkt @@ -250,6 +250,8 @@ (define dist-catalogs (choose-catalogs c '(""))) (define release? (get-opt c '#:release? default-release?)) (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?)) (~a " SERVER=" server " PKGS=" (q pkgs) " DOC_SEARCH=" (q doc-search) @@ -260,7 +262,10 @@ " DIST_SUFFIX=" (q dist-suffix) " DIST_CATALOGS_q=" (qq dist-catalogs kind) " RELEASE_MODE=" (if release? "--release" (q "")) - " SOURCE_MODE=" (if source? "--source" (q "")) + " SOURCE_MODE=" (if source-runtime? "--source" (q "")) + " PKG_SOURCE_MODE=" (if source-pkgs? + (q "--source --no-setup") + (q "")) " README=" (q (file-name-from-path readme)))) (define (unix-build c host port user server repo clean? pull? readme) diff --git a/pkgs/distro-build/readme.rkt b/pkgs/distro-build/readme.rkt index 9917e387a6..8c4fa5ba08 100644 --- a/pkgs/distro-build/readme.rkt +++ b/pkgs/distro-build/readme.rkt @@ -21,10 +21,13 @@ @|(hash-ref config '#:name "Racket")| distribution for version @(version)@(maybe-stamp config).@; - @(if (hash-ref config '#:source? #f) + @(if (let ([src? (hash-ref config '#:source? #f)]) + (or (hash-ref config '#:source-runtime? src?) + (hash-ref config '#:source-pkgs? src?))) (string-append "\n" (make-source-notes config) "\n") "")@; - @(if (and (not (hash-ref config '#:source? #f)) + @(if (and (not (hash-ref config '#:source-runtime? + (hash-ref config '#:source? #f))) (eq? (hash-ref config '#:platform (system-type)) 'macosx)) (string-append "\n" (make-macosx-notes config) "\n") "")@; @@ -66,14 +69,28 @@ share/COPYING_LESSER.txt for more information.}) (define (make-source-notes config) - - @~a{This distribution provides source for the Racket run-time system; - for build and installation instructions, see "racket/src/README". - Besides the run-time system's source, the distribution provides - pre-built versions of the core Racket bytecode, as well as pre-built - versions of included packages and documentation --- which makes it - suitable for quick installation on a Unix platform for which - executable binaries are not already provided.}) + (define src? (hash-ref config '#:source? #f)) + (define rt-src + @~a{This distribution provides source for the Racket run-time system; + for build and installation instructions, see "racket/src/README".}) + (define pkg-src + @~a{(The distribution also includes the core Racket collections and any + installed packages in source form.)}) + (define pkg-built + @~a{Besides the run-time system's source, the distribution provides + pre-built versions of the core Racket bytecode, as well as pre-built + versions of included packages and documentation --- which makes it + suitable for quick installation on a Unix platform for which + executable binaries are not already provided.}) + (cond + [(and (hash-ref config '#:source-runtime? src?) + (not (hash-ref config '#:source-pkgs? src?))) + (~a rt-src "\n" pkg-built)] + [(and (hash-ref config '#:source-runtime? src?) + (hash-ref config '#:source-pkgs? src?)) + (~a rt-src "\n" pkg-src)] + [else + @~a{The distribution includes any pre-installed packages in source form.}])) (define (make-macosx-notes config) @~a{Install by dragging the enclosing diff --git a/racket/collects/setup/unixstyle-install.rkt b/racket/collects/setup/unixstyle-install.rkt index 6edd071d06..3923dfd88d 100644 --- a/racket/collects/setup/unixstyle-install.rkt +++ b/racket/collects/setup/unixstyle-install.rkt @@ -12,8 +12,9 @@ ;; (interactive, undo-on-error, create-uninstaller) ;; - `copy': similar to `move', but copies instead of moving ;; - `bundle': like `copy', but no uninstall script -;; - `post-adjust': adjust an existing bundle after package installs -;; - `post-adjust--source': (really two dashes), like `post-adjust', but for source +;; - `post-adjust': adjust an existing bundle after package installs; +;; two extra arguments determine whether to strip build +;; artifacts ;; - `make-install-copytree': copies some toplevel directories, skips ".*" ;; subdirs, and rewrites "config.rkt", but no uninstaller ;; (used by `make install') (requires an additional `origtree' argument) @@ -35,6 +36,9 @@ (begin0 (car args) (set! args (cdr args)))) (define op (string->symbol (get-arg))) +(define adjust-mode + (and (eq? op 'post-adjust) + (list (get-arg) (get-arg)))) (define rktdir (get-arg)) (define base-destdir (and (pair? args) (null? (cdr args)) @@ -119,6 +123,16 @@ (delete-directory path)] [else #t])) ; shouldn't happen +;; removes "compiled" subdirectories recursively +(define (rm-compiled path) + (define (loop path) + (cond [(equal? path "compiled") (rm path)] + [(directory-exists? path) + (parameterize ([current-directory path]) (for-each loop (ls)))] + [else (void)])) + (parameterize ([current-directory path]) + (for-each loop (ls)))) + ;; used for filtering files when copying (and moving toplevels) (define skip-filter (lambda (p) #f)) @@ -469,20 +483,24 @@ (fix-executables bindir librktdir) (unless origtree? (write-config configdir))) -(define (post-adjust-source) - (define do-tree (move/copy-tree #f)) - (current-directory rktdir) - ;; Copy source into place: - (set! skip-filter ; skip src/build - (lambda (p) (regexp-match? #rx"^build$" p))) - (do-tree "src" (build-path base-destdir "src")) - ;; Remove directories that get re-created: - (define (remove! dst*) (rm (dir: dst*))) - (remove! 'bin) - (remove! 'lib) - (remove! 'man) - (remove! 'config) ; may be recreated by a later bundle step - (remove! 'includerkt)) +(define (post-adjust) + (when (regexp-match? #rx"--source" (car adjust-mode)) + (define do-tree (move/copy-tree #f)) + (current-directory rktdir) + ;; Copy source into place: + (set! skip-filter ; skip src/build + (lambda (p) (regexp-match? #rx"^build$" p))) + (do-tree "src" (build-path base-destdir "src")) + ;; Remove directories that get re-created: + (define (remove! dst*) (rm (dir: dst*))) + (remove! 'bin) + (remove! 'lib) + (remove! 'man) + (remove! 'config) ; may be recreated by a later bundle step + (remove! 'includerkt) + (when (regexp-match? #rx"--source" (cadr adjust-mode)) + ;; strip "compiled" directories back out of "collects" + (rm-compiled (dir: 'collects))))) ;; -------------------------------------------------------------------------- @@ -491,8 +509,7 @@ [(move) (move/copy-distribution #t #f)] [(copy) (move/copy-distribution #f #f)] [(bundle) (move/copy-distribution #f #t)] - [(post-adjust) (void)] - [(post-adjust--source) (post-adjust-source)] + [(post-adjust) (post-adjust)] [(make-install-copytree) (make-install-copytree)] [(make-install-destdir-fix) (make-install-destdir-fix)] [else (error (format "unknown operation: ~e" op))]))