Изменены пути разворачивания сборок

Добавлена синхронизация ядер
master3.4
Mike Khiretskiy 9 years ago
parent 162471ef7b
commit 5309cf31f3

@ -26,7 +26,7 @@ from calculate.lib.utils.files import (
pathJoin, PercentProgress, getProgPath, process, STDOUT, removeDir,
makeDirectory, writeFile, readLinesFile, chmod, chown, FilePermission,
find, FindFileType, removeFileWithEmptyDirectory,
copyWithPath, countFiles)
copyWithPath, countFiles, listDirectory)
from calculate.lib.utils.git import Git
from calculate.lib.utils.portage import Layman, EmergeLog, EmergeLogNamedTask, \
InstalledPackageInfo, EbuildInfoError, EbuildInfo, ChrootEix, \
@ -992,3 +992,38 @@ class Builder(Update):
self.printERROR(p.read())
return False
return True
def sync_vmlinuz(self, flash_dn):
"""
Извлечение ядер из iso образов
:return:
"""
boot_dn = path.join(flash_dn, "boot")
for fn in listDirectory(boot_dn, fullPath=True):
if fn not in ("vmlinuz", "initrd"):
try:
os.unlink(fn)
except (IOError, OSError) as e:
self.printERROR(str(e))
raise BuilderError(
_("Failed to clean /boot directory on Flash driver"))
for data in self.clVars.Get('cl_builder_image_data'):
isofn = data[2]
vmlinuz_orig = data[3]
vmlinuz = data[4]
initrd_orig = data[5]
initrd = data[6]
with IsoDistributive(isofn) as iso:
dn = iso.getDirectory()
vmlinuz_orig = path.join(dn, "boot", vmlinuz_orig)
initrd_orig = path.join(dn, "boot", initrd_orig)
vmlinuz = path.join(boot_dn, vmlinuz)
initrd = path.join(boot_dn, initrd)
try:
open(vmlinuz, 'w').write(open(vmlinuz_orig, 'rb').read())
open(initrd, 'w').write(open(initrd_orig, 'rb').read())
except (IOError, OSError) as e:
self.printERROR(str(e))
raise BuilderError(_("Failed to extract kernel from %s")
% isofn)
return True

@ -156,8 +156,12 @@ class ClBuilderImageAction(Action):
'method': 'Builder.set_builder_action("%s")' % Actions.ImageMenu,
'condition': lambda Get: Get('cl_builder_rescratch_set') == 'on'
},
{'name': 'image_menu:sync_vmlinuz',
'message': __("Extract kernels from ISO images"),
'method': 'Builder.sync_vmlinuz(cl_builder_flash_path)'
},
{'name': 'image_menu:update_menu',
'message': "Templates",
'message': __("Recreate ISO image menu"),
'method': 'Builder.update_menu(cl_builder_flash_path)',
},
]

@ -81,8 +81,8 @@ class VariableClBuilderAvailableDev(Variable):
type = "list"
def get(self):
if self.Get('os_root_type') == "livecd":
return ["/run/initramfs/workspace/var/calculate/builder"]
if self.Get('os_root_type_ext') in RootType.Live:
return [path.join(Dracut.Workspace, "var/calculate/builder")]
return []
@ -186,7 +186,7 @@ class VariableClBuilderSourceFilename(Variable):
def get(self):
if self.Get('os_root_type') == 'livecd':
return '/run/initramfs/live'
return Dracut.IsoLive
return ""
@ -734,14 +734,13 @@ class VariableClBuilderImageFilename(Variable):
class VariableClBuilderIsoBasePath(Variable):
"""
Базовый путь, где будут подготавливаться данные, которые будут запакованы в iso
Базовый путь, где будут подготавливаться данные, которые будут запакованы
"""
livecd_value = '/run/initramfs/live/tmp'
default_value = "/var/calculate/tmp"
def get(self):
if self.Get('os_root_type') == 'livecd':
return self.livecd_value
if self.Get('os_root_type_ext') in RootType.RebuildAvailable:
return path.join(self.Get('cl_builder_flash_path'), "tmp")
return self.default_value

Loading…
Cancel
Save