- 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
This commit is contained in:
lxnay
2008-03-30 10:23:24 +00:00
parent 0e51cc635b
commit a3951cbb4f
2 changed files with 20 additions and 3 deletions
+18 -1
View File
@@ -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))
+2 -2
View File
@@ -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