How to use the pkgcore.log.logger.warning function in pkgcore

To help you get started, we’ve selected a few pkgcore examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pkgcore / pkgcore / src / pkgcore / ebuild / domain.py View on Github external
def package_keywords_splitter(iterable):
    for line, lineno, path in iterable:
        v = line.split()
        try:
            yield parse_match(v[0]), tuple(v[1:]), line, lineno, path
        except ParseError as e:
            logger.warning(f'{path!r}, line {lineno}: parsing error: {e}')
github pkgcore / pkgcore / src / pkgcore / ebuild / triggers.py View on Github external
target_repo = None
        if target_repo is not None:
            if 'buildpkg' in self.domain.features:
                yield triggers.SavePkg(pristine='no', target_repo=target_repo)
            elif 'pristine-buildpkg' in self.domain.features:
                yield triggers.SavePkg(pristine='yes', target_repo=target_repo)
            elif 'buildsyspkg' in self.domain.features:
                yield triggers.SavePkgIfInPkgset(
                    pristine='yes', target_repo=target_repo, pkgset=self.domain.profile.system)
            elif 'unmerge-backup' in self.domain.features:
                yield triggers.SavePkgUnmerging(target_repo=target_repo)

        if 'save-deb' in self.domain.features:
            path = self.opts.get("DEB_REPO_ROOT", None)
            if path is None:
                logger.warning("disabling save-deb; DEB_REPO_ROOT is unset")
            else:
                yield ospkg.triggers.SaveDeb(
                    basepath=normpath(path), maintainer=self.opts.get("DEB_MAINAINER", ''),
                    platform=self.opts.get("DEB_ARCHITECTURE", ""))

        if 'splitdebug' in self.domain.features:
            yield triggers.BinaryDebug(mode='split', compress=('compressdebug' in self.domain.features))
        elif 'strip' in self.domain.features or 'nostrip' not in self.domain.features:
            yield triggers.BinaryDebug(mode='strip')

        if '-fixlafiles' not in self.domain.features:
            yield libtool.FixLibtoolArchivesTrigger()

        for x in ("man", "info", "doc"):
            if f"no{x}" in self.domain.features:
                self.opts["INSTALL_MASK"].append(f"/usr/share/{x}")
github pkgcore / pkgcore / src / pkgcore / ebuild / ebd.py View on Github external
env = expected_ebuild_env(pkg)

    ebd = request_ebuild_processor(userpriv=userpriv, sandbox=sandbox, fd_pipes=fd_pipes)
    # this is a bit of a hack; used until ebd accepts observers that handle
    # the output redirection on its own.  Primary relevance is when
    # stdout/stderr are pointed at a file; we leave buffering on, just
    # force the flush for synchronization.
    sys.stdout.flush()
    sys.stderr.flush()
    try:
        if not ebd.run_phase(phase, env, tmpdir=tmpdir, sandbox=sandbox,
                             logging=logging, additional_commands=extra_handlers):
            if not failure_allowed:
                raise format.GenericBuildError(
                    phase + ": Failed building (False/0 return from handler)")
                logger.warning(f"executing phase {phase}: execution failed, ignoring")
    except Exception as e:
        if isinstance(e, ebd_ipc.IpcError):
            # notify bash side of IPC error
            ebd.write(e.ret)
            if isinstance(e, ebd_ipc.IpcInternalError):
                # show main exception cause for internal IPC errors
                ebd.shutdown_processor(force=True)
                raise e.__cause__
        try:
            ebd.shutdown_processor()
        except ProcessorError as pe:
            # catch die errors during shutdown
            e = pe
        release_ebuild_processor(ebd)
        if isinstance(e, ProcessorError):
            # force verbose die output
github pkgcore / pkgcore / src / pkgcore / ebuild / portage_conf.py View on Github external
self['ebuild-repo-common'] = basics.AutoConfigSection({
            'class': 'pkgcore.ebuild.repository.tree',
            'default_mirrors': gentoo_mirrors,
            'inherit-only': True,
        })

        repo_map = {}

        for repo_name, repo_opts in list(repos_conf.items()):
            repo_cls = repo_opts.pop('repo-type')
            try:
                repo = repo_cls(
                    self, repo_name=repo_name, repo_opts=repo_opts,
                    repo_map=repo_map, defaults=repos_conf_defaults)
            except repo_errors.UnsupportedRepo as e:
                logger.warning(
                    f'skipping {repo_name!r} repo: unsupported EAPI {str(e.repo.eapi)!r}')
                del repos_conf[repo_name]
                continue

            self[repo_name] = basics.AutoConfigSection(repo)

        # XXX: Hack for portage-2 profile format support. We need to figure out how
        # to dynamically create this from the config at runtime on attr access.
        profiles.ProfileNode._repo_map = ImmutableDict(repo_map)

        self._make_repo_syncers(repos_conf, make_conf)
        repos = [name for name in repos_conf.keys()]
        if repos:
            self['repo-stack'] = basics.FakeIncrementalDictConfigSection(
                my_convert_hybrid, {
                    'class': 'pkgcore.repository.multiplex.config_tree',
github pkgcore / pkgcore / src / pkgcore / vdb / repo_ops.py View on Github external
try:
                        s = ' '.join(v)
                    except TypeError:
                        s = str(v)
                else:
                    s = v
                with open(pjoin(dirpath, rewrite.get(k, k.upper())), "w", 32768) as f:
                    if s:
                        s += '\n'
                    f.write(s)

        # ebuild_data is the actual ebuild- no point in holding onto
        # it for built ebuilds, but if it's there, we store it.
        o = getattr(self.new_pkg, "ebuild", None)
        if o is None:
            logger.warning(
                "doing install/replace op, "
                "but source package doesn't provide the actual ebuild data.  "
                "Creating an empty file")
            o = ''
        else:
            o = o.bytes_fileobj().read()
        # XXX lil hackish accessing PF
        with open(pjoin(dirpath, self.new_pkg.PF + ".ebuild"), "wb") as f:
            f.write(o)

        # install NEEDED and NEEDED.ELF.2 files from tmpdir if they exist
        pkg_tmpdir = normpath(pjoin(domain.pm_tmpdir, self.new_pkg.category,
                                    self.new_pkg.PF, 'temp'))
        for f in ['NEEDED', 'NEEDED.ELF.2']:
            fp = pjoin(pkg_tmpdir, f)
            if os.path.exists(fp):
github pkgcore / pkgcore / src / pkgcore / ebuild / domain.py View on Github external
def tmpdir(self):
        """Temporary directory for the system.

        Uses PORTAGE_TMPDIR setting and falls back to using the system's TMPDIR if unset.
        """
        path = self.settings.get('PORTAGE_TMPDIR', '')
        if not os.path.exists(path):
            try:
                os.mkdir(path)
            except EnvironmentError:
                path = tempfile.gettempdir()
                logger.warning(f'nonexistent PORTAGE_TMPDIR path, defaulting to {path!r}')
        return os.path.normpath(path)
github pkgcore / pkgcore / src / pkgcore / pkgsets / glsa.py View on Github external
try:
                            pkgname = str(pkg.get('name')).strip()
                            pkg_vuln_restrict = \
                                self.generate_intersects_from_pkg_node(
                                    pkg, tag="glsa(%s)" % fn[5:-4])
                            if pkg_vuln_restrict is None:
                                continue
                            pkgatom = atom.atom(pkgname)
                            yield fn[5:-4], pkgname, pkgatom, pkg_vuln_restrict
                        except (TypeError, ValueError) as e:
                            # thrown from cpv.
                            logger.warning(f"invalid glsa- {fn}, package {pkgname}: {e}")
                        except IGNORED_EXCEPTIONS:
                            raise
                        except Exception as e:
                            logger.warning(f"invalid glsa- {fn}: error: {e}")
github pkgcore / pkgcore / src / pkgcore / ebuild / portage_conf.py View on Github external
"ignoring repo")
                    continue

                # Priority defaults to zero if unset or invalid for ebuild repos
                # while binpkg repos have the lowest priority by default.
                priority = repo_conf.get('priority', None)
                if priority is None:
                    if repo_type.startswith('binpkg'):
                        priority = -10000
                    else:
                        priority = 0

                try:
                    priority = int(priority)
                except ValueError:
                    logger.warning(
                        f"repos.conf: parsing {fp!r}: {name!r} repo has invalid priority "
                        f"setting: {priority!r} (defaulting to 0)")
                    priority = 0
                finally:
                    repo_conf['priority'] = priority

                # register repo
                repos[name] = repo_conf

        if repos:
            # the default repo is gentoo if unset and gentoo exists
            default_repo = main_defaults.get('main-repo', 'gentoo')
            if default_repo not in repos:
                raise config_errors.UserConfigError(
                    f"repos.conf: default repo {default_repo!r} is undefined or invalid")