Makefile: refine support for building an installer from a site

This commit is contained in:
Matthew Flatt 2014-03-10 16:57:16 -06:00
parent 99f124e82d
commit 1260dd6b2e
4 changed files with 103 additions and 26 deletions

View File

@ -205,7 +205,7 @@ that act as client machines.
See See
pkgs/distro-build/doc.txt pkgs/distro-build-pkgs/distro-build-client/doc.txt
for a description of the site-configuration module and requirements on for a description of the site-configuration module and requirements on
client hosts. client hosts.
@ -224,7 +224,9 @@ configuration file there and omit the `CONFIG' argument to
`make'. Supply `CONFIG_MODE=...' to pass a configuration mode on to `make'. Supply `CONFIG_MODE=...' to pass a configuration mode on to
your site-configuration module (accessible via the `current-mode' your site-configuration module (accessible via the `current-mode'
parameter). Supply `CLEAN_MODE=--clean' to make the default `#:clean?' parameter). Supply `CLEAN_MODE=--clean' to make the default `#:clean?'
configuration for a client #t instead of #f. configuration for a client #t instead of #f, and supply
`RELEASE_MODE=--release' to make thde default `#:release?'
configuration #t.
A configuration file can specify the packages to include, host address A configuration file can specify the packages to include, host address
of the server, distribution name, installer directory, and of the server, distribution name, installer directory, and
@ -354,15 +356,20 @@ Roughly, the steps are
Add `DIST_DESC="..."' to the `client' line to set the installer's Add `DIST_DESC="..."' to the `client' line to set the installer's
description, which is used as a key in the generated table of description, which is used as a key in the generated table of
installer files. uploaded installer files (when UPLOAD is set).
Add `DIST_CATALOGS_q='...'' to the `client' line to declare a Add `DIST_CATALOGS_q='...'' to the `client' line to declare a
space-separated sequence of catalog URLs to set an installation's space-separated sequence of catalog URLs to set an installation's
initial package catalog URLs. Use the empty string in place of a initial package catalog URLs. Use the empty string in place of a
URL to indicate that the default path should be spliced. URL to indicate that the default path should be spliced.
Add `README="..."' to specify a file to download from the server Add `README="..."' to specify a URL for a file to use as the
to use as the "README" file in the generated installer. "README" file in the generated installer, or leave as empty for no
"README".
Add `UPLOAD="..."` to specify a URL to use as an upload
destination for the created installed, where the installer's name
is added to the end of the URL, or leave as empty for no upload.
In more detail: In more detail:
@ -397,7 +404,7 @@ In more detail:
The server provides README files from the "build/readmes" The server provides README files from the "build/readmes"
directory. If "README.txt" does not exist when the sever is directory. If "README.txt" does not exist when the sever is
started, when a default file is created (and clients download started, a default file is created (and clients download
"README.txt" by default). "README.txt" by default).
If you stop the server and want to restart it, use the If you stop the server and want to restart it, use the
@ -470,6 +477,19 @@ In more detail:
`make'. The `README' value is used as a file name to download `make'. The `README' value is used as a file name to download
from the server. from the server.
For a Mac OS X installer, set `SIGN_IDENTITY' to sign the
installer, where the value of `SIGN_IDENTITY' is the name to
which the signing certificate is associated. Set `MAC_PKG_MODE'
to "--mac-pkg" to create a ".pkg" installer instead of a ".dmg"
image.
The `SERVER_CATALOG_PATH' and `SERVER_COLLECTS_PATH' makefile
variables specify paths at `SERVER' plus `SERVER_PORT' to access
the package catalog and pre-built "collects" tree needed for a
client, but those paths should be empty for a server started with
`make server', and they are used mainly by `make
client-from-site' (described below).
On each client, step 2b produces a "bundle/installer.txt" file that On each client, step 2b produces a "bundle/installer.txt" file that
contains the path to the generated installer on one line, followed by contains the path to the generated installer on one line, followed by
the description on a second line. The installer is also uploaded to the description on a second line. The installer is also uploaded to
@ -480,3 +500,23 @@ its filename in "build/installers/table.rktd".
If you provide `JOB_OPTIONS=...' for either a client or server build, If you provide `JOB_OPTIONS=...' for either a client or server build,
the options are used both for `raco setup' and `raco pkg the options are used both for `raco setup' and `raco pkg
install'. Normally, `JOB_OPTIONS' is used to control parallelism. install'. Normally, `JOB_OPTIONS' is used to control parallelism.
Creating a Client from an Installer Web Site
--------------------------------------------
If you (or someone else) previously created an installer site with
`make site', then `make client-from-site` in a clean repository
creates an installer for the current platform drawing packages
from the site.
At a minimum, provide `SERVER', `SERVER_PORT' (usually 80), and
`SITE_PATH' (if not empty, include a trailing "/") makefile variables
to access a site at
http://$(SERVER):$(SERVER_PORT)/$(SITE_PATH)
The `client-from-site' makefile target chains to `make client' while
passing suitable values for `DIST_CATALOGS_q`, `DOC_SEARCH`,
`SERVER_CATALOG_PATH', and `SERVER_COLLECTS_PATH'. Supply any other
suitable variables, such as `DIST_NAME' or `RELEASE_MODE', the same as
for `make client'.

View File

@ -120,6 +120,11 @@ DOC_SEARCH =
SERVER = localhost SERVER = localhost
SERVER_PORT = 9440 SERVER_PORT = 9440
# Paths on the server to reach catalog content and "collects.tgz",
# if not the root:
SERVER_CATALOG_PATH =
SERVER_COLLECTS_PATH =
# Set `SERVER_HOSTS` to a comma-delimited set of server addresses # Set `SERVER_HOSTS` to a comma-delimited set of server addresses
# that determine the interfaces on which the server listens; the # that determine the interfaces on which the server listens; the
# default, "localhost", listens only on the loopback device, while # default, "localhost", listens only on the loopback device, while
@ -151,7 +156,7 @@ DIST_DIR = racket
# a variant of an OS: # a variant of an OS:
DIST_SUFFIX = DIST_SUFFIX =
# A human-readable description (spaces allowed) of the generated # A human-readable description (spaces allowed) of the generated
# installer, usually describing a platform: # installer, usually describing a platform, used for upload:
DIST_DESC = DIST_DESC =
# Package catalog URLs (individually quoted as needed, separated by # Package catalog URLs (individually quoted as needed, separated by
@ -172,8 +177,14 @@ INSTALL_NAME =
# installer: # installer:
SIGN_IDENTITY = SIGN_IDENTITY =
# A README file to download from the server for the client: # URL for a README file to include in an installer (empty for none,
README = README.txt # spaces allowed):
README = http://$(SVR_PRT)/README.txt
# URL destination to upload an installer file after it is created
# (empty for no upload, spaces allowed); the file name is added to the
# end of the URL, and DIST_DESC is passed as a "Description:" header:
UPLOAD =
# Configuration module that describes a build, normally implemented # Configuration module that describes a build, normally implemented
# with `#lang distro-build/config': # with `#lang distro-build/config':
@ -210,6 +221,8 @@ DISTBLD = pkgs/distro-build-pkgs/distro-build-server
SVR_PRT = $(SERVER):$(SERVER_PORT) SVR_PRT = $(SERVER):$(SERVER_PORT)
SVR_CAT = http://$(SVR_PRT)/$(SERVER_CATALOG_PATH)
# Helper macros: # Helper macros:
USER_CONFIG = -G build/user/config -A build/user USER_CONFIG = -G build/user/config -A build/user
RACKET = racket/bin/racket $(USER_CONFIG) RACKET = racket/bin/racket $(USER_CONFIG)
@ -220,8 +233,8 @@ X_AUTO_OPTIONS = --skip-installed --deps search-auto --pkgs $(JOB_OPTIONS)
USER_AUTO_OPTIONS = --scope user $(X_AUTO_OPTIONS) USER_AUTO_OPTIONS = --scope user $(X_AUTO_OPTIONS)
LOCAL_USER_AUTO = --catalog build/local/catalog $(USER_AUTO_OPTIONS) LOCAL_USER_AUTO = --catalog build/local/catalog $(USER_AUTO_OPTIONS)
SOURCE_USER_AUTO_q = --catalog "$(SRC_CATALOG)" $(USER_AUTO_OPTIONS) SOURCE_USER_AUTO_q = --catalog "$(SRC_CATALOG)" $(USER_AUTO_OPTIONS)
REMOTE_USER_AUTO = --catalog http://$(SVR_PRT)/ $(USER_AUTO_OPTIONS) REMOTE_USER_AUTO = --catalog $(SVR_CAT) $(USER_AUTO_OPTIONS)
REMOTE_INST_AUTO = --catalog http://$(SVR_PRT)/ --scope installation $(X_AUTO_OPTIONS) REMOTE_INST_AUTO = --catalog $(SVR_CAT) --scope installation $(X_AUTO_OPTIONS)
CONFIG_MODE_q = "$(CONFIG)" "$(CONFIG_MODE)" CONFIG_MODE_q = "$(CONFIG)" "$(CONFIG_MODE)"
BUNDLE_CONFIG = bundle/racket/etc/config.rktd BUNDLE_CONFIG = bundle/racket/etc/config.rktd
BUNDLE_RACO_FLAGS = -A bundle/user -l raco BUNDLE_RACO_FLAGS = -A bundle/user -l raco
@ -382,25 +395,30 @@ binary-catalog-server:
# keep the "build/user" directory on the grounds that the # keep the "build/user" directory on the grounds that the
# client is the same as the server. # client is the same as the server.
COPY_ARGS = SERVER=$(SERVER) SERVER_PORT=$(SERVER_PORT) SERVER_HOSTS="$(SERVER_HOSTS)" \ PROP_ARGS = SERVER=$(SERVER) SERVER_PORT=$(SERVER_PORT) SERVER_HOSTS="$(SERVER_HOSTS)" \
PKGS="$(PKGS)" BUILD_STAMP="$(BUILD_STAMP)" \ PKGS="$(PKGS)" BUILD_STAMP="$(BUILD_STAMP)" \
RELEASE_MODE=$(RELEASE_MODE) SOURCE_MODE=$(SOURCE_MODE) MAC_PKG_MODE=$(MAC_PKG_MODE) \ RELEASE_MODE=$(RELEASE_MODE) SOURCE_MODE=$(SOURCE_MODE) MAC_PKG_MODE=$(MAC_PKG_MODE) \
PKG_SOURCE_MODE="$(PKG_SOURCE_MODE)" INSTALL_NAME="$(INSTALL_NAME)"\ PKG_SOURCE_MODE="$(PKG_SOURCE_MODE)" INSTALL_NAME="$(INSTALL_NAME)"\
DIST_NAME="$(DIST_NAME)" DIST_BASE=$(DIST_BASE) \ DIST_NAME="$(DIST_NAME)" DIST_BASE=$(DIST_BASE) \
DIST_DIR=$(DIST_DIR) DIST_SUFFIX=$(DIST_SUFFIX) \ DIST_DIR=$(DIST_DIR) DIST_SUFFIX=$(DIST_SUFFIX) UPLOAD="$(UPLOAD)" \
DIST_DESC="$(DIST_DESC)" README="$(README)" SIGN_IDENTITY="$(SIGN_IDENTITY)"\ DIST_DESC="$(DIST_DESC)" README="$(README)" SIGN_IDENTITY="$(SIGN_IDENTITY)"\
JOB_OPTIONS="$(JOB_OPTIONS)" JOB_OPTIONS="$(JOB_OPTIONS)"
COPY_ARGS = $(PROP_ARGS) \
SERVER_CATALOG_PATH=$(SERVER_CATALOG_PATH) SERVER_COLLECTS_PATH=$(SERVER_COLLECTS_PATH)
# 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)
client: client:
if [ ! -d build/log ] ; then rm -rf build/user ; fi if [ ! -d build/log ] ; then rm -rf build/user ; fi
$(MAKE) base $(COPY_ARGS) $(MAKE) base $(COPY_ARGS)
$(MAKE) distro-build-from-server $(COPY_ARGS) $(MAKE) distro-build-from-server $(COPY_ARGS)
$(MAKE) bundle-from-server $(COPY_ARGS) $(MAKE) bundle-from-server $(COPY_ARGS)
$(MAKE) bundle-config $(COPY_ARGS) $(RACKET) -l distro-build/set-config $(SET_BUNDLE_CONFIG_q)
$(MAKE) installer-from-bundle $(COPY_ARGS) $(MAKE) installer-from-bundle $(COPY_ARGS)
SET_BUNDLE_CONFIG_q = $(BUNDLE_CONFIG) "" "" "$(INSTALL_NAME)" "$(BUILD_STAMP)" "$(DOC_SEARCH)" $(DIST_CATALOGS_q)
win32-client: win32-client:
IF EXIST build\user cmd /c rmdir /S /Q build\user IF EXIST build\user cmd /c rmdir /S /Q build\user
$(MAKE) win32-base $(COPY_ARGS) $(MAKE) win32-base $(COPY_ARGS)
@ -425,15 +443,12 @@ bundle-from-server:
rm -rf bundle rm -rf bundle
mkdir -p bundle/racket mkdir -p bundle/racket
$(RACKET) -l setup/unixstyle-install bundle racket bundle/racket $(RACKET) -l setup/unixstyle-install bundle racket bundle/racket
$(RACKET) -l distro-build/unpack-collects http://$(SVR_PRT)/ $(RACKET) -l distro-build/unpack-collects http://$(SVR_PRT)/$(SERVER_COLLECTS_PATH)
$(BUNDLE_RACO) pkg install $(REMOTE_INST_AUTO) $(PKG_SOURCE_MODE) $(REQUIRED_PKGS) $(BUNDLE_RACO) pkg install $(REMOTE_INST_AUTO) $(PKG_SOURCE_MODE) $(REQUIRED_PKGS)
$(BUNDLE_RACO) pkg install $(REMOTE_INST_AUTO) $(PKG_SOURCE_MODE) $(PKGS) $(BUNDLE_RACO) pkg install $(REMOTE_INST_AUTO) $(PKG_SOURCE_MODE) $(PKGS)
$(RACKET) -l setup/unixstyle-install post-adjust "$(SOURCE_MODE)" "$(PKG_SOURCE_MODE)" racket bundle/racket $(RACKET) -l setup/unixstyle-install post-adjust "$(SOURCE_MODE)" "$(PKG_SOURCE_MODE)" racket bundle/racket
bundle-config: UPLOAD_q = --readme "$(README)" --upload "$(UPLOAD)" --desc "$(DIST_DESC)"
$(RACKET) -l distro-build/set-config $(SET_BUNDLE_CONFIG_q)
UPLOAD_q = --readme http://$(SVR_PRT)/$(README) --upload http://$(SVR_PRT)/ --desc "$(DIST_DESC)"
DIST_ARGS_q = $(UPLOAD_q) $(RELEASE_MODE) $(SOURCE_MODE) $(MAC_PKG_MODE) \ DIST_ARGS_q = $(UPLOAD_q) $(RELEASE_MODE) $(SOURCE_MODE) $(MAC_PKG_MODE) \
"$(DIST_NAME)" $(DIST_BASE) $(DIST_DIR) "$(DIST_SUFFIX)" \ "$(DIST_NAME)" $(DIST_BASE) $(DIST_DIR) "$(DIST_SUFFIX)" \
"$(SIGN_IDENTITY)" "$(SIGN_IDENTITY)"
@ -455,13 +470,32 @@ win32-bundle:
win32-bundle-from-server: win32-bundle-from-server:
$(MAKE) win32-bundle $(COPY_ARGS) $(MAKE) win32-bundle $(COPY_ARGS)
$(WIN32_RACKET) -l distro-build/unpack-collects http://$(SVR_PRT)/ $(WIN32_RACKET) -l distro-build/unpack-collects http://$(SVR_PRT)/$(SERVER_COLLECTS_PATH)
$(WIN32_BUNDLE_RACO) pkg install $(REMOTE_INST_AUTO) $(PKG_SOURCE_MODE) $(REQUIRED_PKGS) $(WIN32_BUNDLE_RACO) pkg install $(REMOTE_INST_AUTO) $(PKG_SOURCE_MODE) $(REQUIRED_PKGS)
$(WIN32_BUNDLE_RACO) pkg install $(REMOTE_INST_AUTO) $(PKG_SOURCE_MODE) $(PKGS) $(WIN32_BUNDLE_RACO) pkg install $(REMOTE_INST_AUTO) $(PKG_SOURCE_MODE) $(PKGS)
win32-installer-from-bundle: win32-installer-from-bundle:
$(WIN32_RACKET) -l- distro-build/installer $(DIST_ARGS_q) $(WIN32_RACKET) -l- distro-build/installer $(DIST_ARGS_q)
# ------------------------------------------------------------
# On a supported platform (for an installer build) after a `make site'
# has completed; SERVER, SERVER_PORT (usually 80), and SITE_PATH
# should be set, and other configurations are propagated; normally,
# README should be set (possibly to empty), because a site doesn't
# provide a generic "README.txt".
# Relative path on server for the site; include a trailing "/"
# if non-empty:
SITE_PATH =
FROM_SITE_ARGS = SERVER_CATALOG_PATH=$(SITE_PATH)catalog/ SERVER_COLLECTS_PATH=$(SITE_PATH)origin/ \
DIST_CATALOGS_q='http://$(SERVER):$(SERVER_PORT)/$(SITE_PATH)catalog/ ""' \
DOC_SEARCH="http://$(SERVER):$(SERVER_PORT)/$(SITE_PATH)doc/local-redirect/index.html" \
$(PROP_ARGS)
client-from-site:
make client $(FROM_SITE_ARGS)
# ------------------------------------------------------------ # ------------------------------------------------------------
# Drive installer build across server and clients: # Drive installer build across server and clients:

View File

@ -30,11 +30,13 @@
[("--mac-pkg") "Create a \".pkg\" installer on Mac OS X" [("--mac-pkg") "Create a \".pkg\" installer on Mac OS X"
(set! mac-pkg? #t)] (set! mac-pkg? #t)]
[("--upload") url "Upload installer" [("--upload") url "Upload installer"
(set! upload-to url)] (unless (string=? url "")
(set! upload-to url))]
[("--desc") desc "Description to accompany upload" [("--desc") desc "Description to accompany upload"
(set! upload-desc desc)] (set! upload-desc desc)]
[("--readme") readme "URL for README.txt to include" [("--readme") readme "URL for README.txt to include"
(set! download-readme readme)] (unless (string=? readme "")
(set! download-readme readme))]
#:args #:args
(human-name base-name dir-name dist-suffix sign-identity) (human-name base-name dir-name dist-suffix sign-identity)
(values human-name (values human-name
@ -81,7 +83,7 @@
(printf "Upload ~a to ~a\n" installer-file upload-to) (printf "Upload ~a to ~a\n" installer-file upload-to)
(define i (define i
(put-pure-port (put-pure-port
(string->url (format "~aupload/~a" (string->url (format "~a~a"
upload-to upload-to
(path->string (file-name-from-path installer-file)))) (path->string (file-name-from-path installer-file))))
(file->bytes installer-file) (file->bytes installer-file)

View File

@ -338,7 +338,8 @@
(q "--source --no-setup") (q "--source --no-setup")
(q "")) (q ""))
" MAC_PKG_MODE=" (if mac-pkg? "--mac-pkg" (q "")) " MAC_PKG_MODE=" (if mac-pkg? "--mac-pkg" (q ""))
" README=" (q (file-name-from-path readme)))) " UPLOAD=http://" server ":" server-port "/upload/"
" README=http://" server ":" server-port "/" (q (file-name-from-path readme))))
(define (unix-build c platform host port user server server-port repo clean? pull? readme) (define (unix-build c platform host port user server server-port repo clean? pull? readme)
(define dir (get-path-opt c '#:dir "build/plt" #:localhost (current-directory))) (define dir (get-path-opt c '#:dir "build/plt" #:localhost (current-directory)))