[gentoo-commits] proj/portage:master commit in: pym/_emerge/resolver/, pym/_emerge/, pym/portage/, pym/portage/dbapi/

2018-04-08 Thread Zac Medico
commit: bfe7892202b85c46ff127048ca1cc752c54b186c
Author: Zac Medico  gentoo  org>
AuthorDate: Fri Apr  6 20:05:25 2018 +
Commit: Zac Medico  gentoo  org>
CommitDate: Mon Apr  9 05:19:55 2018 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=bfe78922

_pkg_str: add _db attribute (bug 640318)

In order to propagate information from dbapi to Package instance,
it's useful for each _pkg_str instance to have a _db attribute
which references the dbapi instance that instantiated it. Use a new
dbapi._iuse_implicit_cnstr method to delegate implicit IUSE logic to
the dbapi instance, in order to make the behavior customizable at the
dbapi level for the purposes of bug 640318. This patch consists only
of refactoring, with no behavioral changes.

Bug: https://bugs.gentoo.org/640318

 pym/_emerge/Package.py | 53 +-
 pym/_emerge/depgraph.py| 11 ++-
 pym/_emerge/resolver/DbapiProvidesIndex.py |  3 +-
 pym/portage/dbapi/__init__.py  | 44 +
 pym/portage/dbapi/bintree.py   | 15 +
 pym/portage/dbapi/porttree.py  |  4 +--
 pym/portage/dbapi/vartree.py   |  5 +--
 pym/portage/dbapi/virtual.py   |  4 +--
 pym/portage/versions.py|  6 ++--
 9 files changed, 84 insertions(+), 61 deletions(-)

diff --git a/pym/_emerge/Package.py b/pym/_emerge/Package.py
index 791a35612..a7ce00bc9 100644
--- a/pym/_emerge/Package.py
+++ b/pym/_emerge/Package.py
@@ -67,8 +67,19 @@ class Package(Task):
if not self.built:
self._metadata['CHOST'] = 
self.root_config.settings.get('CHOST', '')
eapi_attrs = _get_eapi_attrs(self.eapi)
+
+   try:
+   db = self.cpv._db
+   except AttributeError:
+   if self.built:
+   # For independence from the source ebuild 
repository and
+   # profile implicit IUSE state, require the _db 
attribute
+   # for built packages.
+   raise
+   db = self.root_config.trees['porttree'].dbapi
+
self.cpv = _pkg_str(self.cpv, metadata=self._metadata,
-   settings=self.root_config.settings)
+   settings=self.root_config.settings, db=db)
if hasattr(self.cpv, 'slot_invalid'):
self._invalid_metadata('SLOT.invalid',
"SLOT: invalid value: '%s'" % 
self._metadata["SLOT"])
@@ -82,17 +93,10 @@ class Package(Task):
# sync metadata with validated repo (may be UNKNOWN_REPO)
self._metadata['repository'] = self.cpv.repo
 
-   if eapi_attrs.iuse_effective:
-   implicit_match = 
self.root_config.settings._iuse_effective_match
-   if self.built:
-   implicit_match = functools.partial(
-   self._built_iuse_effective_match,
-   implicit_match, 
frozenset(self._metadata['USE'].split()))
-   else:
-   implicit_match = 
self.root_config.settings._iuse_implicit_match
+   implicit_match = db._iuse_implicit_cnstr(self.cpv, 
self._metadata)
usealiases = 
self.root_config.settings._use_manager.getUseAliases(self)
-   self.iuse = self._iuse(self, self._metadata["IUSE"].split(), 
implicit_match,
-   usealiases, self.eapi)
+   self.iuse = self._iuse(self, self._metadata["IUSE"].split(),
+   implicit_match, usealiases, self.eapi)
 
if (self.iuse.enabled or self.iuse.disabled) and \
not eapi_attrs.iuse_defaults:
@@ -115,33 +119,6 @@ class Package(Task):
type_name=self.type_name)
self._hash_value = hash(self._hash_key)
 
-   @staticmethod
-   def _built_iuse_effective_match(prof_effective_match, built_use, flag):
-   """
-   For built packages, it is desirable for the built USE setting 
to be
-   independent of the profile's current IUSE_IMPLICIT state, since 
the
-   profile's IUSE_IMPLICT setting may have diverged. Therefore, any
-   member of the built USE setting is considered to be a valid 
member of
-   IUSE_EFFECTIVE. Note that the binary package may be remote, so 
it's
-   only possible to rely on metadata that is available in the 
remote
-   Packages file, and the IUSE_IMPLICIT header in the Packages 
file is
-   vulnerable to mutation (see bug 640318).
-
-   This function is only used for EAPIs that support 
IUSE_EFFECTIVE,
-   since built USE 

[gentoo-commits] proj/portage:master commit in: pym/_emerge/resolver/, pym/_emerge/

2017-10-04 Thread Zac Medico
commit: d93c62eab16b1ecb09766448f8dbc12a2e17d933
Author: Daniel Robbins  funtoo  org>
AuthorDate: Wed Oct  4 18:10:09 2017 +
Commit: Zac Medico  gentoo  org>
CommitDate: Wed Oct  4 18:31:12 2017 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=d93c62ea

_dynamic_depgraph_config: new digraph docs

Closes: https://github.com/gentoo/portage/pull/217

 pym/_emerge/depgraph.py | 41 +
 pym/_emerge/resolver/package_tracker.py | 12 +-
 2 files changed, 47 insertions(+), 6 deletions(-)

diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index 0b9b98dbb..75fb3 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -357,6 +357,47 @@ class _rebuild_config(object):
 
 class _dynamic_depgraph_config(object):
 
+   """
+   ``dynamic_depgraph_config`` is an object that is used to collect 
settings and important data structures that are
+   used in calculating Portage dependencies. Each depgraph created by the 
depgraph.py code gets its own
+   ``dynamic_depgraph_config``, whereas ``frozen_depgraph_config`` is 
shared among all depgraphs.
+
+   **self.digraph**
+
+   Of particular importance is the instance variable ``self.digraph``, 
which is an instance of
+   ``portage.util.digraph``, a directed graph data structure. 
``portage.util.digraph`` is used for a variety of
+   purposes in the Portage codebase, but in this particular scenario as 
``self.digraph``, it is used to create a
+   dependency tree of Portage packages. So for ``self.digraph``, each 
*node* of the directed graph is a ``Package``,
+   while *edges* connect nodes and each edge can have a Priority. The 
Priority setting is used to help resolve
+   circular dependencies, and should be interpreted in the direction of 
parent to child.
+
+   Conceptually, think of ``self.digraph`` as containing user-specified 
packages or sets at the very top, with
+   dependencies hanging down as children, and dependencies of those 
children as children of children, etc. The depgraph
+   is intended to model dependency relationships, not the order that 
packages should be installed.
+
+   **resolving the digraph**
+
+   To convert a digraph to an ordered list of packages to merge in an 
order where all dependencies are properly
+   satisfied, we would first start by looking at leaf nodes, which are 
nodes that have no dependencies of their own. We
+   could then traverse the digraph upwards from the leaf nodes, towards 
the parents. Along the way, depending on emerge
+   options, we could make decisions what packages should be installed or 
rebuilt. This is how ``self.digraph`` is used
+   in the code.
+
+   **digraph creation**
+
+   The ``depgraph.py`` code creates the digraph by first adding emerge 
arguments to the digraph as the main parents,
+   so if ``@world`` is specified, then the world set is added as the main 
parents. Then, ``emerge`` will determine
+   the dependencies of these packages, and depending on what options are 
passed to ``emerge``, will look at installed
+   packages, binary packages and available ebuilds that could be merged to 
satisfy dependencies, and these will be
+   added as children in the digraph. Children of children will be added as 
dependencies as needed, depending on the
+   depth setting used by ``emerge``.
+
+   As the digraph is created, it is perfectly fine for Packages to be 
added to the digraph that conflict with one
+   another. After the digraph has been fully populated to the necessary 
depth, code within ``depgraph.py`` will
+   identify any conflicts that are modeled within the digraph and 
determine the best way to handle them.
+
+   """
+
def __init__(self, depgraph, myparams, allow_backtracking, 
backtrack_parameters):
self.myparams = myparams.copy()
self._vdb_loaded = False

diff --git a/pym/_emerge/resolver/package_tracker.py 
b/pym/_emerge/resolver/package_tracker.py
index 06163574e..ccb0b11cf 100644
--- a/pym/_emerge/resolver/package_tracker.py
+++ b/pym/_emerge/resolver/package_tracker.py
@@ -42,13 +42,13 @@ class PackageTracker(object):
considering installing on the system, based on the information in 
Portage's dependency graph. Multiple roots are
supported, so that situations can be modeled where ROOT is set to a 
non-default value (non-``/``).
 
-   You can use the add_pkg() method to add a to-be-merged package to the 
PackageTracker, and ``add_installed_pkg()``
-   to add an already-installed package to the package tracker. Typical use 
of the package tracker involves the
-   depgraph.py code populating the package tracker with calls to 
``add_installed_pkg()`` to add all installed packages
-   on the system, and then it is initialized and ready for use. At that 
point, ``depgraph.py`` can use 

[gentoo-commits] proj/portage:master commit in: pym/_emerge/resolver/

2017-10-03 Thread Zac Medico
commit: 8fba660fb08ddd468d934c7478dcfc8015330e9b
Author: Daniel Robbins  funtoo  org>
AuthorDate: Tue Oct  3 20:29:44 2017 +
Commit: Zac Medico  gentoo  org>
CommitDate: Wed Oct  4 00:26:56 2017 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=8fba660f

resolver/package_tracker: new docs

Closes: https://github.com/gentoo/portage/pull/216

 pym/_emerge/resolver/package_tracker.py | 87 ++---
 1 file changed, 69 insertions(+), 18 deletions(-)

diff --git a/pym/_emerge/resolver/package_tracker.py 
b/pym/_emerge/resolver/package_tracker.py
index 398d4cf46..06163574e 100644
--- a/pym/_emerge/resolver/package_tracker.py
+++ b/pym/_emerge/resolver/package_tracker.py
@@ -31,38 +31,89 @@ class PackageConflict(_PackageConflict):
 
 class PackageTracker(object):
"""
-   This class tracks packages which are currently
-   installed and packages which have been pulled into
-   the dependency graph.
+   **Behavior**
 
-   It automatically tracks conflicts between packages.
+   This section is intended to give you a good conceptual overview of the 
``PackageTracker`` class and its general
+   behavior -- how you can expect it to behave and how in turn expects to 
be used successfully by the programmer.
 
-   Possible conflicts:
-   1) Packages that share the same SLOT.
-   2) Packages with the same cpv.
-   Not yet implemented:
-   3) Packages that block each other.
+   This class is used to model the behavior of a real Gentoo or other 
system using Portage for package management,
+   along with the installed and to-be-installed packages. The installed 
packages are ones that are already on the
+   system and recorded in ``/var/db/pkg``, while the to-be-installed 
packages are a group of packages that Portage is
+   considering installing on the system, based on the information in 
Portage's dependency graph. Multiple roots are
+   supported, so that situations can be modeled where ROOT is set to a 
non-default value (non-``/``).
+
+   You can use the add_pkg() method to add a to-be-merged package to the 
PackageTracker, and ``add_installed_pkg()``
+   to add an already-installed package to the package tracker. Typical use 
of the package tracker involves the
+   depgraph.py code populating the package tracker with calls to 
``add_installed_pkg()`` to add all installed packages
+   on the system, and then it is initialized and ready for use. At that 
point, ``depgraph.py`` can use ``add_pkg()``
+   to add to-be-installed packages to the system.
+
+   It's worth mentioning that PackageTracker uses ``Package`` objects as 
arguments, and stores these objects
+   internally. There are parts of the code that ensure that a ``Package`` 
instance is added to the PackageTracker
+   only once.
+
+   Note that when a to-be-merged package is added to the package tracker 
via ``add_pkg()``, it will "cover up"
+   (replace) any installed package that shares the same root-catpkg-slot 
or root-catpkg-version, meaning that calling
+   the ``all_pkgs()`` or ``match()`` method will not return the installed 
package in the list. And the code does
+   support the scenario where ``add_installed_pkg(pkg2)`` is called 
*after* a call to ``add_pkg(pkg1)`` -- in this
+   case, if ``pkg1`` would 'cover up' ``pkg2``, this will be identified 
and handled correctly.
+
+   But the package tracker is designed to have an important behavior in 
this regard -- because PackageTracker has a
+   ``remove()`` method, these replaced/covered-up packages are not 
permanently removed -- so if you ``remove()`` a
+   to-be-installed package that was "replacing" an installed package, the 
installed package will "reappear". This
+   removal functionality is used by the slot conflict code in 
``depgraph.py`` to modify the list of to-be-installed
+   packages as it addresses slot conflicts.
+
+   One of the main purposes of the PackageTracker is to detect conflicts 
between packages. Conflicts are detected
+   on to-be-installed packages only.
+
+   A slot conflict is a situation where a to-be-installed package is added 
to the package tracker via ``add_pkg()``,
+   and there is already a to-be-installed package added that has the same 
root, catpkg and slot. These cannot co-exist.
+
+   A cpv conflict is a situation where a to-be-installed package is added 
to the package tracker via ``add_pkg()``, and
+   there is already a to-be-installed package add that has the same root, 
catpkg, and version+revision. These cannot
+   co-exist.
+
+   The package tracker does not prevent slot and cpv conflicts from 
occurring. Instead, it allows them to be recorded
+   and the ``conflicts()`` and ``slot_conflicts()`` method will cause the 
package tracker to look at its internal data
+   structures 

[gentoo-commits] proj/portage:master commit in: pym/_emerge/resolver/

2016-12-18 Thread Zac Medico
commit: ddbe020d9385f8b70e4ec6f085d3afa7271949d7
Author: Zac Medico  gentoo  org>
AuthorDate: Sun Dec 18 12:39:59 2016 +
Commit: Zac Medico  gentoo  org>
CommitDate: Mon Dec 19 04:53:27 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=ddbe020d

slot_conflict_handler: report packages that can't be rebuilt (bug 602964)

Report packages that need to be rebuilt in order to solve slot
conflicts, but cannot be rebuilt for some reason. The following
reasons will be detected:

* matched by --exclude argument
* matched by --useoldpkg-atoms argument
* ebuild is masked or unavailable

Example output:

!!! The slot conflict(s) shown above involve package(s) which may need to
!!! be rebuilt in order to solve the conflict(s). However, the following
!!! package(s) cannot be rebuilt for the reasons shown:

  (sys-apps/less-480:0/0::gentoo, installed): ebuild is masked or unavailable

X-Gentoo-bug: 602964
X-Gentoo-bug-url: https://bugs.gentoo.org/602964
Acked-by: Brian Dolbec  gentoo.org>

 pym/_emerge/resolver/slot_collision.py | 37 --
 1 file changed, 35 insertions(+), 2 deletions(-)

diff --git a/pym/_emerge/resolver/slot_collision.py 
b/pym/_emerge/resolver/slot_collision.py
index cfb5885..f676b38 100644
--- a/pym/_emerge/resolver/slot_collision.py
+++ b/pym/_emerge/resolver/slot_collision.py
@@ -241,6 +241,8 @@ class slot_conflict_handler(object):
Print all slot conflicts in a human readable way.
"""
_pkg_use_enabled = self.depgraph._pkg_use_enabled
+   usepkgonly = "--usepkgonly" in self.myopts
+   need_rebuild = {}
verboseconflicts = "--verbose-conflicts" in self.myopts
any_omitted_parents = False
msg = self.conflict_msg
@@ -394,6 +396,29 @@ class slot_conflict_handler(object):

selected_for_display.update(

best_matches.values())
elif type in ("soname", "slot"):
+   # Check for packages 
that might need to
+   # be rebuilt, but 
cannot be rebuilt for
+   # some reason.
+   for ppkg, atom, 
other_pkg in parents:
+   if not 
(isinstance(ppkg, Package) and ppkg.installed):
+   continue
+   if not 
(atom.soname or atom.slot_operator_built):
+   continue
+   if 
self.depgraph._frozen_config.excluded_pkgs.findAtomForPackage(ppkg,
+   
modified_use=self.depgraph._pkg_use_enabled(ppkg)):
+   
selected_for_display.add((ppkg, atom))
+   
need_rebuild[ppkg] = 'matched by --exclude argument'
+   elif 
self.depgraph._frozen_config.useoldpkg_atoms.findAtomForPackage(ppkg,
+   
modified_use=self.depgraph._pkg_use_enabled(ppkg)):
+   
selected_for_display.add((ppkg, atom))
+   
need_rebuild[ppkg] = 'matched by --useoldpkg-atoms argument'
+   elif usepkgonly:
+   # This 
case is tricky, so keep quiet in order to avoid false-positives.
+   pass
+   elif not 
self.depgraph._equiv_ebuild_visible(ppkg):
+   
selected_for_display.add((ppkg, atom))
+   
need_rebuild[ppkg] = 'ebuild is masked or unavailable'
+
for ppkg, atom, 
other_pkg in parents:

selected_for_display.add((ppkg, atom))
if not 
verboseconflicts:
@@ -611,10 +636,18 @@ class slot_conflict_handler(object):

[gentoo-commits] proj/portage:master commit in: pym/_emerge/resolver/

2016-05-27 Thread Alexander Berntsen
commit: 40cdc1c3f467ac94d3a966777eb6a0907c269550
Author: Adam Mills  armills  info>
AuthorDate: Wed May 25 16:12:57 2016 +
Commit: Alexander Berntsen  gentoo  org>
CommitDate: Fri May 27 08:23:14 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=40cdc1c3

Colorize packages in world_sets (bug 583164)

Packages belonging to a set listed in world_sets will now be colorized
as a world package.

X-Gentoo-bug: 583164
X-Gentoo-bug-url: https://bugs.gentoo.org/show_bug.cgi?id=583164
Acked-by: Alexander Berntsen  gentoo.org>
Acked-by: Zac Medico  gentoo.org>
Signed-off-by: Alexander Berntsen  gentoo.org>

 pym/_emerge/resolver/output.py |  2 +-
 pym/_emerge/resolver/output_helpers.py | 11 +++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/pym/_emerge/resolver/output.py b/pym/_emerge/resolver/output.py
index 400617d..ac979f6 100644
--- a/pym/_emerge/resolver/output.py
+++ b/pym/_emerge/resolver/output.py
@@ -707,7 +707,7 @@ class Display(object):
"""
root_config = self.conf.roots[pkg.root]
system_set = root_config.sets["system"]
-   world_set  = root_config.sets["selected"]
+   world_set  = self.conf.selected_sets[pkg.root]
system = False
world = False
try:

diff --git a/pym/_emerge/resolver/output_helpers.py 
b/pym/_emerge/resolver/output_helpers.py
index 70f7bc0..b83717e 100644
--- a/pym/_emerge/resolver/output_helpers.py
+++ b/pym/_emerge/resolver/output_helpers.py
@@ -17,6 +17,7 @@ import sys
 from portage import os
 from portage import _encodings, _unicode_encode
 from portage._sets.base import InternalPackageSet
+from portage.exception import PackageSetNotFound
 from portage.localization import localized_size
 from portage.output import (blue, bold, colorize, create_color_func,
green, red, teal, turquoise, yellow)
@@ -213,6 +214,16 @@ class _DisplayConfig(object):
self.running_root = frozen_config._running_root
self.roots = frozen_config.roots
 
+   # Create a set of selected packages for each root
+   self.selected_sets = {}
+   for root_name, root in self.roots.items():
+   try:
+   self.selected_sets[root_name] = 
InternalPackageSet(
+   
initial_atoms=root.setconfig.getSetAtoms("selected"))
+   except PackageSetNotFound:
+   # A nested set could not be resolved, so ignore 
nested sets.
+   self.selected_sets[root_name] = 
root.sets["selected"]
+
self.blocker_parents = dynamic_config._blocker_parents
self.reinstall_nodes = dynamic_config._reinstall_nodes
self.digraph = dynamic_config.digraph



[gentoo-commits] proj/portage:master commit in: pym/_emerge/resolver/

2015-08-03 Thread Zac Medico
commit: 024e2a5779e92fffbd0a0d30c8cff725c4552626
Author: Zac Medico zmedico AT gentoo DOT org
AuthorDate: Mon Aug  3 06:17:26 2015 +
Commit: Zac Medico zmedico AT gentoo DOT org
CommitDate: Mon Aug  3 18:35:04 2015 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=024e2a57

circular_dependency_handler: limit USE combination search (bug 555698)

Limit the number of USE combinations searched to 1024 = 2 ** 10, where
10 is a constant named MAX_AFFECTING_USE, in order to avoid consuming
unreasonable amounts of time. First, discard irrelevent flags that are
not enabled. Since extract_affecting_use doesn't distinguish between
positive and negative effects (flag? vs. !flag?), assume a positive
relationship. If there are still too many combinations,then don't
bother to explore any of them.

X-Gentoo-Bug: 555698
X-Gentoo-Bug-url: https://bugs.gentoo.org/show_bug.cgi?id=555698
Acked-by: Brian Dolbec dolsen AT gentoo.org

 pym/_emerge/resolver/circular_dependency.py | 21 +++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/pym/_emerge/resolver/circular_dependency.py 
b/pym/_emerge/resolver/circular_dependency.py
index b710671..5c11956 100644
--- a/pym/_emerge/resolver/circular_dependency.py
+++ b/pym/_emerge/resolver/circular_dependency.py
@@ -14,7 +14,9 @@ from _emerge.DepPrioritySatisfiedRange import 
DepPrioritySatisfiedRange
 from _emerge.Package import Package
 
 class circular_dependency_handler(object):
-   
+
+   MAX_AFFECTING_USE = 10
+
def __init__(self, depgraph, graph):
self.depgraph = depgraph
self.graph = graph
@@ -156,7 +158,7 @@ class circular_dependency_handler(object):
total_flags = set()
total_flags.update(affecting_use, 
required_use_flags)
total_flags.difference_update(untouchable_flags)
-   if len(total_flags) = 10:
+   if len(total_flags) = self.MAX_AFFECTING_USE:
affecting_use = total_flags
 
affecting_use = tuple(affecting_use)
@@ -164,6 +166,21 @@ class circular_dependency_handler(object):
if not affecting_use:
continue
 
+   if len(affecting_use)  self.MAX_AFFECTING_USE:
+   # Limit the number of combinations explored 
(bug #555698).
+   # First, discard irrelevent flags that are not 
enabled.
+   # Since extract_affecting_use doesn't 
distinguish between
+   # positive and negative effects (flag? vs. 
!flag?), assume
+   # a positive relationship.
+   current_use = 
self.depgraph._pkg_use_enabled(parent)
+   affecting_use = tuple(flag for flag in 
affecting_use
+   if flag in current_use)
+
+   if len(affecting_use)  self.MAX_AFFECTING_USE:
+   # There are too many USE combinations 
to explore in
+   # a reasonable amount of time.
+   continue
+
#We iterate over all possible settings of these use 
flags and gather
#a set of possible changes
#TODO: Use the information encoded in REQUIRED_USE



[gentoo-commits] proj/portage:master commit in: pym/_emerge/resolver/

2015-07-29 Thread Zac Medico
commit: 44971d397c63e16b134d9b93b06ce3b8db768aca
Author: Zac Medico zmedico AT gentoo DOT org
AuthorDate: Wed Jul 29 05:18:30 2015 +
Commit: Zac Medico zmedico AT gentoo DOT org
CommitDate: Wed Jul 29 18:43:21 2015 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=44971d39

slot_conflict_handler: suggest --verbose-conflicts (bug 556172)

A suggestion to use --verbose-conflicts is now shown when relevant:

!!! Multiple package instances within a single package slot have been pulled
!!! into the dependency graph, resulting in a slot conflict:

dev-libs/icu:0

  (dev-libs/icu-54.1-r1:0/54a::gentoo, ebuild scheduled for merge) pulled in by
dev-libs/icu-55.1 (Argument)

  (dev-libs/icu-55.1:0/55::gentoo, installed) pulled in by
dev-libs/icu:0/55 required by 
(app-office/libreoffice-bin-4.4.3.2:0/0::gentoo, installed)
^
=dev-libs/icu-51.2-r1:0/55=[abi_x86_32(-),abi_x86_64(-)] required by 
(dev-libs/libxml2-2.9.2-r1:2/2::gentoo, installed)
  ^^
(and 19 more with the same problems)

NOTE: Use the '--verbose-conflicts' option to display parents omitted above

X-Gentoo-Bug: 556172
X-Gentoo-Bug-url: https://bugs.gentoo.org/show_bug.cgi?id=556172
Acked-by: Alexander Berntsen bernalex AT gentoo.org

 pym/_emerge/resolver/slot_collision.py | 11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/pym/_emerge/resolver/slot_collision.py 
b/pym/_emerge/resolver/slot_collision.py
index 5473d72..cfb5885 100644
--- a/pym/_emerge/resolver/slot_collision.py
+++ b/pym/_emerge/resolver/slot_collision.py
@@ -242,6 +242,7 @@ class slot_conflict_handler(object):

_pkg_use_enabled = self.depgraph._pkg_use_enabled
verboseconflicts = --verbose-conflicts in self.myopts
+   any_omitted_parents = False
msg = self.conflict_msg
indent =   
msg.append(\n!!! Multiple package instances within a single  
+ \
@@ -596,6 +597,7 @@ class slot_conflict_handler(object):

omitted_parents = 
num_all_specific_atoms - len(selected_for_display)
if omitted_parents:
+   any_omitted_parents = True
msg.append(2*indent)
if len(selected_for_display)  
1:
msg.append((and %d 
more with the same problems)\n % omitted_parents)
@@ -604,7 +606,14 @@ class slot_conflict_handler(object):
else:
msg.append( (no parents)\n)
msg.append(\n)
-   msg.append(\n)
+
+   if any_omitted_parents:
+   msg.append(colorize(INFORM,
+   NOTE: Use the '--verbose-conflicts'
+option to display parents omitted above))
+   msg.append(\n\n)
+   else:
+   msg.append(\n)
 
def get_explanation(self):
msg = 



[gentoo-commits] proj/portage:master commit in: pym/_emerge/resolver/, pym/_emerge/, pym/portage/, pym/portage/dbapi/, ...

2015-03-04 Thread Zac Medico
commit: 34055adae6bd90fc64f18421e2cec5f8da6f7c33
Author: Zac Medico zmedico AT gentoo DOT org
AuthorDate: Tue Feb 17 22:56:47 2015 +
Commit: Zac Medico zmedico AT gentoo DOT org
CommitDate: Wed Mar  4 21:32:07 2015 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=34055ada

binpkg-multi-instance 1 of 7

Extend the _pkg_str class with build_id, build_time, file_size, and
mtime attributes. These will be used to distinguish binary package
instances that have the same cpv. Package sorting accounts for
build_time, which will be used to prefer newer builds over older builds
when their versions are identical.

 pym/_emerge/Package.py| 51 +--
 pym/_emerge/resolver/output.py| 21 ++---
 pym/portage/cache/index/pkg_desc_index.py |  1 +
 pym/portage/dbapi/__init__.py | 10 --
 pym/portage/dbapi/vartree.py  |  8 +++--
 pym/portage/versions.py   | 28 +++--
 6 files changed, 93 insertions(+), 26 deletions(-)

diff --git a/pym/_emerge/Package.py b/pym/_emerge/Package.py
index e8a13cb..975335d 100644
--- a/pym/_emerge/Package.py
+++ b/pym/_emerge/Package.py
@@ -41,12 +41,12 @@ class Package(Task):
_validated_atoms, _visible)
 
metadata_keys = [
-   BUILD_TIME, CHOST, COUNTER, DEPEND, EAPI,
-   HDEPEND, INHERITED, IUSE, KEYWORDS,
-   LICENSE, PDEPEND, PROVIDE, RDEPEND,
-   repository, PROPERTIES, RESTRICT, SLOT, USE,
-   _mtime_, DEFINED_PHASES, REQUIRED_USE, PROVIDES,
-   REQUIRES]
+   BUILD_ID, BUILD_TIME, CHOST, COUNTER, DEFINED_PHASES,
+   DEPEND, EAPI, HDEPEND, INHERITED, IUSE, KEYWORDS,
+   LICENSE, MD5, PDEPEND, PROVIDE, PROVIDES,
+   RDEPEND, repository, REQUIRED_USE,
+   PROPERTIES, REQUIRES, RESTRICT, SIZE,
+   SLOT, USE, _mtime_]
 
_dep_keys = ('DEPEND', 'HDEPEND', 'PDEPEND', 'RDEPEND')
_buildtime_keys = ('DEPEND', 'HDEPEND')
@@ -114,13 +114,14 @@ class Package(Task):
return self._metadata[EAPI]
 
@property
+   def build_id(self):
+   return self.cpv.build_id
+
+   @property
def build_time(self):
if not self.built:
raise AttributeError('build_time')
-   try:
-   return long(self._metadata['BUILD_TIME'])
-   except (KeyError, ValueError):
-   return 0
+   return self.cpv.build_time
 
@property
def defined_phases(self):
@@ -509,9 +510,15 @@ class Package(Task):
else:
cpv_color = PKG_NOMERGE
 
+   build_id_str = 
+   if isinstance(self.cpv.build_id, long) and self.cpv.build_id  
0:
+   build_id_str = -%s % self.cpv.build_id
+
s = (%s, %s \
-   % (portage.output.colorize(cpv_color, self.cpv + 
_slot_separator + \
-   self.slot + / + self.sub_slot + _repo_separator + 
self.repo) , self.type_name)
+   % (portage.output.colorize(cpv_color, self.cpv +
+   build_id_str + _slot_separator + self.slot + / +
+   self.sub_slot + _repo_separator + self.repo),
+   self.type_name)
 
if self.type_name == installed:
if self.root_config.settings['ROOT'] != /:
@@ -755,29 +762,41 @@ class Package(Task):
def __lt__(self, other):
if other.cp != self.cp:
return self.cp  other.cp
-   if portage.vercmp(self.version, other.version)  0:
+   result = portage.vercmp(self.version, other.version)
+   if result  0:
return True
+   if result == 0 and self.built and other.built:
+   return self.build_time  other.build_time
return False
 
def __le__(self, other):
if other.cp != self.cp:
return self.cp = other.cp
-   if portage.vercmp(self.version, other.version) = 0:
+   result = portage.vercmp(self.version, other.version)
+   if result = 0:
return True
+   if result == 0 and self.built and other.built:
+   return self.build_time = other.build_time
return False
 
def __gt__(self, other):
if other.cp != self.cp:
return self.cp  other.cp
-   if portage.vercmp(self.version, other.version)  0:
+   result = portage.vercmp(self.version, other.version)
+   if result  0:
return True
+   if result == 0 and self.built and other.built:
+   

[gentoo-commits] proj/portage:master commit in: pym/_emerge/resolver/

2014-12-13 Thread Arfrever Frehtes Taifersar Arahesis
commit: c2577dc8d625fae4a573b2d89a58951498fbd0f6
Author: Arfrever Frehtes Taifersar Arahesis Arfrever AT Apache DOT Org
AuthorDate: Sat Dec 13 14:49:39 2014 +
Commit: Arfrever Frehtes Taifersar Arahesis arfrever AT apache DOT org
CommitDate: Sat Dec 13 14:49:39 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=c2577dc8

emerge --verbose --quiet-repo-display: Delete deprecated code.

Use portage.repository.config.RepoConfigLoader.__iter__() instead of deprecated
PORTDIR and PORTDIR_OVERLAY.
1 call to deprecated 
portage.repository.config.RepoConfigLoader.mainRepoLocation()
function has been deleted.

---
 pym/_emerge/resolver/output_helpers.py | 19 ---
 1 file changed, 4 insertions(+), 15 deletions(-)

diff --git a/pym/_emerge/resolver/output_helpers.py 
b/pym/_emerge/resolver/output_helpers.py
index eb8d97d..70f7bc0 100644
--- a/pym/_emerge/resolver/output_helpers.py
+++ b/pym/_emerge/resolver/output_helpers.py
@@ -21,7 +21,7 @@ from portage.localization import localized_size
 from portage.output import (blue, bold, colorize, create_color_func,
green, red, teal, turquoise, yellow)
 bad = create_color_func(BAD)
-from portage.util import shlex_split, writemsg
+from portage.util import writemsg
 from portage.util.SlotObject import SlotObject
 from portage.versions import catpkgsplit
 
@@ -39,24 +39,13 @@ class _RepoDisplay(object):
self._unknown_repo = False
repo_paths = set()
for root_config in roots.values():
-   portdir = root_config.settings.get(PORTDIR)
-   if portdir:
-   repo_paths.add(portdir)
-   overlays = root_config.settings.get(PORTDIR_OVERLAY)
-   if overlays:
-   repo_paths.update(shlex_split(overlays))
+   for repo in root_config.settings.repositories:
+   repo_paths.add(repo.location)
repo_paths = list(repo_paths)
self._repo_paths = repo_paths
self._repo_paths_real = [ os.path.realpath(repo_path) \
for repo_path in repo_paths ]
 
-   # pre-allocate index for PORTDIR so that it always has index 0.
-   for root_config in roots.values():
-   portdb = root_config.trees[porttree].dbapi
-   portdir = portdb.repositories.mainRepoLocation()
-   if portdir:
-   self.repoStr(portdir)
-
def repoStr(self, repo_path_real):
real_index = -1
if repo_path_real:
@@ -80,7 +69,7 @@ class _RepoDisplay(object):
shown_repos = self._shown_repos
unknown_repo = self._unknown_repo
if shown_repos or self._unknown_repo:
-   output.append(Portage tree and overlays:\n)
+   output.append(Repositories:\n)
show_repo_paths = list(shown_repos)
for repo_path, repo_index in shown_repos.items():
show_repo_paths[repo_index] = repo_path



[gentoo-commits] proj/portage:master commit in: pym/_emerge/resolver/, pym/_emerge/, man/

2014-12-12 Thread Arfrever Frehtes Taifersar Arahesis
commit: 751104acb0f14124ef44ba55a336dacca9474ae2
Author: Arfrever Frehtes Taifersar Arahesis Arfrever AT Apache DOT Org
AuthorDate: Sat Dec 13 06:16:31 2014 +
Commit: Arfrever Frehtes Taifersar Arahesis arfrever AT apache DOT org
CommitDate: Sat Dec 13 06:16:31 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=751104ac

When using --verbose, always print ::repository in list of packages for 
installation.

--verbose-main-repo-display option is no longer supported.
3 calls to deprecated portage.repository.config.RepoConfigLoader.mainRepo() 
function
have been deleted.

---
 man/emerge.1   | 3 ---
 pym/_emerge/depgraph.py| 7 +--
 pym/_emerge/main.py| 1 -
 pym/_emerge/resolver/output.py | 9 ++---
 4 files changed, 3 insertions(+), 17 deletions(-)

diff --git a/man/emerge.1 b/man/emerge.1
index b36f59c..faa1f33 100644
--- a/man/emerge.1
+++ b/man/emerge.1
@@ -899,9 +899,6 @@ Symbol  LocationMeaning
 Make slot conflicts more verbose. Note that this may in some cases output
 hundreds of packages for slot conflicts.
 .TP
-.BR \-\-verbose\-main\-repo\-display
-In the package merge list display, print ::repository even for main repository.
-.TP
 .BR \-\-verbose\-slot\-rebuilds [ y | n ]
 Turns on/off the extra emerge output to list which packages are causing 
rebuilds.
 The default is set to y (on).

diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index df1e266..4a42ed5 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -4293,14 +4293,9 @@ class depgraph(object):
child = None
all_parents = self._dynamic_config._parent_atoms
graph = self._dynamic_config.digraph
-   verbose_main_repo_display = --verbose-main-repo-display in \
-   self._frozen_config.myopts
 
def format_pkg(pkg):
-   pkg_name = %s % (pkg.cpv,)
-   if verbose_main_repo_display or pkg.repo != \
-   
pkg.root_config.settings.repositories.mainRepo().name:
-   pkg_name += _repo_separator + pkg.repo
+   pkg_name = %s%s%s % (pkg.cpv, _repo_separator, 
pkg.repo)
return pkg_name
 
if target_atom is not None and isinstance(node, Package):

diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py
index 66d4891..7c707f9 100644
--- a/pym/_emerge/main.py
+++ b/pym/_emerge/main.py
@@ -50,7 +50,6 @@ options=[
 --tree,
 --unordered-display,
 --update,
---verbose-main-repo-display,
 ]
 
 shortmapping={

diff --git a/pym/_emerge/resolver/output.py b/pym/_emerge/resolver/output.py
index aefc3f4..14d1b28 100644
--- a/pym/_emerge/resolver/output.py
+++ b/pym/_emerge/resolver/output.py
@@ -387,9 +387,7 @@ class Display(object):
if old_pkg.slot != 
old_pkg.sub_slot or \
old_pkg.slot == 
pkg.slot and old_pkg.sub_slot != pkg.sub_slot:
key += / + 
old_pkg.sub_slot
-   if not self.quiet_repo_display and 
(self.verbose_main_repo_display or
-   
self.portdb.repositories.mainRepo() is None or
-   any(x.repo != 
self.portdb.repositories.mainRepo().name for x in myoldbest + [pkg])):
+   if not self.quiet_repo_display:
key += _repo_separator + 
old_pkg.repo
versions.append(key)
myoldbest_str = blue([+, .join(versions)+])
@@ -422,9 +420,7 @@ class Display(object):
@param pkg_info: dictionary
@rtype string

-   if not self.quiet_repo_display and 
(self.verbose_main_repo_display or
-   self.portdb.repositories.mainRepo() is None or
-   any(x.repo != self.portdb.repositories.mainRepo().name 
for x in pkg_info.oldbest_list + [pkg])):
+   if not self.quiet_repo_display:
pkg_str += _repo_separator + pkg.repo
return pkg_str
 
@@ -819,7 +815,6 @@ class Display(object):
# and disable the entire repo display in this case.
repoadd_set = set()
 
-   self.verbose_main_repo_display = --verbose-main-repo-display 
in depgraph._frozen_config.myopts
self.restrict_fetch_list = {}
 
for mylist_index in range(len(mylist)):



[gentoo-commits] proj/portage:master commit in: pym/_emerge/resolver/

2014-08-23 Thread Zac Medico
commit: 5c0f68017e9943f9486ee68005ea3ef7743244bd
Author: Zac Medico zmedico AT gentoo DOT org
AuthorDate: Fri Aug 22 22:32:18 2014 +
Commit: Zac Medico zmedico AT gentoo DOT org
CommitDate: Sat Aug 23 06:14:38 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=5c0f6801

package_tracker.match: account for unevaluated_atom

This fixes the match cache to properly account for
atom.unevaluated_atom, which is required since match_from_list output
depends on atom.unevaluated_atom (for IUSE matching logic). Note that
similar issues were also fixed in commits
d603f1440c814377fbc1965729fd9b6b008cf76d and
5438bb29c996d777b6343515995176912a7c137f.

X-Gentoo-Bug: 515230
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=515230

---
 pym/_emerge/resolver/package_tracker.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pym/_emerge/resolver/package_tracker.py 
b/pym/_emerge/resolver/package_tracker.py
index 5982750..406d5ce 100644
--- a/pym/_emerge/resolver/package_tracker.py
+++ b/pym/_emerge/resolver/package_tracker.py
@@ -152,7 +152,7 @@ class PackageTracker(object):
packages may also be returned.

cp_key = root, atom.cp
-   cache_key = root, atom, installed
+   cache_key = root, atom, atom.unevaluated_atom, installed
try:
return iter(self._match_cache.get(cp_key, 
{})[cache_key])
except KeyError:



[gentoo-commits] proj/portage:master commit in: pym/_emerge/resolver/, pym/portage/tests/glsa/, pym/portage/tests/dbapi/, ...

2014-08-22 Thread Zac Medico
commit: 7e545d52d6cb2b9fb4d5d769f132e37b0c6b0d4b
Author: Zac Medico zmedico AT gentoo DOT org
AuthorDate: Fri Aug 22 20:11:27 2014 +
Commit: Zac Medico zmedico AT gentoo DOT org
CommitDate: Fri Aug 22 20:11:27 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=7e545d52

Fix porttree_root deprecation warnings

export PYTHONWARNINGS=d to see the warnings that this fixes.

---
 pym/_emerge/FakeVartree.py   |  4 +++-
 pym/_emerge/actions.py   |  4 +++-
 pym/_emerge/resolver/output_helpers.py   |  2 +-
 pym/portage/_global_updates.py   |  4 +++-
 pym/portage/emaint/modules/move/move.py  |  5 +++--
 pym/portage/news.py  |  8 +---
 pym/portage/tests/dbapi/test_portdb_cache.py | 18 +-
 pym/portage/tests/glsa/test_security_set.py  |  3 ++-
 8 files changed, 29 insertions(+), 19 deletions(-)

diff --git a/pym/_emerge/FakeVartree.py b/pym/_emerge/FakeVartree.py
index 14be50c..254f667 100644
--- a/pym/_emerge/FakeVartree.py
+++ b/pym/_emerge/FakeVartree.py
@@ -299,7 +299,9 @@ def grab_global_updates(portdb):
upd_commands.extend(commands)
retupdates[repo_name] = upd_commands
 
-   master_repo = portdb.getRepositoryName(portdb.porttree_root)
+   master_repo = portdb.repositories.mainRepo()
+   if master_repo is not None:
+   master_repo = master_repo.name
if master_repo in retupdates:
retupdates['DEFAULT'] = retupdates[master_repo]
 

diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py
index 66e18a4..fa04e10 100644
--- a/pym/_emerge/actions.py
+++ b/pym/_emerge/actions.py
@@ -1582,7 +1582,9 @@ def action_info(settings, trees, myopts, myfiles):
 
myvars = sorted(set(atoms))
 
-   main_repo = portdb.getRepositoryName(portdb.porttree_root)
+   main_repo = portdb.repositories.mainRepo()
+   if main_repo is not None:
+   main_repo = main_repo.name
cp_map = {}
cp_max_len = 0
 

diff --git a/pym/_emerge/resolver/output_helpers.py 
b/pym/_emerge/resolver/output_helpers.py
index e0ee3e0..eb8d97d 100644
--- a/pym/_emerge/resolver/output_helpers.py
+++ b/pym/_emerge/resolver/output_helpers.py
@@ -53,7 +53,7 @@ class _RepoDisplay(object):
# pre-allocate index for PORTDIR so that it always has index 0.
for root_config in roots.values():
portdb = root_config.trees[porttree].dbapi
-   portdir = portdb.porttree_root
+   portdir = portdb.repositories.mainRepoLocation()
if portdir:
self.repoStr(portdir)
 

diff --git a/pym/portage/_global_updates.py b/pym/portage/_global_updates.py
index dde7268..17dc080 100644
--- a/pym/portage/_global_updates.py
+++ b/pym/portage/_global_updates.py
@@ -118,7 +118,9 @@ def _do_global_updates(trees, prev_mtimes, quiet=False, 
if_mtime_changed=True):
else:
bindb = None
 
-   master_repo = portdb.getRepositoryName(portdb.porttree_root)
+   master_repo = portdb.repositories.mainRepo()
+   if master_repo is not None:
+   master_repo = master_repo.name
if master_repo in repo_map:
repo_map['DEFAULT'] = repo_map[master_repo]
 

diff --git a/pym/portage/emaint/modules/move/move.py 
b/pym/portage/emaint/modules/move/move.py
index ef674d4..41ca167 100644
--- a/pym/portage/emaint/modules/move/move.py
+++ b/pym/portage/emaint/modules/move/move.py
@@ -13,8 +13,9 @@ class MoveHandler(object):
self._tree = tree
self._portdb = porttree.dbapi
self._update_keys = Package._dep_keys + (PROVIDE,)
-   self._master_repo = \
-   
self._portdb.getRepositoryName(self._portdb.porttree_root)
+   self._master_repo = self._portdb.repositories.mainRepo()
+   if self._master_repo is not None:
+   self._master_repo = self._master_repo.name
 
def _grab_global_updates(self):
from portage.update import grab_updates, parse_updates

diff --git a/pym/portage/news.py b/pym/portage/news.py
index 408fb5c..0d72b00 100644
--- a/pym/portage/news.py
+++ b/pym/portage/news.py
@@ -61,10 +61,12 @@ class NewsManager(object):
self._dir_mode  = 0o0074
self._mode_mask = 0o
 
-   portdir = portdb.porttree_root
-   profiles_base = os.path.join(portdir, 'profiles') + os.path.sep
+   portdir = portdb.repositories.mainRepoLocation()
+   profiles_base = None
+   if portdir is not None:
+   profiles_base = os.path.join(portdir, 'profiles') + 
os.path.sep
profile_path = None
-   if portdb.settings.profile_path:
+   if profiles_base is