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 D01BC1381F3 for ; Sat, 22 Jun 2013 15:24:48 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 337C3E0AF8; Sat, 22 Jun 2013 15:24:29 +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 B4BEDE0AF8 for ; Sat, 22 Jun 2013 15:24:23 +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 02E5A33E6DA for ; Sat, 22 Jun 2013 15:24:22 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 4990DE5473 for ; Sat, 22 Jun 2013 15:24:20 +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: <1371913385.5374a6066d9f8615243bba9b0a2d0c5be487f653.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: 5374a6066d9f8615243bba9b0a2d0c5be487f653 X-VCS-Branch: master Date: Sat, 22 Jun 2013 15:24:20 +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: 1fef39b5-ebdd-423e-8a6b-d200a2419f4a X-Archives-Hash: 56c76b8f3d37808bd05c4c0f4232fc85 commit: 5374a6066d9f8615243bba9b0a2d0c5be487f653 Author: André Erdmann mailerd de> AuthorDate: Sat Jun 22 15:03:05 2013 +0000 Commit: André Erdmann mailerd de> CommitDate: Sat Jun 22 15:03:05 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=5374a606 roverlay/packageinfo, revbump: set src_uri_dest Rename distfiles of rev-bumped ebuilds. --- roverlay/packageinfo.py | 48 ++++++++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/roverlay/packageinfo.py b/roverlay/packageinfo.py index 7b74425..b86d69d 100644 --- a/roverlay/packageinfo.py +++ b/roverlay/packageinfo.py @@ -94,6 +94,7 @@ class PackageInfo ( object ): PKGSUFFIX_REGEX = re.compile ( config.get_or_fail ( 'R_PACKAGE.suffix_regex' ) + '$' ) + EBUILDREV_REGEX = re.compile ( '[-]r[0-9]+$' ) ALWAYS_FALLBACK = frozenset ( ( 'ebuild', 'ebuild_file' ) ) _UPDATE_KEYS_SIMPLE = frozenset (( @@ -505,19 +506,36 @@ class PackageInfo ( object ): def revbump ( self, newrev=None ): """Do whatever necessary to revbump this pakages, that is set/update - all data like src_uri_destfile. + all data like src_uri_dest and ebuild_verstr. arguments: * newrev -- new revision, (current rev + 1) is used if this is None """ - if newrev is None: - # get old rev and increment it - ## direct dict access - self._info ['rev'] += 1 - else: - self._info ['rev'] = int ( newrev ) + rev = self._info['rev'] + 1 if newrev is None else int ( newrev ) + rev_str = ( '-r' + str ( rev ) ) if rev > 0 else '' + vstr = '.'.join ( str ( k ) for k in self ['version'] ) + rev_str + + # preserve destpath directory + # (this allows to handle paths like "a/b.tar/pkg.tgz" properly) + # + old_destpath = self ['package_src_destpath'].rpartition ( os.path.sep ) + + # os.path.splitext does not "recognize" .tar.gz + fhead, ftar, fext = old_destpath[2].rpartition ( '.tar' ) + if not ftar: + fhead, fext = os.path.splitext ( fext ) + + # FIXME: any way to get this reliably (+faster) done without a regex? + # ( a,b,c=fhead.rpartition ( '-r' ); try int(c) ...; ?) + distfile = ( + old_destpath[0] + old_destpath[1] + + self.EBUILDREV_REGEX.sub ( '', fhead ) + rev_str + ftar + fext + ) + + self._info ['rev'] = rev + self._info ['ebuild_verstr'] = vstr + self._info ['src_uri_dest'] = distfile - self._reset_version_str() return self # --- end of revbump (...) --- @@ -620,20 +638,6 @@ class PackageInfo ( object ): return None # --- end of get_evars (...) --- - def _reset_version_str ( self ): - """Recreates the version_str ($PVR) of this PackageInfo instance.""" - rev = self ['rev'] - version = self ['version'] - - if rev > 0: - vstr = '.'.join ( str ( k ) for k in version ) + '-r' + str ( rev ) - else: - vstr = '.'.join ( str ( k ) for k in version ) - - self._info ['ebuild_verstr'] = vstr - #return vstr - # --- end of _reset_version_str (...) --- - def _update ( self, info ): """Updates self._info using the given info dict. 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 B9D361381F3 for ; Sat, 22 Jun 2013 15:14:32 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 5E60FE0A62; Sat, 22 Jun 2013 15:14:31 +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 B77E0E0AAD for ; Sat, 22 Jun 2013 15:14:30 +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 92D5733E6D8 for ; Sat, 22 Jun 2013 15:14:29 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 4A90AE546A for ; Sat, 22 Jun 2013 15:14:27 +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: <1371913385.5374a6066d9f8615243bba9b0a2d0c5be487f653.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: 5374a6066d9f8615243bba9b0a2d0c5be487f653 X-VCS-Branch: gsoc13/next Date: Sat, 22 Jun 2013 15:14:27 +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: fda14fc3-efa0-40b5-9ddf-3500c0aabb73 X-Archives-Hash: b323303571e4a9e02e20bf5c639119d2 Message-ID: <20130622151427.c9MXxxfKoYIEp7MuG6XBPoXx2pOKnG46pAznXBvOg48@z> commit: 5374a6066d9f8615243bba9b0a2d0c5be487f653 Author: André Erdmann mailerd de> AuthorDate: Sat Jun 22 15:03:05 2013 +0000 Commit: André Erdmann mailerd de> CommitDate: Sat Jun 22 15:03:05 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=5374a606 roverlay/packageinfo, revbump: set src_uri_dest Rename distfiles of rev-bumped ebuilds. --- roverlay/packageinfo.py | 48 ++++++++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/roverlay/packageinfo.py b/roverlay/packageinfo.py index 7b74425..b86d69d 100644 --- a/roverlay/packageinfo.py +++ b/roverlay/packageinfo.py @@ -94,6 +94,7 @@ class PackageInfo ( object ): PKGSUFFIX_REGEX = re.compile ( config.get_or_fail ( 'R_PACKAGE.suffix_regex' ) + '$' ) + EBUILDREV_REGEX = re.compile ( '[-]r[0-9]+$' ) ALWAYS_FALLBACK = frozenset ( ( 'ebuild', 'ebuild_file' ) ) _UPDATE_KEYS_SIMPLE = frozenset (( @@ -505,19 +506,36 @@ class PackageInfo ( object ): def revbump ( self, newrev=None ): """Do whatever necessary to revbump this pakages, that is set/update - all data like src_uri_destfile. + all data like src_uri_dest and ebuild_verstr. arguments: * newrev -- new revision, (current rev + 1) is used if this is None """ - if newrev is None: - # get old rev and increment it - ## direct dict access - self._info ['rev'] += 1 - else: - self._info ['rev'] = int ( newrev ) + rev = self._info['rev'] + 1 if newrev is None else int ( newrev ) + rev_str = ( '-r' + str ( rev ) ) if rev > 0 else '' + vstr = '.'.join ( str ( k ) for k in self ['version'] ) + rev_str + + # preserve destpath directory + # (this allows to handle paths like "a/b.tar/pkg.tgz" properly) + # + old_destpath = self ['package_src_destpath'].rpartition ( os.path.sep ) + + # os.path.splitext does not "recognize" .tar.gz + fhead, ftar, fext = old_destpath[2].rpartition ( '.tar' ) + if not ftar: + fhead, fext = os.path.splitext ( fext ) + + # FIXME: any way to get this reliably (+faster) done without a regex? + # ( a,b,c=fhead.rpartition ( '-r' ); try int(c) ...; ?) + distfile = ( + old_destpath[0] + old_destpath[1] + + self.EBUILDREV_REGEX.sub ( '', fhead ) + rev_str + ftar + fext + ) + + self._info ['rev'] = rev + self._info ['ebuild_verstr'] = vstr + self._info ['src_uri_dest'] = distfile - self._reset_version_str() return self # --- end of revbump (...) --- @@ -620,20 +638,6 @@ class PackageInfo ( object ): return None # --- end of get_evars (...) --- - def _reset_version_str ( self ): - """Recreates the version_str ($PVR) of this PackageInfo instance.""" - rev = self ['rev'] - version = self ['version'] - - if rev > 0: - vstr = '.'.join ( str ( k ) for k in version ) + '-r' + str ( rev ) - else: - vstr = '.'.join ( str ( k ) for k in version ) - - self._info ['ebuild_verstr'] = vstr - #return vstr - # --- end of _reset_version_str (...) --- - def _update ( self, info ): """Updates self._info using the given info dict.