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 057661381F3 for ; Fri, 30 Aug 2013 14:49:48 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 94A89E10A1; Fri, 30 Aug 2013 14:49:47 +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 1FA65E10A1 for ; Fri, 30 Aug 2013 14:49:41 +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 0222D33ED53 for ; Fri, 30 Aug 2013 14:49:41 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id D318AE546F for ; Fri, 30 Aug 2013 14:49:37 +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: <1377873797.ad22bc5fcd4df4805a8cc4fd7a975e9c021fae5d.dywi@gentoo> Subject: [gentoo-commits] proj/R_overlay:master commit in: roverlay/db/, roverlay/ X-VCS-Repository: proj/R_overlay X-VCS-Files: roverlay/db/distmap.py roverlay/packageinfo.py X-VCS-Directories: roverlay/db/ roverlay/ X-VCS-Committer: dywi X-VCS-Committer-Name: André Erdmann X-VCS-Revision: ad22bc5fcd4df4805a8cc4fd7a975e9c021fae5d X-VCS-Branch: master Date: Fri, 30 Aug 2013 14:49:37 +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: 28fae140-725b-46e5-b87f-fc56fef3c848 X-Archives-Hash: 5c79f6ea7a199be2c3916ffe641d64d3 commit: ad22bc5fcd4df4805a8cc4fd7a975e9c021fae5d Author: André Erdmann mailerd de> AuthorDate: Fri Aug 30 14:43:17 2013 +0000 Commit: André Erdmann mailerd de> CommitDate: Fri Aug 30 14:43:17 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=ad22bc5f packageinfo, get_distmap_value(): include distfile + support no_digest keyword arg which sets digest=None + get_distmap_value()'s code moved to get_distmap_item() --- roverlay/db/distmap.py | 4 +--- roverlay/packageinfo.py | 34 ++++++++++++++++++++++------------ 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/roverlay/db/distmap.py b/roverlay/db/distmap.py index cddcb5b..0ae294a 100644 --- a/roverlay/db/distmap.py +++ b/roverlay/db/distmap.py @@ -184,9 +184,7 @@ class _DistMapBase ( object ): if isinstance ( value, DistMapInfo ): self.add_entry ( key, value ) elif hasattr ( value, 'get_distmap_value' ): - self.add_entry ( - key, DistMapInfo ( key, *value.get_distmap_value() ) - ) + self.add_entry ( key, DistMapInfo.from_package_info ( key ) ) else: self.add_entry ( key, DistMapInfo ( key, *value ) ) # --- end of __setitem__ (...) --- diff --git a/roverlay/packageinfo.py b/roverlay/packageinfo.py index 193fe18..43fe4f3 100644 --- a/roverlay/packageinfo.py +++ b/roverlay/packageinfo.py @@ -532,9 +532,26 @@ class PackageInfo ( roverlay.util.objects.Referenceable ): return self._info ['desc_data'] # --- end of get_desc_data (...) --- - def get_distmap_item ( self ): + def get_distmap_item ( self, allow_digest_create=False, no_digest=False ): """Returns a 2-tuple ( key, info ) for the distmap.""" - return ( self.get_distmap_key(), self.get_distmap_value() ) + if no_digest: + digest = None + elif allow_digest_create: + digest = self.make_distmap_hash() + else: + digest = self.hashdict [self.DISTMAP_DIGEST_TYPE] + + distfile = self.get ( "package_src_destpath" ) + repo = self.get ( "origin" ) + + return ( + distfile, ( + distfile, + repo.name, + os.path.relpath ( self.get ( "package_file" ), repo.distdir ), + digest + ) + ) # --- end of get_distmap_item (...) --- def get_distmap_key ( self ): @@ -542,21 +559,14 @@ class PackageInfo ( roverlay.util.objects.Referenceable ): return self.get ( "package_src_destpath" ) # --- end of get_distmap_key (...) --- - def get_distmap_value ( self, allow_digest_create=False ): + def get_distmap_value ( self, allow_digest_create=False, no_digest=False ): """Returns a data tuple for creating DistMapInfo instances. arguments: * allow_digest_create -- + * no_digest -- use None as digest """ - repo = self.get ( "origin" ) - return ( - repo.name, - os.path.relpath ( self.get ( "package_file" ), repo.distdir ), - ( - self.make_distmap_hash() if allow_digest_create - else self.hashdict [self.DISTMAP_DIGEST_TYPE] - ) - ) + return self.get_distmap_item ( allow_digest_create, no_digest ) [1] # --- end of get_distmap_value (...) --- def make_distmap_hash ( self ):