Re: [gentoo-portage-dev] [PATCH] per package environment: generalize the mechanism to be profile specific

2014-09-18 Thread Alexander Berntsen
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

For future reference, please use git's send-email option with
- --in-reply-to, to send the patches inline. The way they are sent now,
(I assume) most of us have to download your patches and open them in a
text viewer to review it. If the patches were inline, I could just
look at them in the email client.

Thanks for splitting them up, and thanks for your work on this.
- -- 
Alexander
berna...@gentoo.org
https://secure.plaimi.net/~alexander
-BEGIN PGP SIGNATURE-
Version: GnuPG v2
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iF4EAREIAAYFAlQajFsACgkQRtClrXBQc7We4gD/UztD3pvIRr2DDP5l/qZBFPFq
zwJ+A2ijpKkBDGAF9kwBAJ8fii7loZ+AHw+InoHQat7s2BOFh6fkvz/uNx2J4iDb
=IGeT
-END PGP SIGNATURE-



Re: [gentoo-portage-dev] [PATCH] per package environment: generalize the mechanism to be profile specific

2014-09-18 Thread Michał Górny
Dnia 2014-09-17, o godz. 14:57:10
Bertrand Simonnet bsimon...@google.com napisał(a):

 I'd rather use the env/ mechanism instead of the package.env one as it is
 more flexible.

It depends on what you aim to do. As portage(5) points out, both have
their advantages:

- package.env is parsed early, and so allows you override more
  variables, like FEATURES,

- env/ is used as bashrc extension.

The other difference is that package.env supports any atom syntax that
the particular EAPI supports, while env/ has hardcoded list of
possibilities.

-- 
Best regards,
Michał Górny


signature.asc
Description: PGP signature


Re: [gentoo-portage-dev] [PATCH] per package environment: generalize the mechanism to be profile specific

2014-09-18 Thread Bertrand Simonnet
For my purpose, I think bash scripting would be more useful. I thought
about package.env
in the beginning (see first few messages on this thread) as it would help
us reuse code but
variable setting only will limit what we can do.

If you want package.env, we can implement it too and have both mechanisms
available.

Thanks,
Bertrand

On Thu, Sep 18, 2014 at 1:02 AM, Michał Górny mgo...@gentoo.org wrote:

 Dnia 2014-09-17, o godz. 14:57:10
 Bertrand Simonnet bsimon...@google.com napisał(a):

  I'd rather use the env/ mechanism instead of the package.env one as it is
  more flexible.

 It depends on what you aim to do. As portage(5) points out, both have
 their advantages:

 - package.env is parsed early, and so allows you override more
   variables, like FEATURES,

 - env/ is used as bashrc extension.

 The other difference is that package.env supports any atom syntax that
 the particular EAPI supports, while env/ has hardcoded list of
 possibilities.

 --
 Best regards,
 Michał Górny



[gentoo-portage-dev] [PATCH] _backtrack_depgraph: fix bug #523048

2014-09-18 Thread Zac Medico
This fixes _backtrack_depgraph to immediately report necessary
REQUIRED_USE changes instead of discarding the graph. This is
accomplished by replacing the depgraph.success_without_autounmask
method with a new need_config_change method that accounts for both
autounmask and REQUIRED_USE changes.

X-Gentoo-Bug: 523048
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=523048
---
 pym/_emerge/depgraph.py  | 11 +++
 pym/portage/tests/resolver/ResolverPlayground.py | 16 ++--
 2 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index 6332733..e7ae720 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -421,6 +421,7 @@ class _dynamic_depgraph_config(object):
self._buildpkgonly_deps_unsatisfied = False
self._autounmask = 
depgraph._frozen_config.myopts.get('--autounmask') != 'n'
self._success_without_autounmask = False
+   self._required_use_unsatisfied = False
self._traverse_ignored_deps = False
self._complete_mode = False
self._slot_operator_deps = {}
@@ -2461,6 +2462,7 @@ class depgraph(object):

self._dynamic_config._unsatisfied_deps_for_display.append(
((pkg.root, atom),
{myparent : dep.parent, 
show_req_use : pkg}))
+   self._dynamic_config._required_use_unsatisfied 
= True
self._dynamic_config._skip_restart = True
return 0
 
@@ -8390,8 +8392,9 @@ class depgraph(object):
return self._dynamic_config._need_restart and \
not self._dynamic_config._skip_restart
 
-   def success_without_autounmask(self):
-   return self._dynamic_config._success_without_autounmask
+   def need_config_change(self):
+   return self._dynamic_config._success_without_autounmask or \
+   self._dynamic_config._required_use_unsatisfied
 
def autounmask_breakage_detected(self):
try:
@@ -8665,7 +8668,7 @@ def _backtrack_depgraph(settings, trees, myopts, 
myparams, myaction, myfiles, sp
backtrack_parameters=backtrack_parameters)
success, favorites = mydepgraph.select_files(myfiles)
 
-   if success or mydepgraph.success_without_autounmask():
+   if success or mydepgraph.need_config_change():
break
elif not allow_backtracking:
break
@@ -8677,7 +8680,7 @@ def _backtrack_depgraph(settings, trees, myopts, 
myparams, myaction, myfiles, sp
else:
break
 
-   if not (success or mydepgraph.success_without_autounmask()) and 
backtracked:
+   if not (success or mydepgraph.need_config_change()) and backtracked:
 
if debug:
writemsg_level(
diff --git a/pym/portage/tests/resolver/ResolverPlayground.py 
b/pym/portage/tests/resolver/ResolverPlayground.py
index 646987d..8560871 100644
--- a/pym/portage/tests/resolver/ResolverPlayground.py
+++ b/pym/portage/tests/resolver/ResolverPlayground.py
@@ -674,7 +674,8 @@ class ResolverPlaygroundTestCase(object):
expected = x
break
elif key in (unstable_keywords, 
needed_p_mask_changes,
-   unsatisfied_deps) and expected is not None:
+   unsatisfied_deps, required_use_unsatisfied) 
and \
+   expected is not None:
expected = set(expected)
 
elif key == forced_rebuilds and expected is not None:
@@ -693,10 +694,12 @@ class ResolverPlaygroundResult(object):
 
checks = (
success, mergelist, use_changes, license_changes, 
unstable_keywords, slot_collision_solutions,
-   circular_dependency_solutions, needed_p_mask_changes, 
unsatisfied_deps, forced_rebuilds
+   circular_dependency_solutions, needed_p_mask_changes, 
unsatisfied_deps, forced_rebuilds,
+   required_use_unsatisfied
)
optional_checks = (
forced_rebuilds,
+   required_use_unsatisfied,
unsatisfied_deps
)
 
@@ -714,6 +717,7 @@ class ResolverPlaygroundResult(object):
self.circular_dependency_solutions = None
self.unsatisfied_deps = frozenset()
self.forced_rebuilds = None
+   self.required_use_unsatisfied = None
 
if self.depgraph._dynamic_config._serialized_tasks_cache is not 
None:
self.mergelist = []
@@ -780,6 

[gentoo-portage-dev] Re: [PATCH] _backtrack_depgraph: fix bug #523048

2014-09-18 Thread Zac Medico
On 09/18/2014 11:46 AM, Zac Medico wrote:
 This fixes _backtrack_depgraph to immediately report necessary
 REQUIRED_USE changes instead of discarding the graph. This is
 accomplished by replacing the depgraph.success_without_autounmask
 method with a new need_config_change method that accounts for both
 autounmask and REQUIRED_USE changes.
 
 X-Gentoo-Bug: 523048
 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=523048
 ---

I forgot to include the test case that goes along with this patch, but
you can see it in this branch if you're interested:

https://github.com/zmedico/portage/tree/bug_523048
-- 
Thanks,
Zac



Re: [gentoo-portage-dev] [PATCH] _backtrack_depgraph: fix bug #523048

2014-09-18 Thread Brian Dolbec
On Thu, 18 Sep 2014 11:46:55 -0700
Zac Medico zmed...@gentoo.org wrote:

 This fixes _backtrack_depgraph to immediately report necessary
 REQUIRED_USE changes instead of discarding the graph. This is
 accomplished by replacing the depgraph.success_without_autounmask
 method with a new need_config_change method that accounts for both
 autounmask and REQUIRED_USE changes.
 
 X-Gentoo-Bug: 523048
 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=523048
 ---
  pym/_emerge/depgraph.py  | 11 +++
  pym/portage/tests/resolver/ResolverPlayground.py | 16
 ++-- 2 files changed, 21 insertions(+), 6 deletions(-)
 

LGTM 
-- 
Brian Dolbec dolsen




[gentoo-portage-dev] _solve_..slot_conflicts: fix bug #522084

2014-09-18 Thread Zac Medico
From 963efa6fcf1e61d836d5292c88500a7c032cf46e Mon Sep 17 00:00:00 2001
From: Zac Medico zmed...@gentoo.org
Date: Thu, 18 Sep 2014 16:16:13 -0700
Subject: [PATCH] _solve_..slot_conflicts: fix bug #522084

Fix _solve_non_slot_operator_slot_conflicts to add all parents to the
conflict_graph, even for parents where the atom matches all relevant
nodes. Otherwise, we risk removing all of the matched nodes from the
graph, which would cause a missed update.

X-Gentoo-Bug: 522084
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=522084
---
 pym/_emerge/depgraph.py| 14 ++--
 .../test_solve_non_slot_operator_slot_conflicts.py | 74 ++
 2 files changed, 81 insertions(+), 7 deletions(-)
 create mode 100644 
pym/portage/tests/resolver/test_solve_non_slot_operator_slot_conflicts.py

diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index 6332733..7bb5252 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -1171,12 +1171,15 @@ class depgraph(object):
for match in matched:
writemsg_level( match: 
%s\n % match, level=logging.DEBUG, noiselevel=-1)
 
-   if len(matched) == len(conflict):
-   # All packages match.
-   continue
+   if len(matched)  1:
+   # Even if all packages match, This 
parent must still
+   # be added to the conflict_graph. 
Otherwise, we risk
+   # removing all of these packages from 
the depgraph,
+   # which could cause a missed update 
(bug #522084).
+   conflict_graph.add(or_tuple(matched), 
parent)
elif len(matched) == 1:
conflict_graph.add(matched[0], parent)
-   elif len(matched) == 0:
+   else:
# This typically means that autounmask 
broke a
# USE-dep, but it could also be due to 
the slot
# not matching due to multislot (bug 
#220341).
@@ -1188,9 +1191,6 @@ class depgraph(object):
for pkg in conflict:
writemsg_level(
 non-match: %s\n % pkg,

level=logging.DEBUG, noiselevel=-1)
-   else:
-   # More than one packages matched, but 
not all.
-   conflict_graph.add(or_tuple(matched), 
parent)
 
for pkg in indirect_conflict_pkgs:
for parent, atom in 
self._dynamic_config._parent_atoms.get(pkg, []):
diff --git 
a/pym/portage/tests/resolver/test_solve_non_slot_operator_slot_conflicts.py 
b/pym/portage/tests/resolver/test_solve_non_slot_operator_slot_conflicts.py
new file mode 100644
index 000..ecda28e
--- /dev/null
+++ b/pym/portage/tests/resolver/test_solve_non_slot_operator_slot_conflicts.py
@@ -0,0 +1,74 @@
+# Copyright 2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+from portage.tests import TestCase
+from portage.tests.resolver.ResolverPlayground import (ResolverPlayground,
+   ResolverPlaygroundTestCase)
+
+class SolveNonSlotOperatorSlotConflictsTestCase(TestCase):
+
+   def testSolveNonSlotOperatorSlotConflicts(self):
+
+   ebuilds = {
+
+   app-misc/A-1 : {
+   EAPI: 5,
+   SLOT: 0/1,
+   PDEPEND: app-misc/B
+   },
+
+   app-misc/A-2 : {
+   EAPI: 5,
+   SLOT: 0/2,
+   PDEPEND: app-misc/B
+   },
+
+   app-misc/B-0 : {
+   EAPI: 5,
+   RDEPEND: app-misc/A:=
+   },
+
+   }
+
+   installed = {
+
+   app-misc/A-1 : {
+   EAPI: 5,
+   SLOT: 0/1,
+   PDEPEND: app-misc/B
+   },
+
+   app-misc/B-0 : {
+   EAPI: 5,
+   RDEPEND: app-misc/A:0/1=
+   },
+
+   }
+
+   world = [app-misc/A]
+
+   test_cases = (
+
+   # bug 522084
+   # In this case,