|
|
|
@ -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
|
|
|
|
|