distro-build: refine client--server split

This commit is contained in:
Matthew Flatt 2014-03-10 17:19:36 -06:00
parent 1260dd6b2e
commit df857e1c76
9 changed files with 77 additions and 72 deletions

View File

@ -334,8 +334,8 @@ local-build:
fresh-user:
rm -rf build/user
set-config:
$(RACKET) -l distro-build/set-config build/user/config/config.rktd $(CONFIG_MODE_q) "$(DOC_SEARCH)" "" "" ""
set-server-config:
$(RACKET) -l distro-build/set-server-config build/user/config/config.rktd $(CONFIG_MODE_q) "$(DOC_SEARCH)" "" "" ""
# Install packages from the source copies in this directory. The
# packages are installed in user scope, but we set the add-on
@ -344,7 +344,7 @@ set-config:
# from it):
packages-from-local:
$(RACO) pkg install $(LOCAL_USER_AUTO) $(REQUIRED_PKGS) $(DISTRO_BUILD_PKGS)
$(MAKE) set-config
$(MAKE) set-server-config
$(RACKET) -l distro-build/install-pkgs $(CONFIG_MODE_q) "$(PKGS)" $(LOCAL_USER_AUTO)
$(RACO) setup --avoid-main $(JOB_OPTIONS)
@ -354,7 +354,7 @@ packages-from-local:
build-from-catalog:
$(MAKE) fresh-user
$(RACO) pkg install --all-platforms $(SOURCE_USER_AUTO_q) $(REQUIRED_PKGS) $(DISTRO_BUILD_PKGS)
$(MAKE) set-config
$(MAKE) set-server-config
$(RACKET) -l distro-build/install-pkgs $(CONFIG_MODE_q) "$(PKGS)" $(SOURCE_USER_AUTO_q) --all-platforms
$(RACO) setup --avoid-main $(JOB_OPTIONS)
@ -409,7 +409,7 @@ COPY_ARGS = $(PROP_ARGS) \
# Not copied, because used only immediately: DOC_SEARCH and DIST_CATALOGS_q
SET_BUNDLE_CONFIG_q = $(BUNDLE_CONFIG) "" "" "$(INSTALL_NAME)" "$(BUILD_STAMP)" "$(DOC_SEARCH)" $(DIST_CATALOGS_q)
SET_BUNDLE_CONFIG_q = $(BUNDLE_CONFIG) "$(INSTALL_NAME)" "$(BUILD_STAMP)" "$(DOC_SEARCH)" $(DIST_CATALOGS_q)
client:
if [ ! -d build/log ] ; then rm -rf build/user ; fi

View File

@ -1,20 +0,0 @@
#lang racket/base
(require racket/cmdline
pkg
pkg/lib
net/url)
(module test racket/base)
(define (add-catalog! url)
(define s (url->string url))
(define l (pkg-config-catalogs))
(unless (member s l)
(apply pkg-config-command #:set #t
"catalogs"
(append l (list s)))))
(command-line
#:args
(dir)
(add-catalog! (path->url (path->complete-path dir))))

View File

@ -1,57 +1,49 @@
#lang racket/base
(require racket/cmdline
racket/file
racket/path
(only-in "config.rkt" extract-options)
"url-options.rkt")
racket/path)
(provide set-config)
(module test racket/base)
(define-values (dest-config-file config-file config-mode
install-name build-stamp
default-doc-search default-catalogs)
(module+ main
(command-line
#:args
(dest-config-file config-file config-mode
install-name build-stamp
(dest-config-file install-name build-stamp
doc-search . catalog)
(values dest-config-file config-file config-mode
install-name build-stamp
doc-search catalog)))
(set-config dest-config-file
install-name build-stamp
doc-search catalog)))
(define config (if (equal? config-file "")
(hash)
(extract-options config-file config-mode)))
(define (set-config dest-config-file
install-name build-stamp
doc-search catalogs)
(define orig
(if (file-exists? dest-config-file)
(call-with-input-file* dest-config-file read)
(hash)))
(define doc-search (choose-doc-search config default-doc-search))
(define catalogs (choose-catalogs config default-catalogs))
(define orig
(if (file-exists? dest-config-file)
(call-with-input-file* dest-config-file read)
(hash)))
(let* ([table orig]
[table
(if (equal? doc-search "")
table
(hash-set table 'doc-search-url doc-search))]
[table (if (equal? catalogs '(""))
table
(hash-set table 'catalogs
(for/list ([c (in-list catalogs)])
(if (equal? c "")
#f
c))))]
[table (if (equal? install-name "")
table
(hash-set table 'installation-name install-name))]
[table (hash-set table 'build-stamp build-stamp)])
(unless (equal? table orig)
(make-directory* (path-only dest-config-file))
(call-with-output-file dest-config-file
#:exists 'truncate
(lambda (o)
(write table o)
(newline o)))))
(let* ([table orig]
[table
(if (equal? doc-search "")
table
(hash-set table 'doc-search-url doc-search))]
[table (if (equal? catalogs '(""))
table
(hash-set table 'catalogs
(for/list ([c (in-list catalogs)])
(if (equal? c "")
#f
c))))]
[table (if (equal? install-name "")
table
(hash-set table 'installation-name install-name))]
[table (hash-set table 'build-stamp build-stamp)])
(unless (equal? table orig)
(make-directory* (path-only dest-config-file))
(call-with-output-file dest-config-file
#:exists 'truncate
(lambda (o)
(write table o)
(newline o))))))

View File

@ -5,7 +5,7 @@
racket/system
compiler/find-exe
(only-in "config.rkt" extract-options)
"display-time.rkt")
distro-build/display-time)
(module test racket/base)

View File

@ -0,0 +1,33 @@
#lang racket/base
(require racket/cmdline
racket/file
racket/path
(only-in "config.rkt" extract-options)
"url-options.rkt"
distro-build/set-config)
(module test racket/base)
(define-values (dest-config-file config-file config-mode
install-name build-stamp
default-doc-search default-catalogs)
(command-line
#:args
(dest-config-file config-file config-mode
install-name build-stamp
doc-search . catalog)
(values dest-config-file config-file config-mode
install-name build-stamp
doc-search catalog)))
(define config (if (equal? config-file "")
(hash)
(extract-options config-file config-mode)))
(define doc-search (choose-doc-search config default-doc-search))
(define catalogs (choose-catalogs config default-catalogs))
(set-config dest-config-file
install-name build-stamp
doc-search catalogs)