public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/
@ 2013-07-23  7:51 André Erdmann
  2013-07-23  7:51 ` [gentoo-commits] proj/R_overlay:gsoc13/next " André Erdmann
  0 siblings, 1 reply; 20+ messages in thread
From: André Erdmann @ 2013-07-23  7:51 UTC (permalink / raw
  To: gentoo-commits

commit:     80a5617c256f0c650221849a5f0c0d39b3cb2686
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Mon Jul 22 12:08:45 2013 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Mon Jul 22 12:08:45 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=80a5617c

roverlay/argutil: remove --run-script entirely

---
 roverlay/argutil.py | 20 --------------------
 1 file changed, 20 deletions(-)

diff --git a/roverlay/argutil.py b/roverlay/argutil.py
index df40d34..449b359 100644
--- a/roverlay/argutil.py
+++ b/roverlay/argutil.py
@@ -6,8 +6,6 @@
 
 """provides arg parsing for the roverlay main script"""
 
-# TODO: remove --run-script here
-
 __all__ = [ 'parse_argv', ]
 
 import os
@@ -409,18 +407,6 @@ def get_parser ( command_map, default_config_file, default_command='create' ):
       type=is_gid,
    )
 
-   arg (
-      '--run-script', '-X', default=argparse.SUPPRESS,
-      metavar="<script>",
-      help="run a script in roverlay\'s environment and exit afterwards",
-      type=is_fs_file,
-   )
-
-   arg (
-      '--script-args', dest='run_script_args', default=argparse.SUPPRESS,
-      metavar="<args>",
-      help="args for --run-script",
-   )
 
 #   # TODO
 #   arg (
@@ -496,12 +482,6 @@ def parse_argv ( command_map, **kw ):
       target_gid              = p.target_gid,
    )
 
-   if given ( 'run_script' ):
-      extra ['run_script']      = p.run_script
-      extra ['run_script_args'] = tuple (
-         getattr ( p, 'run_script_args', "" ).split ( None )
-      )
-      # or use shlex for splitting
 
    if given ( 'overlay' ):
       doconf ( p.overlay, 'OVERLAY.dir' )


^ permalink raw reply related	[flat|nested] 20+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/
@ 2013-07-23  7:51 André Erdmann
  2013-07-19 18:00 ` [gentoo-commits] proj/R_overlay:gsoc13/next " André Erdmann
  0 siblings, 1 reply; 20+ messages in thread
From: André Erdmann @ 2013-07-23  7:51 UTC (permalink / raw
  To: gentoo-commits

commit:     09b615d1352bab7662426b3b5c64bb60ae4e4a7b
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Fri Jul 19 17:45:47 2013 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Fri Jul 19 17:45:47 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=09b615d1

roverlay/strutil: unquote_all()

---
 roverlay/strutil.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/roverlay/strutil.py b/roverlay/strutil.py
index b4e2631..755a191 100644
--- a/roverlay/strutil.py
+++ b/roverlay/strutil.py
@@ -108,7 +108,7 @@ def pipe_lines ( _pipe, use_filter=False, filter_func=None ):
       return lines
 # --- end of pipe_lines (...) ---
 
-def unquote ( _str, keep_going=False):
+def unquote ( _str, keep_going=False ):
    """Removes enclosing quotes from a string.
 
    arguments:
@@ -124,6 +124,10 @@ def unquote ( _str, keep_going=False):
    return _str
 # --- end of unquote (...) ---
 
+def unquote_all ( s ):
+   return unquote ( s, keep_going=True )
+# --- end of unquote_all (...) ---
+
 def bytes_try_decode (
    byte_str,
    encodings=_DEFAULT_ENCODINGS,


^ permalink raw reply related	[flat|nested] 20+ messages in thread
* [gentoo-commits] proj/R_overlay:gsoc13/next commit in: roverlay/
@ 2013-07-19 18:00 André Erdmann
  0 siblings, 0 replies; 20+ messages in thread
From: André Erdmann @ 2013-07-19 18:00 UTC (permalink / raw
  To: gentoo-commits

commit:     545daa132cf9ea6e52e925c57b3a3718e2916ad1
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Fri Jul 19 18:00:12 2013 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Fri Jul 19 18:00:12 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=545daa13

roverlay/main: use new depres console

---
 roverlay/main.py | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/roverlay/main.py b/roverlay/main.py
index 31a5ea0..b97b5cd 100644
--- a/roverlay/main.py
+++ b/roverlay/main.py
@@ -579,10 +579,15 @@ def main (
          die ( "depres_console cannot be run with other commands!", DIE.USAGE )
 
       try:
-         from roverlay.depres.simpledeprule.console import DepResConsole
-         con = DepResConsole()
-         con.run()
-         set_action_done ( "depres_console" )
+         from roverlay.console.depres import DepresConsole
+         con = DepresConsole()
+         con.setup ( config=conf )
+         try:
+            con.run_forever()
+            set_action_done ( "depres_console" )
+         finally:
+            con.close()
+
       except ImportError:
          if HIDE_EXCEPTIONS:
             die ( "Cannot import depres console!", DIE.IMPORT )


^ permalink raw reply related	[flat|nested] 20+ messages in thread
* [gentoo-commits] proj/R_overlay:gsoc13/next commit in: roverlay/
@ 2013-07-17 18:05 André Erdmann
  0 siblings, 0 replies; 20+ messages in thread
From: André Erdmann @ 2013-07-17 18:05 UTC (permalink / raw
  To: gentoo-commits

commit:     a01c5b354610331bdd684aa3632a1f692a44d6cb
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Wed Jul 17 17:58:11 2013 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Wed Jul 17 18:00:00 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=a01c5b35

fix versiontuple (again)

The le/lt/ge/gt comparision functions were completely wrong, which caused
selfdep validation to misbehave. Checking "(0,97) <= (1,1,2)" always returned
False (but 0 < 1!), whereas "(1,1,2) >= (0,97)" returned False, too (which is
be correct, but "neither less nor greater nor equal" makes no sense at all).

In a second (incremental) run, all comparisions would then evaluate to true,
because PackageInfo created normal tuples for scanned ebuilds, for which
IntVersionTuple returns NotImplemented (when comparing).
And bool( NotImplemented ) <=> True,
so even IntVersionTuple(1,1) was "less than" tuple(0,0).

This commit fixes this issue.

---
 roverlay/packageinfo.py  |  9 +++++----
 roverlay/versiontuple.py | 52 +++++++++++++++++++++++++++++++++++++-----------
 2 files changed, 45 insertions(+), 16 deletions(-)

diff --git a/roverlay/packageinfo.py b/roverlay/packageinfo.py
index 0224d6c..feee360 100644
--- a/roverlay/packageinfo.py
+++ b/roverlay/packageinfo.py
@@ -108,7 +108,7 @@ class PackageInfo ( object ):
       'has_suggests',
    ))
    _UPDATE_KEYS_SIMPLE_INITIAL = frozenset ((
-      'package_filename',
+      'package_filename', 'name',
    ))
    _UPDATE_KEYS_FILTER_NONE    = frozenset ((
       'src_uri_base',
@@ -810,9 +810,10 @@ class PackageInfo ( object ):
             )
          )
       # non-digit chars in pv are unsupported, too
-
-      self._info ['version'] = tuple ( int ( z ) for z in pv.split ( '.' ) )
-      self._info ['rev']     =  int ( pr_str ) if pr_str else 0
+      self._info ['version'] = roverlay.versiontuple.IntVersionTuple (
+         int ( z ) for z in pv.split ( '.' )
+      )
+      self._info ['rev'] = int ( pr_str ) if pr_str else 0
 
       self._info ['ebuild_verstr'] = pvr
    # --- end of _use_pvr (...) ---

diff --git a/roverlay/versiontuple.py b/roverlay/versiontuple.py
index 0ca902a..20d5cf8 100644
--- a/roverlay/versiontuple.py
+++ b/roverlay/versiontuple.py
@@ -166,36 +166,64 @@ class IntVersionTuple ( VersionTuple ):
 
    def __le__ ( self, other ):
       if isinstance ( other, self.__class__ ):
-         return all ( a <= b
-            for a, b in _zip_longest ( self, other, fillvalue=0 )
-         )
+         #
+         # ( k0, k1, ..., kN ) x ( l0, l1, ..., lN )
+         #
+         # from left to right (high to low)
+         # if k_j < l_j
+         #    return True (k <= j)
+         # elif k_j == l_j
+         #    continue with next
+         # else
+         #    return False (k > j)
+         #
+         # return True if last pair was equal
+         for a, b in _zip_longest ( self, other, fillvalue=0 ):
+            if a < b:
+               return True
+            elif a > b:
+               return False
+         else:
+            return True
       else:
          return NotImplemented
    # --- end of __le__ (...) ---
 
    def __ge__ ( self, other ):
       if isinstance ( other, self.__class__ ):
-         return all ( a >= b
-            for a, b in _zip_longest ( self, other, fillvalue=0 )
-         )
+         for a, b in _zip_longest ( self, other, fillvalue=0 ):
+            if a > b:
+               return True
+            elif a < b:
+               return False
+         else:
+            return True
       else:
          return NotImplemented
    # --- end of __ge__ (...) ---
 
    def __lt__ ( self, other ):
       if isinstance ( other, self.__class__ ):
-         return all ( a < b
-            for a, b in _zip_longest ( self, other, fillvalue=0 )
-         )
+         for a, b in _zip_longest ( self, other, fillvalue=0 ):
+            if a < b:
+               return True
+            elif a > b:
+               return False
+         else:
+            return False
       else:
          return NotImplemented
    # --- end of __lt__ (...) ---
 
    def __gt__ ( self, other ):
       if isinstance ( other, self.__class__ ):
-         return all ( a > b
-            for a, b in _zip_longest ( self, other, fillvalue=0 )
-         )
+         for a, b in _zip_longest ( self, other, fillvalue=0 ):
+            if a > b:
+               return True
+            elif a < b:
+               return False
+         else:
+            return False
       else:
          return NotImplemented
    # --- end of __gt__ (...) ---


^ permalink raw reply related	[flat|nested] 20+ messages in thread
* [gentoo-commits] proj/R_overlay:gsoc13/next commit in: roverlay/
@ 2013-07-15 22:31 André Erdmann
  0 siblings, 0 replies; 20+ messages in thread
From: André Erdmann @ 2013-07-15 22:31 UTC (permalink / raw
  To: gentoo-commits

commit:     6e32f77915e8bf388059f79750a5a30bf8d2fb49
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Mon Jul 15 22:29:05 2013 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Mon Jul 15 22:29:05 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=6e32f779

--run-script: respect EvENT_HOOK_RESTRICT

---
 roverlay/hook.py |  4 ++--
 roverlay/main.py | 25 +++++++++++++++----------
 2 files changed, 17 insertions(+), 12 deletions(-)

diff --git a/roverlay/hook.py b/roverlay/hook.py
index e56aa33..262d3c2 100644
--- a/roverlay/hook.py
+++ b/roverlay/hook.py
@@ -32,12 +32,12 @@ _EVENT_POLICY = 0
 class HookException ( Exception ):
    pass
 
-def setup():
+def setup ( force=False ):
    global _EVENT_SCRIPT
    global _EVENT_POLICY
    global _EVENT_RESTRICT
 
-   if roverlay.config.get ( 'write_disabled', False ):
+   if roverlay.config.get ( 'write_disabled', False ) and not force:
       _EVENT_SCRIPT = False
       return
 

diff --git a/roverlay/main.py b/roverlay/main.py
index 24c02c6..7a88171 100644
--- a/roverlay/main.py
+++ b/roverlay/main.py
@@ -497,16 +497,21 @@ def main (
 
    if do_runscript:
       import roverlay.tools.shenv
-      sys.exit (
-         roverlay.tools.shenv.run_script (
-            script         = extra_opts ['run_script'],
-            phase          = "user",
-            argv           = extra_opts ['run_script_args'],
-            return_success = False,
-            log_output     = False,
-            initial_dir    = os.getcwd(),
-         ).returncode
-      )
+      import roverlay.hook
+      roverlay.hook.setup ( force=True )
+      if roverlay.hook.phase_allowed ( "user" ):
+         sys.exit (
+            roverlay.tools.shenv.run_script (
+               script         = extra_opts ['run_script'],
+               phase          = "user",
+               argv           = extra_opts ['run_script_args'],
+               return_success = False,
+               log_output     = False,
+               initial_dir    = os.getcwd(),
+            ).returncode
+         )
+      else:
+         die ( "--run-script: 'user' phase is not allowed." )
    elif do_setupdirs:
       sys.exit ( run_setupdirs (
          conf, extra_opts['target_uid'], extra_opts['target_gid']


^ permalink raw reply related	[flat|nested] 20+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/
@ 2013-07-12 13:57 André Erdmann
  2013-07-12 13:57 ` [gentoo-commits] proj/R_overlay:gsoc13/next " André Erdmann
  0 siblings, 1 reply; 20+ messages in thread
From: André Erdmann @ 2013-07-12 13:57 UTC (permalink / raw
  To: gentoo-commits

commit:     55b83ffd569c0c3ce9ae46e6198805873864e8a4
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Fri Jul 12 13:47:45 2013 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Fri Jul 12 13:47:45 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=55b83ffd

roverlay, setupdirs command: dont load field def

---
 roverlay/__init__.py | 27 ++++++++++++++++-----------
 roverlay/main.py     |  2 ++
 2 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/roverlay/__init__.py b/roverlay/__init__.py
index 175f2d1..f660a4a 100644
--- a/roverlay/__init__.py
+++ b/roverlay/__init__.py
@@ -30,17 +30,21 @@ def setup_initial_logger():
    """Sets up initial logging."""
    roverlay.recipe.easylogger.setup_initial()
 
-def load_config_file ( cfile, extraconf=None, setup_logger=True ):
+def load_config_file (
+   cfile, extraconf=None, setup_logger=True, load_main_only=False
+):
    """
    Loads the config, including the field definition file.
    Sets up the logger afterwards.
    (Don't call this method more than once.)
 
    arguments:
-   * cfile        -- path to the config file
-   * extraconf    -- a dict with additional config entries that will override
-                      entries read from cfile
-   * setup_logger -- set up logger (defaults to True)
+   * cfile          -- path to the config file
+   * extraconf      -- a dict with additional config entries that will override
+                        entries read from cfile
+   * setup_logger   -- set up logger (defaults to True)
+   * load_main_only -- if set and True: load main config file only
+                        (= do not load field def, ...)
    """
    roverlay_config = roverlay.config.access()
 
@@ -55,12 +59,13 @@ def load_config_file ( cfile, extraconf=None, setup_logger=True ):
    if setup_logger:
       roverlay.recipe.easylogger.setup ( roverlay_config )
 
-   confloader.load_field_definition (
-      roverlay_config.get_or_fail ( "DESCRIPTION.field_definition_file" )
-   )
+   if not load_main_only:
+      confloader.load_field_definition (
+         roverlay_config.get_or_fail ( "DESCRIPTION.field_definition_file" )
+      )
 
-   confloader.load_use_expand_map (
-      roverlay_config.get ( "EBUILD.USE_EXPAND.rename_file" )
-   )
+      confloader.load_use_expand_map (
+         roverlay_config.get ( "EBUILD.USE_EXPAND.rename_file" )
+      )
 
    return roverlay_config

diff --git a/roverlay/main.py b/roverlay/main.py
index 75d1e2f..0fec74d 100644
--- a/roverlay/main.py
+++ b/roverlay/main.py
@@ -101,6 +101,7 @@ def run_setupdirs ( config, target_uid, target_gid ):
                os.path.dirname ( value.rstrip ( os.sep ) )
                if dirmask & WANT_FILEDIR else value.rstrip ( os.sep )
             )
+
             if dirpath:
                dodir ( dirpath )
                if dirmask & WANT_PRIVATE:
@@ -459,6 +460,7 @@ def main (
          config_file,
          extraconf=additional_config,
          setup_logger=want_logging,
+         load_main_only=do_setupdirs,
       )
       del config_file, additional_config
    except:


^ permalink raw reply related	[flat|nested] 20+ messages in thread
* [gentoo-commits] proj/R_overlay:gsoc13/next commit in: roverlay/
@ 2013-07-08 22:47 André Erdmann
  0 siblings, 0 replies; 20+ messages in thread
From: André Erdmann @ 2013-07-08 22:47 UTC (permalink / raw
  To: gentoo-commits

commit:     f08cd6669279af63d10b26879c41bb3d9500b6af
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Mon Jul  8 22:45:28 2013 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Mon Jul  8 22:45:28 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=f08cd666

fix package_comparator in roverlay/versiontuple.py

---
 roverlay/versiontuple.py | 66 ++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 64 insertions(+), 2 deletions(-)

diff --git a/roverlay/versiontuple.py b/roverlay/versiontuple.py
index 2fa78ba..0ca902a 100644
--- a/roverlay/versiontuple.py
+++ b/roverlay/versiontuple.py
@@ -24,6 +24,35 @@ VMOD_GE    = VMOD_EQ | VMOD_GT
 VMOD_LT    = 16
 VMOD_LE    = VMOD_EQ | VMOD_LT
 
+VMOD_INVERSE_MAP = {
+   VMOD_EQ: VMOD_NE,
+   VMOD_NE: VMOD_EQ,
+   VMOD_LE: VMOD_GT,
+   VMOD_LT: VMOD_GE,
+   VMOD_GE: VMOD_LT,
+   VMOD_GT: VMOD_LE,
+}
+VMOD_INVERSE_EQ_PRESERVE_MAP = {
+   VMOD_EQ: VMOD_NE,
+   VMOD_NE: VMOD_EQ,
+   VMOD_LE: VMOD_GE,
+   VMOD_LT: VMOD_GT,
+   VMOD_GE: VMOD_LE,
+   VMOD_GT: VMOD_LT,
+}
+
+def vmod_inverse ( vmod, keep_eq=True ):
+   """Returns the inverse of vmod (== becomes !=, > becomes <=, ...).
+   Returns VMOD_UNDEF if the operation is not supported.
+
+   arguments:
+   * vmod    -- int
+   * keep_eq -- preserve VMOD_EQ
+   """
+   return (
+      VMOD_INVERSE_EQ_PRESERVE_MAP if keep_eq else VMOD_INVERSE_MAP
+   ).get ( vmod, VMOD_UNDEF )
+# --- end of vmod_inverse (...) ---
 
 def pkgver_decorator ( func ):
    def wrapped ( p, *args, **kwargs ):
@@ -43,6 +72,17 @@ class VersionTuple ( tuple ):
    # --- end of __init__ (...) ---
 
    def get_comparator ( self, mode ):
+      """Returns a function "this ~ other" that returns
+      "<this version> <mode, e.g. VMOD_EQ> <other version>", e.g. <a> <= <b>.
+
+      Returns None if mode is unknown / not supported.
+
+      Note: Use vmod_inverse(mode) to get a comparator "other ~ this"
+
+      arguments:
+      * mode -- comparator 'mode' (VMOD_EQ, VMOD_NE, VMOD_LE, VMOD_GE,
+                VMOD_LT, VMOD_GT)
+      """
       if not mode or mode & VMOD_UNDEF:
          return None
       elif mode & VMOD_EQ:
@@ -62,16 +102,38 @@ class VersionTuple ( tuple ):
       return None
    # --- end of get_comparator (...) ---
 
-   def get_package_comparator ( self, mode ):
-      f = self.get_comparator ( mode )
+   def get_package_comparator ( self, mode, keep_eq=True ):
+      """Returns a function "package ~ this" that returns
+      "<package version> <inversed mode> <this version>"
+
+      Returns None if mode is unknown / not supported.
+
+      arguments:
+      * mode    -- comparator 'mode' that will be inversed
+                   (see get_comparator() and vmod_inverse())
+      * keep_eq -- preserve VMOD_EQ when determining the inverse of mode
+                   (Example: '<' becomes '>' if True, else '>=')
+      """
+      f = self.get_comparator ( vmod_inverse ( mode, keep_eq=True ) )
       return pkgver_decorator ( f ) if f is not None else None
    # --- end of get_package_comparator (...) ---
 
    def set_default_compare ( self, mode ):
+      """Sets the default comparator.
+
+      arguments:
+      * mode -- comparator mode
+      """
       self._default_compare = self.get_comparator ( mode )
    # --- end of set_default_compare (...) ---
 
    def compare ( self, other ):
+      """Uses the default comparator to compare this object with another one
+      and returns the result.
+
+      arguments:
+      * other --
+      """
       self._default_compare ( other )
    # --- end of compare (...) ---
 


^ permalink raw reply related	[flat|nested] 20+ messages in thread
* [gentoo-commits] proj/R_overlay:gsoc13/next commit in: roverlay/
@ 2013-07-08 22:47 André Erdmann
  0 siblings, 0 replies; 20+ messages in thread
From: André Erdmann @ 2013-07-08 22:47 UTC (permalink / raw
  To: gentoo-commits

commit:     7fafe288511b1b12fd7e18d6ec51e8d1c18f3640
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Mon Jul  8 22:34:37 2013 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Mon Jul  8 22:34:37 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=7fafe288

roverlay/digest: try to use hashlib-provided funcs

---
 roverlay/digest.py | 53 +++++++++++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 49 insertions(+), 4 deletions(-)

diff --git a/roverlay/digest.py b/roverlay/digest.py
index a031889..49625ee 100644
--- a/roverlay/digest.py
+++ b/roverlay/digest.py
@@ -14,19 +14,64 @@ __all__ = [
    'whirlpool_file',
 ]
 
-import hashlib
-import portage.util.whirlpool
-
 DEFAULT_BLOCKSIZE=16384
 
+
+import hashlib
+
 _HASH_CREATE_MAP = {
    'md5'       : hashlib.md5,
    'sha1'      : hashlib.sha1,
    'sha256'    : hashlib.sha256,
    'sha512'    : hashlib.sha512,
-   'whirlpool' : portage.util.whirlpool.new,
 }
 
+def hashlib_wrap ( name ):
+   """Creates a wrapper that uses hashlib.new(<name>) for the given name.
+
+   arguments:
+   * name -- hash name, e.g. whirlpool
+   """
+   def wrapped ( *args, **kwargs ):
+      return hashlib.new ( name, *args, **kwargs )
+   # --- end of wrapped (...) ---
+
+   h = hashlib.new
+   wrapped.__dict__.update ( h.__dict__ )
+   wrapped.__name__ = name
+   wrapped.__doc__  = h.__doc__
+   del h
+   return wrapped
+# --- end of hashlib_wrap (...) ---
+
+def hashlib_supports ( name ):
+   """Returns True if the given hash type is supported, else False.
+
+   arguments:
+   * name --
+   """
+   if name in getattr ( hashlib, 'algorithms_available', () ):
+      # python 2's hashlib has no algorithms_available attribute
+      return True
+   else:
+      ret = False
+      try:
+         hashlib.new ( name )
+      except ValueError:
+         pass
+      else:
+         ret = True
+      return ret
+# --- end of hashlib_supports (...) ---
+
+if hashlib_supports ( 'whirlpool' ):
+   _HASH_CREATE_MAP ['whirlpool'] = hashlib_wrap ( "whirlpool" )
+else:
+   import portage.util.whirlpool
+   _HASH_CREATE_MAP ['whirlpool'] = portage.util.whirlpool.new
+
+# -- end of imports / HASH_CREATE_MAP
+
 
 def _generic_obj_hash (
    hashobj, fh, binary_digest=False, blocksize=DEFAULT_BLOCKSIZE


^ permalink raw reply related	[flat|nested] 20+ messages in thread
* [gentoo-commits] proj/R_overlay:gsoc13/next commit in: roverlay/
@ 2013-07-05 16:55 André Erdmann
  0 siblings, 0 replies; 20+ messages in thread
From: André Erdmann @ 2013-07-05 16:55 UTC (permalink / raw
  To: gentoo-commits

commit:     cf75a983ebf49ebcf4cd360da311545a39bfb2f7
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Fri Jul  5 16:55:01 2013 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Fri Jul  5 16:55:01 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=cf75a983

roverlay/main: call selfdep reduction

---
 roverlay/main.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/roverlay/main.py b/roverlay/main.py
index 8bfecf6..b49cac3 100644
--- a/roverlay/main.py
+++ b/roverlay/main.py
@@ -278,6 +278,10 @@ def main (
             overlay_creator.remove_moved_ebuilds ( reverse=True )
 
          overlay_creator.run ( close_when_done=True )
+         # FIXME:
+         # overlay_creator.remove_bad_packages() should replace this direct
+         # call (and could create timestats for it)
+         overlay_creator.overlay.remove_bad_packages()
 
          optionally ( overlay_creator.write_overlay, 'write_overlay' )
          optionally ( overlay_creator.show_overlay,  'show_overlay'  )


^ permalink raw reply related	[flat|nested] 20+ messages in thread
* [gentoo-commits] proj/R_overlay:gsoc13/next commit in: roverlay/
@ 2013-07-05 16:55 André Erdmann
  0 siblings, 0 replies; 20+ messages in thread
From: André Erdmann @ 2013-07-05 16:55 UTC (permalink / raw
  To: gentoo-commits

commit:     63c708b21af0b6aea9ffb881f24a98a3e2281209
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Fri Jul  5 16:43:19 2013 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Fri Jul  5 16:43:19 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=63c708b2

packageinfo: init_selfdep_validate(), versiontuple

versiontuple implements comparision operations (==,!=,<=,<,>=,>).

---
 roverlay/packageinfo.py  |  28 ++++++++--
 roverlay/versiontuple.py | 141 +++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 164 insertions(+), 5 deletions(-)

diff --git a/roverlay/packageinfo.py b/roverlay/packageinfo.py
index bef9327..1bcf495 100644
--- a/roverlay/packageinfo.py
+++ b/roverlay/packageinfo.py
@@ -18,6 +18,7 @@ import os.path
 import logging
 
 import roverlay.digest
+import roverlay.versiontuple
 import roverlay.db.distmap
 
 from roverlay          import config, strutil
@@ -128,11 +129,11 @@ class PackageInfo ( object ):
       * **initial_info -- passed to update ( **kw )
       """
       self._info    = dict()
-      self.valid    = True
       self.readonly = False
       self.logger   = LOGGER
       self.selfdeps = None
 
+      #self.selfdeps_valid      = UNDEF
       #self.overlay_package_ref = None
       #self._evars              = dict()
       #self._lazy_actions       = list()
@@ -141,13 +142,26 @@ class PackageInfo ( object ):
       self.update ( **initial_info )
    # --- end of __init__ (...) ---
 
+   def init_selfdep_validate ( self ):
+      """Tells this packageinfo to initialize selfdep validation.
+      Returns True on success (=has selfdeps), else False.
+      """
+      self.selfdeps_valid = True
+      if self.selfdeps:
+         for selfdep in self.selfdeps:
+            selfdep.prepare_selfdep_reduction()
+         return True
+      else:
+         return False
+   # --- end of init_selfdep_validate (...) ---
+
    def has_valid_selfdeps ( self ):
       """Returns True if all selfdeps of this package are valid."""
-      v = self.valid
+      v = self.selfdeps_valid
       if v is True and self.selfdeps is not None and not all (
          map ( lambda d: d.deps_satisfiable(), self.selfdeps )
       ):
-         self.valid = False
+         self.selfdeps_valid = False
          return False
       return v
    # --- end of has_valid_selfdeps (...) ---
@@ -528,7 +542,9 @@ class PackageInfo ( object ):
       """
       rev     = self._info['rev'] + 1 if newrev is None else int ( newrev )
       rev_str = ( '-r' + str ( rev ) ) if rev > 0 else ''
-      vstr    = '.'.join ( str ( k ) for k in self ['version'] ) + rev_str
+      vstr    = (
+         '.'.join ( str ( k ) for k in self._info['version'] ) + rev_str
+      )
 
       # preserve destpath directory
       #  (this allows to handle paths like "a/b.tar/pkg.tgz" properly)
@@ -735,7 +751,9 @@ class PackageInfo ( object ):
 
       try:
          version = tuple ( int ( z ) for z in version_str.split ( '.' ) )
-         self._info ['version'] = version
+         self._info ['version'] = (
+            roverlay.versiontuple.IntVersionTuple ( version )
+         )
       except ValueError as ve:
          # version string is malformed, cannot use it
          self.logger.error (

diff --git a/roverlay/versiontuple.py b/roverlay/versiontuple.py
new file mode 100644
index 0000000..2fa78ba
--- /dev/null
+++ b/roverlay/versiontuple.py
@@ -0,0 +1,141 @@
+# R overlay --
+# -*- coding: utf-8 -*-
+# Copyright (C) 2013 André Erdmann <dywi@mailerd.de>
+# Distributed under the terms of the GNU General Public License;
+# either version 2 of the License, or (at your option) any later version.
+
+import sys
+import itertools
+
+if sys.hexversion >= 0x3000000:
+   _zip_longest = itertools.zip_longest
+else:
+   _zip_longest = itertools.izip_longest
+
+
+# integer representation of version comparision
+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
+
+
+def pkgver_decorator ( func ):
+   def wrapped ( p, *args, **kwargs ):
+      return func ( p._info ['version'], *args, **kwargs )
+   # --- end of wrapped (...) ---
+   wrapped.__name__ = func.__name__
+   wrapped.__doc__  = func.__doc__
+   wrapped.__dict__.update ( func.__dict__ )
+   return wrapped
+# --- end of pkgver_decorator (...) ---
+
+
+class VersionTuple ( tuple ):
+
+   def __init__ ( self, *args, **kwargs ):
+      super ( VersionTuple, self ).__init__ ( *args, **kwargs )
+   # --- end of __init__ (...) ---
+
+   def get_comparator ( self, mode ):
+      if not mode or mode & VMOD_UNDEF:
+         return None
+      elif mode & VMOD_EQ:
+         if mode == VMOD_EQ:
+            return self.__eq__
+         elif mode == VMOD_NE:
+            return self.__ne__
+         elif mode == VMOD_LE:
+            return self.__le__
+         elif mode == VMOD_GE:
+            return self.__ge__
+      elif mode == VMOD_LT:
+         return self.__lt__
+      elif mode == VMOD_GT:
+         return self.__gt__
+
+      return None
+   # --- end of get_comparator (...) ---
+
+   def get_package_comparator ( self, mode ):
+      f = self.get_comparator ( mode )
+      return pkgver_decorator ( f ) if f is not None else None
+   # --- end of get_package_comparator (...) ---
+
+   def set_default_compare ( self, mode ):
+      self._default_compare = self.get_comparator ( mode )
+   # --- end of set_default_compare (...) ---
+
+   def compare ( self, other ):
+      self._default_compare ( other )
+   # --- end of compare (...) ---
+
+# --- end of VersionTuple ---
+
+
+class IntVersionTuple ( VersionTuple ):
+
+   def iter_compare ( self, other ):
+      return _zip_longest ( self, other, fillvalue=0 )
+   # --- end of _iter_compare (...) ---
+
+   def __eq__ ( self, other ):
+      if isinstance ( other, self.__class__ ):
+         return all ( a == b
+            for a, b in _zip_longest ( self, other, fillvalue=0 )
+         )
+      else:
+         return NotImplemented
+   # --- end of __eq__ (...) ---
+
+   def __ne__ ( self, other ):
+      if isinstance ( other, self.__class__ ):
+         return any ( a != b
+            for a, b in _zip_longest ( self, other, fillvalue=0 )
+         )
+      else:
+         return NotImplemented
+   # --- end of __ne__ (...) ---
+
+   def __le__ ( self, other ):
+      if isinstance ( other, self.__class__ ):
+         return all ( a <= b
+            for a, b in _zip_longest ( self, other, fillvalue=0 )
+         )
+      else:
+         return NotImplemented
+   # --- end of __le__ (...) ---
+
+   def __ge__ ( self, other ):
+      if isinstance ( other, self.__class__ ):
+         return all ( a >= b
+            for a, b in _zip_longest ( self, other, fillvalue=0 )
+         )
+      else:
+         return NotImplemented
+   # --- end of __ge__ (...) ---
+
+   def __lt__ ( self, other ):
+      if isinstance ( other, self.__class__ ):
+         return all ( a < b
+            for a, b in _zip_longest ( self, other, fillvalue=0 )
+         )
+      else:
+         return NotImplemented
+   # --- end of __lt__ (...) ---
+
+   def __gt__ ( self, other ):
+      if isinstance ( other, self.__class__ ):
+         return all ( a > b
+            for a, b in _zip_longest ( self, other, fillvalue=0 )
+         )
+      else:
+         return NotImplemented
+   # --- end of __gt__ (...) ---
+
+# --- end of IntVersionTuple ---


^ permalink raw reply related	[flat|nested] 20+ messages in thread
* [gentoo-commits] proj/R_overlay:gsoc13/next commit in: roverlay/
@ 2013-07-05 16:55 André Erdmann
  0 siblings, 0 replies; 20+ messages in thread
From: André Erdmann @ 2013-07-05 16:55 UTC (permalink / raw
  To: gentoo-commits

commit:     0eb35aacd9c423b6b30be532a5e86aa0c9a2ce3d
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Fri Jul  5 11:20:12 2013 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Fri Jul  5 11:20:12 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=0eb35aac

roverlay/: don't run hooks if write is disabled

---
 roverlay/argutil.py | 2 ++
 roverlay/hook.py    | 4 ++++
 2 files changed, 6 insertions(+)

diff --git a/roverlay/argutil.py b/roverlay/argutil.py
index 34147d7..869ea8b 100644
--- a/roverlay/argutil.py
+++ b/roverlay/argutil.py
@@ -468,6 +468,8 @@ def parse_argv ( command_map, **kw ):
    if given ( 'distmap_verify' ):
       doconf ( p.distmap_verify, 'OVERLAY.DISTDIR.verify' )
 
+   if not extra.get ( 'write_overlay', True ):
+      doconf ( True, "write_disabled" )
 
    return ( commands, p.config, conf, extra )
 # --- end of parse_argv (...) ---

diff --git a/roverlay/hook.py b/roverlay/hook.py
index 3392e4e..e56aa33 100644
--- a/roverlay/hook.py
+++ b/roverlay/hook.py
@@ -37,6 +37,10 @@ def setup():
    global _EVENT_POLICY
    global _EVENT_RESTRICT
 
+   if roverlay.config.get ( 'write_disabled', False ):
+      _EVENT_SCRIPT = False
+      return
+
    _EVENT_SCRIPT = roverlay.config.get ( 'EVENT_HOOK.exe', False )
    if _EVENT_SCRIPT is False:
       if roverlay.config.get_or_fail ( 'installed' ):


^ permalink raw reply related	[flat|nested] 20+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/
@ 2013-06-22 15:24 André Erdmann
  2013-06-22 15:14 ` [gentoo-commits] proj/R_overlay:gsoc13/next " André Erdmann
  0 siblings, 1 reply; 20+ messages in thread
From: André Erdmann @ 2013-06-22 15:24 UTC (permalink / raw
  To: gentoo-commits

commit:     5374a6066d9f8615243bba9b0a2d0c5be487f653
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Sat Jun 22 15:03:05 2013 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Sat Jun 22 15:03:05 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=5374a606

roverlay/packageinfo, revbump: set src_uri_dest

Rename distfiles of rev-bumped ebuilds.

---
 roverlay/packageinfo.py | 48 ++++++++++++++++++++++++++----------------------
 1 file changed, 26 insertions(+), 22 deletions(-)

diff --git a/roverlay/packageinfo.py b/roverlay/packageinfo.py
index 7b74425..b86d69d 100644
--- a/roverlay/packageinfo.py
+++ b/roverlay/packageinfo.py
@@ -94,6 +94,7 @@ class PackageInfo ( object ):
    PKGSUFFIX_REGEX = re.compile (
       config.get_or_fail ( 'R_PACKAGE.suffix_regex' ) + '$'
    )
+   EBUILDREV_REGEX = re.compile ( '[-]r[0-9]+$' )
    ALWAYS_FALLBACK = frozenset ( ( 'ebuild', 'ebuild_file' ) )
 
    _UPDATE_KEYS_SIMPLE         = frozenset ((
@@ -505,19 +506,36 @@ class PackageInfo ( object ):
 
    def revbump ( self, newrev=None ):
       """Do whatever necessary to revbump this pakages, that is set/update
-      all data like src_uri_destfile.
+      all data like src_uri_dest and ebuild_verstr.
 
       arguments:
       * newrev -- new revision, (current rev + 1) is used if this is None
       """
-      if newrev is None:
-         # get old rev and increment it
-         ## direct dict access
-         self._info ['rev'] += 1
-      else:
-         self._info ['rev'] = int ( newrev )
+      rev     = self._info['rev'] + 1 if newrev is None else int ( newrev )
+      rev_str = ( '-r' + str ( rev ) ) if rev > 0 else ''
+      vstr    = '.'.join ( str ( k ) for k in self ['version'] ) + rev_str
+
+      # preserve destpath directory
+      #  (this allows to handle paths like "a/b.tar/pkg.tgz" properly)
+      #
+      old_destpath = self ['package_src_destpath'].rpartition ( os.path.sep )
+
+      # os.path.splitext does not "recognize" .tar.gz
+      fhead, ftar, fext = old_destpath[2].rpartition ( '.tar' )
+      if not ftar:
+         fhead, fext = os.path.splitext ( fext )
+
+      # FIXME: any way to get this reliably (+faster) done without a regex?
+      #  ( a,b,c=fhead.rpartition ( '-r' ); try int(c) ...; ?)
+      distfile = (
+         old_destpath[0] + old_destpath[1]
+         + self.EBUILDREV_REGEX.sub ( '', fhead ) + rev_str + ftar + fext
+      )
+
+      self._info ['rev']           = rev
+      self._info ['ebuild_verstr'] = vstr
+      self._info ['src_uri_dest']  = distfile
 
-      self._reset_version_str()
       return self
    # --- end of revbump (...) ---
 
@@ -620,20 +638,6 @@ class PackageInfo ( object ):
          return None
    # --- end of get_evars (...) ---
 
-   def _reset_version_str ( self ):
-      """Recreates the version_str ($PVR) of this PackageInfo instance."""
-      rev     = self ['rev']
-      version = self ['version']
-
-      if rev > 0:
-         vstr = '.'.join ( str ( k ) for k in version ) + '-r' + str ( rev )
-      else:
-         vstr = '.'.join ( str ( k ) for k in version )
-
-      self._info ['ebuild_verstr'] = vstr
-      #return vstr
-   # --- end of _reset_version_str (...) ---
-
    def _update ( self, info ):
       """Updates self._info using the given info dict.
 


^ permalink raw reply related	[flat|nested] 20+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/
@ 2013-06-22 15:24 André Erdmann
  2013-06-22 15:14 ` [gentoo-commits] proj/R_overlay:gsoc13/next " André Erdmann
  0 siblings, 1 reply; 20+ messages in thread
From: André Erdmann @ 2013-06-22 15:24 UTC (permalink / raw
  To: gentoo-commits

commit:     305933fc8ce3375745927cfda5fca824eb67f004
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Sat Jun 22 10:31:24 2013 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Sat Jun 22 10:31:24 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=305933fc

roverlay/packageinfo: support revbumps

---
 roverlay/packageinfo.py | 91 ++++++++++++++++++++++++++++++-------------------
 1 file changed, 56 insertions(+), 35 deletions(-)

diff --git a/roverlay/packageinfo.py b/roverlay/packageinfo.py
index 83a05ed..b75eb8c 100644
--- a/roverlay/packageinfo.py
+++ b/roverlay/packageinfo.py
@@ -16,6 +16,8 @@ __all__ = [ 'PackageInfo', ]
 import re
 import os.path
 import logging
+# TODO: remove threading/locks here, exclusive access to PackageInfo instances
+#       should be guaranteed
 import threading
 
 import roverlay.digest
@@ -320,10 +322,6 @@ class PackageInfo ( object ):
          return self._info [key_low]
 
       # 'virtual' keys - calculate result
-      elif key_low == 'name':
-         # no special name, using package_name
-         return self._info ['package_name']
-
       elif key_low == 'package_file':
          distdir = self.get ( 'distdir', do_fallback=True )
          if distdir:
@@ -443,14 +441,14 @@ class PackageInfo ( object ):
       """Returns the DESCRIPTION data for this PackageInfo (by reading the
       R package file if necessary).
       """
-      if 'desc_data' in self._info:
-         return self._info ['desc_data']
-
-      self._writelock_acquire()
       if 'desc_data' not in self._info:
-         self._info ['desc_data'] = descriptionreader.read ( self )
+         self._writelock_acquire()
+         if 'desc_data' not in self._info:
+            self._info ['desc_data'] = descriptionreader.read ( self )
+
+         self._update_lock.release()
+      # -- end if;
 
-      self._update_lock.release()
       return self._info ['desc_data']
    # --- end of get_desc_data (...) ---
 
@@ -518,12 +516,14 @@ class PackageInfo ( object ):
       arguments:
       * newrev -- new revision, (current rev + 1) is used if this is None
       """
-      raise NotImplementedError ( "revbump code" )
       if newrev is None:
          # get old rev and increment it
-         pass
+         ## direct dict access
+         self._info ['rev'] += 1
       else:
-         pass
+         self._info ['rev'] = int ( newrev )
+
+      self._reset_version_str()
       return self
    # --- end of revbump (...) ---
 
@@ -635,6 +635,19 @@ class PackageInfo ( object ):
          return None
    # --- end of get_evars (...) ---
 
+   def _reset_version_str ( self ):
+      rev     = self ['rev']
+      version = self ['version']
+
+      if rev > 0:
+         vstr = '.'.join ( str ( k ) for k in version ) + '-r' + str ( rev )
+      else:
+         vstr = '.'.join ( str ( k ) for k in version )
+
+      self._info ['ebuild_verstr'] = vstr
+      #return vstr
+   # --- end of _reset_version_str (...) ---
+
    def _update ( self, info ):
       """Updates self._info using the given info dict.
 
@@ -645,15 +658,14 @@ class PackageInfo ( object ):
 
       for key, value in info.items():
 
-         if key in self.__class__._UPDATE_KEYS_SIMPLE:
-            self [key] = value
-
-         elif initial and key in self.__class__._UPDATE_KEYS_SIMPLE_INITIAL:
-            self [key] = value
+         if key in self.__class__._UPDATE_KEYS_SIMPLE or (
+            initial and key in self.__class__._UPDATE_KEYS_SIMPLE_INITIAL
+         ):
+            self._info [key] = value
 
          elif key in self.__class__._UPDATE_KEYS_FILTER_NONE:
             if value is not None:
-               self [key] = value
+               self._info [key] = value
 
          elif key == 'filename':
             self._use_filename ( value )
@@ -662,10 +674,10 @@ class PackageInfo ( object ):
             self._use_pvr ( value )
 
          elif key == 'suggests':
-            self ['has_suggests'] = value
+            self._info ['has_suggests'] = value
 
          elif key == 'depres_result':
-            self ['has_suggests'] = value [2]
+            self._info ['has_suggests'] = value [2]
 
          elif key == 'filepath':
             self._use_filepath ( value )
@@ -720,7 +732,7 @@ class PackageInfo ( object ):
 
       try:
          version = tuple ( int ( z ) for z in version_str.split ( '.' ) )
-         self ['version'] = version
+         self._info ['version'] = version
       except ValueError as ve:
          # version string is malformed, cannot use it
          self.logger.error (
@@ -736,24 +748,33 @@ class PackageInfo ( object ):
       # removing illegal chars from the package_name
       ebuild_name = strutil.fix_ebuild_name ( package_name )
 
-      if ebuild_name != package_name:
-         self ['name'] = ebuild_name
-
-      self ['ebuild_verstr']    = version_str
-
       # for DescriptionReader
-      self ['package_name']     = package_name
+      self._info ['package_name']     = package_name
 
-      self ['package_filename'] = filename_with_ext
+      self._info ['rev']              = 0
+      self._info ['name']             = ebuild_name
+      self._info ['ebuild_verstr']    = version_str
+      self._info ['package_filename'] = filename_with_ext
    # --- end of _use_filename (...) ---
 
    def _use_pvr ( self, pvr ):
-      # 0.1_pre2-r17 -> ( 0, 1 )
-      pv = pvr.partition ( '-' ) [0]
-      self ['version'] = tuple (
-         int ( z ) for z in ( pv.partition ( '_' ) [0].split ( '.' ) )
-      )
-      self ['ebuild_verstr'] = pvr
+      # 0.1_pre2-r17 -> ( ( 0, 1 ), ( 17 ) )
+      pv_str, DONT_CARE, pr_str    = pvr.partition    ( '-r' )
+      pv,     DONT_CARE, pv_suffix = pv_str.partition ( '_'  )
+
+      if pv_suffix:
+         # not supported
+         raise NotImplementedError (
+            "version suffix {!r} cannot be preserved for $PVR {!r}".format (
+               pv_suffix, pvr
+            )
+         )
+      # non-digit chars in pv are unsupported, too
+
+      self._info ['version'] = tuple ( int ( z ) for z in pv.split ( '.' ) )
+      self._info ['rev']     =  int ( pr_str ) if pr_str else 0
+
+      self._info ['ebuild_verstr'] = pvr
    # --- end of _use_pvr (...) ---
 
    def _remove_auto ( self, ebuild_status ):


^ permalink raw reply related	[flat|nested] 20+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/
@ 2013-06-22 15:24 André Erdmann
  2013-06-20 23:40 ` [gentoo-commits] proj/R_overlay:gsoc13/next " André Erdmann
  0 siblings, 1 reply; 20+ messages in thread
From: André Erdmann @ 2013-06-22 15:24 UTC (permalink / raw
  To: gentoo-commits

commit:     7a98234f8f14a864be8a1ba2ebb8e45d202a9c00
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Thu Jun 20 23:38:38 2013 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Thu Jun 20 23:38:38 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=7a98234f

roverlay/main: run hook after overlay creation

---
 roverlay/main.py | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/roverlay/main.py b/roverlay/main.py
index a0ca8e4..207bea6 100644
--- a/roverlay/main.py
+++ b/roverlay/main.py
@@ -81,6 +81,34 @@ def main (
          return call ( *args, **kw )
    # --- end of optionally (...) ---
 
+   def run_hook ( hook_key, phase ):
+      print ( "RUN_HOOK?", hook_key, phase )
+      script = roverlay.config.get ( hook_key, None )
+      if script:
+         print ( "YES.", str ( script ) )
+         return roverlay.tools.shenv.run_script (
+            script, phase.lower(), return_success=True
+         )
+      else:
+         print ( "NO." )
+         # nop
+         return True
+   # --- end of run_hook (...) ---
+
+   def run_hook_lazy ( phase ):
+      crelpath, sepa, ckey = phase.rpartition ( '_' )
+      if sepa:
+         # HOOK.~phase
+         cpath = (
+            'HOOK.' + crelpath.replace ( '_', '.' ).upper()
+            + '.' + ckey.lower()
+         )
+
+         return run_hook ( cpath, phase )
+      else:
+         raise Exception ( "cannot parse phase {!r}".format ( phase ) )
+   # --- end of run_hook_lazy (...) ---
+
    def run_sync():
       if "sync" in actions_done: return
       try:
@@ -284,6 +312,14 @@ def main (
          if OPTION ( 'print_stats' ):
             print ( "\n" + overlay_creator.stats_str() )
 
+
+         # FIXME/TODO:
+         #  this hook should be called _after_ verifying the overlay
+         #  (verification is not implemented yet)
+         #
+         if not run_hook_lazy ( 'overlay_success' ):
+            die ( "overlay_success hook returned non-zero", DIE.OV_CREATE )
+
          set_action_done ( "create" )
 
       except KeyboardInterrupt:
@@ -466,6 +502,9 @@ def main (
       try:
          from roverlay.remote          import RepoList
          from roverlay.overlay.creator import OverlayCreator
+
+         import roverlay.config
+         import roverlay.tools.shenv
       except ImportError:
          if HIDE_EXCEPTIONS:
             die ( "Cannot import roverlay modules!", DIE.IMPORT )


^ permalink raw reply related	[flat|nested] 20+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/
@ 2013-06-22 15:24 André Erdmann
  2013-06-20 23:40 ` [gentoo-commits] proj/R_overlay:gsoc13/next " André Erdmann
  0 siblings, 1 reply; 20+ messages in thread
From: André Erdmann @ 2013-06-22 15:24 UTC (permalink / raw
  To: gentoo-commits

commit:     ddc3781f3fe2df940306c14a0ee2779a07454cb4
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Thu Jun 20 23:27:41 2013 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Thu Jun 20 23:27:41 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=ddc3781f

roverlay/digest: fixup

---
 roverlay/digest.py | 86 ++++++++++++++++++++++++++++++++++--------------------
 1 file changed, 54 insertions(+), 32 deletions(-)

diff --git a/roverlay/digest.py b/roverlay/digest.py
index 983ca1a..a031889 100644
--- a/roverlay/digest.py
+++ b/roverlay/digest.py
@@ -6,13 +6,19 @@
 
 """provides digest related utility functions (e.g. md5sum_file())"""
 
-__all__ = [ 'digest_compare', 'digest_supported',
-   'dodigest_file', 'md5sum_file'
+__all__ = [
+   'digest_compare', 'digest_comparator',
+   'digest_supported', 'dodigest_file',
+   'multihash', 'multihash_file',
+   'md5sum_file', 'sha1_file', 'sha256_file', 'sha512_file',
+   'whirlpool_file',
 ]
 
 import hashlib
 import portage.util.whirlpool
 
+DEFAULT_BLOCKSIZE=16384
+
 _HASH_CREATE_MAP = {
    'md5'       : hashlib.md5,
    'sha1'      : hashlib.sha1,
@@ -21,7 +27,10 @@ _HASH_CREATE_MAP = {
    'whirlpool' : portage.util.whirlpool.new,
 }
 
-def _generic_obj_hash ( hashobj, fh, binary_digest=False, blocksize=16384 ):
+
+def _generic_obj_hash (
+   hashobj, fh, binary_digest=False, blocksize=DEFAULT_BLOCKSIZE
+):
    block = fh.read ( blocksize )
    while block:
       hashobj.update ( block )
@@ -30,7 +39,17 @@ def _generic_obj_hash ( hashobj, fh, binary_digest=False, blocksize=16384 ):
    return hashobj.digest() if binary_digest else hashobj.hexdigest()
 # --- end of _hashsum_generic (...) ---
 
-def multihash ( fh, hashlist, binary_digest=False, blocksize=16384 ):
+def _generic_file_obj_hash (
+   hashobj, filepath, binary_digest=False, blocksize=DEFAULT_BLOCKSIZE
+):
+   with open ( filepath, 'rb' ) as fh:
+      ret = _generic_obj_hash ( hashobj, fh, binary_digest, blocksize )
+   return ret
+# --- end of _generic_file_obj_hash (...) ---
+
+def multihash (
+   fh, hashlist, binary_digest=False, blocksize=DEFAULT_BLOCKSIZE
+):
    """Calculates multiple digests for an already openened file and returns the
    resulting hashes as dict.
 
@@ -73,50 +92,53 @@ def multihash_file ( filepath, digest_types, **kwargs ):
       return dict()
 # --- end of multihash_file (...) ---
 
-def md5sum_file ( fh, binary_digest=False ):
-   """Returns the md5 sum for an already opened file."""
-   return _generic_obj_hash ( hashlib.md5(), fh, binary_digest )
+def md5sum_file ( filepath, **kw ):
+   """Returns the md5 sum for a file."""
+   return _generic_file_obj_hash ( hashlib.md5(), filepath, **kw )
 # --- end of md5sum_file (...) ---
 
-def sha1_file ( fh, binary_digest=False ):
-   return _generic_obj_hash ( hashlib.sha1(), fh, binary_digest )
+def sha1_file ( filepath, **kw ):
+   return _generic_obj_hash ( hashlib.sha1(), filepath, **kw )
 # --- end of sha1_file (...) ---
 
-def sha256_file ( fh, binary_digest=False ):
-   return _generic_obj_hash ( hashlib.sha256(), fh, binary_digest )
+def sha256_file ( filepath, **kw ):
+   return _generic_obj_hash ( hashlib.sha256(), filepath, **kw )
 # --- end of sha256_file (...) ---
 
-def sha512_file ( fh, binary_digest=False ):
-   return _generic_obj_hash ( hashlib.sha512(), fh, binary_digest )
+def sha512_file ( filepath, **kw ):
+   return _generic_obj_hash ( hashlib.sha512(), filepath, **kw )
 # --- end of sha512_file (...) ---
 
-def whirlpool_file ( fh, binary_digest=False ):
+def whirlpool_file ( filepath, **kw ):
    return _generic_obj_hash (
-      portage.util.whirlpool.new(), fh, binary_digest
+      portage.util.whirlpool.new(), filepath, **kw
    )
 # --- end of whirlpool_file (...) ---
 
-# TODO: remove
-_DIGEST_MAP = dict (
-   md5       = md5sum_file,
-   sha1      = sha1_file,
-   sha256    = sha256_file,
-   sha512    = sha512_file,
-   whirlpool = whirlpool_file,
-)
-
 def digest_supported ( digest_type ):
    """Returns True if the given digest type is supported, else False."""
-   return digest_type in _DIGEST_MAP
+   return digest_type in _HASH_CREATE_MAP
 # --- digest_supported (...) ---
 
-def dodigest_file ( _file, digest_type, binary_digest=False ):
-   ret = None
-   with open ( _file, mode='rb' ) as fh:
-      ret = _DIGEST_MAP [digest_type] ( fh, binary_digest=binary_digest )
-   return ret
+def dodigest_file ( _file, digest_type, **kwargs ):
+   return _generic_file_obj_hash (
+      hashobj       = _HASH_CREATE_MAP [digest_type](),
+      filepath      = _file,
+      **kwargs
+   )
 # --- end of dodigest_file (...) ---
 
-def digest_compare ( _file, digest, digest_type, binary_digest=False ):
-   return digest == dodigest_file ( _file, digest_type, binary_digest )
+def digest_compare ( digest, digest_type, filepath, **kwargs ):
+   return digest == dodigest_file ( filepath, digest_type, **kwargs )
 # --- end of digest_compare (...) ---
+
+# digest_comparator :: digest_type -> digest -> ( filepath, ... ) -> bool
+digest_comparator = (
+   lambda digest_type : (
+      lambda digest : (
+         lambda filepath, *args, **kwargs : digest_compare (
+            digest, digest_type, *args, **kwargs
+         )
+      )
+   )
+)


^ permalink raw reply related	[flat|nested] 20+ messages in thread
* [gentoo-commits] proj/R_overlay:gsoc13/next commit in: roverlay/
@ 2013-06-19 18:58 André Erdmann
  0 siblings, 0 replies; 20+ messages in thread
From: André Erdmann @ 2013-06-19 18:58 UTC (permalink / raw
  To: gentoo-commits

commit:     daf73b9acc9191382332ef2e4582e906db9ad435
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Wed Jun 19 18:51:35 2013 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Wed Jun 19 18:51:35 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=daf73b9a

packageinfo: create distmap data, make hashes

---
 roverlay/packageinfo.py | 43 +++++++++++++++++++++++++++++++++++++++----
 1 file changed, 39 insertions(+), 4 deletions(-)

diff --git a/roverlay/packageinfo.py b/roverlay/packageinfo.py
index 90b4250..e8004d0 100644
--- a/roverlay/packageinfo.py
+++ b/roverlay/packageinfo.py
@@ -18,6 +18,8 @@ import os.path
 import logging
 import threading
 
+import roverlay.digest
+
 from roverlay          import config, strutil
 from roverlay.rpackage import descriptionreader
 
@@ -123,7 +125,7 @@ class PackageInfo ( object ):
       self._info               = dict()
       self.readonly            = False
       self._update_lock        = threading.RLock()
-      self.overlay_package_ref = None
+      #self.overlay_package_ref = None
       self.logger              = LOGGER
       #self._evars              = dict()
       #self._lazy_actions       = list()
@@ -373,9 +375,7 @@ class PackageInfo ( object ):
       elif key_low == 'package_src_destpath':
          # src file path relative to distroot (mirror root dir)
          destpath = self._info.get ('src_uri_dest', None )
-         return (
-            destpath or os.path.basename ( self._info ['package_filename'] )
-         )
+         return ( destpath or self._info ['package_filename'] )
 
       # end if <key matches ...>
 
@@ -450,6 +450,41 @@ class PackageInfo ( object ):
       return self._info ['desc_data']
    # --- end of get_desc_data (...) ---
 
+   def get_distmap_item ( self ):
+      return ( self.get_distmap_key(), self.get_distmap_value() )
+   # --- end of get_distmap_item (...) ---
+
+   def get_distmap_key ( self ):
+      return self.get ( "package_src_destpath" )
+   # --- end of get_distmap_key (...) ---
+
+   def get_distmap_value ( self ):
+      assert 'sha256' in self.hashdict
+
+      repo = self.get ( "origin" )
+      return (
+         repo.name,
+         os.path.relpath ( self.get ( "package_file" ), repo.distdir ),
+         self.hashdict ['sha256']
+      )
+   # --- end of get_distmap_value (...) ---
+
+   def make_hashes ( self, hashlist ):
+      pkgfile = self.get ( "package_file" )
+
+      if hasattr ( self, 'hashdict' ) and self.hashdict:
+         new_hashes = (
+            frozenset ( hashlist ) - frozenset ( self.hashdict.keys() )
+         )
+
+         if new_hashes:
+            self.hashdict.update (
+               roverlay.digest.multihash_file ( pkgfile, new_hashes )
+            )
+      else:
+         self.hashdict = roverlay.digest.multihash_file ( pkgfile, hashlist )
+   # --- end of make_hashes (...) ---
+
    def __getitem__ ( self, key ):
       """Returns an item."""
       return self.get ( key, do_fallback=False )


^ permalink raw reply related	[flat|nested] 20+ messages in thread
* [gentoo-commits] proj/R_overlay:gsoc13/next commit in: roverlay/
@ 2013-06-19 18:58 André Erdmann
  0 siblings, 0 replies; 20+ messages in thread
From: André Erdmann @ 2013-06-19 18:58 UTC (permalink / raw
  To: gentoo-commits

commit:     ce623a4736308104f0c11e27c2e94feeda7bbb26
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Wed Jun 19 18:43:33 2013 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Wed Jun 19 18:43:33 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=ce623a47

roverlay/digest: support sha* and multihash mode

This commit adds support for sha1/sha256/sha512 (via hashlib) and whirlpool (via
portage.util).

It also adds the mulihash[_file]() function(s) that create more than one digest
at once.

---
 roverlay/digest.py | 89 +++++++++++++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 82 insertions(+), 7 deletions(-)

diff --git a/roverlay/digest.py b/roverlay/digest.py
index 218f98c..983ca1a 100644
--- a/roverlay/digest.py
+++ b/roverlay/digest.py
@@ -11,23 +11,98 @@ __all__ = [ 'digest_compare', 'digest_supported',
 ]
 
 import hashlib
+import portage.util.whirlpool
 
-def md5sum_file ( fh, binary_digest=False ):
-   """Returns the md5 sum for an already opened file."""
-   md5 = hashlib.md5()
-   blocksize = 16384
+_HASH_CREATE_MAP = {
+   'md5'       : hashlib.md5,
+   'sha1'      : hashlib.sha1,
+   'sha256'    : hashlib.sha256,
+   'sha512'    : hashlib.sha512,
+   'whirlpool' : portage.util.whirlpool.new,
+}
 
+def _generic_obj_hash ( hashobj, fh, binary_digest=False, blocksize=16384 ):
    block = fh.read ( blocksize )
    while block:
-      md5.update ( block )
+      hashobj.update ( block )
       block = fh.read ( blocksize )
 
-   return md5.digest() if binary_digest else md5.hexdigest()
+   return hashobj.digest() if binary_digest else hashobj.hexdigest()
+# --- end of _hashsum_generic (...) ---
+
+def multihash ( fh, hashlist, binary_digest=False, blocksize=16384 ):
+   """Calculates multiple digests for an already openened file and returns the
+   resulting hashes as dict.
+
+   arguments:
+   * fh            -- file handle
+   * hashlist      -- iterable with hash names (e.g. md5)
+   * binary_digest -- whether the hashes should be binary or not
+   * blocksize     -- block size for reading
+   """
+   hashobj_dict = {
+      h: _HASH_CREATE_MAP[h]() for h in hashlist
+   }
+   block = fh.read ( blocksize )
+   while block:
+      for hashobj in hashobj_dict.values():
+         hashobj.update ( block )
+      block = fh.read ( blocksize )
+
+   if binary_digest:
+      return { h: hashobj.digest() for h, hashobj in hashobj_dict.items() }
+   else:
+      return { h: hashobj.hexdigest() for h, hashobj in hashobj_dict.items() }
+# --- end of multihash (...) ---
+
+def multihash_file ( filepath, digest_types, **kwargs ):
+   """Calculates multiple digests for the given file path.
+
+   Returns an empty dict if digest_types is empty.
+
+   arguments:
+   * filepath     --
+   * digest_types --
+   * **kwargs     -- passed to multihash()
+   """
+   if digest_types:
+      with open ( filepath, mode='rb' ) as fh:
+         hashdict = multihash ( fh, digest_types, **kwargs )
+      return hashdict
+   else:
+      return dict()
+# --- end of multihash_file (...) ---
+
+def md5sum_file ( fh, binary_digest=False ):
+   """Returns the md5 sum for an already opened file."""
+   return _generic_obj_hash ( hashlib.md5(), fh, binary_digest )
 # --- end of md5sum_file (...) ---
 
+def sha1_file ( fh, binary_digest=False ):
+   return _generic_obj_hash ( hashlib.sha1(), fh, binary_digest )
+# --- end of sha1_file (...) ---
+
+def sha256_file ( fh, binary_digest=False ):
+   return _generic_obj_hash ( hashlib.sha256(), fh, binary_digest )
+# --- end of sha256_file (...) ---
+
+def sha512_file ( fh, binary_digest=False ):
+   return _generic_obj_hash ( hashlib.sha512(), fh, binary_digest )
+# --- end of sha512_file (...) ---
+
+def whirlpool_file ( fh, binary_digest=False ):
+   return _generic_obj_hash (
+      portage.util.whirlpool.new(), fh, binary_digest
+   )
+# --- end of whirlpool_file (...) ---
 
+# TODO: remove
 _DIGEST_MAP = dict (
-   md5 = md5sum_file,
+   md5       = md5sum_file,
+   sha1      = sha1_file,
+   sha256    = sha256_file,
+   sha512    = sha512_file,
+   whirlpool = whirlpool_file,
 )
 
 def digest_supported ( digest_type ):


^ permalink raw reply related	[flat|nested] 20+ messages in thread
* [gentoo-commits] proj/R_overlay:gsoc13/next commit in: roverlay/
@ 2013-06-05 18:08 André Erdmann
  0 siblings, 0 replies; 20+ messages in thread
From: André Erdmann @ 2013-06-05 18:08 UTC (permalink / raw
  To: gentoo-commits

commit:     7e66abd0a28b088f3a657f483b1ed091b5d9a938
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Wed Jun  5 18:04:02 2013 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Wed Jun  5 18:04:02 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=7e66abd0

roverlay/main: --fixup-category-move[-reverse]

---
 roverlay/argutil.py | 30 ++++++++++++++++++++++++++++--
 roverlay/main.py    |  5 +++++
 2 files changed, 33 insertions(+), 2 deletions(-)

diff --git a/roverlay/argutil.py b/roverlay/argutil.py
index 689fe78..90d95df 100644
--- a/roverlay/argutil.py
+++ b/roverlay/argutil.py
@@ -88,7 +88,9 @@ def get_parser ( command_map, default_config_file, default_command='create' ):
       ),
       add_help=True,
       formatter_class=argparse.RawDescriptionHelpFormatter,
-      )
+   )
+
+   incremental_mutex = parser.add_mutually_exclusive_group()
 
    arg     = parser.add_argument
    opt_in  = dict ( default=False, action='store_true' )
@@ -223,6 +225,28 @@ def get_parser ( command_map, default_config_file, default_command='create' ):
       action='store_true',
    )
 
+   incremental_mutex.add_argument (
+      '--fixup-category-move',
+      help='''
+         remove packages from the default category
+         if they exist in another one
+      ''',
+      dest='fixup_category_move',
+      default=None,
+      action='store_true'
+   )
+
+   incremental_mutex.add_argument (
+      '--fixup-category-move-reverse',
+      help='''
+         remove packages from other categories if they exist in the
+         default one
+      ''',
+      default=None,
+      dest='fixup_category_move_rev',
+      action='store_true'
+   )
+
    arg (
       '--stats',
       help="print some stats",
@@ -288,7 +312,7 @@ def get_parser ( command_map, default_config_file, default_command='create' ):
    # --no-incremental currently means that an existing overlay won't be
    # scanned for ebuilds (which means that ebuilds will be recreated),
    # but old ebuilds won't be explicitly removed
-   arg (
+   incremental_mutex.add_argument (
       '--no-incremental',
       help="start overlay creation from scratch (ignore an existing overlay)",
       dest='incremental',
@@ -365,6 +389,8 @@ def parse_argv ( command_map, **kw ):
       incremental             = p.incremental,
       immediate_ebuild_writes = p.immediate_ebuild_writes,
       dump_file               = p.dump_file,
+      fixup_category_move     = p.fixup_category_move,
+      fixup_category_move_rev = p.fixup_category_move_rev,
    )
 
    if given ( 'overlay' ):

diff --git a/roverlay/main.py b/roverlay/main.py
index ab75099..a0ca8e4 100644
--- a/roverlay/main.py
+++ b/roverlay/main.py
@@ -272,6 +272,11 @@ def main (
 
          overlay_creator.release_package_rules()
 
+         if OPTION ( 'fixup_category_move' ):
+            overlay_creator.remove_moved_ebuilds ( reverse=False )
+         elif OPTION ( 'fixup_category_move_rev' ):
+            overlay_creator.remove_moved_ebuilds ( reverse=True )
+
          overlay_creator.run ( close_when_done=True )
 
          optionally ( overlay_creator.write_overlay, 'write_overlay' )


^ permalink raw reply related	[flat|nested] 20+ messages in thread
* [gentoo-commits] proj/R_overlay:gsoc13/next commit in: roverlay/
@ 2013-06-05 18:08 André Erdmann
  0 siblings, 0 replies; 20+ messages in thread
From: André Erdmann @ 2013-06-05 18:08 UTC (permalink / raw
  To: gentoo-commits

commit:     6614a65b9d90716e1648529900cc2241981d5dab
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Wed Jun  5 17:58:41 2013 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Wed Jun  5 17:58:41 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=6614a65b

packageinfo: add support for lazy actions

This feature is disabled because it's not used and would therefore only add
overhead.

---
 roverlay/packageinfo.py | 41 +++++++++++++++++++++++++++++++++++------
 1 file changed, 35 insertions(+), 6 deletions(-)

diff --git a/roverlay/packageinfo.py b/roverlay/packageinfo.py
index c7c71eb..5962867 100644
--- a/roverlay/packageinfo.py
+++ b/roverlay/packageinfo.py
@@ -45,10 +45,19 @@ from roverlay.rpackage import descriptionreader
 # * src_uri            -- SRC_URI for a package
 # * version            -- tuple containing a package's version
 #
-
 #
-# FIXME/TOOD: don't overwrite name (package rules are applied _before_ reading
-#             desc data)
+# Info (keys) that are created before applying package rules:
+#
+# * distdir
+# * origin
+# * package_{file{,name},name}
+# * name (package_name)
+# * src_uri (src_uri_base)
+#
+# "Foreign" info keys (never set or modified here):
+#
+# * category
+# * src_uri_dest
 #
 
 LOGGER = logging.getLogger ( 'PackageInfo' )
@@ -116,7 +125,7 @@ class PackageInfo ( object ):
       self.overlay_package_ref = None
       self.logger              = LOGGER
       #self._evars              = dict()
-      #self.lazy_actions        = list()
+      #self._lazy_actions       = list()
       #(or set(), but list preserves order for actions with the same condition)
 
       self.update ( **initial_info )
@@ -129,13 +138,28 @@ class PackageInfo ( object ):
       arguments:
       * lazy_action --
       """
-      raise NotImplementedError ( "method stub" )
+      raise NotImplementedError ( "lazy actions are disabled." )
+      if hasattr ( self, '_lazy_actions' ):
+         self._lazy_actions.append ( lazy_action )
+      else:
+         self._lazy_actions = [ lazy_action ]
    # --- end of attach_lazy_action (...) ---
 
    def apply_lazy_actions ( self ):
       """Tries to apply all attached (lazy) actions.
       Removes actions that have been applied."""
-      raise NotImplementedError ( "method stub" )
+      raise NotImplementedError ( "lazy actions are disabled." )
+      if hasattr ( self, '_lazy_actions' ):
+         retry_later = list()
+         for action in self._lazy_actions:
+            if not action.try_apply_action ( self ):
+               retry_later.append ( action )
+
+         if retry_later:
+            self._lazy_actions = retry_later
+         else:
+            del self._lazy_actions
+      # -- end if;
    # --- end of apply_lazy_actions (...) ---
 
    def set_readonly ( self, immediate=False, final=False ):
@@ -529,6 +553,11 @@ class PackageInfo ( object ):
                "in _update(): unknown info key {}!".format ( key )
             )
       # -- end for;
+
+      # FIXME (if needed):
+      #  the package rule parser doesn't create lazy actions, currently,
+      #  so calling apply_lazy_actions() would do nothing
+      ##self.apply_lazy_actions()
    # --- end of _update (...) ---
 
    def _use_filename ( self, _filename ):


^ permalink raw reply related	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2013-07-23  7:51 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-23  7:51 [gentoo-commits] proj/R_overlay:master commit in: roverlay/ André Erdmann
2013-07-23  7:51 ` [gentoo-commits] proj/R_overlay:gsoc13/next " André Erdmann
  -- strict thread matches above, loose matches on Subject: below --
2013-07-23  7:51 [gentoo-commits] proj/R_overlay:master " André Erdmann
2013-07-19 18:00 ` [gentoo-commits] proj/R_overlay:gsoc13/next " André Erdmann
2013-07-19 18:00 André Erdmann
2013-07-17 18:05 André Erdmann
2013-07-15 22:31 André Erdmann
2013-07-12 13:57 [gentoo-commits] proj/R_overlay:master " André Erdmann
2013-07-12 13:57 ` [gentoo-commits] proj/R_overlay:gsoc13/next " André Erdmann
2013-07-08 22:47 André Erdmann
2013-07-08 22:47 André Erdmann
2013-07-05 16:55 André Erdmann
2013-07-05 16:55 André Erdmann
2013-07-05 16:55 André Erdmann
2013-06-22 15:24 [gentoo-commits] proj/R_overlay:master " André Erdmann
2013-06-22 15:14 ` [gentoo-commits] proj/R_overlay:gsoc13/next " André Erdmann
2013-06-22 15:24 [gentoo-commits] proj/R_overlay:master " André Erdmann
2013-06-22 15:14 ` [gentoo-commits] proj/R_overlay:gsoc13/next " André Erdmann
2013-06-22 15:24 [gentoo-commits] proj/R_overlay:master " André Erdmann
2013-06-20 23:40 ` [gentoo-commits] proj/R_overlay:gsoc13/next " André Erdmann
2013-06-22 15:24 [gentoo-commits] proj/R_overlay:master " André Erdmann
2013-06-20 23:40 ` [gentoo-commits] proj/R_overlay:gsoc13/next " André Erdmann
2013-06-19 18:58 André Erdmann
2013-06-19 18:58 André Erdmann
2013-06-05 18:08 André Erdmann
2013-06-05 18:08 André Erdmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox