* [gentoo-commits] proj/R_overlay:gsoc13/next commit in: roverlay/depres/
2013-06-13 16:34 [gentoo-commits] proj/R_overlay:master " André Erdmann
@ 2013-06-13 16:34 ` André Erdmann
0 siblings, 0 replies; 11+ messages in thread
From: André Erdmann @ 2013-06-13 16:34 UTC (permalink / raw
To: gentoo-commits
commit: 575a672de2d76fdfb128444a88fe717aa5aff99d
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Thu Jun 13 16:27:23 2013 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Thu Jun 13 16:27:23 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=575a672d
correct comment typo
---
roverlay/depres/deptype.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/roverlay/depres/deptype.py b/roverlay/depres/deptype.py
index 226d871..269f666 100644
--- a/roverlay/depres/deptype.py
+++ b/roverlay/depres/deptype.py
@@ -11,7 +11,7 @@
# * allows to add other types
# <deptype> ::= 2**k | k in {0,1,2,...}
-# try_call indicates that the dep can be checked world-wide (in non-accepting
+# try_other indicates that the dep can be checked world-wide (in non-accepting
# rule pools) after unsuccessful resolution
try_other = 1
mandatory = 2
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [gentoo-commits] proj/R_overlay:gsoc13/next commit in: roverlay/depres/
@ 2013-07-05 16:55 André Erdmann
0 siblings, 0 replies; 11+ messages in thread
From: André Erdmann @ 2013-07-05 16:55 UTC (permalink / raw
To: gentoo-commits
commit: 1b546a7d744a8c7272545ef299e5fa4f2f47b098
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Fri Jul 5 16:44:26 2013 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Fri Jul 5 16:44:26 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=1b546a7d
roverlay/depres/depenv: use versiontuple
---
roverlay/depres/depenv.py | 26 ++++++++++++++++----------
1 file changed, 16 insertions(+), 10 deletions(-)
diff --git a/roverlay/depres/depenv.py b/roverlay/depres/depenv.py
index 3d324a4..972dc79 100644
--- a/roverlay/depres/depenv.py
+++ b/roverlay/depres/depenv.py
@@ -15,6 +15,9 @@ dependency string to be looked up, its resolution progess ("to be resolved",
__all__ = [ 'DepEnv', ]
import re
+
+import roverlay.versiontuple
+
from roverlay import strutil
class DepEnv ( object ):
@@ -63,15 +66,16 @@ class DepEnv ( object ):
_VERMOD = '(?P<vmod>[<>]|[=<>!]?[=])'
# integer representation of version modifiers
- VMOD_NONE = 0
- VMOD_UNDEF = 1
- VMOD_NOT = 2
- VMOD_EQ = 4
- VMOD_NE = VMOD_NOT | VMOD_EQ
- VMOD_GT = 8
- VMOD_GE = VMOD_EQ | VMOD_GT
- VMOD_LT = 16
- VMOD_LE = VMOD_EQ | VMOD_LT
+ ## duplicate of versiontuple.py
+ VMOD_NONE = roverlay.versiontuple.VMOD_NONE
+ VMOD_UNDEF = roverlay.versiontuple.VMOD_UNDEF
+ VMOD_NOT = roverlay.versiontuple.VMOD_NOT
+ VMOD_EQ = roverlay.versiontuple.VMOD_EQ
+ VMOD_NE = roverlay.versiontuple.VMOD_NE
+ VMOD_GT = roverlay.versiontuple.VMOD_GT
+ VMOD_GE = roverlay.versiontuple.VMOD_GE
+ VMOD_LT = roverlay.versiontuple.VMOD_LT
+ VMOD_LE = roverlay.versiontuple.VMOD_LE
VMOD = {
'!=' : VMOD_NE,
@@ -195,7 +199,9 @@ class DepEnv ( object ):
version_modifier = vmod,
version = version,
version_strlist = version_strlist,
- version_tuple = tuple ( version_iparts ),
+ version_tuple = roverlay.versiontuple.IntVersionTuple (
+ version_iparts
+ ),
vmod = self.VMOD.get ( vmod, self.VMOD_UNDEF ),
) )
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [gentoo-commits] proj/R_overlay:gsoc13/next commit in: roverlay/depres/
@ 2013-07-05 16:55 André Erdmann
0 siblings, 0 replies; 11+ messages in thread
From: André Erdmann @ 2013-07-05 16:55 UTC (permalink / raw
To: gentoo-commits
commit: 47310e189b6e55619a37bbf69286627408d6ed7e
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Fri Jul 5 16:44:56 2013 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Fri Jul 5 16:44:56 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=47310e18
roverlay/depres/depresult: use versiontuple
---
roverlay/depres/depresult.py | 52 +++++++++++++++-----------------------------
1 file changed, 17 insertions(+), 35 deletions(-)
diff --git a/roverlay/depres/depresult.py b/roverlay/depres/depresult.py
index 91a4688..e55d9ea 100644
--- a/roverlay/depres/depresult.py
+++ b/roverlay/depres/depresult.py
@@ -12,31 +12,6 @@ EMPTY_STR = ""
class DepResult ( object ):
- # TODO/FIXME: define those constants somewhere else
- # (especially VMOD_??)
- #
- VMOD_COMPARE_MAP = {
- # p.version_compare_* functions are TODO
- roverlay.depres.depenv.DepEnv.VMOD_EQ: (
- lambda p: p.version_compare_eq
- ),
- roverlay.depres.depenv.DepEnv.VMOD_NE: (
- lambda p: p.version_compare_ne
- ),
- roverlay.depres.depenv.DepEnv.VMOD_GT: (
- lambda p: p.version_compare_gt
- ),
- roverlay.depres.depenv.DepEnv.VMOD_GE: (
- lambda p: p.version_compare_ge
- ),
- roverlay.depres.depenv.DepEnv.VMOD_LT: (
- lambda p: p.version_compare_lt
- ),
- roverlay.depres.depenv.DepEnv.VMOD_LE: (
- lambda p: p.version_compare_le
- ),
- }
-
def __init__ ( self,
dep, score, matching_rule, dep_env=None, fuzzy=None
):
@@ -64,8 +39,7 @@ class DepResult ( object ):
# --- end of __eq__ (...) ---
def __hash__ ( self ):
- #return hash ( self.__dict__.values() )
- return hash (( self.dep, self.score, self.is_selfdep ))
+ return id ( self )
# --- end of __hash__ (...) ---
def __bool__ ( self ):
@@ -79,6 +53,7 @@ class DepResult ( object ):
def __getitem__ ( self, key ):
# for backwards compatibility, indexing is supported
+ print ( "FIXME: __getitem__ is deprecated" )
if key == 0:
return self.score
elif key == 1:
@@ -97,16 +72,15 @@ class DepResult ( object ):
self.link = self.candidates.append
if self.fuzzy:
- vmod = self.fuzzy ['vmod']
- self.version = self.fuzzy ['version_tuple']
- self._version_compare = self.VMOD_COMPARE_MAP [vmod]
- self.version_compare = (
- lambda p: self._version_compare ( p ) ( self.version )
- )
+ vmod = self.fuzzy ['vmod']
+ version = self.fuzzy ['version_tuple']
+
+ self.version_compare = version.get_package_comparator ( vmod )
# --- end of prepare_selfdep_reduction (...) ---
def deps_satisfiable ( self ):
return bool ( self.candidates )
+ # --- end of deps_satisfiable (...) ---
def link_if_version_matches ( self, p ):
if not self.fuzzy or self.version_compare ( p ):
@@ -116,7 +90,15 @@ class DepResult ( object ):
return False
# --- end of link_if_version_matches (...) ---
- def reduce ( self ):
+ def linkall_if_version_matches ( self, p_iterable ):
+ any_added = False
+ for p in p_iterable:
+ if self.link_if_version_matches ( p ):
+ any_added = True
+ return any_added
+ # --- end of linkall_if_version_matches (...) ---
+
+ def do_reduce ( self ):
candidates = list (
p for p in self.candidates if p.has_valid_selfdeps()
)
@@ -124,7 +106,7 @@ class DepResult ( object ):
if num_removed != 0:
self.candidates = candidates
return num_removed
- # --- end of reduce (...) ---
+ # --- end of do_reduce (...) ---
# --- end of DepResult ---
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [gentoo-commits] proj/R_overlay:gsoc13/next commit in: roverlay/depres/
@ 2013-07-08 22:47 André Erdmann
0 siblings, 0 replies; 11+ messages in thread
From: André Erdmann @ 2013-07-08 22:47 UTC (permalink / raw
To: gentoo-commits
commit: ef2b1bb33faa1ac49ca500fb8fa2bb210b933cdc
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Mon Jul 8 22:36:59 2013 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Mon Jul 8 22:36:59 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=ef2b1bb3
roverlay/depres/depresult: comments
---
roverlay/depres/depresult.py | 46 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 46 insertions(+)
diff --git a/roverlay/depres/depresult.py b/roverlay/depres/depresult.py
index 8b4fa0d..2049719 100644
--- a/roverlay/depres/depresult.py
+++ b/roverlay/depres/depresult.py
@@ -11,10 +11,20 @@ import roverlay.depres.depenv
EMPTY_STR = ""
class DepResult ( object ):
+ """dependency resolution result data container"""
def __init__ ( self,
dep, score, matching_rule, dep_env=None, fuzzy=None
):
+ """Initializes a dependency resolution result object.
+
+ arguments:
+ * dep -- resolving dependency (string or None)
+ * score -- score (int)
+ * matching_rule -- (reference to) the rule that resolved dep
+ * dep_env -- dependency environment (optional)
+ * fuzzy -- fuzzy dep (sub-)environment (optional)
+ """
self.dep = dep
self.score = score
#assert hasattr ( matching_rule, 'is_selfdep' )
@@ -26,6 +36,7 @@ class DepResult ( object ):
# --- end of DepResult ---
def __eq__ ( self, other ):
+ """Compares this dep result with another result or a string."""
if isinstance ( other, str ):
return str ( self ) == other
elif isinstance ( other, DepResult ):
@@ -43,6 +54,7 @@ class DepResult ( object ):
# --- end of __hash__ (...) ---
def __bool__ ( self ):
+ """Returns True if this dep result has a valid score (>0)."""
return self.score > 0
#and self.dep is not False
# --- end of __bool__ (...) ---
@@ -71,6 +83,9 @@ class DepResult ( object ):
# --- end of __getitem__ (...) ---
def prepare_selfdep_reduction ( self ):
+ """Prepares this dep result for selfdep validation by creating all
+ necessary variables.
+ """
cat, sepa, pkg = self.resolving_package.rpartition ( '/' )
self.category = cat
self.package = pkg
@@ -81,21 +96,40 @@ class DepResult ( object ):
vmod = self.fuzzy ['vmod']
version = self.fuzzy ['version_tuple']
+ # DEBUG bind
+ self.version = version
+
self.version_compare = version.get_package_comparator ( vmod )
return self
# --- end of prepare_selfdep_reduction (...) ---
def deps_satisfiable ( self ):
+ """Returns True if >this< selfdep is satisfiable, else False.
+ This method should only be called _during_ selfdep validation.
+ """
# should be renamed to selfdeps_satisfiable
return bool ( self.candidates )
# --- end of deps_satisfiable (...) ---
def is_valid ( self ):
+ """Returns True if this dependency is valid, i.e. it either is not
+ a selfdep or it is satisfiable.
+ This method should be called _after_ selfdep validation.
+ """
return ( not self.is_selfdep ) or bool ( self.candidates )
# --- end of is_valid (...) ---
def link_if_version_matches ( self, p ):
+ """Tries to a link a given package info as selfdep candidate.
+ Returns True on success, else False.
+
+ The link operation succeeds iff the package claims to be valid and
+ its version is compatible.
+
+ arguments:
+ * p -- package info
+ """
if p.is_valid() and ( not self.fuzzy or self.version_compare ( p ) ):
self.link ( p )
return True
@@ -104,6 +138,12 @@ class DepResult ( object ):
# --- end of link_if_version_matches (...) ---
def linkall_if_version_matches ( self, p_iterable ):
+ """Tries to link several packages.
+ Returns True if at least one package could be linked, else False.
+
+ arguments:
+ * p_iterable -- iterable that contains package info objects
+ """
any_added = False
for p in p_iterable:
if self.link_if_version_matches ( p ):
@@ -112,6 +152,11 @@ class DepResult ( object ):
# --- end of linkall_if_version_matches (...) ---
def do_reduce ( self ):
+ """'reduce' operation for selfdep validation.
+
+ Eliminates candidates that are no longer valid and returns the number
+ of removed candiates (0 if nothing removed).
+ """
candidates = list (
p for p in self.candidates if p.has_valid_selfdeps()
)
@@ -123,4 +168,5 @@ class DepResult ( object ):
# --- end of DepResult ---
+# static object for unresolvable dependencies
DEP_NOT_RESOLVED = DepResult ( dep=None, score=-2, matching_rule=None )
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [gentoo-commits] proj/R_overlay:gsoc13/next commit in: roverlay/depres/
2013-07-11 8:49 [gentoo-commits] proj/R_overlay:master commit in: roverlay/depres/ André Erdmann
@ 2013-07-11 8:45 ` André Erdmann
0 siblings, 0 replies; 11+ messages in thread
From: André Erdmann @ 2013-07-11 8:45 UTC (permalink / raw
To: gentoo-commits
commit: fb5c3772408a021f02a654bd3bfa4a220e486b50
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Thu Jul 11 08:43:48 2013 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Thu Jul 11 08:43:48 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=fb5c3772
roverlay/depres: create multiple DepEnv instances
Create multiple DepEnv instances for a dependency string.
This can be used to split strings like '<dep1> and <dep2>'.
---
roverlay/depres/channels.py | 8 +++++---
roverlay/depres/depenv.py | 32 ++++++++++++++++++++------------
2 files changed, 25 insertions(+), 15 deletions(-)
diff --git a/roverlay/depres/channels.py b/roverlay/depres/channels.py
index b1f39bd..60875f0 100644
--- a/roverlay/depres/channels.py
+++ b/roverlay/depres/channels.py
@@ -112,9 +112,11 @@ class _EbuildJobChannelBase ( DependencyResolverChannel ):
"This channel is 'done', it doesn't accept new dependencies."
)
else:
- dep_env = DepEnv ( dep_str=dep_str, deptype_mask=deptype_mask )
- self._depcount += 1
- self._depres_master.enqueue ( dep_env, self.ident )
+ for dep_env in DepEnv.from_str (
+ dep_str=dep_str, deptype_mask=deptype_mask
+ ):
+ self._depcount += 1
+ self._depres_master.enqueue ( dep_env, self.ident )
# --- end of add_dependency (...) ---
diff --git a/roverlay/depres/depenv.py b/roverlay/depres/depenv.py
index 972dc79..277290c 100644
--- a/roverlay/depres/depenv.py
+++ b/roverlay/depres/depenv.py
@@ -122,17 +122,25 @@ class DepEnv ( object ):
STATUS_RESOLVED = 2
STATUS_UNRESOLVABLE = 4
- def _depstr_fix ( self, dep_str ):
- """Removes cruft from a dep string."""
- # unquote dep_str, remove "from <uri>.." entries and replace all
+ @classmethod
+ def from_str ( cls, dep_str, deptype_mask ):
+ """(Pre-)parses a dependency string and creates DepEnv objects for it."""
+ # split dep_str into logically ANDed dependency strings,
+ # unquote them, remove "from <uri>.." entries and replace all
# whitespace by a single ' ' char
- cls = self.__class__
- return cls.WHITESPACE.sub ( ' ',
- cls.URI_PURGE.sub ( '',
- strutil.unquote ( dep_str )
- )
- ).strip()
- # --- end of _depstr_fix (...) ---
+ return (
+ cls (
+ dep_str = (
+ cls.WHITESPACE.sub ( ' ',
+ cls.URI_PURGE.sub ( '',
+ strutil.unquote ( dep_str )
+ )
+ ).strip()
+ ),
+ deptype_mask = deptype_mask,
+ ),
+ )
+ # --- end of from_str (...) ---
def __init__ ( self, dep_str, deptype_mask ):
"""Initializes a dependency environment that represents the dependency
@@ -147,8 +155,8 @@ class DepEnv ( object ):
self.status = DepEnv.STATUS_UNDONE
self.resolved_by = None
- self.dep_str = self._depstr_fix ( dep_str )
- self.dep_str_low = self.dep_str.lower()
+ self.dep_str = dep_str
+ self.dep_str_low = dep_str.lower()
self.try_all_regexes = self.__class__.TRY_ALL_REGEXES
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/depres/
@ 2013-07-11 8:49 André Erdmann
2013-07-11 8:45 ` [gentoo-commits] proj/R_overlay:gsoc13/next " André Erdmann
0 siblings, 1 reply; 11+ messages in thread
From: André Erdmann @ 2013-07-11 8:49 UTC (permalink / raw
To: gentoo-commits
commit: fb5c3772408a021f02a654bd3bfa4a220e486b50
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Thu Jul 11 08:43:48 2013 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Thu Jul 11 08:43:48 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=fb5c3772
roverlay/depres: create multiple DepEnv instances
Create multiple DepEnv instances for a dependency string.
This can be used to split strings like '<dep1> and <dep2>'.
---
roverlay/depres/channels.py | 8 +++++---
roverlay/depres/depenv.py | 32 ++++++++++++++++++++------------
2 files changed, 25 insertions(+), 15 deletions(-)
diff --git a/roverlay/depres/channels.py b/roverlay/depres/channels.py
index b1f39bd..60875f0 100644
--- a/roverlay/depres/channels.py
+++ b/roverlay/depres/channels.py
@@ -112,9 +112,11 @@ class _EbuildJobChannelBase ( DependencyResolverChannel ):
"This channel is 'done', it doesn't accept new dependencies."
)
else:
- dep_env = DepEnv ( dep_str=dep_str, deptype_mask=deptype_mask )
- self._depcount += 1
- self._depres_master.enqueue ( dep_env, self.ident )
+ for dep_env in DepEnv.from_str (
+ dep_str=dep_str, deptype_mask=deptype_mask
+ ):
+ self._depcount += 1
+ self._depres_master.enqueue ( dep_env, self.ident )
# --- end of add_dependency (...) ---
diff --git a/roverlay/depres/depenv.py b/roverlay/depres/depenv.py
index 972dc79..277290c 100644
--- a/roverlay/depres/depenv.py
+++ b/roverlay/depres/depenv.py
@@ -122,17 +122,25 @@ class DepEnv ( object ):
STATUS_RESOLVED = 2
STATUS_UNRESOLVABLE = 4
- def _depstr_fix ( self, dep_str ):
- """Removes cruft from a dep string."""
- # unquote dep_str, remove "from <uri>.." entries and replace all
+ @classmethod
+ def from_str ( cls, dep_str, deptype_mask ):
+ """(Pre-)parses a dependency string and creates DepEnv objects for it."""
+ # split dep_str into logically ANDed dependency strings,
+ # unquote them, remove "from <uri>.." entries and replace all
# whitespace by a single ' ' char
- cls = self.__class__
- return cls.WHITESPACE.sub ( ' ',
- cls.URI_PURGE.sub ( '',
- strutil.unquote ( dep_str )
- )
- ).strip()
- # --- end of _depstr_fix (...) ---
+ return (
+ cls (
+ dep_str = (
+ cls.WHITESPACE.sub ( ' ',
+ cls.URI_PURGE.sub ( '',
+ strutil.unquote ( dep_str )
+ )
+ ).strip()
+ ),
+ deptype_mask = deptype_mask,
+ ),
+ )
+ # --- end of from_str (...) ---
def __init__ ( self, dep_str, deptype_mask ):
"""Initializes a dependency environment that represents the dependency
@@ -147,8 +155,8 @@ class DepEnv ( object ):
self.status = DepEnv.STATUS_UNDONE
self.resolved_by = None
- self.dep_str = self._depstr_fix ( dep_str )
- self.dep_str_low = self.dep_str.lower()
+ self.dep_str = dep_str
+ self.dep_str_low = dep_str.lower()
self.try_all_regexes = self.__class__.TRY_ALL_REGEXES
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [gentoo-commits] proj/R_overlay:gsoc13/next commit in: roverlay/depres/
@ 2013-07-11 16:44 André Erdmann
0 siblings, 0 replies; 11+ messages in thread
From: André Erdmann @ 2013-07-11 16:44 UTC (permalink / raw
To: gentoo-commits
commit: f7829a4b4809ea2dc42c5b28ceb1cc40a70ac1f1
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Thu Jul 11 16:42:05 2013 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Thu Jul 11 16:42:05 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=f7829a4b
roverlay/depres/depenv: split ANDed dependency str
Dependency strings containing an '<whitespace>and<whitespace>' will now be
splitted, and each part is resolved individually.
Note that this "breaks" some of the existing dependency rules.
---
roverlay/depres/depenv.py | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/roverlay/depres/depenv.py b/roverlay/depres/depenv.py
index 277290c..7455360 100644
--- a/roverlay/depres/depenv.py
+++ b/roverlay/depres/depenv.py
@@ -114,6 +114,8 @@ class DepEnv ( object ):
FIXVERSION_REGEX = re.compile ( '[_\-]' )
URI_PURGE = re.compile ( '\s*from\s*(http|ftp|https)://[^\s]+' )
WHITESPACE = re.compile ( '\s+' )
+ #AND_SPLIT = re.compile ( '\s+and\s+|\s+&&\s+', flags=re.IGNORECASE )
+ AND_SPLIT = re.compile ( '\s+and\s+', flags=re.IGNORECASE )
# try all version regexes if True, else break after first match
TRY_ALL_REGEXES = False
@@ -124,22 +126,27 @@ class DepEnv ( object ):
@classmethod
def from_str ( cls, dep_str, deptype_mask ):
- """(Pre-)parses a dependency string and creates DepEnv objects for it."""
+ """Generator that (pre-)parses a dependency string and creates
+ DepEnv objects for it.
+
+ arguments:
+ * dep_str --
+ * deptype_mask --
+ """
# split dep_str into logically ANDed dependency strings,
# unquote them, remove "from <uri>.." entries and replace all
# whitespace by a single ' ' char
- return (
- cls (
+ for substring in cls.AND_SPLIT.split ( dep_str ):
+ yield cls (
dep_str = (
cls.WHITESPACE.sub ( ' ',
cls.URI_PURGE.sub ( '',
- strutil.unquote ( dep_str )
+ strutil.unquote ( substring )
)
).strip()
),
deptype_mask = deptype_mask,
- ),
- )
+ )
# --- end of from_str (...) ---
def __init__ ( self, dep_str, deptype_mask ):
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [gentoo-commits] proj/R_overlay:gsoc13/next commit in: roverlay/depres/
@ 2013-07-15 22:31 André Erdmann
0 siblings, 0 replies; 11+ messages in thread
From: André Erdmann @ 2013-07-15 22:31 UTC (permalink / raw
To: gentoo-commits
commit: bf85b8297c1581384d9331d750e725a3ff8a650c
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Mon Jul 15 22:29:26 2013 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Mon Jul 15 22:29:26 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=bf85b829
roverlay/depres/listeners: sort unresolvable
---
roverlay/depres/listeners.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/roverlay/depres/listeners.py b/roverlay/depres/listeners.py
index 3d5ceaf..91d4a0b 100644
--- a/roverlay/depres/listeners.py
+++ b/roverlay/depres/listeners.py
@@ -83,7 +83,9 @@ class SetFileListener ( DependencyResolverListener ):
fh = open ( self._file, 'w' )
if sort_entries:
- fh.write ( '\n'.join ( sorted ( self._buffer ) ) )
+ fh.write ( '\n'.join (
+ sorted ( self._buffer, key=lambda x: x.lower() ) )
+ )
else:
fh.write ( '\n'.join ( self._buffer ) )
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [gentoo-commits] proj/R_overlay:gsoc13/next commit in: roverlay/depres/
2013-07-16 16:36 [gentoo-commits] proj/R_overlay:master " André Erdmann
@ 2013-07-15 22:31 ` André Erdmann
0 siblings, 0 replies; 11+ messages in thread
From: André Erdmann @ 2013-07-15 22:31 UTC (permalink / raw
To: gentoo-commits
commit: 21890525bfd7419ad60a0b370cb14de468da2f36
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Mon Jul 15 22:30:17 2013 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Mon Jul 15 22:30:17 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=21890525
roverlay/depres/depenv, fuzzy: ignore certain words
---
roverlay/depres/depenv.py | 26 ++++++++++++++++----------
1 file changed, 16 insertions(+), 10 deletions(-)
diff --git a/roverlay/depres/depenv.py b/roverlay/depres/depenv.py
index 7455360..c8fea7e 100644
--- a/roverlay/depres/depenv.py
+++ b/roverlay/depres/depenv.py
@@ -54,7 +54,7 @@ class DepEnv ( object ):
# excluding A-Z since dep_str_low will be used to find a match
# _NAME ::= word{<whitespace><word>}
- _NAME = '(?P<name>[a-z0-9_\-/.+-]+(\s+[a-z0-9_\-/.+-]+)*)'
+ _NAME = '(?P<name>[a-z0-9_\-/.:+-]+(\s+[a-z0-9_\-/.+-]+)*)'
# _VER ::= [[<version_separator>]*<digit>[<digit>]*]*
# digit ::= {0..9}
@@ -65,6 +65,9 @@ class DepEnv ( object ):
# { <, >, ==, <=, >=, =, != }
_VERMOD = '(?P<vmod>[<>]|[=<>!]?[=])'
+ _NAME_PREFIX = '(?P<name_prefix>for building from source[:])'
+ _NAME_SUFFIX = '(?P<name_suffix>lib|library)'
+
# integer representation of version modifiers
## duplicate of versiontuple.py
VMOD_NONE = roverlay.versiontuple.VMOD_NONE
@@ -91,22 +94,26 @@ class DepEnv ( object ):
VERSION_REGEX = frozenset (
re.compile ( r ) for r in ((
# 'R >= 2.15', 'R >=2.15' etc. (but not 'R>=2.15'!)
- '^{name}\s+{vermod}?\s*{ver}\s*$'.format (
- name=_NAME, vermod=_VERMOD, ver=_VER
+ '^{prefix}?\s*{name}\s+{vermod}?\s*{ver}\s*{suffix}?\s*$'.format (
+ name=_NAME, vermod=_VERMOD, ver=_VER,
+ prefix=_NAME_PREFIX, suffix=_NAME_SUFFIX,
),
# 'R (>= 2.15)', 'R(>=2.15)' etc.
- '^{name}\s*\(\s*{vermod}?\s*{ver}\s*\)$'.format (
- name=_NAME, vermod=_VERMOD, ver=_VER
+ '^{prefix}?\s*{name}\s*\(\s*{vermod}?\s*{ver}\s*\)\s*{suffix}?$'.format (
+ name=_NAME, vermod=_VERMOD, ver=_VER,
+ prefix=_NAME_PREFIX, suffix=_NAME_SUFFIX,
),
# 'R [>= 2.15]', 'R[>=2.15]' etc.
- '^{name}\s*\[\s*{vermod}?\s*{ver}\s*\]$'.format (
- name=_NAME, vermod=_VERMOD, ver=_VER
+ '^{prefix}?\s*{name}\s*\[\s*{vermod}?\s*{ver}\s*\]\s*{suffix}?$'.format (
+ name=_NAME, vermod=_VERMOD, ver=_VER,
+ prefix=_NAME_PREFIX, suffix=_NAME_SUFFIX,
),
# 'R {>= 2.15}', 'R{>=2.15}' etc.
- '^{name}\s*\{{\s*{vermod}?\s*{ver}\s*\}}$'.format (
- name=_NAME, vermod=_VERMOD, ver=_VER
+ '^{prefix}?\s*{name}\s*\{{\s*{vermod}?\s*{ver}\s*\}}\s*{suffix}?$'.format (
+ name=_NAME, vermod=_VERMOD, ver=_VER,
+ prefix=_NAME_PREFIX, suffix=_NAME_SUFFIX,
),
))
)
@@ -207,7 +214,6 @@ class DepEnv ( object ):
version_iparts.append ( int ( v2 ) if v2 else 0 )
-
result.append ( dict (
name = m.group ( 'name' ),
name_low = m.group ( 'name' ).lower(),
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [gentoo-commits] proj/R_overlay:gsoc13/next commit in: roverlay/depres/
@ 2013-07-17 18:10 André Erdmann
0 siblings, 0 replies; 11+ messages in thread
From: André Erdmann @ 2013-07-17 18:10 UTC (permalink / raw
To: gentoo-commits
commit: 3cae70d2b3df58af8957e2c49089eb9d835486f2
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Wed Jul 17 18:06:37 2013 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Wed Jul 17 18:06:37 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=3cae70d2
add debug capabilities to depresult
---
roverlay/depres/depresult.py | 112 +++++++++++++++++++++++++++++++++++++++++--
1 file changed, 108 insertions(+), 4 deletions(-)
diff --git a/roverlay/depres/depresult.py b/roverlay/depres/depresult.py
index 2049719..2ad2488 100644
--- a/roverlay/depres/depresult.py
+++ b/roverlay/depres/depresult.py
@@ -4,13 +4,22 @@
# Distributed under the terms of the GNU General Public License;
# either version 2 of the License, or (at your option) any later version.
+from __future__ import print_function
+
__all__ = [ 'DepResult', 'DEP_NOT_RESOLVED', ]
+import logging
+
import roverlay.depres.depenv
+# two dep result classes are available
+# they're identical, but the "debugged-" one produces a lot of output
+# and calculates some operations twice
+DEBUG = False
+
EMPTY_STR = ""
-class DepResult ( object ):
+class _DepResult ( object ):
"""dependency resolution result data container"""
def __init__ ( self,
@@ -25,6 +34,7 @@ class DepResult ( object ):
* dep_env -- dependency environment (optional)
* fuzzy -- fuzzy dep (sub-)environment (optional)
"""
+ super ( _DepResult, self ).__init__()
self.dep = dep
self.score = score
#assert hasattr ( matching_rule, 'is_selfdep' )
@@ -98,6 +108,7 @@ class DepResult ( object ):
# DEBUG bind
self.version = version
+ self.vmod = vmod
self.version_compare = version.get_package_comparator ( vmod )
@@ -155,7 +166,7 @@ class DepResult ( object ):
"""'reduce' operation for selfdep validation.
Eliminates candidates that are no longer valid and returns the number
- of removed candiates (0 if nothing removed).
+ of removed candidates (0 if nothing removed).
"""
candidates = list (
p for p in self.candidates if p.has_valid_selfdeps()
@@ -166,7 +177,100 @@ class DepResult ( object ):
return num_removed
# --- end of do_reduce (...) ---
-# --- end of DepResult ---
+# --- end of _DepResult ---
+
+
+class _DebuggedDepResult ( _DepResult ):
+ LOGGER = logging.getLogger ( 'depresult' )
+
+ def __init__ ( self, *args, **kwargs ):
+ super ( _DebuggedDepResult, self ).__init__ ( *args, **kwargs )
+ if self.is_selfdep:
+ self.logger = self.__class__.LOGGER.getChild ( self.dep )
+
+ def deps_satisfiable ( self ):
+ self.logger.debug (
+ "deps satisfiable? {}, <{}>".format (
+ ( "Yes" if self.candidates else "No" ),
+ ', '.join (
+ (
+ "{}::{}-{}".format (
+ (
+ p['origin'].name if p.has ( 'origin' ) else "<undef>"
+ ),
+ p['name'], p['ebuild_verstr']
+ ) for p in self.candidates
+ )
+ )
+ )
+ )
+ return super ( DebuggedDepResult, self ).deps_satisfiable()
+ # --- end of deps_satisfiable (...) ---
+
+ def link_if_version_matches ( self, p ):
+ ret = super ( DebuggedDepResult, self ).link_if_version_matches ( p )
+
+ pf = "{PN}-{PVR}".format (
+ PN = p ['name'],
+ PVR = p ['ebuild_verstr'],
+ )
+
+ info_append = ' p\'valid={valid!r}'.format (
+ valid = bool ( p.is_valid() ),
+ )
+
+ if self.fuzzy:
+ info_append += (
+ 'this\'fuzzy={fuzzy!r}, vmatch={vmatch!r}, '
+ 'this\'version={myver!r}, p\'version={pver}, '
+ 'vcomp={vcomp!r} vmod={vmod:d}'.format (
+ fuzzy = bool ( self.fuzzy ),
+ vmatch = self.version_compare ( p ),
+ myver = self.version,
+ pver = p ['version'],
+ vcomp = self.version_compare,
+ vmod = self.vmod,
+ )
+ )
+ else:
+ info_append += ', this\'fuzzy=False'
+
+
+ if ret:
+ self.logger.debug (
+ "Added {PF} to candidate list.".format ( PF=pf )
+ + info_append
+ )
+ else:
+ # recalculate for logging
+ self.logger.debug (
+ 'Rejected {PF} as candidate.'.format ( PF=pf )
+ + info_append
+ )
+
+ return ret
+ # --- end of link_if_version_matches (...) ---
+
+ def do_reduce ( self ):
+ """'reduce' operation for selfdep validation.
+
+ Eliminates candidates that are no longer valid and returns the number
+ of removed candidates (0 if nothing removed).
+ """
+ self.logger.debug ( "Checking candidates:" )
+ for p in self.candidates:
+ "{}-{}: {}".format (
+ p['name'], p['ebuild_verstr'], p.has_valid_selfdeps()
+ )
+ ret = super ( DebuggedDepResult, self ).do_reduce()
+ self.logger.debug ( "Dropped {:d} candidates.".format ( ret ) )
+ return ret
+ # --- end of do_reduce (...) ---
+
+# --- end of _DebuggedDepResult ---
+
+# DepResult <= _DepResult | _DebuggedDepResult
+DepResult = _DebuggedDepResult if DEBUG else _DepResult
# static object for unresolvable dependencies
-DEP_NOT_RESOLVED = DepResult ( dep=None, score=-2, matching_rule=None )
+DEP_NOT_RESOLVED = _DepResult ( dep=None, score=-2, matching_rule=None )
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [gentoo-commits] proj/R_overlay:gsoc13/next commit in: roverlay/depres/
@ 2013-07-18 19:25 André Erdmann
0 siblings, 0 replies; 11+ messages in thread
From: André Erdmann @ 2013-07-18 19:25 UTC (permalink / raw
To: gentoo-commits
commit: e499fb1751df277f49df3abfbbd3a873762f8918
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Thu Jul 18 07:29:58 2013 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Thu Jul 18 07:29:58 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=e499fb17
roverlay/depres/depresult: remove __getitem__()
---
roverlay/depres/depresult.py | 15 ---------------
1 file changed, 15 deletions(-)
diff --git a/roverlay/depres/depresult.py b/roverlay/depres/depresult.py
index 2ad2488..d084ea0 100644
--- a/roverlay/depres/depresult.py
+++ b/roverlay/depres/depresult.py
@@ -4,8 +4,6 @@
# Distributed under the terms of the GNU General Public License;
# either version 2 of the License, or (at your option) any later version.
-from __future__ import print_function
-
__all__ = [ 'DepResult', 'DEP_NOT_RESOLVED', ]
import logging
@@ -79,19 +77,6 @@ class _DepResult ( object ):
return self.dep if self.dep is not None else EMPTY_STR
# --- end of __str__ (...) ---
- def __getitem__ ( self, key ):
- # for backwards compatibility, indexing is supported
- print ( "FIXME: __getitem__ is deprecated" )
- if key == 0:
- return self.score
- elif key == 1:
- return self.dep
- elif isinstance ( key, int ):
- raise IndexError ( key )
- else:
- raise KeyError ( key )
- # --- end of __getitem__ (...) ---
-
def prepare_selfdep_reduction ( self ):
"""Prepares this dep result for selfdep validation by creating all
necessary variables.
^ permalink raw reply related [flat|nested] 11+ messages in thread
end of thread, other threads:[~2013-07-18 19:26 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-11 8:49 [gentoo-commits] proj/R_overlay:master commit in: roverlay/depres/ André Erdmann
2013-07-11 8:45 ` [gentoo-commits] proj/R_overlay:gsoc13/next " André Erdmann
-- strict thread matches above, loose matches on Subject: below --
2013-07-18 19:25 André Erdmann
2013-07-17 18:10 André Erdmann
2013-07-16 16:36 [gentoo-commits] proj/R_overlay:master " André Erdmann
2013-07-15 22:31 ` [gentoo-commits] proj/R_overlay:gsoc13/next " André Erdmann
2013-07-15 22:31 André Erdmann
2013-07-11 16:44 André Erdmann
2013-07-08 22:47 André Erdmann
2013-07-05 16:55 André Erdmann
2013-07-05 16:55 André Erdmann
2013-06-13 16:34 [gentoo-commits] proj/R_overlay:master " André Erdmann
2013-06-13 16:34 ` [gentoo-commits] proj/R_overlay:gsoc13/next " André Erdmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox