예제 #1
0
파일: repo.py 프로젝트: philwyettreb/antbs
    def _add_or_remove_package_alpm_database(self,
                                             action,
                                             pkgname=None,
                                             pkg_fname=None):
        action = 'repo-{}'.format(action)
        cmd = [os.path.join(SCRIPTS_DIR, action)]
        pkg_or_file = pkgname if 'remove' in action else pkg_fname

        if 'add' in action:
            cmd.append('-R')

        cmd.extend([self.alpm_db, pkg_or_file])
        logger.debug(cmd)

        success, res = try_run_command(cmd, self.path)
        lock_not_aquired = 'Failed to acquire lockfile'
        waiting = 0

        if not success and lock_not_aquired in res:
            logger.warning(res)
            while not success and lock_not_aquired in res:
                waiting += 10
                gevent.sleep(10)
                success, res = try_run_command(cmd, self.path)

                if waiting > 300:
                    logger.error('repo-add script timed out!')
                    break

        if not success:
            logger.error(
                '%s command on alpm database failed for %s! Output was: %s',
                action, pkg_fname, res)
예제 #2
0
파일: repo.py 프로젝트: Antergos/antbs
    def _add_or_remove_package_alpm_database(self, action, pkgname=None, pkg_fname=None):
        action = 'repo-{}'.format(action)
        cmd = [os.path.join(SCRIPTS_DIR, action)]
        pkg_or_file = pkgname if 'remove' in action else pkg_fname

        if 'add' in action:
            cmd.append('-R')

        cmd.extend([self.alpm_db, pkg_or_file])
        logger.debug(cmd)

        success, res = try_run_command(cmd, self.path)
        lock_not_aquired = 'Failed to acquire lockfile'
        waiting = 0

        if not success and lock_not_aquired in res:
            logger.warning(res)
            while not success and lock_not_aquired in res:
                waiting += 10
                gevent.sleep(10)
                success, res = try_run_command(cmd, self.path)

                if waiting > 300:
                    logger.error('repo-add script timed out!')
                    break

        logger.debug(res)

        if not success:
            logger.error(
                '%s command on alpm database failed for %s! Output was: %s',
                action,
                pkg_fname,
                res
            )
예제 #3
0
def get():
    comm_val = chpl_comm.get()
    if comm_val == 'ofi':
        libfabric_val = overrides.get('CHPL_LIBFABRIC')
        platform_val = chpl_platform.get('target')
        if not libfabric_val:
            cmd_exists, returncode = try_run_command(
                ['pkg-config', '--exists', 'libfabric'])[0:2]
            if cmd_exists and returncode == 0:
                libfabric_val = 'system'
            else:
                libfabric_val = 'bundled'
        if libfabric_val == 'none':
            error("CHPL_LIBFABRIC must not be 'none' when CHPL_COMM is ofi")
        if platform_val == 'hpe-cray-ex' and libfabric_val != 'system':
            sys.stderr.write('Warning: CHPL_LIBFABRIC!=system is discouraged '
                             'on HPE Cray EX\n')
    else:
        libfabric_val = 'none'

    if libfabric_val == 'libfabric':
        sys.stderr.write("Warning: CHPL_LIBFABRIC=libfabric is deprecated. "
                         "Use CHPL_LIBFABRIC=bundled instead.\n")
        libfabric_val = 'bundled'

    return libfabric_val
예제 #4
0
def get_homebrew_prefix():
    # Check to see if Homebrew is installed. If it is, return the prefix.
    exists, retcode, my_out, my_err = try_run_command(['brew', '--prefix'])
    if exists and retcode == 0:
        # Make sure to include homebrew search path
        homebrew_prefix = my_out.strip()
        return homebrew_prefix

    return None
예제 #5
0
def get_cuda_path():
    chpl_cuda_path = os.environ.get("CHPL_CUDA_PATH")
    if chpl_cuda_path:
        return chpl_cuda_path

    exists, returncode, my_stdout, my_stderr = utils.try_run_command(["which",
                                                                      "nvcc"])

    if exists and returncode == 0:
        chpl_cuda_path = "/".join(my_stdout.strip().split("/")[:-2])
        return chpl_cuda_path
    else:
        return ""
예제 #6
0
def check_llvm_config(llvm_config):
    if llvm_config == 'none':
        return (0, "no llvm-config detected")

    got_version = 0
    version_ok = False
    llvm_header = ''
    llvm_include_ok = False
    clang_header = ''
    clang_include_ok = False
    exists, returncode, my_stdout, my_stderr = try_run_command(
        [llvm_config, '--version'])
    if exists and returncode == 0:
        version_string = my_stdout.strip()
        got_version = version_string.split('.')[0]
        version_ok = got_version in llvm_versions()
    else:
        s = "could not run llvm-config at {0}".format(llvm_config)
        return (0, s)

    include_dir = run_command([llvm_config, '--includedir']).strip()
    if os.path.isdir(include_dir):
        llvm_header = os.path.join(include_dir, 'llvm', 'Config',
                                   'llvm-config.h')
        llvm_include_ok = os.path.exists(llvm_header)
        clang_header = os.path.join(include_dir, 'clang', 'Basic', 'Version.h')
        clang_include_ok = os.path.exists(clang_header)

    s = ''
    if not version_ok:
        s = ("LLVM version {0} is not one of the supported versions: {1}".
             format(got_version, llvm_versions_string()))
        return (got_version, s)

    if not llvm_include_ok:
        s = "Could not find the LLVM header {0}".format(llvm_header)
        s += "\nPerhaps you need to install clang and llvm dev packages"
        return (got_version, s)
    elif not clang_include_ok:
        s = "Could not find the clang header {0}".format(clang_header)
        s += "\nPerhaps you need to install clang and llvm dev packages"
        return (got_version, s)

    return (got_version, '')
예제 #7
0
    def move_files_to_staging_repo(bld_obj):
        file_count = len(bld_obj.generated_files)
        files_exist = bld_obj.generated_files and all_file_paths_exist(bld_obj.generated_files)

        if not files_exist or not (file_count % 2 == 0):
            logger.error(
                'Unable to move files to staging repo! files_exist is: %s file_count is: %s',
                files_exist,
                file_count
            )

        for pkg_file in bld_obj.generated_files:
            if 'i686' in pkg_file:
                continue

            fname = os.path.basename(pkg_file)
            staging_file = os.path.join(status.STAGING_64, fname)

            copy_or_symlink(pkg_file, status.STAGING_64, logger)
            bld_obj.staging_files.append(staging_file)

            if '-any.pkg' in pkg_file:
                src = os.path.basename(pkg_file)
                dst = '../i686/{}'.format(fname)

                success, res = try_run_command(
                    ['/bin/ln', '-srf', src, dst],
                    cwd=status.STAGING_64,
                    logger=logger
                )
                if not success:
                    logger.error(res)

        for pkg_file in bld_obj.generated_files:
            if 'x86_64' in pkg_file or '-any.pkg' in pkg_file:
                continue

            fname = os.path.basename(pkg_file)
            staging_file = os.path.join(status.STAGING_32, fname)

            copy_or_symlink(pkg_file, status.STAGING_32, logger)
            bld_obj.staging_files.append(staging_file)
예제 #8
0
def get():
    comm_val = chpl_comm.get()
    if comm_val == 'ofi':
        libfabric_val = overrides.get('CHPL_LIBFABRIC')
        platform_val = chpl_platform.get('target')
        if not libfabric_val:
            cmd_exists, returncode = try_run_command(
                ['pkg-config', '--exists', 'libfabric'])[0:2]
            if cmd_exists and returncode == 0:
                libfabric_val = 'system'
            else:
                libfabric_val = 'bundled'
        if libfabric_val == 'none':
            error("CHPL_LIBFABRIC must not be 'none' when CHPL_COMM is ofi")
        if platform_val == 'hpe-cray-ex' and libfabric_val != 'system':
            warning('CHPL_LIBFABRIC!=system is discouraged on HPE Cray EX')
    else:
        libfabric_val = 'none'

    return libfabric_val
예제 #9
0
def gather_pe_chpl_pkgconfig_libs():
    # Don't do anything if we aren't using a PrgEnv compiler
    if chpl_compiler.get_prgenv_compiler() == 'none':
        return ""

    import chpl_comm, chpl_comm_substrate, chpl_aux_filesys, chpl_libfabric

    platform = chpl_platform.get('target')
    comm = chpl_comm.get()
    substrate = chpl_comm_substrate.get()
    auxfs = chpl_aux_filesys.get()

    ret = os.environ.get('PE_CHAPEL_PKGCONFIG_LIBS', '')
    if comm != 'none':
        if platform != 'hpe-cray-ex':
            # Adding -lhugetlbfs gets the PrgEnv driver to add the appropriate
            # linker option for static linking with it. While it's not always
            # used with Chapel programs, it is expected to be the common case
            # when running on a Cray X*, so just always linking it is ok.
            # (We don't add it for HPE Cray EX systems, where it's not needed.)
            ret = 'craype-hugetlbfs:cray-pmi:' + ret

        if platform.startswith('cray-x'):
            ret = 'cray-ugni:' + ret

        if comm == 'gasnet' and substrate == 'aries':
            ret = 'cray-udreg:' + ret

        if comm == 'ofi' and chpl_libfabric.get() == 'system':
            ret = 'libfabric:' + ret

        # on login/compute nodes, lustre requires the devel api to make
        # lustre/lustreapi.h available (it's implicitly available on esl nodes)
        if 'lustre' in auxfs:
            exists, returncode, out, err = try_run_command(
                ['pkg-config', '--exists', 'cray-lustre-api-devel'])
            if exists and returncode == 0:
                ret = 'cray-lustre-api-devel:' + ret

    return ret
예제 #10
0
    def move_files_to_staging_repo(bld_obj):
        file_count = len(bld_obj.generated_files)
        files_exist = bld_obj.generated_files and all_file_paths_exist(
            bld_obj.generated_files)

        if not files_exist or not (file_count % 2 == 0):
            logger.error(
                'Unable to move files to staging repo! files_exist is: %s file_count is: %s',
                files_exist, file_count)

        for pkg_file in bld_obj.generated_files:
            if 'i686' in pkg_file:
                continue

            fname = os.path.basename(pkg_file)
            staging_file = os.path.join(status.STAGING_64, fname)

            copy_or_symlink(pkg_file, status.STAGING_64, logger)
            bld_obj.staging_files.append(staging_file)

            if '-any.pkg' in pkg_file:
                src = os.path.basename(pkg_file)
                dst = '../i686/{}'.format(fname)

                success, res = try_run_command(['/bin/ln', '-srf', src, dst],
                                               cwd=status.STAGING_64,
                                               logger=logger)
                if not success:
                    logger.error(res)

        for pkg_file in bld_obj.generated_files:
            if 'x86_64' in pkg_file or '-any.pkg' in pkg_file:
                continue

            fname = os.path.basename(pkg_file)
            staging_file = os.path.join(status.STAGING_32, fname)

            copy_or_symlink(pkg_file, status.STAGING_32, logger)
            bld_obj.staging_files.append(staging_file)
예제 #11
0
def check_llvm_config(llvm_config):
    if llvm_config == 'none':
        return (0, "no llvm-config detected")

    got_version = 0
    version_ok = False

    exists, returncode, my_stdout, my_stderr = try_run_command([llvm_config,
                                                                '--version'])
    s = ''
    if exists and returncode == 0:
        version_string = my_stdout.strip()
        got_version = version_string.split('.')[0]
        version_ok = got_version in llvm_versions()
    else:
        s = "could not run llvm-config at {0}".format(llvm_config)
        return (0, s)

    if not version_ok:
        s = ("LLVM version {0} is not one of the supported versions: {1}"
             .format(got_version, llvm_versions_string()))

    return (got_version, s)