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 0475D138200 for ; Thu, 13 Jun 2013 16:34:31 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 6B07CE096C; Thu, 13 Jun 2013 16:34:30 +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 C15B0E0973 for ; Thu, 13 Jun 2013 16:34:29 +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 979E933E48D for ; Thu, 13 Jun 2013 16:34:28 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id E6F07E5466 for ; Thu, 13 Jun 2013 16:34:25 +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: <1370377934.621d7b95dedf09850097304d1a3a4a9d87796591.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: 621d7b95dedf09850097304d1a3a4a9d87796591 X-VCS-Branch: master Date: Thu, 13 Jun 2013 16:34:25 +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: a6975285-e880-4ed2-a17e-f1f8066bb765 X-Archives-Hash: abef7dda3330e68dcbaff71074da19d0 commit: 621d7b95dedf09850097304d1a3a4a9d87796591 Author: André Erdmann mailerd de> AuthorDate: Tue Jun 4 20:32:14 2013 +0000 Commit: André Erdmann mailerd de> CommitDate: Tue Jun 4 20:32:14 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=621d7b95 packageinfo: doc, method stubs, set_direct_unsafe * doc: PackageInfo key list methods for new package rule actions (not committed yet): * method stubs: attach_lazy_action()/apply_lazy_actions() * set_direct_unsafe(): direct ("unsafe"!) write access to the info dict --- roverlay/packageinfo.py | 69 +++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 56 insertions(+), 13 deletions(-) diff --git a/roverlay/packageinfo.py b/roverlay/packageinfo.py index da3e5f1..c7c71eb 100644 --- a/roverlay/packageinfo.py +++ b/roverlay/packageinfo.py @@ -21,20 +21,34 @@ import threading from roverlay import config, strutil from roverlay.rpackage import descriptionreader +# PackageInfo info keys know to be used in roverlay's modules: +# *** some keys are not listed here (FIXME) *** # -# PackageInfo keys known to be used (read) in the roverlay modules: +# * desc_data -- dict containing DESCRIPTION data (created by +# rpackage.descriptionreader.DescriptionReader) +# * distdir -- fs path to the directory containing the pkg (file) +# * ebuild -- object representing the ebuild (printable via str()) +# * ebuild_file -- fs path to the ebuild file (str) +# * ebuild_verstr -- version string as it's used in the ebuild +# * has_suggests -- bool that indicates whether a package has optional +# dependencies +# * name -- (ebuild) name of a package (no "special" chars etc.) +# * orig_name -- original (ebuild) name (before "name" has been +# modified by package rules) +# * origin -- a package's origin (repository object) +# * package_file -- full fs path to the package file +# * package_filename -- file name (including file extension) +# * package_name -- package name (file name without version, f-ext) +# * physical_only -- bool that indicates whether a package exists as +# ebuild file only (True) or has additional +# runtime data (False) +# * src_uri -- SRC_URI for a package +# * version -- tuple containing a package's version # -# * desc_data in ebuild/creation, metadata/__init__ -# * distdir in manifest/helpers -# * ebuild in overlay/package -# * ebuild_file in manifest/helpers, overlay/package -# * ebuild_verstr in overlay/package -# * name in ebuild/creation, overlay/category -# * package_file in rpackage/descriptionreader -# * package_name in rpackage/descriptionreader -# * package_url in ebuild/creation -# * physical_only in overlay/pacakge -# * version in ebuild/package (as tuple) + +# +# FIXME/TOOD: don't overwrite name (package rules are applied _before_ reading +# desc data) # LOGGER = logging.getLogger ( 'PackageInfo' ) @@ -97,15 +111,33 @@ class PackageInfo ( object ): * **initial_info -- passed to update ( **kw ) """ self._info = dict() - #self._evars = dict() self.readonly = False self._update_lock = threading.RLock() self.overlay_package_ref = None self.logger = LOGGER + #self._evars = dict() + #self.lazy_actions = list() + #(or set(), but list preserves order for actions with the same condition) self.update ( **initial_info ) # --- end of __init__ (...) --- + def attach_lazy_action ( self, lazy_action ): + """Attaches a lazy action. + Unsafe operation (no locks will be acquired etc.). + + arguments: + * lazy_action -- + """ + raise NotImplementedError ( "method stub" ) + # --- 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" ) + # --- end of apply_lazy_actions (...) --- + def set_readonly ( self, immediate=False, final=False ): """Makes the package info readonly. @@ -357,6 +389,17 @@ class PackageInfo ( object ): self._update_lock.release() # --- end of __setitem__ (...) --- + def set_direct_unsafe ( self, key, value ): + """Sets an item. This operation is unsafe (no locks will be acquired, + write-accessibility won't be checked, data won't be validated). + + arguments: + * key -- + * value -- + """ + self._info [key] = value + # --- end of set_direct_unsafe (...) --- + def update_now ( self, **info ): """Updates the package info data with temporarily enabling write access. Data will be readonly after calling this method.