make site: propagate package dependencies, modules, etc. to catalog

This commit is contained in:
Matthew Flatt 2014-07-04 08:38:19 +01:00
parent 8d6870a7c3
commit 3f040f7a1a
4 changed files with 60 additions and 19 deletions

View File

@ -373,11 +373,11 @@ PACK_NATIVE = --native --pack build/native/pkgs \
++catalog build/native/catalog \
++catalog build/local/catalog
native-catalog:
$(RACKET) racket/src/pack-all.rkt $(PACK_NATIVE) native-pkgs
$(RACKET) racket/src/pack-all.rkt --mods $(PACK_NATIVE) native-pkgs
# Create a catalog for all packages in this directory:
local-source-catalog:
$(RACKET) racket/src/pack-all.rkt ++catalog build/local/catalog pkgs
$(RACKET) racket/src/pack-all.rkt --mods ++catalog build/local/catalog pkgs
# Clear out a package build in "build/user", and then install
# packages:
@ -399,6 +399,7 @@ set-server-config:
packages-from-local:
$(RACO) pkg install $(LOCAL_USER_AUTO) $(REQUIRED_PKGS) $(DISTRO_BUILD_PKGS)
$(MAKE) set-server-config
$(RACKET) -l- distro-build/pkg-info -o build/pkgs.rktd build/local/catalog
$(RACKET) -l distro-build/install-pkgs $(CONFIG_MODE_q) "$(PKGS)" $(LOCAL_USER_AUTO)
$(RACO) setup --avoid-main $(JOB_OPTIONS)
@ -409,6 +410,7 @@ build-from-catalog:
$(MAKE) fresh-user
$(RACO) pkg install --all-platforms $(SOURCE_USER_AUTO_q) $(REQUIRED_PKGS) $(DISTRO_BUILD_PKGS)
$(MAKE) set-server-config
$(RACKET) -l- distro-build/pkg-info -o build/pkgs.rktd $(SRC_CATALOG)
$(RACKET) -l distro-build/install-pkgs $(CONFIG_MODE_q) "$(PKGS)" $(SOURCE_USER_AUTO_q) --all-platforms
$(RACO) setup --avoid-main $(JOB_OPTIONS)
@ -422,7 +424,7 @@ origin-collects:
# Now that we've built packages from local sources, create "built"
# versions of the packages from the installation into "build/user":
built-catalog:
$(RACKET) -l distro-build/pack-built
$(RACKET) -l distro-build/pack-built build/pkgs.rktd
# Run a catalog server to provide pre-built packages, as well
# as the copy of the server's "collects" tree:
@ -434,7 +436,7 @@ built-catalog-server:
# which involves creating package archives in "binary" mode
# instead of "built" mode:
binary-catalog:
$(RACKET) -l- distro-build/pack-built --mode binary
$(RACKET) -l- distro-build/pack-built --mode binary build/pkgs.rktd
binary-catalog-server:
$(RACKET) -l- distro-build/serve-catalog --mode binary $(CONFIG_MODE_q) "$(SERVER_HOSTS)" $(SERVER_PORT)

View File

@ -13,12 +13,13 @@
(define create-mode 'built)
(command-line
#:once-each
[("--mode") mode "Create package archives for <mode>"
(set! create-mode (string->symbol mode))]
#:args ()
(void))
(define pkg-info-file
(command-line
#:once-each
[("--mode") mode "Create package archives for <mode>"
(set! create-mode (string->symbol mode))]
#:args (pkg-info-file)
pkg-info-file))
(define build-dir "build")
(define dest-dir (build-path build-dir (~a create-mode)))
@ -29,9 +30,12 @@
(make-directory* pkg-dest-dir)
(make-directory* catalog-pkg-dir)
(define pkg-details (call-with-input-file* pkg-info-file read))
(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
@ -46,10 +50,10 @@
(simple-form-path dest-zip)))
'checksum (call-with-input-file* dest-zip sha1)
'name pkg
'author "plt@racket-lang.org"
'description "library"
'tags '()
'dependencies '()
'modules '())
'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)))))

View File

@ -0,0 +1,34 @@
#lang racket/base
(require pkg/lib
racket/cmdline
net/url)
(define dest-file #f)
(define catalog
(command-line
#:once-each
[("-o") file "Output file"
(set! dest-file file)]
#:args
(catalog)
catalog))
(define catalog-url
(if (regexp-match? #rx"^[a-z]+:" catalog)
(string->url catalog-url)
(path->url (path->complete-path catalog))))
(define details
(parameterize ([current-pkg-catalogs (list catalog-url)])
(get-all-pkg-details-from-catalogs)))
(define (write-out o)
(write details o)
(newline o))
(if dest-file
(call-with-output-file* dest-file
#:exists 'truncate/replace
write-out)
(write-out (current-output-port)))

View File

@ -1,8 +1,9 @@
# ------------------------------------------------------------
# Configuration
# This `racket' must have the the "distro-build" and "aws" packages
# installed, where "aws" depends on "html-lib":
# This `racket' must have the the "aws" package installed,
# where "aws" depends on "html-lib", and it must be consistent
# with "pack-all.rkt" in `PLT_TOP`.
RACKET = racket
# In `PLT_TOP', "build/latest" should be a git clone to update (and it
@ -43,8 +44,8 @@ PACK_ARCHIVE = --at-checksum $(PLT_TOP)/build/archive/pkgs \
--mods
archive-catalog:
rm -rf $(PLT_TOP)/build/archive/catalog
$(RACKET) -l- distro-build/pack-and-catalog --native $(PACK_ARCHIVE) $(PLT_TOP)/build/latest/native-pkgs
$(RACKET) -l- distro-build/pack-and-catalog $(PACK_ARCHIVE) $(PLT_TOP)/build/latest/pkgs
$(RACKET) $(PLT_TOP)/racket/src/pack-all.rkt --native $(PACK_ARCHIVE) $(PLT_TOP)/build/latest/native-pkgs
$(RACKET) $(PLT_TOP)/racket/src/pack-all.rkt $(PACK_ARCHIVE) $(PLT_TOP)/build/latest/pkgs
# Copy files from "build/archive" to $(BUCKET), and update
# $(DEST_CATALOG):