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 9CCD1138720 for ; Mon, 28 Jan 2013 23:54:16 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id BA9BF21C0BA; Mon, 28 Jan 2013 23:54:09 +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 1A73B21C0BB for ; Mon, 28 Jan 2013 23:54:08 +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 E202A33DBA2 for ; Mon, 28 Jan 2013 23:54:07 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 3B251E4092 for ; Mon, 28 Jan 2013 23:54:05 +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: <1359416224.1853a1c2a3f7371c9920f0c744992aac4d501944.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: 1853a1c2a3f7371c9920f0c744992aac4d501944 X-VCS-Branch: master Date: Mon, 28 Jan 2013 23:54:05 +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: b5333d0b-b586-4371-9be0-b8ba3ad29afa X-Archives-Hash: 7fc84ee20619a079f017801a31926652 commit: 1853a1c2a3f7371c9920f0c744992aac4d501944 Author: André Erdmann mailerd de> AuthorDate: Mon Jan 28 21:19:12 2013 +0000 Commit: André Erdmann mailerd de> CommitDate: Mon Jan 28 23:37:04 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=1853a1c2 roverlay/packageinfo: ebuild_filename, remove_auto * new key: ebuild_filename * update(): call _remove_auto() after processing all other keywords --- roverlay/packageinfo.py | 26 ++++++++++++++++++++++---- 1 files changed, 22 insertions(+), 4 deletions(-) diff --git a/roverlay/packageinfo.py b/roverlay/packageinfo.py index fb1a570..f4b7c9e 100644 --- a/roverlay/packageinfo.py +++ b/roverlay/packageinfo.py @@ -60,6 +60,10 @@ class PackageInfo ( object ): no keys have been stored) * _UPDATE_KEYS_FILTER_NONE -- like _UPDATE_KEYS_SIMPLE, but stores key's value only if it is not None + * _REMOVE_KEYS_KEEP_EBUILD -- a set of keys that will be kept when + _remove_auto ( 'ebuild_written' ) is + called. + These keys must exist at this point! """ EBUILDVER_REGEX = re.compile ( '[-]{1,}' ) @@ -83,6 +87,11 @@ class PackageInfo ( object ): 'distdir', )) + _REMOVE_KEYS_KEEP_EBUILD = frozenset (( + 'distdir', 'desc_data', 'ebuild_file', 'version', + 'ebuild_filename', 'package_name', 'package_filename', + )) + def __init__ ( self, **initial_info ): """Initializes a PackageInfo. @@ -281,6 +290,11 @@ class PackageInfo ( object ): if ebuild_file is not None: return os.path.dirname ( ebuild_file ) + elif key_low == 'ebuild_filename': + ebuild_file = self._info ['ebuild_file'] + if ebuild_file is not None: + return os.path.basename ( ebuild_file ) + # end if @@ -357,6 +371,9 @@ class PackageInfo ( object ): 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() for key, value in info.items(): @@ -393,9 +410,6 @@ class PackageInfo ( object ): except KeyError: pass - elif key == 'remove_auto': - self._remove_auto ( value ) - elif key == 'make_desc_data': if value: self.get_desc_data() @@ -404,6 +418,10 @@ class PackageInfo ( object ): self.logger.error ( "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) --- @@ -481,7 +499,7 @@ class PackageInfo ( object ): if ebuild_status == 'ebuild_written': # selectively copying required keys to a new info dict - to_keep = ( 'distdir', 'desc_data', 'ebuild_file', 'version' ) + to_keep = self.__class__._REMOVE_KEYS_KEEP_EBUILD # needs python >= 2.7 info_new = { k : self.get ( k ) for k in to_keep }