Изменена нумерация образов на флешке

master3.4
Mike Khiretskiy 9 years ago
parent 5309cf31f3
commit c6bec0519b

@ -699,7 +699,6 @@ class VariableClBuilderImageFilename(Variable):
Название iso образа Название iso образа
""" """
opt = ["--iso"] opt = ["--iso"]
value = ""
metavalue = "IMAGE" metavalue = "IMAGE"
untrusted = True untrusted = True
@ -713,12 +712,20 @@ class VariableClBuilderImageFilename(Variable):
if not value: if not value:
raise VariableError(_("You must specify image filename")) raise VariableError(_("You must specify image filename"))
def _isoname(self): def _isoname(self, dn):
shortname = self.Get('os_builder_linux_shortname').lower() shortname = self.Get('os_builder_linux_shortname').lower()
buildnumber = self.Get('os_builder_linux_build') buildnumber = self.Get('os_builder_linux_build')
arch = self.Get('os_builder_arch_machine') arch = self.Get('os_builder_arch_machine')
return "%s-%s-%s.iso" % (shortname, buildnumber, for i in range(0, 999):
if i:
isoname = "%s-%s-%d-%s.iso" % (shortname, buildnumber,
i, arch)
else:
isoname = "%s-%s-%s.iso" % (shortname, buildnumber,
arch) arch)
fullname = path.join(dn, isoname)
if not path.exists(fullname):
return fullname
def get(self): def get(self):
build_id = self.Get('cl_builder_id') build_id = self.Get('cl_builder_id')
@ -727,8 +734,7 @@ class VariableClBuilderImageFilename(Variable):
if self.Get('os_root_type_ext') in RootType.RebuildAvailable: if self.Get('os_root_type_ext') in RootType.RebuildAvailable:
base_dn = self.Get('cl_builder_flash_repository') base_dn = self.Get('cl_builder_flash_repository')
if build_id: if build_id:
imagename = self._isoname() return self._isoname(base_dn)
return path.join(base_dn, imagename)
return "" return ""

@ -15,6 +15,7 @@
# limitations under the License. # limitations under the License.
import os import os
import re
from os import path from os import path
import sys import sys
from calculate.lib.utils.portage import isPkgInstalled from calculate.lib.utils.portage import isPkgInstalled
@ -132,7 +133,9 @@ class VariableClBuilderImageData(ReadonlyTableVariable):
def generator(self, isopath): def generator(self, isopath):
n = 1 n = 1
for iso_image in [x for x in listDirectory(isopath, fullPath=True) numbered = re.compile(r"^.*-(\d+)-(?:x86_64|i686)\.iso$")
for iso_image in [x for x in sorted(listDirectory(isopath,
fullPath=True))
if x.endswith('.iso')]: if x.endswith('.iso')]:
try: try:
with IsoDistributive(iso_image) as image: with IsoDistributive(iso_image) as image:
@ -144,8 +147,13 @@ class VariableClBuilderImageData(ReadonlyTableVariable):
initrd = dv['cl_builder_initrd_install'] initrd = dv['cl_builder_initrd_install']
initrd_copy = "initrd-%d" % n initrd_copy = "initrd-%d" % n
label = dv['cl_builder_iso_label']
m = numbered.search(iso_image)
if m:
label = "%s-%s"%(label, m.group(1))
yield ["cl-%d"%n, yield ["cl-%d"%n,
dv['cl_builder_iso_label'], label,
iso_image, iso_image,
kernel, kernel_copy, kernel, kernel_copy,
initrd, initrd_copy, initrd, initrd_copy,

Loading…
Cancel
Save