|
|
|
@ -16,6 +16,7 @@
|
|
|
|
|
|
|
|
|
|
import re
|
|
|
|
|
import sys
|
|
|
|
|
from calculate.lib.utils.common import getTupleVersion
|
|
|
|
|
from calculate.lib.utils.portage import isPkgInstalled
|
|
|
|
|
from calculate.lib.variables.linux import LinuxDataVars
|
|
|
|
|
from calculate.install.distr import IsoDistributive, DistributiveError
|
|
|
|
@ -76,7 +77,7 @@ class DataVarsBuilderImage(LinuxDataVars):
|
|
|
|
|
builder.VariableClBuilderInitrdInstall(),
|
|
|
|
|
builder.VariableClBuilderKernelVer(),
|
|
|
|
|
system.VariableOsInstallX11ServerSet(image=False,
|
|
|
|
|
prefix_variable="cl_builder_path"),
|
|
|
|
|
prefix_variable="cl_builder_path"),
|
|
|
|
|
builder.VariableClBuilderVideoDriverPath(),
|
|
|
|
|
builder.VariableClBuilderVideodrvSet(autodetect=True),
|
|
|
|
|
VariableClBuilderIsoLabel(),
|
|
|
|
@ -119,23 +120,40 @@ class VariableClBuilderImageData(ReadonlyTableVariable):
|
|
|
|
|
return newname
|
|
|
|
|
raise VariableError(_("Failed to generate kernel name"))
|
|
|
|
|
|
|
|
|
|
parser = re.compile(r"^.*/(.*?)-(\d+)(-\d+)?-(x86_64|i686)\.iso$")
|
|
|
|
|
parser = re.compile(
|
|
|
|
|
r"^.*/(.*?)-((\d{8})|(\d[0-9.]*\d(?:_beta\d+|_alpha\d+|_rc\d+)?))"
|
|
|
|
|
"(-\d+)?-(x86_64|i686)\.iso$")
|
|
|
|
|
|
|
|
|
|
ver_parser = re.compile(
|
|
|
|
|
r"^.*/(.*?)-((?:\d[0-9.]*)?\d(?:_beta\d+|_alpha\d+|_rc\d+)?)"
|
|
|
|
|
".*\.iso$")
|
|
|
|
|
|
|
|
|
|
def sortkey(self, x):
|
|
|
|
|
m = self.parser.search(x)
|
|
|
|
|
if m:
|
|
|
|
|
return (m.group(1), m.group(2),
|
|
|
|
|
-int(m.group(3)) if m.group(3) else 0, m.group(4))
|
|
|
|
|
# version
|
|
|
|
|
if m.group(4):
|
|
|
|
|
return (1, getTupleVersion(m.group(4)),
|
|
|
|
|
m.group(1), m.group(6))
|
|
|
|
|
# build
|
|
|
|
|
else:
|
|
|
|
|
return (0, m.group(3),
|
|
|
|
|
-int(m.group(5)) if m.group(5) else 0, m.group(1),
|
|
|
|
|
m.group(6))
|
|
|
|
|
else:
|
|
|
|
|
return x,
|
|
|
|
|
m = self.ver_parser.search(x)
|
|
|
|
|
if m:
|
|
|
|
|
return -1, getTupleVersion(m.group(2)), m.group(1)
|
|
|
|
|
else:
|
|
|
|
|
return -2, x,
|
|
|
|
|
|
|
|
|
|
def generator(self, isopath):
|
|
|
|
|
n = 1
|
|
|
|
|
numbered = re.compile(r"^.*-(\d{1,3})-(?:x86_64|i686)\.iso$")
|
|
|
|
|
numbered = re.compile(r"^.*\d{8}-(\d{1,3})-(?:x86_64|i686)\.iso$")
|
|
|
|
|
for iso_image in sorted(
|
|
|
|
|
[x for x in listDirectory(isopath, fullPath=True)
|
|
|
|
|
if x.endswith('.iso')],
|
|
|
|
|
key=self.sortkey):
|
|
|
|
|
key=self.sortkey, reverse=True):
|
|
|
|
|
try:
|
|
|
|
|
with IsoDistributive(iso_image) as image:
|
|
|
|
|
dn = image.getDirectory()
|
|
|
|
|