diff --git a/installsystems/database.py b/installsystems/database.py index c723e26eb352597028c5d7653b1527d7265ba93c..f9dc86ee7cdabd61c95ce9bae4cc9bea6ff862de 100644 --- a/installsystems/database.py +++ b/installsystems/database.py @@ -52,11 +52,11 @@ class Database(object): r = self.ask("SELECT value FROM misc WHERE key = 'version'").fetchone() if r is None: raise TypeError() - self.version = r[0] + self.version = float(r[0]) except: - self.version = u"1" + self.version = 1.0 # we only support database v1 - if self.version != u"1": + if self.version >= 2.0: debug("Invalid database format: %s" % self.version) raise Exception("Invalid database format") # we make a query to be sure format is valid diff --git a/installsystems/image.py b/installsystems/image.py index 87a266f397e3c56c697b0894b7eec6b8a093f9de..9843f612c81c6a4cf4128ff0513f1d5ad0783433 100644 --- a/installsystems/image.py +++ b/installsystems/image.py @@ -10,6 +10,7 @@ import os import stat import time import json +import math import difflib import ConfigParser import subprocess @@ -32,6 +33,8 @@ class Image(object): Abstract class of images ''' + # format should be a float X.Y but for compatibility reason it's a string + # before version 6, it's strict string comparaison format = "1" extension = ".isimage" @@ -546,8 +549,17 @@ class PackageImage(Image): desc = {} # check format img_format = self._tarball.get_str("format") - if img_format != self.format: - raise Exception("Invalid tarball image format") + try: + print img_format + print self.format + print math.floor(float(self.format)) + 1.0 + #print(int(self.format) + 1) + print 'toto' + if float(img_format) >= math.floor(float(self.format)) + 1.0: + print 'otot' + raise Exception() + except: + raise Exception("Invalid image format %s" % img_format) desc["format"] = img_format # check description try: