| | |
| | | #!/usr/bin/python3.5 |
| | | #!/usr/bin/python3.9 |
| | | # |
| | | # CDDL HEADER START |
| | | # |
| | |
| | | except ImportError: |
| | | from os import walk |
| | | |
| | | from bass.component import BassComponent |
| | | from bass.component import Component |
| | | |
| | | logger = logging.getLogger('bass-o-matic') |
| | | |
| | |
| | | dirname = os.path.dirname(line).rsplit(subdir + '/')[-1] |
| | | |
| | | if filename == 'Makefile': |
| | | if glob.glob(os.path.join(workspace_path, dirname, '*.p5m')): |
| | | if glob.glob(os.path.join(workspace_path, dirname, '*.p5m')) and \ |
| | | not os.path.isfile(os.path.join(workspace_path, dirname, 'pkg5.ignore')): |
| | | paths.append(dirname) |
| | | |
| | | # Some components are using SCM checkout as a source code download method and |
| | |
| | | |
| | | # Only 'openindiana' category. |
| | | category = line.split('/')[0] |
| | | if category is 'openindiana': |
| | | if category == 'openindiana': |
| | | continue |
| | | |
| | | filename = os.path.basename(line) |
| | | dirname = os.path.dirname(line) |
| | | |
| | | if filename == 'Makefile': |
| | | if glob.glob(os.path.join(workspace_path, dirname, '*.p5m')): |
| | | if glob.glob(os.path.join(workspace_path, dirname, '*.p5m')) and \ |
| | | not os.path.isfile(os.path.join(workspace_path, dirname, 'pkg5.ignore')): |
| | | paths.append(os.path.dirname(line)) |
| | | |
| | | # 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)) |
| | |
| | | for dirpath, dirnames, filenames in walk(workspace_path): |
| | | for name in filenames: |
| | | if expression.match(name): |
| | | if debug: |
| | | logger.debug('found %s', dirpath) |
| | | paths.append(dirpath) |
| | | if not os.path.isfile(os.path.join( dirpath, 'pkg5.ignore')): |
| | | if debug: |
| | | logger.debug('found %s', dirpath) |
| | | paths.append(dirpath) |
| | | del dirnames[:] |
| | | break |
| | | |
| | |
| | | format='%(asctime)s %(name)-12s %(levelname)-8s %(message)s',) |
| | | |
| | | if make_arg: |
| | | proc = subprocess.Popen(['gmake'] + [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) |
| | | |
| | | if pkg5_arg: |
| | | component_path = os.getcwd().split(os.path.join(workspace, subdir))[-1].replace('/', '', 1) |
| | | # the component may not be built directly but as a dependency of another component |
| | | if os.path.isfile(os.path.join( os.getcwd(), 'pkg5.ignore')): |
| | | sys.exit(0) |
| | | 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 |
| | |
| | | |
| | | 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: |
| | |
| | | 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()) |
| | |
| | | component_path[entry['fmri']] = entry['path'] |
| | | |
| | | for component in components: |
| | | for fmri in component.supplied_packages: |
| | | paths = set([component_path[i] for i in component.required_packages]) |
| | | dependencies[fmri] = list(paths) |
| | | selfpath = component.path.split(os.path.join(workspace, subdir))[-1].replace('/', '', 1) |
| | | # Some packages from OpenSolaris only exist in binary form in the pkg repository |
| | | paths = set([component_path.get(i, "https://pkg.openindiana.org/hipster") for i in component.required_packages]) |
| | | # Remove self from the set of paths it depends on |
| | | paths.discard(selfpath) |
| | | dependencies[selfpath] = sorted(list(paths)) |
| | | |
| | | dependencies_file = os.path.join(workspace, subdir, 'dependencies.json') |
| | | with open(dependencies_file, 'w') as f: |