public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "André Erdmann" <dywi@mailerd.de>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/R_overlay:gsoc13/next commit in: roverlay/packagerules/parser/context/
Date: Wed,  5 Jun 2013 18:08:41 +0000 (UTC)	[thread overview]
Message-ID: <1370455071.69d3d6eebf2bd33fbb135be71004791a37f70ba1.dywi@gentoo> (raw)

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

package rule parser, set/rename: ActionInvalid

---
 roverlay/packagerules/parser/context/action.py | 45 ++++++++++++++++----------
 1 file changed, 28 insertions(+), 17 deletions(-)

diff --git a/roverlay/packagerules/parser/context/action.py b/roverlay/packagerules/parser/context/action.py
index c58f7ca..22936cc 100644
--- a/roverlay/packagerules/parser/context/action.py
+++ b/roverlay/packagerules/parser/context/action.py
@@ -14,14 +14,22 @@ import roverlay.packagerules.actions.relocate
 import roverlay.packagerules.actions.trace
 import roverlay.packagerules.parser.context.base
 
-class ActionUnknown ( ValueError ):
+class RuleActionException ( ValueError ):
+   pass
+# --- end of RuleActionException ---
+
+class ActionUnknown ( RuleActionException ):
    pass
 # --- end of ActionUnknown ---
 
-class ActionNeedsValue ( ValueError ):
+class ActionNeedsValue ( RuleActionException ):
    pass
 # --- end of ActionNeedsValue ---
 
+class ActionInvalid ( RuleActionException ):
+   pass
+# --- end of ActionInvalid ---
+
 
 class RuleActionContext (
    roverlay.packagerules.parser.context.base.BaseContext
@@ -50,18 +58,19 @@ class RuleActionContext (
    #
    DEFAULT_MODIFY_INFO_ACTIONS = (
       roverlay.packagerules.actions.info.InfoSetToAction,
-      roverlay.packagerules.actions.info.LazyInfoRenameAction
+      roverlay.packagerules.actions.info.InfoRenameAction,
    )
 
-   # dict { key => None | { None | SetTo_Action, None | Rename_Action }
-   #   where None is "use default action(s)"
+   # dict { key => None | ( None|False|SetTo_Action, None|False|Rename_Action )
+   #   where None  is "use default action(s)"
+   #   and   False is "invalid"/"not supported"
+   #
+   # (see comment in packageinfo.py concerning keys that exist when calling
+   #  apply_action() and enable lazy actions if necessary)
    #
    MODIFIABLE_INFO_KEYS = {
-      'name' : (
-         None,
-         roverlay.packagerules.actions.info.InfoRenameAction
-      ),
-      'category' : None,
+      'name'     : None,
+      'category' : ( None, False ),
       'destfile' : (
          None,
          roverlay.packagerules.actions.relocate.SrcDestRenameAction
@@ -141,17 +150,19 @@ class RuleActionContext (
 
          # ( ( cls_tuple or <default> ) [action_type] ) or <default>
          action_cls = (
-            (
-               self.MODIFIABLE_INFO_KEYS [key]
-               or self.DEFAULT_MODIFY_INFO_ACTIONS
-            ) [action_type]
-            or self.DEFAULT_MODIFY_INFO_ACTIONS [action_type]
-         )
+            self.MODIFIABLE_INFO_KEYS [key]
+            or self.DEFAULT_MODIFY_INFO_ACTIONS
+         ) [action_type]
+
+         if action_cls is None:
+            action_cls = self.DEFAULT_MODIFY_INFO_ACTIONS [action_type]
       except KeyError:
          raise ActionUnknown ( orig_str )
 
       # create and add action
-      if action_type == 0:
+      if action_cls is False:
+         raise ActionInvalid ( orig_str )
+      elif action_type == 0:
          # info action (1 arg)
          value = roverlay.strutil.unquote ( value )
 


WARNING: multiple messages have this Message-ID (diff)
From: "André Erdmann" <dywi@mailerd.de>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/R_overlay:master commit in: roverlay/packagerules/parser/context/
Date: Thu, 13 Jun 2013 16:34:27 +0000 (UTC)	[thread overview]
Message-ID: <1370455071.69d3d6eebf2bd33fbb135be71004791a37f70ba1.dywi@gentoo> (raw)
Message-ID: <20130613163427.uC-b8j2vZQmGkb9d0pP5jju6M7yr4lrtcOepXzq-Krk@z> (raw)

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

package rule parser, set/rename: ActionInvalid

---
 roverlay/packagerules/parser/context/action.py | 45 ++++++++++++++++----------
 1 file changed, 28 insertions(+), 17 deletions(-)

diff --git a/roverlay/packagerules/parser/context/action.py b/roverlay/packagerules/parser/context/action.py
index c58f7ca..22936cc 100644
--- a/roverlay/packagerules/parser/context/action.py
+++ b/roverlay/packagerules/parser/context/action.py
@@ -14,14 +14,22 @@ import roverlay.packagerules.actions.relocate
 import roverlay.packagerules.actions.trace
 import roverlay.packagerules.parser.context.base
 
-class ActionUnknown ( ValueError ):
+class RuleActionException ( ValueError ):
+   pass
+# --- end of RuleActionException ---
+
+class ActionUnknown ( RuleActionException ):
    pass
 # --- end of ActionUnknown ---
 
-class ActionNeedsValue ( ValueError ):
+class ActionNeedsValue ( RuleActionException ):
    pass
 # --- end of ActionNeedsValue ---
 
+class ActionInvalid ( RuleActionException ):
+   pass
+# --- end of ActionInvalid ---
+
 
 class RuleActionContext (
    roverlay.packagerules.parser.context.base.BaseContext
@@ -50,18 +58,19 @@ class RuleActionContext (
    #
    DEFAULT_MODIFY_INFO_ACTIONS = (
       roverlay.packagerules.actions.info.InfoSetToAction,
-      roverlay.packagerules.actions.info.LazyInfoRenameAction
+      roverlay.packagerules.actions.info.InfoRenameAction,
    )
 
-   # dict { key => None | { None | SetTo_Action, None | Rename_Action }
-   #   where None is "use default action(s)"
+   # dict { key => None | ( None|False|SetTo_Action, None|False|Rename_Action )
+   #   where None  is "use default action(s)"
+   #   and   False is "invalid"/"not supported"
+   #
+   # (see comment in packageinfo.py concerning keys that exist when calling
+   #  apply_action() and enable lazy actions if necessary)
    #
    MODIFIABLE_INFO_KEYS = {
-      'name' : (
-         None,
-         roverlay.packagerules.actions.info.InfoRenameAction
-      ),
-      'category' : None,
+      'name'     : None,
+      'category' : ( None, False ),
       'destfile' : (
          None,
          roverlay.packagerules.actions.relocate.SrcDestRenameAction
@@ -141,17 +150,19 @@ class RuleActionContext (
 
          # ( ( cls_tuple or <default> ) [action_type] ) or <default>
          action_cls = (
-            (
-               self.MODIFIABLE_INFO_KEYS [key]
-               or self.DEFAULT_MODIFY_INFO_ACTIONS
-            ) [action_type]
-            or self.DEFAULT_MODIFY_INFO_ACTIONS [action_type]
-         )
+            self.MODIFIABLE_INFO_KEYS [key]
+            or self.DEFAULT_MODIFY_INFO_ACTIONS
+         ) [action_type]
+
+         if action_cls is None:
+            action_cls = self.DEFAULT_MODIFY_INFO_ACTIONS [action_type]
       except KeyError:
          raise ActionUnknown ( orig_str )
 
       # create and add action
-      if action_type == 0:
+      if action_cls is False:
+         raise ActionInvalid ( orig_str )
+      elif action_type == 0:
          # info action (1 arg)
          value = roverlay.strutil.unquote ( value )
 


             reply	other threads:[~2013-06-05 18:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-05 18:08 André Erdmann [this message]
2013-06-13 16:34 ` [gentoo-commits] proj/R_overlay:master commit in: roverlay/packagerules/parser/context/ André Erdmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1370455071.69d3d6eebf2bd33fbb135be71004791a37f70ba1.dywi@gentoo \
    --to=dywi@mailerd.de \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox