From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <gentoo-commits+bounces-553115-garchives=archives.gentoo.org@lists.gentoo.org> Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id D6040138779 for <garchives@archives.gentoo.org>; Wed, 30 Jan 2013 20:16:28 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 47464E060D; Wed, 30 Jan 2013 20:16:28 +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 CA44BE060D for <gentoo-commits@lists.gentoo.org>; Wed, 30 Jan 2013 20:16:27 +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 D4F1C33DC0C for <gentoo-commits@lists.gentoo.org>; Wed, 30 Jan 2013 20:16:26 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 68F39E4073 for <gentoo-commits@lists.gentoo.org>; Wed, 30 Jan 2013 20:16:24 +0000 (UTC) From: "André Erdmann" <dywi@mailerd.de> 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" <dywi@mailerd.de> Message-ID: <1359576033.78675495ed708852d5771ebd98aec38d0c2ed6ab.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: 78675495ed708852d5771ebd98aec38d0c2ed6ab X-VCS-Branch: master Date: Wed, 30 Jan 2013 20:16:24 +0000 (UTC) Precedence: bulk List-Post: <mailto:gentoo-commits@lists.gentoo.org> List-Help: <mailto:gentoo-commits+help@lists.gentoo.org> List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org> List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org> List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org> X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 76dff006-8097-4c5d-a946-199b81c1dac5 X-Archives-Hash: 15da3552fdbe8fd8fde4249227c94005 commit: 78675495ed708852d5771ebd98aec38d0c2ed6ab Author: André Erdmann <dywi <AT> mailerd <DOT> de> AuthorDate: Wed Jan 30 19:57:42 2013 +0000 Commit: André Erdmann <dywi <AT> mailerd <DOT> de> CommitDate: Wed Jan 30 20:00:33 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=78675495 packageinfo: update_unsafe(), add ebuild variables new function update_unsafe() that simply adds information to a PackageInfo instance without locking or checking for writability. added EVAR* key that can be used to add per-package ebuild variables (evar) --- roverlay/packageinfo.py | 45 ++++++++++++++++++++++++++++++++++++--------- 1 files changed, 36 insertions(+), 9 deletions(-) diff --git a/roverlay/packageinfo.py b/roverlay/packageinfo.py index f4b7c9e..438433c 100644 --- a/roverlay/packageinfo.py +++ b/roverlay/packageinfo.py @@ -357,6 +357,17 @@ class PackageInfo ( object ): self.set_readonly() # --- end of update_now (...) --- + def update_unsafe ( self, **info ): + """Updates the package info data without retrieving any locks or + checking writability. + Meant for usage with "package actions" (packagerules module). + + arguments: + * **info -- + """ + self._update ( info ) + # --- end of update_unsafe (...) --- + def update ( self, **info ): """Uses **info to update the package info data. @@ -369,13 +380,27 @@ class PackageInfo ( object ): # nothing to do return - initial = len ( self._info ) == 0 - # remove_auto has to be the last action (keyword order is not "stable") remove_auto = info.pop ( 'remove_auto', None ) self._writelock_acquire() + self._update ( info ) + + if remove_auto: + self._remove_auto ( remove_auto ) + + self._update_lock.release() + # --- end of update (**kw) --- + + def _update ( self, info ): + """Updates self._info using the given info dict. + + arguments: + * info -- + """ + initial = len ( self._info ) == 0 + for key, value in info.items(): if key in self.__class__._UPDATE_KEYS_SIMPLE: @@ -384,6 +409,13 @@ class PackageInfo ( object ): elif initial and key in self.__class__._UPDATE_KEYS_SIMPLE_INITIAL: self [key] = value + elif key[:4] == 'EVAR': + if 'EVAR' in self._info: + self._info ['EVAR'].add ( value ) + else: + # set or dict? + self._info ['EVAR'] = set ( ( value, ) ) + elif key in self.__class__._UPDATE_KEYS_FILTER_NONE: if value is not None: self [key] = value @@ -416,15 +448,10 @@ class PackageInfo ( object ): else: self.logger.error ( - "in update(): unknown info key {}!".format ( key ) + "in _update(): unknown info key {}!".format ( key ) ) # -- end for; - - if remove_auto: - self._remove_auto ( remove_auto ) - - self._update_lock.release() - # --- end of update (**kw) --- + # --- end of _update (...) --- def _use_filename ( self, _filename ): """auxiliary method for update(**kw)