From: "André Erdmann" <dywi@mailerd.de> To: gentoo-commits@lists.gentoo.org Subject: [gentoo-commits] proj/R_overlay:gsoc13/next commit in: roverlay/ Date: Wed, 5 Jun 2013 18:08:41 +0000 (UTC) [thread overview] Message-ID: <1370455121.6614a65b9d90716e1648529900cc2241981d5dab.dywi@gentoo> (raw) 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 ):
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/ Date: Thu, 13 Jun 2013 16:34:27 +0000 (UTC) [thread overview] Message-ID: <1370455121.6614a65b9d90716e1648529900cc2241981d5dab.dywi@gentoo> (raw) Message-ID: <20130613163427.plQV6aOS6VJ5XY_vldMyd4l5mcxQkKmWQRnbi9MT7Yk@z> (raw) 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 ):
next reply other threads:[~2013-06-05 18:08 UTC|newest] Thread overview: 20+ 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/ André Erdmann -- strict thread matches above, loose matches on Subject: below -- 2013-06-05 18:08 [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-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-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-07-05 16:55 André Erdmann 2013-07-05 16:55 André Erdmann 2013-07-05 16:55 André Erdmann 2013-07-08 22:47 André Erdmann 2013-07-08 22:47 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-15 22:31 André Erdmann 2013-07-17 18:05 André Erdmann 2013-07-19 18:00 André Erdmann 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-23 7:51 [gentoo-commits] proj/R_overlay:master " André Erdmann 2013-07-23 7:51 ` [gentoo-commits] proj/R_overlay:gsoc13/next " 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=1370455121.6614a65b9d90716e1648529900cc2241981d5dab.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: linkBe 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