dbh201
2022-10-13 87ddceedc6f9638042762585099cb6b22e1f9575
bass-o-matic: support job servers

3 files modified
16 ■■■■ changed files
Makefile 2 ●●● patch | view | raw | blame | history
components/Makefile 2 ●●● patch | view | raw | blame | history
tools/bass-o-matic 12 ●●●●● patch | view | raw | blame | history
Makefile
@@ -44,6 +44,6 @@
test component-hook unpack patch: $(SUBDIRS)
$(SUBDIRS):    FORCE
    @+echo "$(TARGET) $@" ; $(GMAKE) -C $@ $(TARGET)
    @+echo "$(TARGET) $@" ; $(GMAKE) -s -C $@ $(TARGET)
FORCE:
components/Makefile
@@ -180,7 +180,7 @@
endif
$(COMPONENT_DIRS.nosetup):    $(WS_LOGS) FORCE
    @cd $(@:%.nosetup=%) && echo "$(TARGET) $(@:%.nosetup=%)" && \
    @+cd $(@:%.nosetup=%) && echo "$(TARGET) $(@:%.nosetup=%)" && \
     $(BASS_O_MATIC) --make $(TARGET) $(LOG)
.PHONY:
tools/bass-o-matic
@@ -192,7 +192,17 @@
                        format='%(asctime)s %(name)-12s %(levelname)-8s %(message)s',)
    if make_arg:
        proc = subprocess.Popen(['gmake', '-s'] + [make_arg])
        MAKE=os.getenv("MAKE","gmake")
        # https://www.gnu.org/software/make/manual/html_node/POSIX-Jobserver.html
        JOBFLAGS=re.match('.* (--jobserver-auth=([0-9]+),([0-9]+)) ?.*',os.getenv("MAKEFLAGS",""))
        if JOBFLAGS:
            JOBFDS=( JOBFLAGS.group(2), JOBFLAGS.group(3) )
            JOBFLAGS=[JOBFLAGS.group(1)]
        else:
            JOBFDS=()
            JOBFLAGS=[]
        proc = subprocess.Popen([MAKE, '-s'] + [make_arg] + JOBFLAGS,pass_fds=JOBFDS)
        rc = proc.wait()
        sys.exit(rc)