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 E20C71381F3 for ; Wed, 19 Jun 2013 18:58:07 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 5F1BFE0933; Wed, 19 Jun 2013 18:58:07 +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 D5F84E0930 for ; Wed, 19 Jun 2013 18:58:06 +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 DC4C333E62F for ; Wed, 19 Jun 2013 18:58:05 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 8AED2E5466 for ; Wed, 19 Jun 2013 18:58:03 +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: <1371667895.daf73b9acc9191382332ef2e4582e906db9ad435.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: daf73b9acc9191382332ef2e4582e906db9ad435 X-VCS-Branch: gsoc13/next Date: Wed, 19 Jun 2013 18:58:03 +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: c0abf12b-6b81-4d12-8b03-15f08c869374 X-Archives-Hash: 7ef100ca50e523191f46d908c78e5388 commit: daf73b9acc9191382332ef2e4582e906db9ad435 Author: André Erdmann mailerd de> AuthorDate: Wed Jun 19 18:51:35 2013 +0000 Commit: André Erdmann mailerd de> CommitDate: Wed Jun 19 18:51:35 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=daf73b9a packageinfo: create distmap data, make hashes --- roverlay/packageinfo.py | 43 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 39 insertions(+), 4 deletions(-) diff --git a/roverlay/packageinfo.py b/roverlay/packageinfo.py index 90b4250..e8004d0 100644 --- a/roverlay/packageinfo.py +++ b/roverlay/packageinfo.py @@ -18,6 +18,8 @@ import os.path import logging import threading +import roverlay.digest + from roverlay import config, strutil from roverlay.rpackage import descriptionreader @@ -123,7 +125,7 @@ class PackageInfo ( object ): self._info = dict() self.readonly = False self._update_lock = threading.RLock() - self.overlay_package_ref = None + #self.overlay_package_ref = None self.logger = LOGGER #self._evars = dict() #self._lazy_actions = list() @@ -373,9 +375,7 @@ class PackageInfo ( object ): elif key_low == 'package_src_destpath': # src file path relative to distroot (mirror root dir) destpath = self._info.get ('src_uri_dest', None ) - return ( - destpath or os.path.basename ( self._info ['package_filename'] ) - ) + return ( destpath or self._info ['package_filename'] ) # end if @@ -450,6 +450,41 @@ class PackageInfo ( object ): return self._info ['desc_data'] # --- end of get_desc_data (...) --- + def get_distmap_item ( self ): + return ( self.get_distmap_key(), self.get_distmap_value() ) + # --- end of get_distmap_item (...) --- + + def get_distmap_key ( self ): + return self.get ( "package_src_destpath" ) + # --- end of get_distmap_key (...) --- + + def get_distmap_value ( self ): + assert 'sha256' in self.hashdict + + repo = self.get ( "origin" ) + return ( + repo.name, + os.path.relpath ( self.get ( "package_file" ), repo.distdir ), + self.hashdict ['sha256'] + ) + # --- end of get_distmap_value (...) --- + + def make_hashes ( self, hashlist ): + pkgfile = self.get ( "package_file" ) + + if hasattr ( self, 'hashdict' ) and self.hashdict: + new_hashes = ( + frozenset ( hashlist ) - frozenset ( self.hashdict.keys() ) + ) + + if new_hashes: + self.hashdict.update ( + roverlay.digest.multihash_file ( pkgfile, new_hashes ) + ) + else: + self.hashdict = roverlay.digest.multihash_file ( pkgfile, hashlist ) + # --- end of make_hashes (...) --- + def __getitem__ ( self, key ): """Returns an item.""" return self.get ( key, do_fallback=False ) 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 6C9C41381F3 for ; Sat, 22 Jun 2013 15:24:18 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id EDE45E0A59; Sat, 22 Jun 2013 15:24:17 +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 77C5BE0A53 for ; Sat, 22 Jun 2013 15:24:17 +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 7CD3B33E469 for ; Sat, 22 Jun 2013 15:24:16 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 25076E468F for ; Sat, 22 Jun 2013 15:24:15 +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: <1371667895.daf73b9acc9191382332ef2e4582e906db9ad435.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: daf73b9acc9191382332ef2e4582e906db9ad435 X-VCS-Branch: master Date: Sat, 22 Jun 2013 15:24:15 +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: d80acdc1-b2ed-4793-9559-52c5cb5ee51d X-Archives-Hash: 60a81cdf2dd3b0a553d2c56c1142095b Message-ID: <20130622152415.CV6ybrZf-IN072MvRbYnU_yIiU4kXKsal4jpKuhYBew@z> commit: daf73b9acc9191382332ef2e4582e906db9ad435 Author: André Erdmann mailerd de> AuthorDate: Wed Jun 19 18:51:35 2013 +0000 Commit: André Erdmann mailerd de> CommitDate: Wed Jun 19 18:51:35 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=daf73b9a packageinfo: create distmap data, make hashes --- roverlay/packageinfo.py | 43 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 39 insertions(+), 4 deletions(-) diff --git a/roverlay/packageinfo.py b/roverlay/packageinfo.py index 90b4250..e8004d0 100644 --- a/roverlay/packageinfo.py +++ b/roverlay/packageinfo.py @@ -18,6 +18,8 @@ import os.path import logging import threading +import roverlay.digest + from roverlay import config, strutil from roverlay.rpackage import descriptionreader @@ -123,7 +125,7 @@ class PackageInfo ( object ): self._info = dict() self.readonly = False self._update_lock = threading.RLock() - self.overlay_package_ref = None + #self.overlay_package_ref = None self.logger = LOGGER #self._evars = dict() #self._lazy_actions = list() @@ -373,9 +375,7 @@ class PackageInfo ( object ): elif key_low == 'package_src_destpath': # src file path relative to distroot (mirror root dir) destpath = self._info.get ('src_uri_dest', None ) - return ( - destpath or os.path.basename ( self._info ['package_filename'] ) - ) + return ( destpath or self._info ['package_filename'] ) # end if @@ -450,6 +450,41 @@ class PackageInfo ( object ): return self._info ['desc_data'] # --- end of get_desc_data (...) --- + def get_distmap_item ( self ): + return ( self.get_distmap_key(), self.get_distmap_value() ) + # --- end of get_distmap_item (...) --- + + def get_distmap_key ( self ): + return self.get ( "package_src_destpath" ) + # --- end of get_distmap_key (...) --- + + def get_distmap_value ( self ): + assert 'sha256' in self.hashdict + + repo = self.get ( "origin" ) + return ( + repo.name, + os.path.relpath ( self.get ( "package_file" ), repo.distdir ), + self.hashdict ['sha256'] + ) + # --- end of get_distmap_value (...) --- + + def make_hashes ( self, hashlist ): + pkgfile = self.get ( "package_file" ) + + if hasattr ( self, 'hashdict' ) and self.hashdict: + new_hashes = ( + frozenset ( hashlist ) - frozenset ( self.hashdict.keys() ) + ) + + if new_hashes: + self.hashdict.update ( + roverlay.digest.multihash_file ( pkgfile, new_hashes ) + ) + else: + self.hashdict = roverlay.digest.multihash_file ( pkgfile, hashlist ) + # --- end of make_hashes (...) --- + def __getitem__ ( self, key ): """Returns an item.""" return self.get ( key, do_fallback=False )