Marcel Telka
2024-04-05 26ab531a0abac615aaedf17622ee2aa5e19c5114
tools/bass-o-matic
@@ -1,4 +1,4 @@
#!/usr/bin/python3.5
#!/usr/bin/python3.9
#
# CDDL HEADER START
#
@@ -42,7 +42,7 @@
except ImportError:
    from os import walk
from bass.component import BassComponent
from bass.component import Component
logger = logging.getLogger('bass-o-matic')
@@ -118,7 +118,7 @@
            # Only 'openindiana' category.
            category = line.split('/')[0]
            if category is 'openindiana':
            if category == 'openindiana':
                continue
            filename = os.path.basename(line)
@@ -131,10 +131,10 @@
        # Add meta-packages/history only if we build the main repository, where
        # subdir is equal to 'components'.
        if subdir is 'components':
        if subdir == 'components':
            paths.append('meta-packages/history')
        # Add encumbered/meta-packages/history only if we build the encumbered repository
        if subdir is 'components/encumbered':
        if subdir == 'components/encumbered':
            paths.append('encumbered/meta-packages/history')
        paths = list(set(paths))
@@ -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)
@@ -204,7 +214,7 @@
        component_pkg5 = os.path.join( os.getcwd(), 'pkg5')
        if os.path.isfile(component_pkg5):
            os.remove(component_pkg5)
        BassComponent(FindComponentPaths(path=workspace, debug=debug, subdir=os.path.join(subdir, component_path))[0])
        Component(FindComponentPaths(path=workspace, debug=debug, subdir=os.path.join(subdir, component_path))[0])
        sys.exit(0)
    incremental = False
@@ -224,7 +234,7 @@
        elif components_arg in COMPONENTS_ALLOWED_FMRIS:
            pool = multiprocessing.Pool(processes=multiprocessing.cpu_count())
            components = pool.map(BassComponent, component_paths)
            components = pool.map(Component, component_paths)
            for component in components:
                for fmri in component.supplied_packages:
@@ -234,7 +244,7 @@
            dependencies = {}
            pool = multiprocessing.Pool(processes=multiprocessing.cpu_count())
            components = pool.map(BassComponent, component_paths)
            components = pool.map(Component, component_paths)
            with open(os.path.join(workspace, subdir, 'mapping.json'), "r") as f:
                     data = json.loads(f.read())