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 0C1A7138200 for ; Wed, 17 Jul 2013 18:05:59 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 49AB2E09B2; Wed, 17 Jul 2013 18:05:58 +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 A25A4E09B2 for ; Wed, 17 Jul 2013 18:05:57 +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 8283B33E753 for ; Wed, 17 Jul 2013 18:05:56 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 30EB3E545F for ; Wed, 17 Jul 2013 18:05:55 +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: <1374084000.a01c5b354610331bdd684aa3632a1f692a44d6cb.dywi@gentoo> Subject: [gentoo-commits] proj/R_overlay:master commit in: roverlay/ X-VCS-Repository: proj/R_overlay X-VCS-Files: roverlay/packageinfo.py roverlay/versiontuple.py X-VCS-Directories: roverlay/ X-VCS-Committer: dywi X-VCS-Committer-Name: André Erdmann X-VCS-Revision: a01c5b354610331bdd684aa3632a1f692a44d6cb X-VCS-Branch: master Date: Wed, 17 Jul 2013 18:05:55 +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: 0859572a-b923-4276-b793-01e78802afc5 X-Archives-Hash: 6a3ebbc6870404ef476cd6874afc973d Message-ID: <20130717180555.divyScmW7hWB0T9KdsktTSMAZ7vPxmNHDiM9VDYR2Ns@z> commit: a01c5b354610331bdd684aa3632a1f692a44d6cb Author: André Erdmann mailerd de> AuthorDate: Wed Jul 17 17:58:11 2013 +0000 Commit: André Erdmann mailerd de> CommitDate: Wed Jul 17 18:00:00 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=a01c5b35 fix versiontuple (again) The le/lt/ge/gt comparision functions were completely wrong, which caused selfdep validation to misbehave. Checking "(0,97) <= (1,1,2)" always returned False (but 0 < 1!), whereas "(1,1,2) >= (0,97)" returned False, too (which is be correct, but "neither less nor greater nor equal" makes no sense at all). In a second (incremental) run, all comparisions would then evaluate to true, because PackageInfo created normal tuples for scanned ebuilds, for which IntVersionTuple returns NotImplemented (when comparing). And bool( NotImplemented ) <=> True, so even IntVersionTuple(1,1) was "less than" tuple(0,0). This commit fixes this issue. --- roverlay/packageinfo.py | 9 +++++---- roverlay/versiontuple.py | 52 +++++++++++++++++++++++++++++++++++++----------- 2 files changed, 45 insertions(+), 16 deletions(-) diff --git a/roverlay/packageinfo.py b/roverlay/packageinfo.py index 0224d6c..feee360 100644 --- a/roverlay/packageinfo.py +++ b/roverlay/packageinfo.py @@ -108,7 +108,7 @@ class PackageInfo ( object ): 'has_suggests', )) _UPDATE_KEYS_SIMPLE_INITIAL = frozenset (( - 'package_filename', + 'package_filename', 'name', )) _UPDATE_KEYS_FILTER_NONE = frozenset (( 'src_uri_base', @@ -810,9 +810,10 @@ class PackageInfo ( object ): ) ) # non-digit chars in pv are unsupported, too - - self._info ['version'] = tuple ( int ( z ) for z in pv.split ( '.' ) ) - self._info ['rev'] = int ( pr_str ) if pr_str else 0 + self._info ['version'] = roverlay.versiontuple.IntVersionTuple ( + int ( z ) for z in pv.split ( '.' ) + ) + self._info ['rev'] = int ( pr_str ) if pr_str else 0 self._info ['ebuild_verstr'] = pvr # --- end of _use_pvr (...) --- diff --git a/roverlay/versiontuple.py b/roverlay/versiontuple.py index 0ca902a..20d5cf8 100644 --- a/roverlay/versiontuple.py +++ b/roverlay/versiontuple.py @@ -166,36 +166,64 @@ class IntVersionTuple ( VersionTuple ): def __le__ ( self, other ): if isinstance ( other, self.__class__ ): - return all ( a <= b - for a, b in _zip_longest ( self, other, fillvalue=0 ) - ) + # + # ( k0, k1, ..., kN ) x ( l0, l1, ..., lN ) + # + # from left to right (high to low) + # if k_j < l_j + # return True (k <= j) + # elif k_j == l_j + # continue with next + # else + # return False (k > j) + # + # return True if last pair was equal + for a, b in _zip_longest ( self, other, fillvalue=0 ): + if a < b: + return True + elif a > b: + return False + else: + return True else: return NotImplemented # --- end of __le__ (...) --- def __ge__ ( self, other ): if isinstance ( other, self.__class__ ): - return all ( a >= b - for a, b in _zip_longest ( self, other, fillvalue=0 ) - ) + for a, b in _zip_longest ( self, other, fillvalue=0 ): + if a > b: + return True + elif a < b: + return False + else: + return True else: return NotImplemented # --- end of __ge__ (...) --- def __lt__ ( self, other ): if isinstance ( other, self.__class__ ): - return all ( a < b - for a, b in _zip_longest ( self, other, fillvalue=0 ) - ) + for a, b in _zip_longest ( self, other, fillvalue=0 ): + if a < b: + return True + elif a > b: + return False + else: + return False else: return NotImplemented # --- end of __lt__ (...) --- def __gt__ ( self, other ): if isinstance ( other, self.__class__ ): - return all ( a > b - for a, b in _zip_longest ( self, other, fillvalue=0 ) - ) + for a, b in _zip_longest ( self, other, fillvalue=0 ): + if a > b: + return True + elif a < b: + return False + else: + return False else: return NotImplemented # --- end of __gt__ (...) ---