+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
from _emerge.SlotObject import SlotObject
class AbstractDepPriority(SlotObject):
__slots__ = ("buildtime", "runtime", "runtime_post")
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
from _emerge.AsynchronousTask import AsynchronousTask
from _emerge.PollConstants import PollConstants
class AbstractPollTask(AsynchronousTask):
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
from _emerge.SlotObject import SlotObject
class AsynchronousTask(SlotObject):
"""
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
from _emerge.DependencyArg import DependencyArg
# for an explanation on this logic, see pym/_emerge/__init__.py
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
from _emerge.EbuildPhase import EbuildPhase
from _emerge.BinpkgFetcher import BinpkgFetcher
from _emerge.BinpkgExtractorAsync import BinpkgExtractorAsync
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
from _emerge.SpawnProcess import SpawnProcess
# for an explanation on this logic, see pym/_emerge/__init__.py
import os
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
from _emerge.SpawnProcess import SpawnProcess
import urlparse
import sys
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
from _emerge.BinpkgFetcher import BinpkgFetcher
from _emerge.CompositeTask import CompositeTask
from _emerge.BinpkgVerifier import BinpkgVerifier
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
from _emerge.AsynchronousTask import AsynchronousTask
from portage.util import writemsg
import sys
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
from _emerge.Task import Task
# for an explanation on this logic, see pym/_emerge/__init__.py
import os
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
from portage.util import writemsg
from portage.data import secpass
# for an explanation on this logic, see pym/_emerge/__init__.py
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
# for an explanation on this logic, see pym/_emerge/__init__.py
import os
import sys
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
from _emerge.DepPriority import DepPriority
class BlockerDepPriority(DepPriority):
__slots__ = ()
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
from _emerge.AsynchronousTask import AsynchronousTask
import os
class CompositeTask(AsynchronousTask):
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
from _emerge.AbstractDepPriority import AbstractDepPriority
class DepPriority(AbstractDepPriority):
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
from _emerge.DepPriority import DepPriority
class DepPriorityNormalRange(object):
"""
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
from _emerge.DepPriority import DepPriority
class DepPrioritySatisfiedRange(object):
"""
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
from _emerge.DepPriority import DepPriority
from _emerge.SlotObject import SlotObject
class Dependency(SlotObject):
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
class DependencyArg(object):
def __init__(self, arg=None, root_config=None):
self.arg = arg
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
from _emerge.EbuildProcess import EbuildProcess
import os
class EbuildBinpkg(EbuildProcess):
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
from _emerge.EbuildExecuter import EbuildExecuter
from _emerge.EbuildPhase import EbuildPhase
from _emerge.EbuildBinpkg import EbuildBinpkg
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
from _emerge.SlotObject import SlotObject
# for an explanation on this logic, see pym/_emerge/__init__.py
import os
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
from _emerge.EbuildPhase import EbuildPhase
from _emerge.TaskSequence import TaskSequence
from _emerge.CompositeTask import CompositeTask
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
from _emerge.SpawnProcess import SpawnProcess
from _emerge.EbuildBuildDir import EbuildBuildDir
# for an explanation on this logic, see pym/_emerge/__init__.py
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
from _emerge.SlotObject import SlotObject
import shutil
# for an explanation on this logic, see pym/_emerge/__init__.py
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
from _emerge.SlotObject import SlotObject
# for an explanation on this logic, see pym/_emerge/__init__.py
import os
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
from _emerge.SubProcess import SubProcess
from _emerge.PollConstants import PollConstants
import sys
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
from _emerge.MiscFunctionsProcess import MiscFunctionsProcess
from _emerge.EbuildProcess import EbuildProcess
from _emerge.CompositeTask import CompositeTask
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
from _emerge.SpawnProcess import SpawnProcess
# for an explanation on this logic, see pym/_emerge/__init__.py
import os
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
import os
from itertools import izip
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
import formatter
import os
import sys
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
import os
from portage.output import colorize
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
# for an explanation on this logic, see pym/_emerge/__init__.py
import os
import sys
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
from _emerge.SpawnProcess import SpawnProcess
# for an explanation on this logic, see pym/_emerge/__init__.py
import os
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
import re
from itertools import chain
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
from _emerge.DependencyArg import DependencyArg
# for an explanation on this logic, see pym/_emerge/__init__.py
import os
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
from portage.output import colorize, create_color_func
bad = create_color_func("BAD")
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
from _emerge.AsynchronousTask import AsynchronousTask
from portage.output import colorize
class PackageMerge(AsynchronousTask):
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
import logging
# for an explanation on this logic, see pym/_emerge/__init__.py
import os
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
# for an explanation on this logic, see pym/_emerge/__init__.py
import os
import sys
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
from _emerge.AbstractPollTask import AbstractPollTask
from _emerge.PollConstants import PollConstants
import sys
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
import select
class PollConstants(object):
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
import logging
import select
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
from _emerge.PollConstants import PollConstants
import select
class PollSelectAdapter(PollConstants):
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
import time
class ProgressHandler(object):
def __init__(self):
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
from _emerge.PollScheduler import PollScheduler
class QueueScheduler(PollScheduler):
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
from portage.output import teal
import os
class RepoDisplay(object):
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
from _emerge.PackageVirtualDbapi import PackageVirtualDbapi
class RootConfig(object):
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
import logging
import os
import sys
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
from _emerge.SlotObject import SlotObject
from collections import deque
class SequentialTaskQueue(SlotObject):
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
from _emerge.DependencyArg import DependencyArg
from portage.sets import SETPREFIX
class SetArg(DependencyArg):
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
class SlotObject(object):
__slots__ = ("__weakref__",)
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
from _emerge.SubProcess import SubProcess
from _emerge.PollConstants import PollConstants
import sys
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
from _emerge.AbstractPollTask import AbstractPollTask
import signal
import os
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
from _emerge.SlotObject import SlotObject
class Task(SlotObject):
__slots__ = ("_hash_key", "_hash_value")
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
from _emerge.QueueScheduler import QueueScheduler
from _emerge.SequentialTaskQueue import SequentialTaskQueue
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
from _emerge.CompositeTask import CompositeTask
from _emerge.AsynchronousTask import AsynchronousTask
import os
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
# for an explanation on this logic, see pym/_emerge/__init__.py
import os
import sys
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
from _emerge.AbstractDepPriority import AbstractDepPriority
class UnmergeDepPriority(AbstractDepPriority):
__slots__ = ("optional", "satisfied",)
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
from portage.output import red
from portage.util import cmp_sort_key
from portage.output import blue
-#!@PORTAGE_PYTHON@ -O
-# Copyright 1999-2006 Gentoo Foundation
+# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
from _emerge.DepPriority import DepPriority
from _emerge.Package import Package
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
def _flush_elog_mod_echo():
"""
Dump the mod_echo output now so that our other
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
import commands
import errno
import logging
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
import os
import re
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
import gc
# for an explanation on this logic, see pym/_emerge/__init__.py
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
import sys
import time
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
def create_depgraph_params(myopts, myaction):
#configure emerge engine parameters
#
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
# for an explanation on this logic, see pym/_emerge/__init__.py
import os
import sys
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
import gc
import os
import re
print
+ def _iter_match_pkgs(self, root_config, pkg_type, atom, onlydeps=False):
+ """
+ Iterate over Package instances of pkg_type matching the given atom.
+ This does not check visibility and it also does not match USE for
+ unbuilt ebuilds since USE are lazily calculated after visibility
+ checks (to avoid the expense when possible).
+ """
+
+ db = root_config.trees[self.pkg_tree_map[pkg_type]].dbapi
+
+ if hasattr(db, "xmatch"):
+ cpv_list = db.xmatch("match-all", atom)
+ else:
+ cpv_list = db.match(atom)
+
+ # USE=multislot can make an installed package appear as if
+ # it doesn't satisfy a slot dependency. Rebuilding the ebuild
+ # won't do any good as long as USE=multislot is enabled since
+ # the newly built package still won't have the expected slot.
+ # Therefore, assume that such SLOT dependencies are already
+ # satisfied rather than forcing a rebuild.
+ installed = pkg_type == 'installed'
+ if installed and not cpv_list and atom.slot:
+ for cpv in db.match(atom.cp):
+ slot_available = False
+ for other_db, other_type, other_built, \
+ other_installed, other_keys in \
+ self._filtered_trees[root_config.root]["dbs"]:
+ try:
+ if atom.slot == \
+ other_db.aux_get(cpv, ["SLOT"])[0]:
+ slot_available = True
+ break
+ except KeyError:
+ pass
+ if not slot_available:
+ continue
+ inst_pkg = self._pkg(cpv, "installed",
+ root_config, installed=installed)
+ # Remove the slot from the atom and verify that
+ # the package matches the resulting atom.
+ atom_without_slot = portage.dep.remove_slot(atom)
+ if atom.use:
+ atom_without_slot += str(atom.use)
+ atom_without_slot = portage.dep.Atom(atom_without_slot)
+ if portage.match_from_list(
+ atom_without_slot, [inst_pkg]):
+ cpv_list = [inst_pkg.cpv]
+ break
+
+ if cpv_list:
+
+ # descending order
+ cpv_list.reverse()
+ for cpv in cpv_list:
+ try:
+ pkg = self._pkg(cpv, pkg_type, root_config,
+ installed=installed, onlydeps=onlydeps)
+ except portage.exception.PackageNotFound:
+ pass
+ else:
+ if pkg.cp != atom.cp:
+ # A cpv can be returned from dbapi.match() as an
+ # old-style virtual match even in cases when the
+ # package does not actually PROVIDE the virtual.
+ # Filter out any such false matches here.
+ if not InternalPackageSet(initial_atoms=(atom,)
+ ).findAtomForPackage(pkg):
+ continue
+ yield pkg
+
def _select_pkg_highest_available(self, root, atom, onlydeps=False):
cache_key = (root, atom, onlydeps)
ret = self._highest_pkg_cache.get(cache_key)
if not isinstance(atom, portage.dep.Atom):
atom = portage.dep.Atom(atom)
atom_cp = atom.cp
- atom_set = InternalPackageSet(initial_atoms=(atom,))
existing_node = None
myeb = None
usepkgonly = "--usepkgonly" in self.myopts
(found_available_arg and not selective)
if want_reinstall and matched_packages:
continue
- if hasattr(db, "xmatch"):
- cpv_list = db.xmatch("match-all", atom)
- else:
- cpv_list = db.match(atom)
-
- # USE=multislot can make an installed package appear as if
- # it doesn't satisfy a slot dependency. Rebuilding the ebuild
- # won't do any good as long as USE=multislot is enabled since
- # the newly built package still won't have the expected slot.
- # Therefore, assume that such SLOT dependencies are already
- # satisfied rather than forcing a rebuild.
- if installed and not cpv_list and atom.slot:
- for cpv in db.match(atom.cp):
- slot_available = False
- for other_db, other_type, other_built, \
- other_installed, other_keys in dbs:
- try:
- if atom.slot == \
- other_db.aux_get(cpv, ["SLOT"])[0]:
- slot_available = True
- break
- except KeyError:
- pass
- if not slot_available:
- continue
- inst_pkg = self._pkg(cpv, "installed",
- root_config, installed=installed)
- # Remove the slot from the atom and verify that
- # the package matches the resulting atom.
- atom_without_slot = portage.dep.remove_slot(atom)
- if atom.use:
- atom_without_slot += str(atom.use)
- atom_without_slot = portage.dep.Atom(atom_without_slot)
- if portage.match_from_list(
- atom_without_slot, [inst_pkg]):
- cpv_list = [inst_pkg.cpv]
- break
-
- if not cpv_list:
- continue
- # descending order
- cpv_list.reverse()
- for cpv in cpv_list:
+ for pkg in self._iter_match_pkgs(root_config, pkg_type, atom,
+ onlydeps=onlydeps):
+ cpv = pkg.cpv
# Make --noreplace take precedence over --newuse.
- if not installed and noreplace and \
+ if not pkg.installed and noreplace and \
cpv in vardb.match(atom):
# If the installed version is masked, it may
# be necessary to look at lower versions,
# in case there is a visible downgrade.
continue
reinstall_for_flags = None
- try:
- pkg = self._pkg(cpv, pkg_type, root_config,
- installed=installed, onlydeps=onlydeps)
- except portage.exception.PackageNotFound:
- continue
if not installed or (built and matched_packages):
# Only enforce visibility on installed packages
# expensive, so it is only performed lazily, after the
# above visibility checks are complete.
- if pkg.cp != atom.cp:
- # A cpv can be returned from dbapi.match() as an
- # old-style virtual match even in cases when the
- # package does not actually PROVIDE the virtual.
- # Filter out any such false matches here.
- if not atom_set.findAtomForPackage(pkg):
- continue
-
myarg = None
if root == self.target_root:
try:
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
import os
import sys
import time
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
# formats a size given in bytes nicely
def format_size(mysize):
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
import os
getloadavg = getattr(os, "getloadavg", None)
-# Copyright 1999-2007 Gentoo Foundation
+# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
import re
# for an explanation on this logic, see pym/_emerge/__init__.py
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
import os
import re
from itertools import izip
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
import logging
import os
import textwrap
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
import platform
import sys
import time
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
import logging
import os
import sys
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
import sys
from portage.output import bold, create_color_func
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
# for an explanation on this logic, see pym/_emerge/__init__.py
import os
import sys