Norm Jacobs
2010-09-19 79b849686f586ef87a8a89413e6cc7ba36b7ea9a
prepare for zone based component builds

--HG--
rename : tools/bass-o-matic.py => tools/bass-o-matic
rename : tools/fetch.py => tools/userland-fetch
rename : tools/unpack.py => tools/userland-unpack
3 files modified
3 files renamed
80 ■■■■ changed files
components/Makefile 41 ●●●●● patch | view | raw | blame | history
make-rules/prep.mk 4 ●●●● patch | view | raw | blame | history
make-rules/shared-macros.mk 14 ●●●●● patch | view | raw | blame | history
tools/bass-o-matic 21 ●●●●● patch | view | raw | blame | history
tools/userland-fetch patch | view | raw | blame | history
tools/userland-unpack patch | view | raw | blame | history
components/Makefile
@@ -31,9 +31,9 @@
# components.mk is auto-generated by the build tools.  It populates the
# COMPONENT_DIRS macro with a list of all directories in the workspace that
# contain a component.
components.mk:    Makefile # $(WS_TOP)/components
components.mk:    # Makefile # $(WS_TOP)/components
    @echo "Generating component list..."
    @$(TOOLS)/bass-o-matic.py --workspace=$(WS_TOP) --components=paths \
    @$(BASS_O_MATIC) --workspace=$(WS_TOP) --components=paths \
        | sed -e 's;^$(shell pwd)/;COMPONENT_DIRS += ;g' >$@
include components.mk
@@ -47,21 +47,22 @@
validate:    TARGET = validate
clean:        TARGET = clean
clobber:    TARGET = clobber
prep build install publish:        LOG = >$(WS_LOGS)/$(TARGET):$@.log 2>&1
prep build install publish:        TEMPLATE_ZONE=$(ZONE)
prep build install publish:        LOG = >$(WS_LOGS)/$@.$(TARGET).log 2>&1
.DEFAULT:    publish
.PARALLEL:    $(COMPONENT_DIRS)
download prep build install publish validate: $(COMPONENT_DIRS)
download prep build install publish validate: setup $(COMPONENT_DIRS)
COMPONENT_DIRS.nosetup =    $(COMPONENT_DIRS:%=%.nosetup)
clean clobber:    $(COMPONENT_DIRS)
ifeq ($(findstring file://, $(PKG_REPO)),file://)
    $(RM) -r $(PKG_REPO:file://%=%) $(WS_LOGS)
endif
    $(RM) components.mk depends.mk
clean:    $(COMPONENT_DIRS:%=%.nosetup)
    $(RM) components.mk depends.mk .profile
setup:    $(WS_LOGS) repo tools
clobber:    $(COMPONENT_DIRS:%=%.nosetup) clean
    $(RM) -r $(WS_REPO) $(WS_LOGS)
setup:    $(WS_LOGS) repo tools .profile
$(WS_LOGS):
    $(MKDIR) $@
@@ -73,13 +74,27 @@
tools:
    @cd ../tools ; echo "building tools..." ; $(GMAKE) setup
# $(WS_COMPONENTS) is the home directory for the zone user, so create a profile
# to pass a few things on to zone based builds
.profile:
    echo "PATH=$(PATH)" >>$@
    echo "WS_TOP=$(WS_TOP)" >>$@
    echo "export PATH WS_TOP" >>$@
$(COMPONENT_DIRS):    setup FORCE
    @cd $@ ; echo "$(TARGET) $@" ; $(GMAKE) $(TARGET) $(LOG)
    @cd $@ ; echo "$(TARGET) $@" ; \
     $(BASS_O_MATIC) $(TEMPLATE_ZONE:%=--template-zone %) \
              $(@:%=--component %) --make $(TARGET) $(LOG)
$(COMPONENT_DIRS.nosetup):    FORCE
    @cd $(@:%.nosetup=%) ; echo "$(TARGET) $(@:%.nosetup=%)" ; \
     $(BASS_O_MATIC) $(TEMPLATE_ZONE:%=--template-zone %) \
              $(@:%.nosetup=--component %) --make $(TARGET) $(LOG)
# depends.mk is auto-generated by the build tools, bass-o-matic.py in particular
depends.mk:    components.mk
    @echo "Generating component dependencies..."
    @$(TOOLS)/bass-o-matic.py --workspace=$(WS_TOP) --components=depend \
    @$(BASS_O_MATIC) --workspace=$(WS_TOP) --components=depend \
        | sed -e 's;$(shell pwd)/;;g' >$@
include depends.mk
make-rules/prep.mk
@@ -21,8 +21,8 @@
# Copyright (c) 2010, Oracle and/or it's affiliates.  All rights reserved.
#
UNPACK =    $(TOOLS)/unpack.py
FETCH =        $(TOOLS)/fetch.py
UNPACK =    $(WS_TOOLS)/userland-unpack
FETCH =        $(WS_TOOLS)/userland-fetch
ARCHIVES += $(COMPONENT_ARCHIVE)
CLEAN_PATHS += $(COMPONENT_SRC)
make-rules/shared-macros.mk
@@ -40,18 +40,22 @@
PYTHON_VERSION =    2.6
PYTHON_VERSIONS =    2.4 2.6
TOOLS =        $(WS_TOP)/tools
WS_LOGS =    $(WS_TOP)/logs
MAKE_RULES =    $(WS_TOP)/make-rules
WS_REPO =    $(WS_TOP)/repo
WS_TOOLS =    $(WS_TOP)/tools
WS_MAKE_RULES =    $(WS_TOP)/make-rules
WS_COMPONENTS =    $(WS_TOP)/components
PKG_REPO =    file://$(WS_TOP)/repo
BASS_O_MATIC =    $(WS_TOOLS)/bass-o-matic
PKG_REPO =    file:$(WS_REPO)
PROTO_DIR =    $(shell pwd)/$(COMPONENT_SRC)/installed-prototype-$(MACH)
# work around _TIME, _DATE, embedded date chatter in component builds
# to use, set TIME_CONSTANT in the component Makefile and add $(CONSTANT_TIME)
# to the appropriate {CONFIGURE|BUILD|INSTALL}_ENV
CONSTANT_TIME =        LD_PRELOAD_32=$(TOOLS)/time-$(MACH32).so
CONSTANT_TIME +=    LD_PRELOAD_64=$(TOOLS)/time-$(MACH64).so
CONSTANT_TIME =        LD_PRELOAD_32=$(WS_TOOLS)/time-$(MACH32).so
CONSTANT_TIME +=    LD_PRELOAD_64=$(WS_TOOLS)/time-$(MACH64).so
CONSTANT_TIME +=    TIME_CONSTANT=$(TIME_CONSTANT)
# set MACH from uname -p to either sparc or i386
tools/bass-o-matic
File was renamed from tools/bass-o-matic.py
@@ -30,6 +30,7 @@
import os
import sys
import re
import subprocess
# Locate SCM directories containing Userland components by searching from
# from a supplied top of tree for .p5m files.  Once a .p5m file is located,
@@ -80,7 +81,6 @@
        return result
    def run_make(self, path, targets):
        import subprocess
        result = list()
@@ -123,11 +123,15 @@
    components = {}
    debug=None
    components_arg=None
    make_arg=None
    component_arg=None
    template_zone=None
    workspace = os.getenv('WS_TOP')
    try:
        opts, args = getopt.getopt(sys.argv[1:], "w:c:d",
            [ "debug", "workspace=", "components=" ])
            [ "debug", "workspace=", "components=",
              "make", "component=", "template-zone=" ])
    except getopt.GetoptError, err:
        print str(err)
        usage()
@@ -137,6 +141,12 @@
            workspace = arg
        elif opt in [ "-l", "--components" ]:
            components_arg = arg
        elif opt in [ "--make" ]:
            make_arg = True
        elif opt in [ "--component" ]:
            component_arg = arg
        elif opt in [ "--template-zone" ]:
            template_zone = arg
        elif opt in [ "-d", "--debug" ]:
            debug = sys.stdout
        else:
@@ -144,6 +154,13 @@
    component_paths = FindComponentPaths(workspace, debug)
    if make_arg:
        if template_zone:
            print "using template zone %s to create a build environment for %s to run '%s'" % (template_zone, component_arg, ['gmake'] + args)
        proc = subprocess.Popen(['gmake'] + args)
    proc.wait()
        sys.exit(0)
    if components_arg:
        if components_arg in [ 'path', 'paths', 'dir', 'dirs', 'directories' ]:
            for path in component_paths:
tools/userland-fetch
tools/userland-unpack