|
|
|
@ -20,7 +20,8 @@ from os import path
|
|
|
|
|
import re
|
|
|
|
|
import operator
|
|
|
|
|
from operator import itemgetter
|
|
|
|
|
from calculate.lib.datavars import Variable,VariableError,ReadonlyVariable
|
|
|
|
|
from calculate.lib.datavars import Variable,VariableError,ReadonlyVariable, \
|
|
|
|
|
CommonVariableError
|
|
|
|
|
from calculate.lib.utils.common import getSupportArch,getTupleVersion, \
|
|
|
|
|
cmpVersion
|
|
|
|
|
from calculate.lib.utils.files import readLinesFile, listDirectory
|
|
|
|
@ -294,6 +295,7 @@ class VariableClImageFilename(Variable,DistroRepository):
|
|
|
|
|
if not("os_linux_shortname" in imageData and \
|
|
|
|
|
imageData.get('os_linux_build','') and \
|
|
|
|
|
"os_arch_machine" in imageData):
|
|
|
|
|
print imageData,isoimage
|
|
|
|
|
raise VariableError(_("Wrong image file"))
|
|
|
|
|
|
|
|
|
|
def humanImageName(self,distroinfo,filepath):
|
|
|
|
@ -514,3 +516,42 @@ class VariableClTarget(ReadonlyVariable):
|
|
|
|
|
systemId=None,
|
|
|
|
|
partitionTable='')
|
|
|
|
|
return target
|
|
|
|
|
|
|
|
|
|
class VariableClImageNewOnly(Variable):
|
|
|
|
|
"""
|
|
|
|
|
Distributive image filename
|
|
|
|
|
"""
|
|
|
|
|
type = 'bool'
|
|
|
|
|
opt = ['-U','--update']
|
|
|
|
|
value = "off"
|
|
|
|
|
|
|
|
|
|
def init(self):
|
|
|
|
|
self.label = _("Install newer images only")
|
|
|
|
|
self.help = _("install newer images only")
|
|
|
|
|
|
|
|
|
|
def installedBuild(self):
|
|
|
|
|
"""
|
|
|
|
|
Get build already installed system
|
|
|
|
|
Need for check update
|
|
|
|
|
"""
|
|
|
|
|
imageData = None
|
|
|
|
|
rootDev = self.Get('os_install_root_dev')
|
|
|
|
|
if not rootDev:
|
|
|
|
|
return ""
|
|
|
|
|
try:
|
|
|
|
|
imageData = Distributive().getInfo(rootDev)
|
|
|
|
|
return imageData.get('os_linux_build','')
|
|
|
|
|
except:
|
|
|
|
|
pass
|
|
|
|
|
return ""
|
|
|
|
|
|
|
|
|
|
def check(self,value):
|
|
|
|
|
if value == 'on':
|
|
|
|
|
try:
|
|
|
|
|
imageData = Distributive().getInfo(self.Get('cl_image_filename'))
|
|
|
|
|
except Exception as e:
|
|
|
|
|
raise VariableError(_("Wrong image file"))
|
|
|
|
|
if imageData.get('os_linux_build','') <= \
|
|
|
|
|
self.Get('os_linux_build') or \
|
|
|
|
|
imageData.get('os_linux_build','') <= self.installedBuild():
|
|
|
|
|
raise CommonVariableError(_("The image for update not found"))
|
|
|
|
|