From c6bec0519b26008223101b6938512e7a3d1aa2d8 Mon Sep 17 00:00:00 2001 From: Mike Khiretskiy Date: Fri, 11 Sep 2015 11:58:24 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD?= =?UTF-8?q?=D0=B0=20=D0=BD=D1=83=D0=BC=D0=B5=D1=80=D0=B0=D1=86=D0=B8=D1=8F?= =?UTF-8?q?=20=D0=BE=D0=B1=D1=80=D0=B0=D0=B7=D0=BE=D0=B2=20=D0=BD=D0=B0=20?= =?UTF-8?q?=D1=84=D0=BB=D0=B5=D1=88=D0=BA=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pym/builder/variables/builder.py | 18 ++++++++++++------ pym/builder/variables/images.py | 12 ++++++++++-- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/pym/builder/variables/builder.py b/pym/builder/variables/builder.py index 874aada..8b8668f 100644 --- a/pym/builder/variables/builder.py +++ b/pym/builder/variables/builder.py @@ -699,7 +699,6 @@ class VariableClBuilderImageFilename(Variable): Название iso образа """ opt = ["--iso"] - value = "" metavalue = "IMAGE" untrusted = True @@ -713,12 +712,20 @@ class VariableClBuilderImageFilename(Variable): if not value: raise VariableError(_("You must specify image filename")) - def _isoname(self): + def _isoname(self, dn): shortname = self.Get('os_builder_linux_shortname').lower() buildnumber = self.Get('os_builder_linux_build') arch = self.Get('os_builder_arch_machine') - return "%s-%s-%s.iso" % (shortname, buildnumber, - arch) + 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) + fullname = path.join(dn, isoname) + if not path.exists(fullname): + return fullname def get(self): build_id = self.Get('cl_builder_id') @@ -727,8 +734,7 @@ class VariableClBuilderImageFilename(Variable): if self.Get('os_root_type_ext') in RootType.RebuildAvailable: base_dn = self.Get('cl_builder_flash_repository') if build_id: - imagename = self._isoname() - return path.join(base_dn, imagename) + return self._isoname(base_dn) return "" diff --git a/pym/builder/variables/images.py b/pym/builder/variables/images.py index f696c23..f0763a8 100644 --- a/pym/builder/variables/images.py +++ b/pym/builder/variables/images.py @@ -15,6 +15,7 @@ # limitations under the License. import os +import re from os import path import sys from calculate.lib.utils.portage import isPkgInstalled @@ -132,7 +133,9 @@ class VariableClBuilderImageData(ReadonlyTableVariable): def generator(self, isopath): 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')]: try: with IsoDistributive(iso_image) as image: @@ -144,8 +147,13 @@ class VariableClBuilderImageData(ReadonlyTableVariable): initrd = dv['cl_builder_initrd_install'] 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, - dv['cl_builder_iso_label'], + label, iso_image, kernel, kernel_copy, initrd, initrd_copy,