diff --git a/distro-build-server/info.rkt b/distro-build-server/info.rkt index 8acdb56..1eb141f 100644 --- a/distro-build-server/info.rkt +++ b/distro-build-server/info.rkt @@ -2,7 +2,7 @@ (define collection "distro-build") -(define deps '("base" +(define deps '(["base" #:version "6.1.1.6"] "distro-build-client" "web-server-lib" "ds-store-lib" diff --git a/distro-build-server/pack-built.rkt b/distro-build-server/pack-built.rkt index 1914ef5..ddafc27 100644 --- a/distro-build-server/pack-built.rkt +++ b/distro-build-server/pack-built.rkt @@ -7,7 +7,8 @@ racket/file racket/path openssl/sha1 - racket/cmdline) + racket/cmdline + setup/getinfo) (module test racket/base) @@ -23,7 +24,6 @@ (define build-dir "build") (define dest-dir (build-path build-dir (~a create-mode))) -(define native-dir (build-path build-dir "native" "pkgs")) (define pkg-dest-dir (path->complete-path (build-path dest-dir "pkgs"))) (define catalog-dir (build-path dest-dir "catalog")) (define catalog-pkg-dir (build-path catalog-dir "pkg")) @@ -32,28 +32,41 @@ (define pkg-details (call-with-input-file* pkg-info-file read)) +(define pkg-cache (make-hash)) + +(define (prefer-binary? pkg) + (define dir (pkg-directory pkg #:cache pkg-cache)) + (define i (get-info/full dir)) + (define mode (and i (i 'distribution-preference (lambda () #f)))) + (or (eq? mode 'binary) + ;; Any ".rkt" or ".scrbl" other than "info.rkt"? + (not (for/or ([f (in-directory dir)]) + (and (regexp-match? #rx"[.](scrbl|rkt)$" f) + (not (let-values ([(base name dir?) (split-path f)]) + (equal? #"info.rkt" (path->bytes name))))))))) + (for ([pkg (in-list (installed-pkg-names))]) - (define native-zip (build-path native-dir (path-add-suffix pkg ".zip"))) - (unless (file-exists? native-zip) - (define ht (hash-ref pkg-details pkg (hash))) - (define dest-zip (build-path pkg-dest-dir (~a pkg ".zip"))) - (pkg-create 'zip pkg - #:source 'name - #:dest pkg-dest-dir - #:mode create-mode) - (call-with-output-file* - (build-path catalog-pkg-dir pkg) - #:exists 'truncate - (lambda (o) - (write (hash 'source (path->string (find-relative-path - (simple-form-path catalog-dir) - (simple-form-path dest-zip))) - 'checksum (call-with-input-file* dest-zip sha1) - 'name pkg - 'author (hash-ref ht 'author "plt@racket-lang.org") - 'description (hash-ref ht 'author "library") - 'tags (hash-ref ht 'tags '()) - 'dependencies (hash-ref ht 'dependencies '()) - 'modules (hash-ref ht 'modules '())) - o) - (newline o))))) + (define ht (hash-ref pkg-details pkg (hash))) + (define dest-zip (build-path pkg-dest-dir (~a pkg ".zip"))) + (pkg-create 'zip pkg + #:source 'name + #:dest pkg-dest-dir + #:mode (if (prefer-binary? pkg) + 'binary + create-mode)) + (call-with-output-file* + (build-path catalog-pkg-dir pkg) + #:exists 'truncate + (lambda (o) + (write (hash 'source (path->string (find-relative-path + (simple-form-path catalog-dir) + (simple-form-path dest-zip))) + 'checksum (call-with-input-file* dest-zip sha1) + 'name pkg + 'author (hash-ref ht 'author "plt@racket-lang.org") + 'description (hash-ref ht 'author "library") + 'tags (hash-ref ht 'tags '()) + 'dependencies (hash-ref ht 'dependencies '()) + 'modules (hash-ref ht 'modules '())) + o) + (newline o)))) diff --git a/distro-build-server/serve-catalog.rkt b/distro-build-server/serve-catalog.rkt index 3e36907..4810a4c 100644 --- a/distro-build-server/serve-catalog.rkt +++ b/distro-build-server/serve-catalog.rkt @@ -42,9 +42,8 @@ (define build-dir (path->complete-path "build")) (define built-dir (build-path build-dir from-dir)) -(define native-dir (build-path build-dir "native")) -(define dirs (list built-dir native-dir)) +(define dirs (list built-dir)) (define (pkg-name->info req name) (for/or ([d (in-list dirs)])