From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 6B431138200 for ; Wed, 5 Jun 2013 18:08:48 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 1EA6AE0952; Wed, 5 Jun 2013 18:08:45 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 8198BE0952 for ; Wed, 5 Jun 2013 18:08:44 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id E36B633D8CC for ; Wed, 5 Jun 2013 18:08:42 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 8FDF0E5462 for ; Wed, 5 Jun 2013 18:08:41 +0000 (UTC) From: "André Erdmann" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "André Erdmann" Message-ID: <1370455121.6614a65b9d90716e1648529900cc2241981d5dab.dywi@gentoo> Subject: [gentoo-commits] proj/R_overlay:gsoc13/next commit in: roverlay/ X-VCS-Repository: proj/R_overlay X-VCS-Files: roverlay/packageinfo.py X-VCS-Directories: roverlay/ X-VCS-Committer: dywi X-VCS-Committer-Name: André Erdmann X-VCS-Revision: 6614a65b9d90716e1648529900cc2241981d5dab X-VCS-Branch: gsoc13/next Date: Wed, 5 Jun 2013 18:08:41 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 3a3c7946-6087-4a99-b009-ca352b2afde0 X-Archives-Hash: 016a917427f95fd1b06103d8d6edbec4 commit: 6614a65b9d90716e1648529900cc2241981d5dab Author: André Erdmann mailerd de> AuthorDate: Wed Jun 5 17:58:41 2013 +0000 Commit: André Erdmann mailerd 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 ): From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 0551E1381F3 for ; Thu, 13 Jun 2013 16:34:49 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 0E033E09B9; Thu, 13 Jun 2013 16:34:38 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 2E7D5E09BF for ; Thu, 13 Jun 2013 16:34:32 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id F170C33E4C1 for ; Thu, 13 Jun 2013 16:34:30 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id B59B0E5476 for ; Thu, 13 Jun 2013 16:34:27 +0000 (UTC) From: "André Erdmann" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "André Erdmann" Message-ID: <1370455121.6614a65b9d90716e1648529900cc2241981d5dab.dywi@gentoo> Subject: [gentoo-commits] proj/R_overlay:master commit in: roverlay/ X-VCS-Repository: proj/R_overlay X-VCS-Files: roverlay/packageinfo.py X-VCS-Directories: roverlay/ X-VCS-Committer: dywi X-VCS-Committer-Name: André Erdmann X-VCS-Revision: 6614a65b9d90716e1648529900cc2241981d5dab X-VCS-Branch: master Date: Thu, 13 Jun 2013 16:34:27 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: b705c664-8ad9-40df-9b44-886a0c1e4caa X-Archives-Hash: 944ab7083bd1a28afb820bc6dc55d1c9 Message-ID: <20130613163427.plQV6aOS6VJ5XY_vldMyd4l5mcxQkKmWQRnbi9MT7Yk@z> commit: 6614a65b9d90716e1648529900cc2241981d5dab Author: André Erdmann mailerd de> AuthorDate: Wed Jun 5 17:58:41 2013 +0000 Commit: André Erdmann mailerd 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 ):