From a3951cbb4fa2f8ad58d92e091c898b4270e4150c Mon Sep 17 00:00:00 2001 From: lxnay Date: Sun, 30 Mar 2008 10:23:24 +0000 Subject: [PATCH] Entropy: - if compareVersions fails, raise a detailed exception to allow debugging git-svn-id: http://svn.sabayonlinux.org/projects/entropy/trunk@1537 cd1c1023-2f26-0410-ae45-c471fc1f0318 --- libraries/databaseTools.py | 19 ++++++++++++++++++- libraries/entropyTools.py | 4 ++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/libraries/databaseTools.py b/libraries/databaseTools.py index 5e4c51624..33df65d50 100644 --- a/libraries/databaseTools.py +++ b/libraries/databaseTools.py @@ -4169,7 +4169,7 @@ class etpDatabase: if not justname: # remove revision (-r0 if none) - if pkgversion.split("-")[-1] == "r0": + if pkgversion.endswith("r0"): # remove entropyTools.remove_revision(pkgversion) @@ -4186,6 +4186,23 @@ class etpDatabase: tagcmp = cmp(matchTag,dbtag) dbver = self.retrieveVersion(idpackage) pkgcmp = entropyTools.compareVersions(pkgversion,dbver) + if type(pkgcmp) is tuple: + failed = pkgcmp[1] + if failed == 0: + failed = pkgversion + else: + failed = dbver + # I am sorry, but either pkgversion or dbver are invalid + self.updateProgress( + bold("atomMatch: ")+red("comparison between %s and %s failed. Wrong syntax for: %s") % (pkgversion,dbver,failed,), + importance = 1, + type = "error", + header = darkred(" !!! ") + ) + raise exceptionTools.InvalidVersionString( + "InvalidVersionString: from atom: %s, cmp: %s, failed: %s" % ( + atom, pkgcmp, failed, ) + ) if direction == ">": if pkgcmp < 0: dbpkginfo.add((idpackage,dbver)) diff --git a/libraries/entropyTools.py b/libraries/entropyTools.py index c5fb5aa03..bf09764aa 100644 --- a/libraries/entropyTools.py +++ b/libraries/entropyTools.py @@ -919,9 +919,9 @@ def compareVersions(ver1, ver2): # checking that the versions are valid if not match1 or not match1.groups(): - return None + return None,0 if not match2 or not match2.groups(): - return None + return None,1 # building lists of the version parts before the suffix # first part is simple