* [gentoo-commits] proj/portage:master commit in: pym/portage/dep/
@ 2011-02-04 6:29 zmedico
0 siblings, 0 replies; 53+ messages in thread
From: zmedico @ 2011-02-04 6:29 UTC (permalink / raw
To: gentoo-commits
commit: 676c6b3845482730d1dec4d683bc6138a5f30727
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Fri Feb 4 06:28:35 2011 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Fri Feb 4 06:28:35 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=676c6b3845482730d1dec4d683bc6138a5f30727
Remove from list by index, not search.
---
pym/portage/dep/__init__.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py
index 68e628b..62e96d2 100644
--- a/pym/portage/dep/__init__.py
+++ b/pym/portage/dep/__init__.py
@@ -2217,7 +2217,7 @@ def check_required_use(required_use, use, iuse_match):
node._satisfied = satisfied
if node._parent._operator not in ("||", "^^"):
offset = node._parent._children.index(node)
- node._parent._children.remove(node)
+ node._parent._children.pop(offset)
for i, child in enumerate(node._children):
node._parent._children.insert(offset + i, child)
if isinstance(child, _RequiredUseBranch):
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/dep/
@ 2011-02-04 23:04 Zac Medico
0 siblings, 0 replies; 53+ messages in thread
From: Zac Medico @ 2011-02-04 23:04 UTC (permalink / raw
To: gentoo-commits
commit: 3b72417b30868335b3314559028f04a62a4b5521
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Fri Feb 4 22:59:28 2011 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Fri Feb 4 22:59:28 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=3b72417b
REQUIRED_USE: fix single child conditionals disp
---
pym/portage/dep/__init__.py | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py
index b429e56..6b125f0 100644
--- a/pym/portage/dep/__init__.py
+++ b/pym/portage/dep/__init__.py
@@ -2226,15 +2226,14 @@ def check_required_use(required_use, use, iuse_match):
node._parent._children.append(child)
if isinstance(child, _RequiredUseBranch):
child._parent = node._parent
- node = node._parent
- continue
- if not node._children:
+ elif not node._children:
last_node = node._parent._children.pop()
if last_node is not node:
raise AssertionError(
"node is not last child of parent")
- elif len(node._children) == 1:
+
+ elif len(node._children) == 1 and op in ("||", "^^"):
last_node = node._parent._children.pop()
if last_node is not node:
raise AssertionError(
@@ -2243,6 +2242,7 @@ def check_required_use(required_use, use, iuse_match):
if isinstance(node._children[0], _RequiredUseBranch):
node._children[0]._parent = node._parent
node = node._children[0]
+
else:
for index, child in enumerate(node._children):
if isinstance(child, _RequiredUseBranch) and \
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/dep/
@ 2011-02-05 0:27 Zac Medico
0 siblings, 0 replies; 53+ messages in thread
From: Zac Medico @ 2011-02-05 0:27 UTC (permalink / raw
To: gentoo-commits
commit: 99883fc79e984177d7c5a1e245518f1d76e3e990
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sat Feb 5 00:27:25 2011 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sat Feb 5 00:27:25 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=99883fc7
check_required_use: remove obsolete hunk
---
pym/portage/dep/__init__.py | 9 ---------
1 files changed, 0 insertions(+), 9 deletions(-)
diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py
index 571f6c1..cf83e0a 100644
--- a/pym/portage/dep/__init__.py
+++ b/pym/portage/dep/__init__.py
@@ -2253,15 +2253,6 @@ def check_required_use(required_use, use, iuse_match):
node._parent._children.append(child)
if isinstance(child, _RequiredUseBranch):
child._parent = node._parent
- else:
- for index, child in enumerate(node._children):
- if isinstance(child, _RequiredUseBranch) and \
- child._operator is None and \
- len(child._children) == 1:
- child = child._children[0]
- node._children[index] = child
- if isinstance(child, _RequiredUseBranch):
- child._parent = node
node = node._parent
else:
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/dep/
@ 2011-02-07 11:19 Zac Medico
0 siblings, 0 replies; 53+ messages in thread
From: Zac Medico @ 2011-02-07 11:19 UTC (permalink / raw
To: gentoo-commits
commit: a60acb9f203f56af8225dc7dda7c453a12fd6372
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon Feb 7 11:11:08 2011 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Feb 7 11:11:08 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=a60acb9f
expand_new_virtuals: save atom unevaluated use
This leads to a better unsatisfied USE message than the one reported
in bug 353933, comment #3. TODO: Fix it so that these generated
atoms don't break depgraph._get_dep_chain(), due to not being
identical to the original atoms and therefore breaking
extract_affecting_use().
---
pym/portage/dep/dep_check.py | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/pym/portage/dep/dep_check.py b/pym/portage/dep/dep_check.py
index cd740cd..3381af9 100644
--- a/pym/portage/dep/dep_check.py
+++ b/pym/portage/dep/dep_check.py
@@ -121,8 +121,8 @@ def _expand_new_virtuals(mysplit, edebug, mydbapi, mysettings, myroot="/",
a = []
for pkg in pkgs:
virt_atom = '=' + pkg.cpv
- if x.use:
- virt_atom += str(x.use)
+ if x.unevaluated_atom.use:
+ virt_atom += str(x.unevaluated_atom.use)
virt_atom = Atom(virt_atom)
# According to GLEP 37, RDEPEND is the only dependency
# type that is valid for new-style virtuals. Repoman
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/dep/
@ 2011-02-07 11:45 Zac Medico
0 siblings, 0 replies; 53+ messages in thread
From: Zac Medico @ 2011-02-07 11:45 UTC (permalink / raw
To: gentoo-commits
commit: 7e735aaa79ed26901c66b9444e4098b320abc2d5
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon Feb 7 11:43:06 2011 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Feb 7 11:43:06 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=7e735aaa
expand_new_virtuals: fix logic from prev commit
We need to evaluate conditionals for dependency matching purposes,
though the unevaluated atom will still be available later for other
purposes.
---
pym/portage/dep/dep_check.py | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/pym/portage/dep/dep_check.py b/pym/portage/dep/dep_check.py
index 3381af9..da9b4e5 100644
--- a/pym/portage/dep/dep_check.py
+++ b/pym/portage/dep/dep_check.py
@@ -123,7 +123,11 @@ def _expand_new_virtuals(mysplit, edebug, mydbapi, mysettings, myroot="/",
virt_atom = '=' + pkg.cpv
if x.unevaluated_atom.use:
virt_atom += str(x.unevaluated_atom.use)
- virt_atom = Atom(virt_atom)
+ virt_atom = Atom(virt_atom)
+ virt_atom = virt_atom.evaluate_conditionals(
+ pkg_use_enabled(graph_parent))
+ else:
+ virt_atom = Atom(virt_atom)
# According to GLEP 37, RDEPEND is the only dependency
# type that is valid for new-style virtuals. Repoman
# should enforce this.
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/dep/
@ 2011-02-07 22:20 Zac Medico
0 siblings, 0 replies; 53+ messages in thread
From: Zac Medico @ 2011-02-07 22:20 UTC (permalink / raw
To: gentoo-commits
commit: ccd0f64fbb03880a2f68f1a949ff5ecff5ee88bd
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon Feb 7 22:19:33 2011 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Feb 7 22:19:33 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=ccd0f64f
expand_new_virtuals: fix last commit USE handling
---
pym/portage/dep/dep_check.py | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/pym/portage/dep/dep_check.py b/pym/portage/dep/dep_check.py
index 60896c0..9373ecb 100644
--- a/pym/portage/dep/dep_check.py
+++ b/pym/portage/dep/dep_check.py
@@ -124,8 +124,11 @@ def _expand_new_virtuals(mysplit, edebug, mydbapi, mysettings, myroot="/",
if x.unevaluated_atom.use:
virt_atom += str(x.unevaluated_atom.use)
virt_atom = Atom(virt_atom)
- virt_atom = virt_atom.evaluate_conditionals(
- pkg_use_enabled(graph_parent))
+ if graph_parent is None:
+ virt_atom = virt_atom.evaluate_conditionals(myuse)
+ else:
+ virt_atom = virt_atom.evaluate_conditionals(
+ pkg_use_enabled(graph_parent))
else:
virt_atom = Atom(virt_atom)
# According to GLEP 37, RDEPEND is the only dependency
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/dep/
@ 2011-02-08 0:43 Zac Medico
0 siblings, 0 replies; 53+ messages in thread
From: Zac Medico @ 2011-02-08 0:43 UTC (permalink / raw
To: gentoo-commits
commit: 15389929b684b41801ffc880c4a4e6714e4245b6
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Feb 8 00:42:37 2011 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Feb 8 00:42:37 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=15389929
expand_new_virtuals: handle None for myuse
---
pym/portage/dep/dep_check.py | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/pym/portage/dep/dep_check.py b/pym/portage/dep/dep_check.py
index 9373ecb..ca65601 100644
--- a/pym/portage/dep/dep_check.py
+++ b/pym/portage/dep/dep_check.py
@@ -125,7 +125,11 @@ def _expand_new_virtuals(mysplit, edebug, mydbapi, mysettings, myroot="/",
virt_atom += str(x.unevaluated_atom.use)
virt_atom = Atom(virt_atom)
if graph_parent is None:
- virt_atom = virt_atom.evaluate_conditionals(myuse)
+ if myuse is None:
+ virt_atom = virt_atom.evaluate_conditionals(
+ mysettings.get("PORTAGE_USE", "").split())
+ else:
+ virt_atom = virt_atom.evaluate_conditionals(myuse)
else:
virt_atom = virt_atom.evaluate_conditionals(
pkg_use_enabled(graph_parent))
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/dep/
@ 2011-02-08 18:57 Zac Medico
0 siblings, 0 replies; 53+ messages in thread
From: Zac Medico @ 2011-02-08 18:57 UTC (permalink / raw
To: gentoo-commits
commit: 9e7ca47a113714551103cb8e5e8fe4dd51c7deec
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Feb 8 18:54:51 2011 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Feb 8 18:54:51 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=9e7ca47a
expand_new_virtuals: fix pkg_use_enabled call
AttributeError: 'tuple' object has no attribute 'use'
---
pym/portage/dep/dep_check.py | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/pym/portage/dep/dep_check.py b/pym/portage/dep/dep_check.py
index ca65601..6d2d99d 100644
--- a/pym/portage/dep/dep_check.py
+++ b/pym/portage/dep/dep_check.py
@@ -36,10 +36,10 @@ def _expand_new_virtuals(mysplit, edebug, mydbapi, mysettings, myroot="/",
if parent is not None:
if virt_parent is not None:
graph_parent = virt_parent
- eapi = virt_parent[0].metadata['EAPI']
+ parent = virt_parent[0]
else:
graph_parent = parent
- eapi = parent.metadata["EAPI"]
+ eapi = parent.metadata["EAPI"]
repoman = not mysettings.local_config
if kwargs["use_binaries"]:
portdb = trees[myroot]["bintree"].dbapi
@@ -124,7 +124,7 @@ def _expand_new_virtuals(mysplit, edebug, mydbapi, mysettings, myroot="/",
if x.unevaluated_atom.use:
virt_atom += str(x.unevaluated_atom.use)
virt_atom = Atom(virt_atom)
- if graph_parent is None:
+ if parent is None:
if myuse is None:
virt_atom = virt_atom.evaluate_conditionals(
mysettings.get("PORTAGE_USE", "").split())
@@ -132,7 +132,7 @@ def _expand_new_virtuals(mysplit, edebug, mydbapi, mysettings, myroot="/",
virt_atom = virt_atom.evaluate_conditionals(myuse)
else:
virt_atom = virt_atom.evaluate_conditionals(
- pkg_use_enabled(graph_parent))
+ pkg_use_enabled(parent))
else:
virt_atom = Atom(virt_atom)
# According to GLEP 37, RDEPEND is the only dependency
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/dep/
@ 2011-02-19 22:55 Zac Medico
0 siblings, 0 replies; 53+ messages in thread
From: Zac Medico @ 2011-02-19 22:55 UTC (permalink / raw
To: gentoo-commits
commit: b06d5460f3849973bf5ebd62c2e109c5892f59da
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sat Feb 19 22:53:45 2011 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sat Feb 19 22:53:45 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=b06d5460
check_required_use: improve missing IUSE error
This will fix bug #355629.
---
pym/portage/dep/__init__.py | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py
index a8d05f1..a92b481 100644
--- a/pym/portage/dep/__init__.py
+++ b/pym/portage/dep/__init__.py
@@ -2145,8 +2145,10 @@ def check_required_use(required_use, use, iuse_match):
is_negated = False
if not flag or not iuse_match(flag):
- raise InvalidDependString(
- _("malformed syntax: '%s'") % required_use)
+ msg = _("USE flag '%s' is not in IUSE") \
+ % (flag,)
+ e = InvalidData(msg, category='IUSE.missing')
+ raise InvalidDependString(msg, errors=(e,))
return (flag in use and not is_negated) or \
(flag not in use and is_negated)
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/dep/
@ 2011-03-17 18:44 Zac Medico
0 siblings, 0 replies; 53+ messages in thread
From: Zac Medico @ 2011-03-17 18:44 UTC (permalink / raw
To: gentoo-commits
commit: 730b33af5ab9e2b7efd2ee4928a1d635dfefaab0
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu Mar 17 18:39:28 2011 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu Mar 17 18:39:28 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=730b33af
dep_check: return errors as unicode
This should prevent the following error due to returning raw bytes,
reported in forum thread #869281:
File "pym/_emerge/BlockerDB.py", line 72, in findInstalledBlockers
portage.writemsg("!!! %s/*DEPEND: %s\n" % \
(pkg_location, atoms), noiselevel=-1)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xef in
position 23: ordinal not in range(128)
---
pym/portage/dep/dep_check.py | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/pym/portage/dep/dep_check.py b/pym/portage/dep/dep_check.py
index 4d26f51..7ec01fa 100644
--- a/pym/portage/dep/dep_check.py
+++ b/pym/portage/dep/dep_check.py
@@ -6,6 +6,7 @@ __all__ = ['dep_check', 'dep_eval', 'dep_wordreduce', 'dep_zapdeps']
import logging
import portage
+from portage import _unicode_decode
from portage.dep import Atom, match_from_list, use_reduce
from portage.exception import InvalidDependString, ParseError
from portage.localization import _
@@ -173,8 +174,8 @@ def _expand_new_virtuals(mysplit, edebug, mydbapi, mysettings, myroot="/",
del mytrees["virt_parent"]
if not mycheck[0]:
- raise ParseError(
- "%s: %s '%s'" % (pkg, mycheck[1], depstring))
+ raise ParseError(_unicode_decode("%s: %s '%s'") % \
+ (pkg, mycheck[1], depstring))
# pull in the new-style virtual
mycheck[1].append(virt_atom)
@@ -587,7 +588,7 @@ def dep_check(depstring, mydbapi, mysettings, use="yes", mode=None, myuse=None,
matchall=(use=="all"), excludeall=useforce, opconvert=True, \
token_class=Atom, eapi=eapi)
except InvalidDependString as e:
- return [0, str(e)]
+ return [0, _unicode_decode("%s") % (e,)]
if mysplit == []:
#dependencies were reduced to nothing
@@ -601,7 +602,7 @@ def dep_check(depstring, mydbapi, mysettings, use="yes", mode=None, myuse=None,
use_force=useforce, use_mask=mymasks, use_cache=use_cache,
use_binaries=use_binaries, myroot=myroot, trees=trees)
except ParseError as e:
- return [0, str(e)]
+ return [0, _unicode_decode("%s") % (e,)]
mysplit2=mysplit[:]
mysplit2=dep_wordreduce(mysplit2,mysettings,mydbapi,mode,use_cache=use_cache)
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/dep/
@ 2011-04-11 22:30 Zac Medico
0 siblings, 0 replies; 53+ messages in thread
From: Zac Medico @ 2011-04-11 22:30 UTC (permalink / raw
To: gentoo-commits
commit: f6773621ee2b8aa617be8b8a9724e74bf65079b9
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon Apr 11 22:30:13 2011 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Apr 11 22:30:13 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=f6773621
extract_affecting_use: allow parens in atoms
This fixes bug #363073 in which an InvalidDependString exception is
erroneously triggered by atoms containing EAPI 4 USE dependency
defaults. This case is very similar to bug #354003 which was fixed in
commit 8735222b77e66850213e2aa6a7ea48e744ba0d4f.
---
pym/portage/dep/__init__.py | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py
index a92b481..5911c8c 100644
--- a/pym/portage/dep/__init__.py
+++ b/pym/portage/dep/__init__.py
@@ -2310,6 +2310,7 @@ def extract_affecting_use(mystr, atom):
@rtype: Tuple of two lists of strings
@return: List of use flags that need to be enabled, List of use flag that need to be disabled
"""
+ useflag_re = _get_useflag_re(None)
mysplit = mystr.split()
level = 0
stack = [[]]
@@ -2322,9 +2323,10 @@ def extract_affecting_use(mystr, atom):
else:
flag = conditional[:-1]
- if not flag:
+ if useflag_re.match(flag) is None:
raise InvalidDependString(
- _("malformed syntax: '%s'") % mystr)
+ _("invalid use flag '%s' in conditional '%s'") % \
+ (flag, conditional))
return flag
@@ -2397,7 +2399,7 @@ def extract_affecting_use(mystr, atom):
need_bracket = True
stack[level].append(token)
else:
- if need_bracket or "(" in token or ")" in token or "|" in token:
+ if need_bracket:
raise InvalidDependString(
_("malformed syntax: '%s'") % mystr)
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/dep/
@ 2011-06-08 19:05 Zac Medico
0 siblings, 0 replies; 53+ messages in thread
From: Zac Medico @ 2011-06-08 19:05 UTC (permalink / raw
To: gentoo-commits
commit: 0388944a560582abcbf5c7b0257d48918ac11455
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Wed Jun 8 19:03:25 2011 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Wed Jun 8 19:03:25 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=0388944a
Atom: avoid TypeError with PyPy
Our test cases pass in raw bytes here, which causes _atom_base.__init__
to raise TypeError with PyPy.
---
pym/portage/dep/__init__.py | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py
index 8332a05..8621543 100644
--- a/pym/portage/dep/__init__.py
+++ b/pym/portage/dep/__init__.py
@@ -30,7 +30,7 @@ __all__ = [
import re, sys
import warnings
from itertools import chain
-import portage.exception
+from portage import _unicode_decode
from portage.eapi import eapi_has_slot_deps, eapi_has_src_uri_arrows, \
eapi_has_use_deps, eapi_has_strong_blocks, eapi_has_use_dep_defaults
from portage.exception import InvalidAtom, InvalidData, InvalidDependString
@@ -1057,6 +1057,10 @@ class Atom(_atom_base):
raise TypeError(_("Expected %s, got %s") % \
(_atom_base, type(s)))
+ if not isinstance(s, _atom_base):
+ # Avoid TypeError with from _atom_base.__init__ with PyPy.
+ s = _unicode_decode(s)
+
_atom_base.__init__(s)
if "!" == s[:1]:
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/dep/
@ 2011-06-23 10:56 Arfrever Frehtes Taifersar Arahesis
0 siblings, 0 replies; 53+ messages in thread
From: Arfrever Frehtes Taifersar Arahesis @ 2011-06-23 10:56 UTC (permalink / raw
To: gentoo-commits
commit: c5245c7472cb89f107b2f960b0f708ee009af892
Author: Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Gentoo <DOT> Org>
AuthorDate: Thu Jun 23 10:55:51 2011 +0000
Commit: Arfrever Frehtes Taifersar Arahesis <arfrever <AT> gentoo <DOT> org>
CommitDate: Thu Jun 23 10:55:51 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=c5245c74
Improve indentation for readability.
---
pym/portage/dep/__init__.py | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py
index 5832fd9..fd5ad30 100644
--- a/pym/portage/dep/__init__.py
+++ b/pym/portage/dep/__init__.py
@@ -635,7 +635,7 @@ def flatten(mylist):
_usedep_re = {
- "0": re.compile("^(?P<prefix>[!-]?)(?P<flag>[A-Za-z0-9][A-Za-z0-9+_@-]*)(?P<default>(\(\+\)|\(\-\))?)(?P<suffix>[?=]?)$"),
+ "0": re.compile("^(?P<prefix>[!-]?)(?P<flag>[A-Za-z0-9][A-Za-z0-9+_@-]*)(?P<default>(\(\+\)|\(\-\))?)(?P<suffix>[?=]?)$"),
"4-python": re.compile("^(?P<prefix>[!-]?)(?P<flag>[A-Za-z0-9][A-Za-z0-9+_@.-]*)(?P<default>(\(\+\)|\(\-\))?)(?P<suffix>[?=]?)$"),
}
@@ -1622,7 +1622,7 @@ _extended_pkg = r'[\w+*][\w+*-]*?'
_atom_wildcard_re = re.compile('(?P<simple>(' + _extended_cat + ')/(' + _extended_pkg + '))(:(?P<slot>' + _slot + '))?(' + _repo_separator + '(?P<repo>' + _repo_name + '))?$')
_useflag_re = {
- "0": re.compile(r'^[A-Za-z0-9][A-Za-z0-9+_@-]*$'),
+ "0": re.compile(r'^[A-Za-z0-9][A-Za-z0-9+_@-]*$'),
"4-python": re.compile(r'^[A-Za-z0-9][A-Za-z0-9+_@.-]*$'),
}
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/dep/
@ 2011-09-10 14:31 Zac Medico
0 siblings, 0 replies; 53+ messages in thread
From: Zac Medico @ 2011-09-10 14:31 UTC (permalink / raw
To: gentoo-commits
commit: c626e20620cb7004d0fe55e18288a0f15fcb48d7
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 10 14:25:19 2011 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sat Sep 10 14:25:19 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=c626e206
Atom: add a with_slot method for adding a slot
---
pym/portage/dep/__init__.py | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py
index fd5ad30..89b6f15 100644
--- a/pym/portage/dep/__init__.py
+++ b/pym/portage/dep/__init__.py
@@ -1216,6 +1216,14 @@ class Atom(_atom_base):
return Atom(self.replace(_slot_separator + self.slot, '', 1),
allow_repo=True, allow_wildcard=True)
+ def with_slot(self, slot):
+ atom = remove_slot(self) + _slot_separator + slot
+ if self.repo is not None:
+ atom += _repo_separator + self.repo
+ if self.use is not None:
+ atom += str(self.use)
+ return Atom(atom, allow_repo=True, allow_wildcard=True)
+
def __setattr__(self, name, value):
raise AttributeError("Atom instances are immutable",
self.__class__, name, value)
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/dep/
@ 2011-09-23 0:48 Zac Medico
0 siblings, 0 replies; 53+ messages in thread
From: Zac Medico @ 2011-09-23 0:48 UTC (permalink / raw
To: gentoo-commits
commit: bb6448785038e812b806e14d16497a1a3aacd201
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Fri Sep 23 00:47:48 2011 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Fri Sep 23 00:47:48 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=bb644878
Atom: add a with_repo method for adding a repo
---
pym/portage/dep/__init__.py | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py
index 89b6f15..5bb6bec 100644
--- a/pym/portage/dep/__init__.py
+++ b/pym/portage/dep/__init__.py
@@ -1216,6 +1216,18 @@ class Atom(_atom_base):
return Atom(self.replace(_slot_separator + self.slot, '', 1),
allow_repo=True, allow_wildcard=True)
+ def with_repo(self, repo):
+ if self.slot is None:
+ atom = self
+ else:
+ atom = remove_slot(self)
+ if self.slot is not None:
+ atom += _slot_separator + slot
+ atom += _repo_separator + repo
+ if self.use is not None:
+ atom += str(self.use)
+ return Atom(atom, allow_repo=True, allow_wildcard=True)
+
def with_slot(self, slot):
atom = remove_slot(self) + _slot_separator + slot
if self.repo is not None:
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/dep/
@ 2011-09-23 1:55 Zac Medico
0 siblings, 0 replies; 53+ messages in thread
From: Zac Medico @ 2011-09-23 1:55 UTC (permalink / raw
To: gentoo-commits
commit: 5c0f7b06a0b7f6461b3d38ea5a7c261d767fd82b
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Fri Sep 23 01:54:52 2011 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Fri Sep 23 01:54:52 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=5c0f7b06
Fix Atom.with_repo() bugs.
---
pym/portage/dep/__init__.py | 7 ++-----
1 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py
index 5bb6bec..21e2fac 100644
--- a/pym/portage/dep/__init__.py
+++ b/pym/portage/dep/__init__.py
@@ -1217,12 +1217,9 @@ class Atom(_atom_base):
allow_repo=True, allow_wildcard=True)
def with_repo(self, repo):
- if self.slot is None:
- atom = self
- else:
- atom = remove_slot(self)
+ atom = remove_slot(self)
if self.slot is not None:
- atom += _slot_separator + slot
+ atom += _slot_separator + self.slot
atom += _repo_separator + repo
if self.use is not None:
atom += str(self.use)
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/dep/
@ 2011-10-05 19:58 Zac Medico
0 siblings, 0 replies; 53+ messages in thread
From: Zac Medico @ 2011-10-05 19:58 UTC (permalink / raw
To: gentoo-commits
commit: fcc8105402dc5f0b55aacff0368a5977e271ec3d
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Wed Oct 5 19:51:05 2011 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Wed Oct 5 19:51:05 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=fcc81054
match_to_list: preserve order
This allows us to properly test behavior of best_match_to_list with
different permutations of the input.
---
pym/portage/dep/__init__.py | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py
index 8c65d66..154b8a2 100644
--- a/pym/portage/dep/__init__.py
+++ b/pym/portage/dep/__init__.py
@@ -1776,7 +1776,14 @@ def match_to_list(mypkg, mylist):
@rtype: List
@return: A unique list of package atoms that match the given package atom
"""
- return [ x for x in set(mylist) if match_from_list(x, [mypkg]) ]
+ matches = set()
+ result = []
+ pkgs = [mypkg]
+ for x in mylist:
+ if x not in matches and match_from_list(x, pkgs):
+ matches.add(x)
+ result.append(x)
+ return result
def best_match_to_list(mypkg, mylist):
"""
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/dep/
@ 2012-01-10 18:41 Zac Medico
0 siblings, 0 replies; 53+ messages in thread
From: Zac Medico @ 2012-01-10 18:41 UTC (permalink / raw
To: gentoo-commits
commit: 5be279c9b406c44b82ffa6015dbdb45263124f84
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Jan 10 18:41:29 2012 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Jan 10 18:41:29 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=5be279c9
ExtendedAtomDict: fix for python-trace
---
pym/portage/dep/__init__.py | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py
index 154b8a2..72411b7 100644
--- a/pym/portage/dep/__init__.py
+++ b/pym/portage/dep/__init__.py
@@ -1376,10 +1376,13 @@ class ExtendedAtomDict(portage.cache.mappings.MutableMapping):
yield k
def iteritems(self):
- for item in self._normal.items():
- yield item
- for item in self._extended.items():
- yield item
+ try:
+ for item in self._normal.items():
+ yield item
+ for item in self._extended.items():
+ yield item
+ except AttributeError:
+ pass # FEATURES=python-trace
def __delitem__(self, cp):
if "*" in cp:
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/dep/
@ 2012-04-22 21:41 Zac Medico
0 siblings, 0 replies; 53+ messages in thread
From: Zac Medico @ 2012-04-22 21:41 UTC (permalink / raw
To: gentoo-commits
commit: 43a15b85b5e719b5cb4f49f9f7210fc5129a9d87
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun Apr 22 21:41:03 2012 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun Apr 22 21:41:03 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=43a15b85
dep.__init__: move writemsg import to top
---
pym/portage/dep/__init__.py | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py
index 3832b0b..0a7fc57 100644
--- a/pym/portage/dep/__init__.py
+++ b/pym/portage/dep/__init__.py
@@ -33,7 +33,7 @@ from itertools import chain
import portage
portage.proxy.lazyimport.lazyimport(globals(),
- 'portage.util:cmp_sort_key',
+ 'portage.util:cmp_sort_key,writemsg',
)
from portage import _unicode_decode
@@ -1882,7 +1882,6 @@ def match_from_list(mydep, candidate_list):
if not candidate_list:
return []
- from portage.util import writemsg
if "!" == mydep[:1]:
if "!" == mydep[1:2]:
mydep = mydep[2:]
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/dep/
@ 2012-05-13 9:31 Zac Medico
0 siblings, 0 replies; 53+ messages in thread
From: Zac Medico @ 2012-05-13 9:31 UTC (permalink / raw
To: gentoo-commits
commit: bb1ac9ea20233ba764e989d36c8e8ea1cfc34cb3
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun May 13 09:31:15 2012 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun May 13 09:31:15 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=bb1ac9ea
match_from_list: preserve input in result
This fixes an unintended change in behavior from commit
f31320b67c9f593a2a8592e1a4e547f5f641943a.
---
pym/portage/dep/__init__.py | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py
index 240e223..31ec75c 100644
--- a/pym/portage/dep/__init__.py
+++ b/pym/portage/dep/__init__.py
@@ -2006,16 +2006,18 @@ def match_from_list(mydep, candidate_list):
elif operator in [">", ">=", "<", "<="]:
for x in candidate_list:
- if not hasattr(x, 'cp'):
+ if hasattr(x, 'cp'):
+ pkg = x
+ else:
try:
- x = _pkg_str(remove_slot(x))
+ pkg = _pkg_str(remove_slot(x))
except InvalidData:
continue
- if x.cp != mydep.cp:
+ if pkg.cp != mydep.cp:
continue
try:
- result = vercmp(x.version, mydep.version)
+ result = vercmp(pkg.version, mydep.version)
except ValueError: # pkgcmp may return ValueError during int() conversion
writemsg(_("\nInvalid package name: %s\n") % x, noiselevel=-1)
raise
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/dep/
@ 2012-05-13 20:22 Zac Medico
0 siblings, 0 replies; 53+ messages in thread
From: Zac Medico @ 2012-05-13 20:22 UTC (permalink / raw
To: gentoo-commits
commit: af2d127f671280ac73e5a18a63bea8458c02ed94
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun May 13 20:21:55 2012 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun May 13 20:21:55 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=af2d127f
match_from_list: avoid multiple meanings of mycpv
---
pym/portage/dep/__init__.py | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py
index 0c92857..4ccc669 100644
--- a/pym/portage/dep/__init__.py
+++ b/pym/portage/dep/__init__.py
@@ -1990,7 +1990,7 @@ def match_from_list(mydep, candidate_list):
myver = mysplit[2].lstrip("0")
if not myver or not myver[0].isdigit():
myver = "0"+myver
- mycpv = mysplit[0]+"/"+mysplit[1]+"-"+myver
+ mycpv_cmp = mysplit[0]+"/"+mysplit[1]+"-"+myver
for x in candidate_list:
xs = getattr(x, "cpv_split", None)
if xs is None:
@@ -1999,7 +1999,7 @@ def match_from_list(mydep, candidate_list):
if not myver or not myver[0].isdigit():
myver = "0"+myver
xcpv = xs[0]+"/"+xs[1]+"-"+myver
- if xcpv.startswith(mycpv):
+ if xcpv.startswith(mycpv_cmp):
mylist.append(x)
elif operator == "~": # version, any revision, match
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/dep/
@ 2012-05-13 20:37 Zac Medico
0 siblings, 0 replies; 53+ messages in thread
From: Zac Medico @ 2012-05-13 20:37 UTC (permalink / raw
To: gentoo-commits
commit: 0f8b7f25d2fc2b7e4571d2e739e80ec2538d3a3f
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun May 13 20:36:59 2012 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun May 13 20:36:59 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=0f8b7f25
best_match_to_list: use _pkg_str
---
pym/portage/dep/__init__.py | 12 +++++-------
1 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py
index 4ccc669..3838217 100644
--- a/pym/portage/dep/__init__.py
+++ b/pym/portage/dep/__init__.py
@@ -1886,9 +1886,10 @@ def best_match_to_list(mypkg, mylist):
# For >, <, >=, and <=, the one with the version
# closest to mypkg is the best match.
if mypkg_cpv is None:
- mypkg_cpv = getattr(mypkg, "cpv", None)
- if mypkg_cpv is None:
- mypkg_cpv = remove_slot(mypkg)
+ try:
+ mypkg_cpv = mypkg.cpv
+ except AttributeError:
+ mypkg_cpv = _pkg_str(remove_slot(mypkg))
if bestm.cpv == mypkg_cpv or bestm.cpv == x.cpv:
pass
elif x.cpv == mypkg_cpv:
@@ -1896,11 +1897,8 @@ def best_match_to_list(mypkg, mylist):
else:
# Sort the cpvs to find the one closest to mypkg_cpv
cpv_list = [bestm.cpv, mypkg_cpv, x.cpv]
- ver_map = {}
- for cpv in cpv_list:
- ver_map[cpv] = '-'.join(catpkgsplit(cpv)[2:])
def cmp_cpv(cpv1, cpv2):
- return vercmp(ver_map[cpv1], ver_map[cpv2])
+ return vercmp(cpv1.version, cpv2.version)
cpv_list.sort(key=cmp_sort_key(cmp_cpv))
if cpv_list[0] is mypkg_cpv or cpv_list[-1] is mypkg_cpv:
if cpv_list[1] is x.cpv:
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/dep/
@ 2012-05-14 0:08 Zac Medico
0 siblings, 0 replies; 53+ messages in thread
From: Zac Medico @ 2012-05-14 0:08 UTC (permalink / raw
To: gentoo-commits
commit: d76df09c56687a58581dc279d4f6e37a95acfb9b
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon May 14 00:08:17 2012 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon May 14 00:08:17 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=d76df09c
dep_check: use _pkg_str + vercmp, not pkgcmp
---
pym/portage/dep/dep_check.py | 36 +++++++++++++++++++++---------------
1 files changed, 21 insertions(+), 15 deletions(-)
diff --git a/pym/portage/dep/dep_check.py b/pym/portage/dep/dep_check.py
index 0866673..99a5eb0 100644
--- a/pym/portage/dep/dep_check.py
+++ b/pym/portage/dep/dep_check.py
@@ -1,4 +1,4 @@
-# Copyright 2010-2011 Gentoo Foundation
+# Copyright 2010-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
__all__ = ['dep_check', 'dep_eval', 'dep_wordreduce', 'dep_zapdeps']
@@ -11,7 +11,7 @@ from portage.dep import Atom, match_from_list, use_reduce
from portage.exception import InvalidDependString, ParseError
from portage.localization import _
from portage.util import writemsg, writemsg_level
-from portage.versions import catpkgsplit, cpv_getkey, pkgcmp
+from portage.versions import vercmp, _pkg_str
def _expand_new_virtuals(mysplit, edebug, mydbapi, mysettings, myroot="/",
trees=None, use_mask=None, use_force=None, **kwargs):
@@ -39,14 +39,12 @@ def _expand_new_virtuals(mysplit, edebug, mydbapi, mysettings, myroot="/",
parent = mytrees.get("parent")
virt_parent = mytrees.get("virt_parent")
graph_parent = None
- eapi = None
if parent is not None:
if virt_parent is not None:
graph_parent = virt_parent
parent = virt_parent
else:
graph_parent = parent
- eapi = parent.metadata["EAPI"]
repoman = not mysettings.local_config
if kwargs["use_binaries"]:
portdb = trees[myroot]["bintree"].dbapi
@@ -352,8 +350,14 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None):
avail_pkg = mydbapi.match(atom.without_use)
if avail_pkg:
avail_pkg = avail_pkg[-1] # highest (ascending order)
- avail_slot = Atom("%s:%s" % (atom.cp,
- mydbapi.aux_get(avail_pkg, ["SLOT"])[0]))
+ try:
+ slot = avail_pkg.slot
+ except AttributeError:
+ eapi, slot, repo = mydbapi.aux_get(avail_pkg,
+ ["EAPI", "SLOT", "repository"])
+ avail_pkg = _pkg_str(avail_pkg, eapi=eapi,
+ slot=slot, repo=repo)
+ avail_slot = Atom("%s:%s" % (atom.cp, slot))
if not avail_pkg:
all_available = False
all_use_satisfied = False
@@ -368,16 +372,19 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None):
avail_pkg_use = avail_pkg_use[-1]
if avail_pkg_use != avail_pkg:
avail_pkg = avail_pkg_use
- avail_slot = Atom("%s:%s" % (atom.cp,
- mydbapi.aux_get(avail_pkg, ["SLOT"])[0]))
+ try:
+ slot = avail_pkg.slot
+ except AttributeError:
+ eapi, slot, repo = mydbapi.aux_get(avail_pkg,
+ ["EAPI", "SLOT", "repository"])
+ avail_pkg = _pkg_str(avail_pkg,
+ eapi=eapi, slot=slot, repo=repo)
slot_map[avail_slot] = avail_pkg
- pkg_cp = cpv_getkey(avail_pkg)
- highest_cpv = cp_map.get(pkg_cp)
+ highest_cpv = cp_map.get(avail_pkg.cp)
if highest_cpv is None or \
- pkgcmp(catpkgsplit(avail_pkg)[1:],
- catpkgsplit(highest_cpv)[1:]) > 0:
- cp_map[pkg_cp] = avail_pkg
+ vercmp(avail_pkg.version, highest_cpv.version) > 0:
+ cp_map[avail_pkg.cp] = avail_pkg
this_choice = (atoms, slot_map, cp_map, all_available)
if all_available:
@@ -515,8 +522,7 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None):
for cp in intersecting_cps:
version_1 = cp_map_1[cp]
version_2 = cp_map_2[cp]
- difference = pkgcmp(catpkgsplit(version_1)[1:],
- catpkgsplit(version_2)[1:])
+ difference = vercmp(version_1.version, version_2.version)
if difference != 0:
if difference > 0:
has_upgrade = True
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/dep/
@ 2012-05-14 6:54 Zac Medico
0 siblings, 0 replies; 53+ messages in thread
From: Zac Medico @ 2012-05-14 6:54 UTC (permalink / raw
To: gentoo-commits
commit: 61b370bd3154250d600bef885073a6edb6fee2bb
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon May 14 06:54:41 2012 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon May 14 06:54:41 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=61b370bd
Atom: use a single _get_atom_re() call
---
pym/portage/dep/__init__.py | 29 +++++++++++++++--------------
1 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py
index 55ed481..152af0a 100644
--- a/pym/portage/dep/__init__.py
+++ b/pym/portage/dep/__init__.py
@@ -1086,6 +1086,7 @@ class Atom(_atom_base):
_atom_base.__init__(s)
+ atom_re = _get_atom_re(eapi)
if eapi_has_repo_deps(eapi):
allow_repo = True
@@ -1098,7 +1099,7 @@ class Atom(_atom_base):
else:
blocker = False
self.__dict__['blocker'] = blocker
- m = _get_atom_re(eapi).match(s)
+ m = atom_re.match(s)
extended_syntax = False
if m is None:
if allow_wildcard:
@@ -1117,32 +1118,32 @@ class Atom(_atom_base):
else:
raise InvalidAtom(self)
elif m.group('op') is not None:
- base = _get_atom_re(eapi).groupindex['op']
+ base = atom_re.groupindex['op']
op = m.group(base + 1)
cpv = m.group(base + 2)
cp = m.group(base + 3)
- slot = m.group(_get_atom_re(eapi).groups - 2)
- repo = m.group(_get_atom_re(eapi).groups - 1)
- use_str = m.group(_get_atom_re(eapi).groups)
+ slot = m.group(atom_re.groups - 2)
+ repo = m.group(atom_re.groups - 1)
+ use_str = m.group(atom_re.groups)
if m.group(base + 4) is not None:
raise InvalidAtom(self)
elif m.group('star') is not None:
- base = _get_atom_re(eapi).groupindex['star']
+ base = atom_re.groupindex['star']
op = '=*'
cpv = m.group(base + 1)
cp = m.group(base + 2)
- slot = m.group(_get_atom_re(eapi).groups - 2)
- repo = m.group(_get_atom_re(eapi).groups - 1)
- use_str = m.group(_get_atom_re(eapi).groups)
+ slot = m.group(atom_re.groups - 2)
+ repo = m.group(atom_re.groups - 1)
+ use_str = m.group(atom_re.groups)
if m.group(base + 3) is not None:
raise InvalidAtom(self)
elif m.group('simple') is not None:
op = None
- cpv = cp = m.group(_get_atom_re(eapi).groupindex['simple'] + 1)
- slot = m.group(_get_atom_re(eapi).groups - 2)
- repo = m.group(_get_atom_re(eapi).groups - 1)
- use_str = m.group(_get_atom_re(eapi).groups)
- if m.group(_get_atom_re(eapi).groupindex['simple'] + 2) is not None:
+ cpv = cp = m.group(atom_re.groupindex['simple'] + 1)
+ slot = m.group(atom_re.groups - 2)
+ repo = m.group(atom_re.groups - 1)
+ use_str = m.group(atom_re.groups)
+ if m.group(atom_re.groupindex['simple'] + 2) is not None:
raise InvalidAtom(self)
else:
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/dep/
@ 2012-05-30 0:47 Arfrever Frehtes Taifersar Arahesis
0 siblings, 0 replies; 53+ messages in thread
From: Arfrever Frehtes Taifersar Arahesis @ 2012-05-30 0:47 UTC (permalink / raw
To: gentoo-commits
commit: 587cce4816afc7d57b3edf0be6c0670ec0be89c9
Author: Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Apache <DOT> Org>
AuthorDate: Wed May 30 00:40:15 2012 +0000
Commit: Arfrever Frehtes Taifersar Arahesis <arfrever.fta <AT> gmail <DOT> com>
CommitDate: Wed May 30 00:40:15 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=587cce48
portage.dep.Atom: Ignore allow_repo argument when non-None eapi is passed.
Allow repository when allow_repo=False is not passed and eapi=None is passed.
---
pym/portage/dep/__init__.py | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py
index 152af0a..d29a4c4 100644
--- a/pym/portage/dep/__init__.py
+++ b/pym/portage/dep/__init__.py
@@ -1068,11 +1068,11 @@ class Atom(_atom_base):
def __init__(self, forbid_overlap=False):
self.overlap = self._overlap(forbid=forbid_overlap)
- def __new__(cls, s, unevaluated_atom=None, allow_wildcard=False, allow_repo=False,
+ def __new__(cls, s, unevaluated_atom=None, allow_wildcard=False, allow_repo=None,
_use=None, eapi=None, is_valid_flag=None):
return _atom_base.__new__(cls, s)
- def __init__(self, s, unevaluated_atom=None, allow_wildcard=False, allow_repo=False,
+ def __init__(self, s, unevaluated_atom=None, allow_wildcard=False, allow_repo=None,
_use=None, eapi=None, is_valid_flag=None):
if isinstance(s, Atom):
# This is an efficiency assertion, to ensure that the Atom
@@ -1087,8 +1087,13 @@ class Atom(_atom_base):
_atom_base.__init__(s)
atom_re = _get_atom_re(eapi)
- if eapi_has_repo_deps(eapi):
- allow_repo = True
+
+ if eapi is not None:
+ # Ignore allow_repo when eapi is specified.
+ allow_repo = eapi_has_repo_deps(eapi)
+ else:
+ if allow_repo is None:
+ allow_repo = True
if "!" == s[:1]:
blocker = self._blocker(forbid_overlap=("!" == s[1:2]))
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/dep/
@ 2012-06-10 20:48 Zac Medico
0 siblings, 0 replies; 53+ messages in thread
From: Zac Medico @ 2012-06-10 20:48 UTC (permalink / raw
To: gentoo-commits
commit: ff8d4c0fe3c91ae739e3e6518e90c0e8b0fe35d0
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun Jun 10 20:48:24 2012 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun Jun 10 20:48:24 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=ff8d4c0f
_get_atom_re: handle many combinations
A namedtuple of _eapi_attrs is used to hash atom regular expressions,
making it easy to handle many different combinations, as will be
necessary for the addition of new features such as abi-slot deps.
---
pym/portage/dep/__init__.py | 62 +++++++++++++++++++++++++++++-------------
1 files changed, 43 insertions(+), 19 deletions(-)
diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py
index ade3a73..66ff1e9 100644
--- a/pym/portage/dep/__init__.py
+++ b/pym/portage/dep/__init__.py
@@ -27,6 +27,7 @@ __all__ = [
# "a? ( b? ( z ) ) -- Valid
#
+import collections
import re, sys
import warnings
from itertools import chain
@@ -54,6 +55,48 @@ if sys.hexversion >= 0x3000000:
# stable keywords, make these warnings unconditional.
_internal_warnings = False
+_eapi_attrs = collections.namedtuple('_eapi_attrs',
+ 'dots_in_PN')
+
+_eapi_attrs_cache = {}
+
+def _get_eapi_attrs(eapi):
+ eapi_attrs = _eapi_attrs_cache.get(eapi)
+ if eapi_attrs is not None:
+ return eapi_attrs
+
+ eapi_attrs = _eapi_attrs(
+ dots_in_PN = (eapi is None or eapi_allows_dots_in_PN(eapi))
+ )
+
+ _eapi_attrs_cache[eapi] = eapi_attrs
+ return eapi_attrs
+
+_atom_re_cache = {}
+
+def _get_atom_re(eapi):
+ eapi_attrs = _get_eapi_attrs(eapi)
+ atom_re = _atom_re_cache.get(eapi_attrs)
+ if atom_re is not None:
+ return atom_re
+
+ if eapi_attrs.dots_in_PN:
+ cp_re = _cp['dots_allowed_in_PN']
+ cpv_re = _cpv['dots_allowed_in_PN']
+ else:
+ cp_re = _cp['dots_disallowed_in_PN']
+ cpv_re = _cpv['dots_disallowed_in_PN']
+
+ atom_re = re.compile('^(?P<without_use>(?:' +
+ '(?P<op>' + _op + cpv_re + ')|' +
+ '(?P<star>=' + cpv_re + r'\*)|' +
+ '(?P<simple>' + cp_re + '))' +
+ '(' + _slot_separator + _slot + ')?' +
+ _repo + ')(' + _use + ')?$', re.VERBOSE)
+
+ _atom_re_cache[eapi_attrs] = atom_re
+ return atom_re
+
def cpvequal(cpv1, cpv2):
"""
@@ -1666,25 +1709,6 @@ _repo_separator = "::"
_repo_name = r'[\w][\w-]*'
_repo = r'(?:' + _repo_separator + '(' + _repo_name + ')' + ')?'
-_atom_re = {
- "dots_disallowed_in_PN": re.compile('^(?P<without_use>(?:' +
- '(?P<op>' + _op + _cpv['dots_disallowed_in_PN'] + ')|' +
- '(?P<star>=' + _cpv['dots_disallowed_in_PN'] + r'\*)|' +
- '(?P<simple>' + _cp['dots_disallowed_in_PN'] + '))' +
- '(' + _slot_separator + _slot + ')?' + _repo + ')(' + _use + ')?$', re.VERBOSE),
- "dots_allowed_in_PN": re.compile('^(?P<without_use>(?:' +
- '(?P<op>' + _op + _cpv['dots_allowed_in_PN'] + ')|' +
- '(?P<star>=' + _cpv['dots_allowed_in_PN'] + r'\*)|' +
- '(?P<simple>' + _cp['dots_allowed_in_PN'] + '))' +
- '(' + _slot_separator + _slot + ')?' + _repo + ')(' + _use + ')?$', re.VERBOSE),
-}
-
-def _get_atom_re(eapi):
- if eapi is None or eapi_allows_dots_in_PN(eapi):
- return _atom_re["dots_allowed_in_PN"]
- else:
- return _atom_re["dots_disallowed_in_PN"]
-
_extended_cat = r'[\w+*][\w+.*-]*'
_extended_pkg = {
"dots_disallowed_in_PN": r'[\w+*][\w+*-]*?',
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/dep/
@ 2012-06-10 21:08 Zac Medico
0 siblings, 0 replies; 53+ messages in thread
From: Zac Medico @ 2012-06-10 21:08 UTC (permalink / raw
To: gentoo-commits
commit: 227b7f4287b758efa3ee25d13abcd21780885b83
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun Jun 10 21:08:14 2012 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun Jun 10 21:08:14 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=227b7f42
Atom: use _eapi_attrs in constructor
---
pym/portage/dep/__init__.py | 25 +++++++++++++++----------
1 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py
index 66ff1e9..eba0a6c 100644
--- a/pym/portage/dep/__init__.py
+++ b/pym/portage/dep/__init__.py
@@ -56,7 +56,7 @@ if sys.hexversion >= 0x3000000:
_internal_warnings = False
_eapi_attrs = collections.namedtuple('_eapi_attrs',
- 'dots_in_PN')
+ 'dots_in_PN repo_deps slot_deps strong_blocks use_deps use_dep_defaults')
_eapi_attrs_cache = {}
@@ -66,7 +66,12 @@ def _get_eapi_attrs(eapi):
return eapi_attrs
eapi_attrs = _eapi_attrs(
- dots_in_PN = (eapi is None or eapi_allows_dots_in_PN(eapi))
+ dots_in_PN = (eapi is None or eapi_allows_dots_in_PN(eapi)),
+ repo_deps = (eapi is None or eapi_has_repo_deps(eapi)),
+ slot_deps = (eapi is None or eapi_has_slot_deps(eapi)),
+ strong_blocks = (eapi is None or eapi_has_strong_blocks(eapi)),
+ use_deps = (eapi is None or eapi_has_use_deps(eapi)),
+ use_dep_defaults = (eapi is None or eapi_has_use_dep_defaults(eapi))
)
_eapi_attrs_cache[eapi] = eapi_attrs
@@ -74,8 +79,7 @@ def _get_eapi_attrs(eapi):
_atom_re_cache = {}
-def _get_atom_re(eapi):
- eapi_attrs = _get_eapi_attrs(eapi)
+def _get_atom_re(eapi_attrs):
atom_re = _atom_re_cache.get(eapi_attrs)
if atom_re is not None:
return atom_re
@@ -1132,11 +1136,12 @@ class Atom(_atom_base):
_atom_base.__init__(s)
- atom_re = _get_atom_re(eapi)
+ eapi_attrs = _get_eapi_attrs(eapi)
+ atom_re = _get_atom_re(eapi_attrs)
if eapi is not None:
# Ignore allow_repo when eapi is specified.
- allow_repo = eapi_has_repo_deps(eapi)
+ allow_repo = eapi_attrs.repo_deps
else:
if allow_repo is None:
allow_repo = True
@@ -1244,16 +1249,16 @@ class Atom(_atom_base):
if not isinstance(eapi, basestring):
raise TypeError('expected eapi argument of ' + \
'%s, got %s: %s' % (basestring, type(eapi), eapi,))
- if self.slot and not eapi_has_slot_deps(eapi):
+ if self.slot and not eapi_attrs.slot_deps:
raise InvalidAtom(
_("Slot deps are not allowed in EAPI %s: '%s'") \
% (eapi, self), category='EAPI.incompatible')
if self.use:
- if not eapi_has_use_deps(eapi):
+ if not eapi_attrs.use_deps:
raise InvalidAtom(
_("Use deps are not allowed in EAPI %s: '%s'") \
% (eapi, self), category='EAPI.incompatible')
- elif not eapi_has_use_dep_defaults(eapi) and \
+ elif not eapi_attrs.use_dep_defaults and \
(self.use.missing_enabled or self.use.missing_disabled):
raise InvalidAtom(
_("Use dep defaults are not allowed in EAPI %s: '%s'") \
@@ -1276,7 +1281,7 @@ class Atom(_atom_base):
"conditional '%s' in atom '%s' is not in IUSE") \
% (flag, conditional_str % flag, self)
raise InvalidAtom(msg, category='IUSE.missing')
- if self.blocker and self.blocker.overlap.forbid and not eapi_has_strong_blocks(eapi):
+ if self.blocker and self.blocker.overlap.forbid and not eapi_attrs.strong_blocks:
raise InvalidAtom(
_("Strong blocks are not allowed in EAPI %s: '%s'") \
% (eapi, self), category='EAPI.incompatible')
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/dep/
@ 2012-06-10 21:51 Zac Medico
0 siblings, 0 replies; 53+ messages in thread
From: Zac Medico @ 2012-06-10 21:51 UTC (permalink / raw
To: gentoo-commits
commit: 9255afd8c6398ce4a58beaff9285fcc3b96a2713
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun Jun 10 21:51:25 2012 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun Jun 10 21:51:25 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=9255afd8
_get_usedep_re: use _eapi_attrs
---
pym/portage/dep/__init__.py | 76 ++++++++++++++++++++++++------------------
1 files changed, 43 insertions(+), 33 deletions(-)
diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py
index eba0a6c..53761e7 100644
--- a/pym/portage/dep/__init__.py
+++ b/pym/portage/dep/__init__.py
@@ -56,17 +56,23 @@ if sys.hexversion >= 0x3000000:
_internal_warnings = False
_eapi_attrs = collections.namedtuple('_eapi_attrs',
- 'dots_in_PN repo_deps slot_deps strong_blocks use_deps use_dep_defaults')
+ 'dots_in_PN dots_in_use_flags repo_deps slot_deps '
+ 'strong_blocks use_deps use_dep_defaults')
_eapi_attrs_cache = {}
def _get_eapi_attrs(eapi):
+ """
+ When eapi is None then validation is not as strict, since we want the
+ same to work for multiple EAPIs that may have slightly different rules.
+ """
eapi_attrs = _eapi_attrs_cache.get(eapi)
if eapi_attrs is not None:
return eapi_attrs
eapi_attrs = _eapi_attrs(
dots_in_PN = (eapi is None or eapi_allows_dots_in_PN(eapi)),
+ dots_in_use_flags = (eapi is None or eapi_allows_dots_in_use_flags(eapi)),
repo_deps = (eapi is None or eapi_has_repo_deps(eapi)),
slot_deps = (eapi is None or eapi_has_slot_deps(eapi)),
strong_blocks = (eapi is None or eapi_has_strong_blocks(eapi)),
@@ -101,6 +107,31 @@ def _get_atom_re(eapi_attrs):
_atom_re_cache[eapi_attrs] = atom_re
return atom_re
+_usedep_re_cache = {}
+
+def _get_usedep_re(eapi_attrs):
+ """
+ @param eapi_attrs: The EAPI attributes from _get_eapi_attrs
+ @type eapi_attrs: _eapi_attrs
+ @rtype: regular expression object
+ @return: A regular expression object that matches valid USE deps for the
+ given eapi.
+ """
+ usedep_re = _usedep_re_cache.get(eapi_attrs)
+ if usedep_re is not None:
+ return usedep_re
+
+ if eapi_attrs.dots_in_use_flags:
+ _flag_re = r'[A-Za-z0-9][A-Za-z0-9+_@.-]*'
+ else:
+ _flag_re = r'[A-Za-z0-9][A-Za-z0-9+_@-]*'
+
+ usedep_re = re.compile(r'^(?P<prefix>[!-]?)(?P<flag>' +
+ _flag_re + r')(?P<default>(\(\+\)|\(\-\))?)(?P<suffix>[?=]?)$')
+
+ _usedep_re_cache[eapi_attrs] = usedep_re
+ return usedep_re
+
def cpvequal(cpv1, cpv2):
"""
@@ -701,30 +732,9 @@ def flatten(mylist):
newlist.append(x)
return newlist
-
-_usedep_re = {
- "dots_disallowed_in_use_flags": re.compile("^(?P<prefix>[!-]?)(?P<flag>[A-Za-z0-9][A-Za-z0-9+_@-]*)(?P<default>(\(\+\)|\(\-\))?)(?P<suffix>[?=]?)$"),
- "dots_allowed_in_use_flags": re.compile("^(?P<prefix>[!-]?)(?P<flag>[A-Za-z0-9][A-Za-z0-9+_@.-]*)(?P<default>(\(\+\)|\(\-\))?)(?P<suffix>[?=]?)$"),
-}
-
-def _get_usedep_re(eapi):
- """
- When eapi is None then validation is not as strict, since we want the
- same to work for multiple EAPIs that may have slightly different rules.
- @param eapi: The EAPI
- @type eapi: String or None
- @rtype: regular expression object
- @return: A regular expression object that matches valid USE deps for the
- given eapi.
- """
- if eapi is None or eapi_allows_dots_in_use_flags(eapi):
- return _usedep_re["dots_allowed_in_use_flags"]
- else:
- return _usedep_re["dots_disallowed_in_use_flags"]
-
class _use_dep(object):
- __slots__ = ("__weakref__", "eapi", "conditional", "missing_enabled", "missing_disabled",
+ __slots__ = ("_eapi_attrs", "conditional", "missing_enabled", "missing_disabled",
"disabled", "enabled", "tokens", "required")
class _conditionals_class(object):
@@ -750,10 +760,10 @@ class _use_dep(object):
'not_equal': '!%s=',
}
- def __init__(self, use, eapi, enabled_flags=None, disabled_flags=None, missing_enabled=None, \
+ def __init__(self, use, eapi_attrs, enabled_flags=None, disabled_flags=None, missing_enabled=None,
missing_disabled=None, conditional=None, required=None):
- self.eapi = eapi
+ self._eapi_attrs = eapi_attrs
if enabled_flags is not None:
#A shortcut for the classe's own methods.
@@ -782,7 +792,7 @@ class _use_dep(object):
no_default = set()
conditional = {}
- usedep_re = _get_usedep_re(self.eapi)
+ usedep_re = _get_usedep_re(self._eapi_attrs)
for x in use:
m = usedep_re.match(x)
@@ -885,7 +895,7 @@ class _use_dep(object):
disabled_flags = set(self.disabled)
tokens = []
- usedep_re = _get_usedep_re(self.eapi)
+ usedep_re = _get_usedep_re(self._eapi_attrs)
for x in self.tokens:
m = usedep_re.match(x)
@@ -921,7 +931,7 @@ class _use_dep(object):
else:
tokens.append(x)
- return _use_dep(tokens, self.eapi, enabled_flags=enabled_flags, disabled_flags=disabled_flags, \
+ return _use_dep(tokens, self._eapi_attrs, enabled_flags=enabled_flags, disabled_flags=disabled_flags,
missing_enabled=self.missing_enabled, missing_disabled=self.missing_disabled, required=self.required)
def violated_conditionals(self, other_use, is_valid_flag, parent_use=None):
@@ -943,7 +953,7 @@ class _use_dep(object):
def validate_flag(flag):
return is_valid_flag(flag) or flag in all_defaults
- usedep_re = _get_usedep_re(self.eapi)
+ usedep_re = _get_usedep_re(self._eapi_attrs)
for x in self.tokens:
m = usedep_re.match(x)
@@ -1035,7 +1045,7 @@ class _use_dep(object):
tokens.append(x)
conditional.setdefault("disabled", set()).add(flag)
- return _use_dep(tokens, self.eapi, enabled_flags=enabled_flags, disabled_flags=disabled_flags, \
+ return _use_dep(tokens, self._eapi_attrs, enabled_flags=enabled_flags, disabled_flags=disabled_flags,
missing_enabled=self.missing_enabled, missing_disabled=self.missing_disabled, \
conditional=conditional, required=self.required)
@@ -1055,7 +1065,7 @@ class _use_dep(object):
missing_disabled = self.missing_disabled
tokens = []
- usedep_re = _get_usedep_re(self.eapi)
+ usedep_re = _get_usedep_re(self._eapi_attrs)
for x in self.tokens:
m = usedep_re.match(x)
@@ -1091,7 +1101,7 @@ class _use_dep(object):
else:
tokens.append(x)
- return _use_dep(tokens, self.eapi, enabled_flags=enabled_flags, disabled_flags=disabled_flags, \
+ return _use_dep(tokens, self._eapi_attrs, enabled_flags=enabled_flags, disabled_flags=disabled_flags,
missing_enabled=missing_enabled, missing_disabled=missing_disabled, required=self.required)
if sys.hexversion < 0x3000000:
@@ -1224,7 +1234,7 @@ class Atom(_atom_base):
if _use is not None:
use = _use
else:
- use = _use_dep(use_str[1:-1].split(","), eapi)
+ use = _use_dep(use_str[1:-1].split(","), eapi_attrs)
without_use = Atom(m.group('without_use'), allow_repo=allow_repo)
else:
use = None
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/dep/
@ 2012-06-10 22:16 Zac Medico
0 siblings, 0 replies; 53+ messages in thread
From: Zac Medico @ 2012-06-10 22:16 UTC (permalink / raw
To: gentoo-commits
commit: 7e22e1e4c339890c4ca132bdbd46bd12edc6370f
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun Jun 10 22:16:03 2012 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun Jun 10 22:16:03 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=7e22e1e4
_get_useflag_re: use _eapi_attrs
---
pym/portage/dep/__init__.py | 48 +++++++++++++++++++++++++-----------------
1 files changed, 28 insertions(+), 20 deletions(-)
diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py
index 53761e7..d2b885b 100644
--- a/pym/portage/dep/__init__.py
+++ b/pym/portage/dep/__init__.py
@@ -132,6 +132,34 @@ def _get_usedep_re(eapi_attrs):
_usedep_re_cache[eapi_attrs] = usedep_re
return usedep_re
+_useflag_re_cache = {}
+
+def _get_useflag_re(eapi):
+ """
+ When eapi is None then validation is not as strict, since we want the
+ same to work for multiple EAPIs that may have slightly different rules.
+ @param eapi: The EAPI
+ @type eapi: String or None
+ @rtype: regular expression object
+ @return: A regular expression object that matches valid USE flags for the
+ given eapi.
+ """
+ eapi_attrs = _get_eapi_attrs(eapi)
+ cache_key = eapi_attrs.dots_in_use_flags
+ useflag_re = _useflag_re_cache.get(cache_key)
+ if useflag_re is not None:
+ return useflag_re
+
+ if eapi_attrs.dots_in_use_flags:
+ flag_re = r'[A-Za-z0-9][A-Za-z0-9+_@.-]*'
+ else:
+ flag_re = r'[A-Za-z0-9][A-Za-z0-9+_@-]*'
+
+ useflag_re = re.compile(r'^' + flag_re + r'$')
+
+ _useflag_re_cache[cache_key] = useflag_re
+ return useflag_re
+
def cpvequal(cpv1, cpv2):
"""
@@ -1741,26 +1769,6 @@ def _get_atom_wildcard_re(eapi):
else:
return _atom_wildcard_re["dots_disallowed_in_PN"]
-_useflag_re = {
- "dots_disallowed_in_use_flags": re.compile(r'^[A-Za-z0-9][A-Za-z0-9+_@-]*$'),
- "dots_allowed_in_use_flags": re.compile(r'^[A-Za-z0-9][A-Za-z0-9+_@.-]*$'),
-}
-
-def _get_useflag_re(eapi):
- """
- When eapi is None then validation is not as strict, since we want the
- same to work for multiple EAPIs that may have slightly different rules.
- @param eapi: The EAPI
- @type eapi: String or None
- @rtype: regular expression object
- @return: A regular expression object that matches valid USE flags for the
- given eapi.
- """
- if eapi is None or eapi_allows_dots_in_use_flags(eapi):
- return _useflag_re["dots_allowed_in_use_flags"]
- else:
- return _useflag_re["dots_disallowed_in_use_flags"]
-
def isvalidatom(atom, allow_blockers=False, allow_wildcard=False, allow_repo=False):
"""
Check to see if a depend atom is valid
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/dep/
@ 2012-06-10 22:20 Zac Medico
0 siblings, 0 replies; 53+ messages in thread
From: Zac Medico @ 2012-06-10 22:20 UTC (permalink / raw
To: gentoo-commits
commit: 2a5d810445fa819ce64218b17dc70b3228cd61c5
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun Jun 10 22:20:23 2012 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun Jun 10 22:20:23 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=2a5d8104
_get_atom_re: share cache between more EAPIs
---
pym/portage/dep/__init__.py | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py
index d2b885b..27b90b9 100644
--- a/pym/portage/dep/__init__.py
+++ b/pym/portage/dep/__init__.py
@@ -86,7 +86,8 @@ def _get_eapi_attrs(eapi):
_atom_re_cache = {}
def _get_atom_re(eapi_attrs):
- atom_re = _atom_re_cache.get(eapi_attrs)
+ cache_key = eapi_attrs.dots_in_PN
+ atom_re = _atom_re_cache.get(cache_key)
if atom_re is not None:
return atom_re
@@ -104,7 +105,7 @@ def _get_atom_re(eapi_attrs):
'(' + _slot_separator + _slot + ')?' +
_repo + ')(' + _use + ')?$', re.VERBOSE)
- _atom_re_cache[eapi_attrs] = atom_re
+ _atom_re_cache[cache_key] = atom_re
return atom_re
_usedep_re_cache = {}
@@ -117,7 +118,8 @@ def _get_usedep_re(eapi_attrs):
@return: A regular expression object that matches valid USE deps for the
given eapi.
"""
- usedep_re = _usedep_re_cache.get(eapi_attrs)
+ cache_key = eapi_attrs.dots_in_use_flags
+ usedep_re = _usedep_re_cache.get(cache_key)
if usedep_re is not None:
return usedep_re
@@ -129,7 +131,7 @@ def _get_usedep_re(eapi_attrs):
usedep_re = re.compile(r'^(?P<prefix>[!-]?)(?P<flag>' +
_flag_re + r')(?P<default>(\(\+\)|\(\-\))?)(?P<suffix>[?=]?)$')
- _usedep_re_cache[eapi_attrs] = usedep_re
+ _usedep_re_cache[cache_key] = usedep_re
return usedep_re
_useflag_re_cache = {}
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/dep/
@ 2012-06-10 22:37 Zac Medico
0 siblings, 0 replies; 53+ messages in thread
From: Zac Medico @ 2012-06-10 22:37 UTC (permalink / raw
To: gentoo-commits
commit: 78e30816903b489106885232c55a2717b51986f8
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun Jun 10 22:37:06 2012 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun Jun 10 22:37:06 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=78e30816
_get_atom_wildcard_re: use _eapi_attrs
---
pym/portage/dep/__init__.py | 38 ++++++++++++++++++++++----------------
1 files changed, 22 insertions(+), 16 deletions(-)
diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py
index 27b90b9..5e747a1 100644
--- a/pym/portage/dep/__init__.py
+++ b/pym/portage/dep/__init__.py
@@ -108,6 +108,27 @@ def _get_atom_re(eapi_attrs):
_atom_re_cache[cache_key] = atom_re
return atom_re
+_atom_wildcard_re_cache = {}
+
+def _get_atom_wildcard_re(eapi_attrs):
+ cache_key = eapi_attrs.dots_in_PN
+ atom_re = _atom_wildcard_re_cache.get(cache_key)
+ if atom_re is not None:
+ return atom_re
+
+ if eapi_attrs.dots_in_PN:
+ pkg_re = r'[\w+*][\w+.*-]*?'
+ else:
+ pkg_re = r'[\w+*][\w+*-]*?'
+
+ atom_re = re.compile(r'(?P<simple>(' +
+ _extended_cat + r')/(' + pkg_re +
+ r'))(:(?P<slot>' + _slot + r'))?(' +
+ _repo_separator + r'(?P<repo>' + _repo_name + r'))?$')
+
+ _atom_wildcard_re_cache[cache_key] = atom_re
+ return atom_re
+
_usedep_re_cache = {}
def _get_usedep_re(eapi_attrs):
@@ -1199,7 +1220,7 @@ class Atom(_atom_base):
extended_syntax = False
if m is None:
if allow_wildcard:
- m = _get_atom_wildcard_re(eapi).match(s)
+ m = _get_atom_wildcard_re(eapi_attrs).match(s)
if m is None:
raise InvalidAtom(self)
op = None
@@ -1755,21 +1776,6 @@ _repo_name = r'[\w][\w-]*'
_repo = r'(?:' + _repo_separator + '(' + _repo_name + ')' + ')?'
_extended_cat = r'[\w+*][\w+.*-]*'
-_extended_pkg = {
- "dots_disallowed_in_PN": r'[\w+*][\w+*-]*?',
- "dots_allowed_in_PN": r'[\w+*][\w+.*-]*?',
-}
-
-_atom_wildcard_re = {
- "dots_disallowed_in_PN": re.compile('(?P<simple>(' + _extended_cat + ')/(' + _extended_pkg['dots_disallowed_in_PN'] + '))(:(?P<slot>' + _slot + '))?(' + _repo_separator + '(?P<repo>' + _repo_name + '))?$'),
- "dots_allowed_in_PN": re.compile('(?P<simple>(' + _extended_cat + ')/(' + _extended_pkg['dots_allowed_in_PN'] + '))(:(?P<slot>' + _slot + '))?(' + _repo_separator + '(?P<repo>' + _repo_name + '))?$'),
-}
-
-def _get_atom_wildcard_re(eapi):
- if eapi is None or eapi_allows_dots_in_PN(eapi):
- return _atom_wildcard_re["dots_allowed_in_PN"]
- else:
- return _atom_wildcard_re["dots_disallowed_in_PN"]
def isvalidatom(atom, allow_blockers=False, allow_wildcard=False, allow_repo=False):
"""
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/dep/
@ 2012-06-10 22:43 Zac Medico
0 siblings, 0 replies; 53+ messages in thread
From: Zac Medico @ 2012-06-10 22:43 UTC (permalink / raw
To: gentoo-commits
commit: 997ad61268b950ad3ae2ead88327d8bc71fedeb5
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun Jun 10 22:43:40 2012 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun Jun 10 22:43:40 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=997ad612
dep: move regex constants to top of file
---
pym/portage/dep/__init__.py | 33 +++++++++++++++++----------------
1 files changed, 17 insertions(+), 16 deletions(-)
diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py
index 5e747a1..d985486 100644
--- a/pym/portage/dep/__init__.py
+++ b/pym/portage/dep/__init__.py
@@ -55,6 +55,23 @@ if sys.hexversion >= 0x3000000:
# stable keywords, make these warnings unconditional.
_internal_warnings = False
+# \w is [a-zA-Z0-9_]
+
+# PMS 3.1.3: A slot name may contain any of the characters [A-Za-z0-9+_.-].
+# It must not begin with a hyphen or a dot.
+_slot_separator = ":"
+_slot = r'([\w+][\w+.-]*)'
+_slot_re = re.compile('^' + _slot + '$', re.VERBOSE)
+
+_use = r'\[.*\]'
+_op = r'([=~]|[><]=?)'
+
+_repo_separator = "::"
+_repo_name = r'[\w][\w-]*'
+_repo = r'(?:' + _repo_separator + '(' + _repo_name + ')' + ')?'
+
+_extended_cat = r'[\w+*][\w+.*-]*'
+
_eapi_attrs = collections.namedtuple('_eapi_attrs',
'dots_in_PN dots_in_use_flags repo_deps slot_deps '
'strong_blocks use_deps use_dep_defaults')
@@ -1761,22 +1778,6 @@ def dep_getusedeps( depend ):
open_bracket = depend.find( '[', open_bracket+1 )
return tuple(use_list)
-# \w is [a-zA-Z0-9_]
-
-# 2.1.3 A slot name may contain any of the characters [A-Za-z0-9+_.-].
-# It must not begin with a hyphen or a dot.
-_slot_separator = ":"
-_slot = r'([\w+][\w+.-]*)'
-_slot_re = re.compile('^' + _slot + '$', re.VERBOSE)
-
-_use = r'\[.*\]'
-_op = r'([=~]|[><]=?)'
-_repo_separator = "::"
-_repo_name = r'[\w][\w-]*'
-_repo = r'(?:' + _repo_separator + '(' + _repo_name + ')' + ')?'
-
-_extended_cat = r'[\w+*][\w+.*-]*'
-
def isvalidatom(atom, allow_blockers=False, allow_wildcard=False, allow_repo=False):
"""
Check to see if a depend atom is valid
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/dep/
@ 2012-06-10 23:18 Zac Medico
0 siblings, 0 replies; 53+ messages in thread
From: Zac Medico @ 2012-06-10 23:18 UTC (permalink / raw
To: gentoo-commits
commit: 8625d3282ec860b795d75322565a95bb4c2e9673
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun Jun 10 23:18:15 2012 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun Jun 10 23:18:15 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=8625d328
dep: remove old "DEPEND SYNTAX" comments
---
pym/portage/dep/__init__.py | 14 --------------
1 files changed, 0 insertions(+), 14 deletions(-)
diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py
index 4d0c4e2..d2df042 100644
--- a/pym/portage/dep/__init__.py
+++ b/pym/portage/dep/__init__.py
@@ -13,20 +13,6 @@ __all__ = [
'_repo_separator', '_slot_separator',
]
-# DEPEND SYNTAX:
-#
-# 'use?' only affects the immediately following word!
-# Nesting is the only legal way to form multiple '[!]use?' requirements.
-#
-# Where: 'a' and 'b' are use flags, and 'z' is a depend atom.
-#
-# "a? z" -- If 'a' in [use], then b is valid.
-# "a? ( z )" -- Syntax with parenthesis.
-# "a? b? z" -- Deprecated.
-# "a? ( b? z )" -- Valid
-# "a? ( b? ( z ) ) -- Valid
-#
-
import re, sys
import warnings
from itertools import chain
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/dep/
@ 2012-06-20 7:00 Zac Medico
0 siblings, 0 replies; 53+ messages in thread
From: Zac Medico @ 2012-06-20 7:00 UTC (permalink / raw
To: gentoo-commits
commit: 0f16a6aa3e7e1f9a601eee88e117fbd141735828
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Wed Jun 20 07:00:28 2012 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Wed Jun 20 07:00:28 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=0f16a6aa
Atom: cleanup str()/unicode() usage
---
pym/portage/dep/__init__.py | 40 +++++++++++++++++++++++-----------------
1 files changed, 23 insertions(+), 17 deletions(-)
diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py
index e6056b1..23bafa8 100644
--- a/pym/portage/dep/__init__.py
+++ b/pym/portage/dep/__init__.py
@@ -22,7 +22,7 @@ portage.proxy.lazyimport.lazyimport(globals(),
'portage.util:cmp_sort_key,writemsg',
)
-from portage import _unicode_decode
+from portage import _encodings, _unicode_decode, _unicode_encode
from portage.eapi import _get_eapi_attrs
from portage.exception import InvalidAtom, InvalidData, InvalidDependString
from portage.localization import _
@@ -32,6 +32,9 @@ import portage.cache.mappings
if sys.hexversion >= 0x3000000:
basestring = str
+ _unicode = str
+else:
+ _unicode = unicode
# Api consumers included in portage should set this to True.
# Once the relevant api changes are in a portage release with
@@ -887,6 +890,14 @@ class _use_dep(object):
return ""
return "[%s]" % (",".join(self.tokens),)
+ if sys.hexversion < 0x3000000:
+
+ __unicode__ = __str__
+
+ def __str__(self):
+ return _unicode_encode(self.__unicode__(),
+ encoding=_encodings['content'], errors='backslashreplace')
+
def __repr__(self):
return "portage.dep._use_dep(%s)" % repr(self.tokens)
@@ -1131,12 +1142,7 @@ class _use_dep(object):
return _use_dep(tokens, self._eapi_attrs, enabled_flags=enabled_flags, disabled_flags=disabled_flags,
missing_enabled=missing_enabled, missing_disabled=missing_disabled, required=self.required)
-if sys.hexversion < 0x3000000:
- _atom_base = unicode
-else:
- _atom_base = str
-
-class Atom(_atom_base):
+class Atom(_unicode):
"""
For compatibility with existing atom string manipulation code, this
@@ -1157,7 +1163,7 @@ class Atom(_atom_base):
def __new__(cls, s, unevaluated_atom=None, allow_wildcard=False, allow_repo=None,
_use=None, eapi=None, is_valid_flag=None):
- return _atom_base.__new__(cls, s)
+ return _unicode.__new__(cls, s)
def __init__(self, s, unevaluated_atom=None, allow_wildcard=False, allow_repo=None,
_use=None, eapi=None, is_valid_flag=None):
@@ -1165,13 +1171,13 @@ class Atom(_atom_base):
# This is an efficiency assertion, to ensure that the Atom
# constructor is not called redundantly.
raise TypeError(_("Expected %s, got %s") % \
- (_atom_base, type(s)))
+ (_unicode, type(s)))
- if not isinstance(s, _atom_base):
- # Avoid TypeError from _atom_base.__init__ with PyPy.
+ if not isinstance(s, _unicode):
+ # Avoid TypeError from _unicode.__init__ with PyPy.
s = _unicode_decode(s)
- _atom_base.__init__(s)
+ _unicode.__init__(s)
eapi_attrs = _get_eapi_attrs(eapi)
atom_re = _get_atom_re(eapi_attrs)
@@ -1343,7 +1349,7 @@ class Atom(_atom_base):
atom += _slot_separator + self.slot
atom += _repo_separator + repo
if self.use is not None:
- atom += str(self.use)
+ atom += _unicode(self.use)
return Atom(atom, allow_repo=True, allow_wildcard=True)
def with_slot(self, slot):
@@ -1351,7 +1357,7 @@ class Atom(_atom_base):
if self.repo is not None:
atom += _repo_separator + self.repo
if self.use is not None:
- atom += str(self.use)
+ atom += _unicode(self.use)
return Atom(atom, allow_repo=True, allow_wildcard=True)
def __setattr__(self, name, value):
@@ -1403,7 +1409,7 @@ class Atom(_atom_base):
if self.slot:
atom += ":%s" % self.slot
use_dep = self.use.evaluate_conditionals(use)
- atom += str(use_dep)
+ atom += _unicode(use_dep)
return Atom(atom, unevaluated_atom=self, allow_repo=(self.repo is not None), _use=use_dep)
def violated_conditionals(self, other_use, is_valid_flag, parent_use=None):
@@ -1425,7 +1431,7 @@ class Atom(_atom_base):
if self.slot:
atom += ":%s" % self.slot
use_dep = self.use.violated_conditionals(other_use, is_valid_flag, parent_use)
- atom += str(use_dep)
+ atom += _unicode(use_dep)
return Atom(atom, unevaluated_atom=self, allow_repo=(self.repo is not None), _use=use_dep)
def _eval_qa_conditionals(self, use_mask, use_force):
@@ -1435,7 +1441,7 @@ class Atom(_atom_base):
if self.slot:
atom += ":%s" % self.slot
use_dep = self.use._eval_qa_conditionals(use_mask, use_force)
- atom += str(use_dep)
+ atom += _unicode(use_dep)
return Atom(atom, unevaluated_atom=self, allow_repo=(self.repo is not None), _use=use_dep)
def __copy__(self):
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/dep/
@ 2012-06-25 21:28 Zac Medico
0 siblings, 0 replies; 53+ messages in thread
From: Zac Medico @ 2012-06-25 21:28 UTC (permalink / raw
To: gentoo-commits
commit: 21ef745c11538e294f0946f2a40812971652b40c
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon Jun 25 21:28:31 2012 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Jun 25 21:28:31 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=21ef745c
_slot_abi: fix broken function refs
---
pym/portage/dep/_slot_abi.py | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/pym/portage/dep/_slot_abi.py b/pym/portage/dep/_slot_abi.py
index 3282caf..7c36e52 100644
--- a/pym/portage/dep/_slot_abi.py
+++ b/pym/portage/dep/_slot_abi.py
@@ -20,7 +20,7 @@ def find_built_slot_abi_atoms(pkg):
def _find_built_slot_abi_op(dep_struct):
for x in dep_struct:
if isinstance(x, list):
- for atom in _find_slot_abi_equal_op(x):
+ for atom in _find_built_slot_abi_op(x):
yield atom
elif isinstance(x, Atom) and x.slot_abi_built:
yield x
@@ -28,7 +28,7 @@ def _find_built_slot_abi_op(dep_struct):
def ignore_built_slot_abi_deps(dep_struct):
for i, x in enumerate(dep_struct):
if isinstance(x, list):
- ignore_slot_abi_equal_deps(x)
+ ignore_built_slot_abi_deps(x)
elif isinstance(x, Atom) and x.slot_abi_built:
# There's no way of knowing here whether the SLOT
# part of the SLOT/ABI pair should be kept, so we
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/dep/
@ 2012-07-02 20:28 Zac Medico
0 siblings, 0 replies; 53+ messages in thread
From: Zac Medico @ 2012-07-02 20:28 UTC (permalink / raw
To: gentoo-commits
commit: 47029cd18764795a4c2cff1f985c56c87ca07ed9
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon Jul 2 20:27:57 2012 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Jul 2 20:27:57 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=47029cd1
Atom: evaluate_conditionals slot-abi, bug #424489
---
pym/portage/dep/__init__.py | 38 +++++++++++++++++++++++++++++++-------
1 files changed, 31 insertions(+), 7 deletions(-)
diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py
index 557c92b..c722e48 100644
--- a/pym/portage/dep/__init__.py
+++ b/pym/portage/dep/__init__.py
@@ -1428,8 +1428,14 @@ class Atom(_unicode):
def with_repo(self, repo):
atom = remove_slot(self)
+ if self.slot is not None or self.slot_abi_op is not None:
+ atom += _slot_separator
if self.slot is not None:
- atom += _slot_separator + self.slot
+ atom += self.slot
+ if self.slot_abi is not None:
+ atom += "/%s" % self.slot_abi
+ if self.slot_abi_op is not None:
+ atom += self.slot_abi_op
atom += _repo_separator + repo
if self.use is not None:
atom += _unicode(self.use)
@@ -1489,8 +1495,14 @@ class Atom(_unicode):
if not (self.use and self.use.conditional):
return self
atom = remove_slot(self)
- if self.slot:
- atom += ":%s" % self.slot
+ if self.slot is not None or self.slot_abi_op is not None:
+ atom += _slot_separator
+ if self.slot is not None:
+ atom += self.slot
+ if self.slot_abi is not None:
+ atom += "/%s" % self.slot_abi
+ if self.slot_abi_op is not None:
+ atom += self.slot_abi_op
use_dep = self.use.evaluate_conditionals(use)
atom += _unicode(use_dep)
return Atom(atom, unevaluated_atom=self, allow_repo=(self.repo is not None), _use=use_dep)
@@ -1511,8 +1523,14 @@ class Atom(_unicode):
if not self.use:
return self
atom = remove_slot(self)
- if self.slot:
- atom += ":%s" % self.slot
+ if self.slot is not None or self.slot_abi_op is not None:
+ atom += _slot_separator
+ if self.slot is not None:
+ atom += self.slot
+ if self.slot_abi is not None:
+ atom += "/%s" % self.slot_abi
+ if self.slot_abi_op is not None:
+ atom += self.slot_abi_op
use_dep = self.use.violated_conditionals(other_use, is_valid_flag, parent_use)
atom += _unicode(use_dep)
return Atom(atom, unevaluated_atom=self, allow_repo=(self.repo is not None), _use=use_dep)
@@ -1521,8 +1539,14 @@ class Atom(_unicode):
if not (self.use and self.use.conditional):
return self
atom = remove_slot(self)
- if self.slot:
- atom += ":%s" % self.slot
+ if self.slot is not None or self.slot_abi_op is not None:
+ atom += _slot_separator
+ if self.slot is not None:
+ atom += self.slot
+ if self.slot_abi is not None:
+ atom += "/%s" % self.slot_abi
+ if self.slot_abi_op is not None:
+ atom += self.slot_abi_op
use_dep = self.use._eval_qa_conditionals(use_mask, use_force)
atom += _unicode(use_dep)
return Atom(atom, unevaluated_atom=self, allow_repo=(self.repo is not None), _use=use_dep)
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/dep/
@ 2012-07-02 23:11 Zac Medico
0 siblings, 0 replies; 53+ messages in thread
From: Zac Medico @ 2012-07-02 23:11 UTC (permalink / raw
To: gentoo-commits
commit: e9aff636fa22ca91f47a3c5b0955e8e7baee5d6a
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon Jul 2 23:11:45 2012 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Jul 2 23:11:45 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=e9aff636
Atom: tweak indent for slot logic
---
pym/portage/dep/__init__.py | 48 +++++++++++++++++++++---------------------
1 files changed, 24 insertions(+), 24 deletions(-)
diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py
index c722e48..d71ec09 100644
--- a/pym/portage/dep/__init__.py
+++ b/pym/portage/dep/__init__.py
@@ -1430,12 +1430,12 @@ class Atom(_unicode):
atom = remove_slot(self)
if self.slot is not None or self.slot_abi_op is not None:
atom += _slot_separator
- if self.slot is not None:
- atom += self.slot
- if self.slot_abi is not None:
- atom += "/%s" % self.slot_abi
- if self.slot_abi_op is not None:
- atom += self.slot_abi_op
+ if self.slot is not None:
+ atom += self.slot
+ if self.slot_abi is not None:
+ atom += "/%s" % self.slot_abi
+ if self.slot_abi_op is not None:
+ atom += self.slot_abi_op
atom += _repo_separator + repo
if self.use is not None:
atom += _unicode(self.use)
@@ -1497,12 +1497,12 @@ class Atom(_unicode):
atom = remove_slot(self)
if self.slot is not None or self.slot_abi_op is not None:
atom += _slot_separator
- if self.slot is not None:
- atom += self.slot
- if self.slot_abi is not None:
- atom += "/%s" % self.slot_abi
- if self.slot_abi_op is not None:
- atom += self.slot_abi_op
+ if self.slot is not None:
+ atom += self.slot
+ if self.slot_abi is not None:
+ atom += "/%s" % self.slot_abi
+ if self.slot_abi_op is not None:
+ atom += self.slot_abi_op
use_dep = self.use.evaluate_conditionals(use)
atom += _unicode(use_dep)
return Atom(atom, unevaluated_atom=self, allow_repo=(self.repo is not None), _use=use_dep)
@@ -1525,12 +1525,12 @@ class Atom(_unicode):
atom = remove_slot(self)
if self.slot is not None or self.slot_abi_op is not None:
atom += _slot_separator
- if self.slot is not None:
- atom += self.slot
- if self.slot_abi is not None:
- atom += "/%s" % self.slot_abi
- if self.slot_abi_op is not None:
- atom += self.slot_abi_op
+ if self.slot is not None:
+ atom += self.slot
+ if self.slot_abi is not None:
+ atom += "/%s" % self.slot_abi
+ if self.slot_abi_op is not None:
+ atom += self.slot_abi_op
use_dep = self.use.violated_conditionals(other_use, is_valid_flag, parent_use)
atom += _unicode(use_dep)
return Atom(atom, unevaluated_atom=self, allow_repo=(self.repo is not None), _use=use_dep)
@@ -1541,12 +1541,12 @@ class Atom(_unicode):
atom = remove_slot(self)
if self.slot is not None or self.slot_abi_op is not None:
atom += _slot_separator
- if self.slot is not None:
- atom += self.slot
- if self.slot_abi is not None:
- atom += "/%s" % self.slot_abi
- if self.slot_abi_op is not None:
- atom += self.slot_abi_op
+ if self.slot is not None:
+ atom += self.slot
+ if self.slot_abi is not None:
+ atom += "/%s" % self.slot_abi
+ if self.slot_abi_op is not None:
+ atom += self.slot_abi_op
use_dep = self.use._eval_qa_conditionals(use_mask, use_force)
atom += _unicode(use_dep)
return Atom(atom, unevaluated_atom=self, allow_repo=(self.repo is not None), _use=use_dep)
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/dep/
@ 2012-09-14 6:00 Zac Medico
0 siblings, 0 replies; 53+ messages in thread
From: Zac Medico @ 2012-09-14 6:00 UTC (permalink / raw
To: gentoo-commits
commit: c138e8e2654ad9350eec2a433991b882b4c6b058
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Fri Sep 14 06:00:16 2012 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Fri Sep 14 06:00:16 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=c138e8e2
dep_check: cleanup repoman use.force/mask code
---
pym/portage/dep/dep_check.py | 13 +++++--------
1 files changed, 5 insertions(+), 8 deletions(-)
diff --git a/pym/portage/dep/dep_check.py b/pym/portage/dep/dep_check.py
index ecb8a9b..6d1969e 100644
--- a/pym/portage/dep/dep_check.py
+++ b/pym/portage/dep/dep_check.py
@@ -564,18 +564,15 @@ def dep_check(depstring, mydbapi, mysettings, use="yes", mode=None, myuse=None,
mymasks = set()
useforce = set()
- useforce.add(mysettings["ARCH"])
if use == "all":
- # This masking/forcing is only for repoman. In other cases, relevant
- # masking/forcing should have already been applied via
- # config.regenerate(). Also, binary or installed packages may have
- # been built with flags that are now masked, and it would be
- # inconsistent to mask them now. Additionally, myuse may consist of
- # flags from a parent package that is being merged to a $ROOT that is
- # different from the one that mysettings represents.
+ # This is only for repoman, in order to constrain the use_reduce
+ # matchall behavior to account for profile use.mask/force. The
+ # ARCH/archlist code here may be redundant, since the profile
+ # really should be handling ARCH masking/forcing itself.
mymasks.update(mysettings.usemask)
mymasks.update(mysettings.archlist())
mymasks.discard(mysettings["ARCH"])
+ useforce.add(mysettings["ARCH"])
useforce.update(mysettings.useforce)
useforce.difference_update(mymasks)
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/dep/
@ 2012-09-26 3:31 Zac Medico
0 siblings, 0 replies; 53+ messages in thread
From: Zac Medico @ 2012-09-26 3:31 UTC (permalink / raw
To: gentoo-commits
commit: 60e5cc3081b1bf9fe4a7c633cc13c183e25d7b36
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Wed Sep 26 03:31:01 2012 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Wed Sep 26 03:31:01 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=60e5cc30
evaluate_slot_operator_equal_deps: do HDEPEND
---
pym/portage/dep/_slot_operator.py | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/pym/portage/dep/_slot_operator.py b/pym/portage/dep/_slot_operator.py
index d7933b5..c98c974 100644
--- a/pym/portage/dep/_slot_operator.py
+++ b/pym/portage/dep/_slot_operator.py
@@ -52,6 +52,7 @@ def evaluate_slot_operator_equal_deps(settings, use, trees):
vardbs.append(running_vardb)
_eval_deps(deps["DEPEND"], vardbs)
+ _eval_deps(deps["HDEPEND"], [running_vardb])
result = {}
for k, v in deps.items():
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/dep/
@ 2012-09-27 16:58 Zac Medico
0 siblings, 0 replies; 53+ messages in thread
From: Zac Medico @ 2012-09-27 16:58 UTC (permalink / raw
To: gentoo-commits
commit: a6cfb7dc96cf015d3867929ab0dece49fb69ded0
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu Sep 27 16:58:35 2012 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu Sep 27 16:58:35 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=a6cfb7dc
_slot_operator: EAPI 5-hdepend DEPEND target only
---
pym/portage/dep/_slot_operator.py | 14 +++++++++-----
1 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/pym/portage/dep/_slot_operator.py b/pym/portage/dep/_slot_operator.py
index c98c974..ae58862 100644
--- a/pym/portage/dep/_slot_operator.py
+++ b/pym/portage/dep/_slot_operator.py
@@ -2,6 +2,7 @@
# Distributed under the terms of the GNU General Public License v2
from portage.dep import Atom, paren_enclose, use_reduce
+from portage.eapi import _get_eapi_attrs
from portage.exception import InvalidData
from _emerge.Package import Package
@@ -37,6 +38,7 @@ def evaluate_slot_operator_equal_deps(settings, use, trees):
metadata = settings.configdict['pkg']
eapi = metadata['EAPI']
+ eapi_attrs = _get_eapi_attrs(eapi)
running_vardb = trees[trees._running_eroot]["vartree"].dbapi
target_vardb = trees[trees._target_eroot]["vartree"].dbapi
vardbs = [target_vardb]
@@ -48,11 +50,13 @@ def evaluate_slot_operator_equal_deps(settings, use, trees):
for k in Package._runtime_keys:
_eval_deps(deps[k], vardbs)
- if running_vardb is not target_vardb:
- vardbs.append(running_vardb)
-
- _eval_deps(deps["DEPEND"], vardbs)
- _eval_deps(deps["HDEPEND"], [running_vardb])
+ if eapi_attrs.hdepend:
+ _eval_deps(deps["HDEPEND"], [running_vardb])
+ _eval_deps(deps["DEPEND"], [target_vardb])
+ else:
+ if running_vardb is not target_vardb:
+ vardbs.append(running_vardb)
+ _eval_deps(deps["DEPEND"], vardbs)
result = {}
for k, v in deps.items():
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/dep/
@ 2012-10-14 19:21 Zac Medico
0 siblings, 0 replies; 53+ messages in thread
From: Zac Medico @ 2012-10-14 19:21 UTC (permalink / raw
To: gentoo-commits
commit: 6210ad8a7ecafcb8a616f28dc3447c219f0d134f
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun Oct 14 19:20:56 2012 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun Oct 14 19:20:56 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=6210ad8a
match_from_list: rm redundant catpkgsplit(mycpv)
---
pym/portage/dep/__init__.py | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py
index ddab4a3..bc9d33e 100644
--- a/pym/portage/dep/__init__.py
+++ b/pym/portage/dep/__init__.py
@@ -2175,11 +2175,10 @@ def match_from_list(mydep, candidate_list):
# XXX: Nasty special casing for leading zeros
# Required as =* is a literal prefix match, so can't
# use vercmp
- mysplit = catpkgsplit(mycpv)
- myver = mysplit[2].lstrip("0")
+ myver = mycpv_cps[2].lstrip("0")
if not myver or not myver[0].isdigit():
myver = "0"+myver
- mycpv_cmp = mysplit[0]+"/"+mysplit[1]+"-"+myver
+ mycpv_cmp = mycpv_cps[0] + "/" + mycpv_cps[1] + "-" + myver
for x in candidate_list:
xs = getattr(x, "cpv_split", None)
if xs is None:
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/dep/
@ 2012-11-14 19:55 Zac Medico
0 siblings, 0 replies; 53+ messages in thread
From: Zac Medico @ 2012-11-14 19:55 UTC (permalink / raw
To: gentoo-commits
commit: 20c14c193dad7f920a4b32ef2007fb9fac4f3b6a
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Wed Nov 14 19:54:59 2012 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Wed Nov 14 19:54:59 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=20c14c19
Atom.without_use: preserve blocker prefix
---
pym/portage/dep/__init__.py | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py
index 55181d7..60d1cc9 100644
--- a/pym/portage/dep/__init__.py
+++ b/pym/portage/dep/__init__.py
@@ -1229,11 +1229,14 @@ class Atom(_unicode):
if allow_repo is None:
allow_repo = True
+ blocker_prefix = ""
if "!" == s[:1]:
blocker = self._blocker(forbid_overlap=("!" == s[1:2]))
if blocker.overlap.forbid:
+ blocker_prefix = s[:2]
s = s[2:]
else:
+ blocker_prefix = s[:1]
s = s[1:]
else:
blocker = False
@@ -1346,15 +1349,18 @@ class Atom(_unicode):
use = _use
else:
use = _use_dep(use_str[1:-1].split(","), eapi_attrs)
- without_use = Atom(m.group('without_use'), allow_repo=allow_repo)
+ without_use = Atom(blocker_prefix + m.group('without_use'),
+ allow_repo=allow_repo)
else:
use = None
if unevaluated_atom is not None and \
unevaluated_atom.use is not None:
# unevaluated_atom.use is used for IUSE checks when matching
# packages, so it must not propagate to without_use
- without_use = Atom(s, allow_wildcard=allow_wildcard,
- allow_repo=allow_repo)
+ without_use = Atom(_unicode(self),
+ allow_wildcard=allow_wildcard,
+ allow_repo=allow_repo,
+ eapi=eapi)
else:
without_use = self
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/dep/
@ 2012-11-25 11:03 Arfrever Frehtes Taifersar Arahesis
0 siblings, 0 replies; 53+ messages in thread
From: Arfrever Frehtes Taifersar Arahesis @ 2012-11-25 11:03 UTC (permalink / raw
To: gentoo-commits
commit: 98a8df6c429e7e40db3a2cdfd7dad9edebdadd3d
Author: Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Apache <DOT> Org>
AuthorDate: Sun Nov 25 11:02:11 2012 +0000
Commit: Arfrever Frehtes Taifersar Arahesis <arfrever.fta <AT> gmail <DOT> com>
CommitDate: Sun Nov 25 11:02:11 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=98a8df6c
Update doc string of portage.dep.extract_affecting_use().
---
pym/portage/dep/__init__.py | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py
index e2aa00d..b3417e2 100644
--- a/pym/portage/dep/__init__.py
+++ b/pym/portage/dep/__init__.py
@@ -2649,16 +2649,16 @@ def extract_affecting_use(mystr, atom, eapi=None):
that decide if the given atom is in effect.
Example usage:
- >>> extract_use_cond('sasl? ( dev-libs/cyrus-sasl ) \
+ >>> extract_affecting_use('sasl? ( dev-libs/cyrus-sasl ) \
!minimal? ( cxx? ( dev-libs/cyrus-sasl ) )', 'dev-libs/cyrus-sasl')
- (['sasl', 'minimal', 'cxx'])
+ {'cxx', 'minimal', 'sasl'}
- @param dep: The dependency string
+ @param mystr: The dependency string
@type mystr: String
@param atom: The atom to get into effect
@type atom: String
- @rtype: Tuple of two lists of strings
- @return: List of use flags that need to be enabled, List of use flag that need to be disabled
+ @rtype: Set of strings
+ @return: Set of use flags affecting given atom
"""
useflag_re = _get_useflag_re(eapi)
mysplit = mystr.split()
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/dep/
@ 2012-12-11 9:42 Arfrever Frehtes Taifersar Arahesis
0 siblings, 0 replies; 53+ messages in thread
From: Arfrever Frehtes Taifersar Arahesis @ 2012-12-11 9:42 UTC (permalink / raw
To: gentoo-commits
commit: f0e2fa9404570891e564d9c6f65f0d577ba53d35
Author: Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Apache <DOT> Org>
AuthorDate: Tue Dec 11 09:39:38 2012 +0000
Commit: Arfrever Frehtes Taifersar Arahesis <arfrever.fta <AT> gmail <DOT> com>
CommitDate: Tue Dec 11 09:39:38 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=f0e2fa94
Disallow SLOT="${slot}/${subslot}=" in ebuilds.
---
pym/portage/dep/__init__.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py
index b3417e2..634b42b 100644
--- a/pym/portage/dep/__init__.py
+++ b/pym/portage/dep/__init__.py
@@ -64,7 +64,7 @@ def _get_slot_re(eapi_attrs):
return slot_re
if eapi_attrs.slot_operator:
- slot_re = _slot + r'(/' + _slot + r'=?)?'
+ slot_re = _slot + r'(/' + _slot + r')?'
else:
slot_re = _slot
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/dep/
@ 2013-06-10 0:50 Zac Medico
0 siblings, 0 replies; 53+ messages in thread
From: Zac Medico @ 2013-06-10 0:50 UTC (permalink / raw
To: gentoo-commits
commit: d6689aa26980aee97c13927828d066336f16a0bc
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon Jun 10 00:50:07 2013 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Jun 10 00:50:07 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=d6689aa2
dep_check: remove redundant list copy
There's no need to copy the list before calling dep_wordreduce, since
dep_wordreduce copies the list internally.
---
pym/portage/dep/dep_check.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pym/portage/dep/dep_check.py b/pym/portage/dep/dep_check.py
index 6e3d086..48df869 100644
--- a/pym/portage/dep/dep_check.py
+++ b/pym/portage/dep/dep_check.py
@@ -622,8 +622,8 @@ def dep_check(depstring, mydbapi, mysettings, use="yes", mode=None, myuse=None,
except ParseError as e:
return [0, "%s" % (e,)]
- mysplit2=mysplit[:]
- mysplit2=dep_wordreduce(mysplit2,mysettings,mydbapi,mode,use_cache=use_cache)
+ mysplit2 = dep_wordreduce(mysplit,
+ mysettings, mydbapi, mode, use_cache=use_cache)
if mysplit2 is None:
return [0, _("Invalid token")]
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/dep/
@ 2013-07-30 5:48 Zac Medico
0 siblings, 0 replies; 53+ messages in thread
From: Zac Medico @ 2013-07-30 5:48 UTC (permalink / raw
To: gentoo-commits
commit: c1292a7c0b7092750fb94aac9680feb38da0bd78
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Jul 30 05:48:37 2013 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Jul 30 05:48:37 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=c1292a7c
dep_zapdeps: skip want_update_pkg if pkg in graph
---
pym/portage/dep/dep_check.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/pym/portage/dep/dep_check.py b/pym/portage/dep/dep_check.py
index 0349853..86112a2 100644
--- a/pym/portage/dep/dep_check.py
+++ b/pym/portage/dep/dep_check.py
@@ -471,6 +471,8 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None):
# installed yet for bug #478188.
want_update = True
for slot_atom, avail_pkg in slot_map.items():
+ if avail_pkg in graph:
+ continue
# New-style virtuals have zero cost to install.
if slot_atom.startswith("virtual/") or \
vardb.match(slot_atom):
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/dep/
@ 2013-08-22 4:15 Zac Medico
0 siblings, 0 replies; 53+ messages in thread
From: Zac Medico @ 2013-08-22 4:15 UTC (permalink / raw
To: gentoo-commits
commit: c0b8b192fbaa09435244f93412445ab965090ae1
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu Aug 22 04:15:31 2013 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu Aug 22 04:15:31 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=c0b8b192
dep_zapdeps: fix all_available reference
This broke in commit c08402d745eef26b99091f62556f48aa9b60345a.
---
pym/portage/dep/dep_check.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pym/portage/dep/dep_check.py b/pym/portage/dep/dep_check.py
index 07d6d1e..b5ace3d 100644
--- a/pym/portage/dep/dep_check.py
+++ b/pym/portage/dep/dep_check.py
@@ -565,7 +565,7 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None):
for allow_masked in (False, True):
for choices in choice_bins:
for choice in choices:
- if all_available or allow_masked:
+ if choice.all_available or allow_masked:
return choice.atoms
assert(False) # This point should not be reachable
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/dep/
@ 2014-03-30 19:00 Sebastian Luther
0 siblings, 0 replies; 53+ messages in thread
From: Sebastian Luther @ 2014-03-30 19:00 UTC (permalink / raw
To: gentoo-commits
commit: d8345b546c4212d928b38b972921879ef9fa466c
Author: Sebastian Luther <SebastianLuther <AT> gmx <DOT> de>
AuthorDate: Sun Mar 30 18:54:17 2014 +0000
Commit: Sebastian Luther <SebastianLuther <AT> gmx <DOT> de >
CommitDate: Sun Mar 30 19:00:08 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=d8345b54
Remove some broken old-style virtual code
Fixes a crash reported on IRC
---
pym/portage/dep/dep_check.py | 14 --------------
1 file changed, 14 deletions(-)
diff --git a/pym/portage/dep/dep_check.py b/pym/portage/dep/dep_check.py
index b5ace3d..b79c5bc 100644
--- a/pym/portage/dep/dep_check.py
+++ b/pym/portage/dep/dep_check.py
@@ -91,7 +91,6 @@ def _expand_new_virtuals(mysplit, edebug, mydbapi, mysettings, myroot="/",
if portdb.cp_list(x.cp):
newsplit.append(x)
else:
- # TODO: Add PROVIDE check for repoman.
a = []
myvartree = mytrees.get("vartree")
if myvartree is not None:
@@ -196,19 +195,6 @@ def _expand_new_virtuals(mysplit, edebug, mydbapi, mysettings, myroot="/",
virt_atom_node = (virt_atom, id(virt_atom))
atom_graph.add(virt_atom_node, graph_parent)
atom_graph.add(pkg, virt_atom_node)
- # Plain old-style virtuals. New-style virtuals are preferred.
- if not pkgs:
- for y in mychoices:
- new_atom = Atom(x.replace(x.cp, y.cp, 1))
- matches = portdb.match(new_atom)
- # portdb is an instance of depgraph._dep_check_composite_db, so
- # USE conditionals are already evaluated.
- if matches and mykey in \
- portdb.aux_get(matches[-1], ['PROVIDE'])[0].split():
- a.append(new_atom)
- if atom_graph is not None:
- atom_graph.add((new_atom, id(new_atom)),
- graph_parent)
if not a and mychoices:
# Check for a virtual package.provided match.
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/dep/
@ 2014-08-28 8:59 Michał Górny
0 siblings, 0 replies; 53+ messages in thread
From: Michał Górny @ 2014-08-28 8:59 UTC (permalink / raw
To: gentoo-commits
commit: ccbaa896448681d42a3b286858c3bd5d912aec56
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Thu Jul 31 08:44:29 2014 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu Aug 28 08:58:16 2014 +0000
URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=ccbaa896
vdb: Preserve := when storing uninstalled dependency atoms
Make the slot operator processing code not remove the := operator from
vdb dependency entries when the underlying package is not installed.
This fixes a bug where dependencies like || ( A:= B:= ) were stored as
|| ( A:0/1= B ) if B was not installed. This especially confused
dependency comparisons in @changed-deps.
With this patch, Portage stores the original := (or :slot=) atom in the
vdb. This fixes the issue while preserving the same behavior in the
current dependency resolver.
Acked-by: Alexander Berntsen <bernalex <AT> gentoo.org>
Acked-by: Brian Dolbec <dolsen <AT> gentoo.org>
Reviewed-by: Zac Medico <zmedico <AT> gentoo.org>
---
pym/portage/dep/_slot_operator.py | 27 ++++++++++++++++++---------
1 file changed, 18 insertions(+), 9 deletions(-)
diff --git a/pym/portage/dep/_slot_operator.py b/pym/portage/dep/_slot_operator.py
index 7b64444..8b67fc5 100644
--- a/pym/portage/dep/_slot_operator.py
+++ b/pym/portage/dep/_slot_operator.py
@@ -1,4 +1,4 @@
-# Copyright 2012-2013 Gentoo Foundation
+# Copyright 2012-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
from __future__ import unicode_literals
@@ -67,6 +67,11 @@ def evaluate_slot_operator_equal_deps(settings, use, trees):
return result
def _eval_deps(dep_struct, vardbs):
+ # TODO: we'd use a better || () handling, i.e. || ( A:= B:= ) with both A
+ # and B installed should record subslot on A only since the package is
+ # supposed to link against that anyway, and we have no guarantee that B
+ # has matching ABI.
+
for i, x in enumerate(dep_struct):
if isinstance(x, list):
_eval_deps(x, vardbs)
@@ -87,11 +92,15 @@ def _eval_deps(dep_struct, vardbs):
dep_struct[i] = x
break
else:
- # this dep could not be resolved, so remove the operator
- # (user may be using package.provided and managing rebuilds
- # manually)
- if x.slot:
- x = x.with_slot(x.slot)
- else:
- x = x.without_slot
- dep_struct[i] = x
+ # this dep could not be resolved, possibilities include:
+ # 1. unsatisfied branch of || () dep,
+ # 2. package.provided,
+ # 3. --nodeps.
+ #
+ # just leave it as-is for now. this does not cause any special
+ # behavior while keeping the information in vdb -- necessary
+ # e.g. for @changed-deps to work properly.
+ #
+ # TODO: make it actually cause subslot rebuilds when switching
+ # || () branches.
+ pass
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/dep/
@ 2015-02-24 17:41 Zac Medico
0 siblings, 0 replies; 53+ messages in thread
From: Zac Medico @ 2015-02-24 17:41 UTC (permalink / raw
To: gentoo-commits
commit: 0887d95d288226c52c1d5610b514d41a624eadb7
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Feb 24 05:34:50 2015 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Feb 24 17:40:25 2015 +0000
URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=0887d95d
use_reduce: support non-string token_class (bug 541198)
Do not assume that token_class returns a basestring.
X-Gentoo-Bug: 541198
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=541198
Acked-by: Brian Dolbec <dolsen <AT> gentoo.org>
---
pym/portage/dep/__init__.py | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py
index e2e416c..a8c748d 100644
--- a/pym/portage/dep/__init__.py
+++ b/pym/portage/dep/__init__.py
@@ -558,7 +558,8 @@ def use_reduce(depstr, uselist=[], masklist=[], matchall=False, excludeall=[], i
stack[level].extend(l)
continue
- if stack[level]:
+ if stack[level] and isinstance(stack[level][-1],
+ basestring):
if stack[level][-1] == "||" and not l:
#Optimize: || ( ) -> .
stack[level].pop()
@@ -583,7 +584,8 @@ def use_reduce(depstr, uselist=[], masklist=[], matchall=False, excludeall=[], i
#ends in a non-operator. This is almost equivalent to stack[level][-1]=="||",
#expect that it skips empty levels.
while k>=0:
- if stack[k]:
+ if stack[k] and isinstance(stack[k][-1],
+ basestring):
if stack[k][-1] == "||":
return k
elif stack[k][-1][-1] != "?":
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/dep/
@ 2016-11-22 17:11 Zac Medico
0 siblings, 0 replies; 53+ messages in thread
From: Zac Medico @ 2016-11-22 17:11 UTC (permalink / raw
To: gentoo-commits
commit: d7af27b4166f9ce693203bfc92d9bf44d3db081c
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun Nov 20 23:13:14 2016 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Nov 22 16:52:08 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=d7af27b4
dep_zapdeps: make package selections internally consistent (bug 600346)
When selecting packages to determine which choices have upgrades
or downgrades relative to other choices, make the package selections
internally consistent by choosing a package that satisfies all atoms
in the choice which match a package in the same slot.
Also, fix the Atom.match() method to handle _pkg_str instances,
since dep_zapdeps can pass in _pkg_str instances instead of Package
instances.
X-Gentoo-Bug: 600346
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=600346
Acked-by: Brian Dolbec <dolsen <AT> gentoo.org>
pym/portage/dep/__init__.py | 16 ++++++++++++----
pym/portage/dep/dep_check.py | 28 ++++++++++++++++++++++++++--
2 files changed, 38 insertions(+), 6 deletions(-)
diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py
index 5dd1638..968ff5b 100644
--- a/pym/portage/dep/__init__.py
+++ b/pym/portage/dep/__init__.py
@@ -1603,10 +1603,18 @@ class Atom(_unicode):
if pkg.cp == self.cp:
return bool(match_from_list(self, [pkg]))
else:
- for provided_cp in pkg.provided_cps:
- if provided_cp == self.cp:
- return bool(match_from_list(
- self.replace(self.cp, provided_cp, 1), [pkg]))
+ try:
+ provided_cps = pkg.provided_cps
+ except AttributeError:
+ # Since _pkg_str instances lack PROVIDE metadata,
+ # just ignore this case (PROVIDE has been deprecated
+ # for years).
+ pass
+ else:
+ for provided_cp in provided_cps:
+ if provided_cp == self.cp:
+ return bool(match_from_list(
+ self.replace(self.cp, provided_cp, 1), [pkg]))
return False
_extended_cp_re_cache = {}
diff --git a/pym/portage/dep/dep_check.py b/pym/portage/dep/dep_check.py
index 9d2ca4b..737d2b1 100644
--- a/pym/portage/dep/dep_check.py
+++ b/pym/portage/dep/dep_check.py
@@ -5,6 +5,7 @@ from __future__ import unicode_literals
__all__ = ['dep_check', 'dep_eval', 'dep_wordreduce', 'dep_zapdeps']
+import collections
import logging
import operator
@@ -354,6 +355,7 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None):
all_use_satisfied = True
all_use_unmasked = True
conflict_downgrade = False
+ slot_atoms = collections.defaultdict(list)
slot_map = {}
cp_map = {}
for atom in atoms:
@@ -418,9 +420,31 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None):
avail_slot = Atom("%s:%s" % (atom.cp, avail_pkg.slot))
slot_map[avail_slot] = avail_pkg
+ slot_atoms[avail_slot].append(atom)
highest_cpv = cp_map.get(avail_pkg.cp)
- if highest_cpv is None or \
- vercmp(avail_pkg.version, highest_cpv.version) > 0:
+ all_match_current = None
+ all_match_previous = None
+ if (highest_cpv is not None and
+ highest_cpv.slot == avail_pkg.slot):
+ # If possible, make the package selection internally
+ # consistent by choosing a package that satisfies all
+ # atoms which match a package in the same slot. Later on,
+ # the package version chosen here is used in the
+ # has_upgrade/has_downgrade logic to prefer choices with
+ # upgrades, and a package choice that is not internally
+ # consistent will lead the has_upgrade/has_downgrade logic
+ # to produce invalid results (see bug 600346).
+ all_match_current = all(a.match(avail_pkg)
+ for a in slot_atoms[avail_slot])
+ all_match_previous = all(a.match(highest_cpv)
+ for a in slot_atoms[avail_slot])
+ if all_match_previous and not all_match_current:
+ continue
+
+ current_higher = (highest_cpv is None or
+ vercmp(avail_pkg.version, highest_cpv.version) > 0)
+
+ if current_higher or (all_match_current and not all_match_previous):
cp_map[avail_pkg.cp] = avail_pkg
this_choice = _dep_choice(atoms=atoms, slot_map=slot_map,
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/dep/
@ 2017-03-08 19:30 Zac Medico
0 siblings, 0 replies; 53+ messages in thread
From: Zac Medico @ 2017-03-08 19:30 UTC (permalink / raw
To: gentoo-commits
commit: c4447175e57a8311f254cfc9fa32646467e1830f
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon Mar 6 19:51:38 2017 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Wed Mar 8 19:29:23 2017 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=c4447175
use_reduce: reserve missing_white_space_check for invalid tokens (bug 611838)
Since it's possible for a URI to contain parenthesis, only call
missing_white_space_check for tokens that fail to validate with
token_class. The missing_white_space_check function only serves
to clarify exception messages, so it must not be allowed to
reject valid tokens.
X-Gentoo-Bug: 611838
X-Gentoo-Bug-Url: https://bugs.gentoo.org/show_bug.cgi?id=611838
Acked-by: Brian Dolbec <dolsen <AT> gentoo.org>
pym/portage/dep/__init__.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py
index 968ff5b89..6ff6adcb9 100644
--- a/pym/portage/dep/__init__.py
+++ b/pym/portage/dep/__init__.py
@@ -677,8 +677,6 @@ def use_reduce(depstr, uselist=[], masklist=[], matchall=False, excludeall=[], i
need_simple_token = True
stack[level].append(token)
else:
- missing_white_space_check(token, pos)
-
if need_bracket:
raise InvalidDependString(
_("expected: '(', got: '%s', token %s") % (token, pos+1))
@@ -698,12 +696,14 @@ def use_reduce(depstr, uselist=[], masklist=[], matchall=False, excludeall=[], i
token = token_class(token, eapi=eapi,
is_valid_flag=is_valid_flag)
except InvalidAtom as e:
+ missing_white_space_check(token, pos)
raise InvalidDependString(
_("Invalid atom (%s), token %s") \
% (e, pos+1), errors=(e,))
except SystemExit:
raise
except Exception as e:
+ missing_white_space_check(token, pos)
raise InvalidDependString(
_("Invalid token '%s', token %s") % (token, pos+1))
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/dep/
@ 2017-07-02 15:34 Brian Dolbec
0 siblings, 0 replies; 53+ messages in thread
From: Brian Dolbec @ 2017-07-02 15:34 UTC (permalink / raw
To: gentoo-commits
commit: 7a5489e8b2715d48767ec7ee936736e862a8d7c1
Author: Sergei Trofimovich <siarheit <AT> google <DOT> com>
AuthorDate: Sun Jul 2 15:28:03 2017 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sun Jul 2 15:33:25 2017 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=7a5489e8
portage/dep/depcheck.py: Whitespace, add indentation level after newline
Signed-off-by: Sergei Trofimovich <siarheit <AT> google.com>
Final commit adds line trim @line 340
pym/portage/dep/dep_check.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/pym/portage/dep/dep_check.py b/pym/portage/dep/dep_check.py
index 737d2b138..35caecc74 100644
--- a/pym/portage/dep/dep_check.py
+++ b/pym/portage/dep/dep_check.py
@@ -337,7 +337,7 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None):
return [mydbapi._pkg_str(cpv, atom.repo)
for cpv in mydbapi.match(atom)]
- # Sort the deps into installed, not installed but already
+ # Sort the deps into installed, not installed but already
# in the graph and other, not installed and not in the graph
# and other, with values of [[required_atom], availablility]
for x, satisfied in zip(deps, satisfieds):
@@ -713,8 +713,8 @@ def dep_check(depstring, mydbapi, mysettings, use="yes", mode=None, myuse=None,
else:
try:
mysplit = use_reduce(depstring, uselist=myusesplit,
- masklist=mymasks, matchall=(use=="all"), excludeall=useforce,
- opconvert=True, token_class=Atom, eapi=eapi)
+ masklist=mymasks, matchall=(use=="all"), excludeall=useforce,
+ opconvert=True, token_class=Atom, eapi=eapi)
except InvalidDependString as e:
return [0, "%s" % (e,)]
^ permalink raw reply related [flat|nested] 53+ messages in thread
end of thread, other threads:[~2017-07-02 15:34 UTC | newest]
Thread overview: 53+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-20 7:00 [gentoo-commits] proj/portage:master commit in: pym/portage/dep/ Zac Medico
-- strict thread matches above, loose matches on Subject: below --
2017-07-02 15:34 Brian Dolbec
2017-03-08 19:30 Zac Medico
2016-11-22 17:11 Zac Medico
2015-02-24 17:41 Zac Medico
2014-08-28 8:59 Michał Górny
2014-03-30 19:00 Sebastian Luther
2013-08-22 4:15 Zac Medico
2013-07-30 5:48 Zac Medico
2013-06-10 0:50 Zac Medico
2012-12-11 9:42 Arfrever Frehtes Taifersar Arahesis
2012-11-25 11:03 Arfrever Frehtes Taifersar Arahesis
2012-11-14 19:55 Zac Medico
2012-10-14 19:21 Zac Medico
2012-09-27 16:58 Zac Medico
2012-09-26 3:31 Zac Medico
2012-09-14 6:00 Zac Medico
2012-07-02 23:11 Zac Medico
2012-07-02 20:28 Zac Medico
2012-06-25 21:28 Zac Medico
2012-06-10 23:18 Zac Medico
2012-06-10 22:43 Zac Medico
2012-06-10 22:37 Zac Medico
2012-06-10 22:20 Zac Medico
2012-06-10 22:16 Zac Medico
2012-06-10 21:51 Zac Medico
2012-06-10 21:08 Zac Medico
2012-06-10 20:48 Zac Medico
2012-05-30 0:47 Arfrever Frehtes Taifersar Arahesis
2012-05-14 6:54 Zac Medico
2012-05-14 0:08 Zac Medico
2012-05-13 20:37 Zac Medico
2012-05-13 20:22 Zac Medico
2012-05-13 9:31 Zac Medico
2012-04-22 21:41 Zac Medico
2012-01-10 18:41 Zac Medico
2011-10-05 19:58 Zac Medico
2011-09-23 1:55 Zac Medico
2011-09-23 0:48 Zac Medico
2011-09-10 14:31 Zac Medico
2011-06-23 10:56 Arfrever Frehtes Taifersar Arahesis
2011-06-08 19:05 Zac Medico
2011-04-11 22:30 Zac Medico
2011-03-17 18:44 Zac Medico
2011-02-19 22:55 Zac Medico
2011-02-08 18:57 Zac Medico
2011-02-08 0:43 Zac Medico
2011-02-07 22:20 Zac Medico
2011-02-07 11:45 Zac Medico
2011-02-07 11:19 Zac Medico
2011-02-05 0:27 Zac Medico
2011-02-04 23:04 Zac Medico
2011-02-04 6:29 zmedico
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox