|
|
|
@ -37,7 +37,7 @@ from calculate.lib.utils.files import (
|
|
|
|
|
find, FindFileType, removeFileWithEmptyDirectory, check_rw,
|
|
|
|
|
tar_xz_directory, sha256sum, quite_unlink,
|
|
|
|
|
copyWithPath, countFiles, listDirectory, getRunCommands, readFile,
|
|
|
|
|
DirectoryRCS, RCSError)
|
|
|
|
|
DirectoryRCS, RCSError, readLinesFile)
|
|
|
|
|
from calculate.lib.utils.mount import isMount
|
|
|
|
|
from calculate.lib.utils.git import Git
|
|
|
|
|
from calculate.builder.variables.action import Actions
|
|
|
|
@ -1157,6 +1157,52 @@ class Builder(Update):
|
|
|
|
|
self.unstash_cache(rpath, laymanname)
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
cap_file = "/var/lib/calculate/filecaps"
|
|
|
|
|
|
|
|
|
|
def save_file_capabilities(self):
|
|
|
|
|
"""
|
|
|
|
|
Сохранить информацию о file capabilities при помощи команды filecap
|
|
|
|
|
"""
|
|
|
|
|
chroot_path = self.clVars.Get('cl_builder_path')
|
|
|
|
|
filecap = getProgPath("/usr/bin/filecap")
|
|
|
|
|
p = process(filecap, chroot_path)
|
|
|
|
|
with writeFile(pathJoin(chroot_path, self.cap_file)) as f:
|
|
|
|
|
for line in (x.strip() for x in p):
|
|
|
|
|
if not line or line.startswith("file"):
|
|
|
|
|
continue
|
|
|
|
|
fn, caps = line.partition(" ")[::2]
|
|
|
|
|
fn = fn[len(chroot_path):]
|
|
|
|
|
f.write("%s %s\n"% (fn, " ".join(x.strip() for x in caps.split(","))))
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
def clear_file_capabilities(self):
|
|
|
|
|
chroot_path = self.clVars.Get('cl_builder_path')
|
|
|
|
|
filecap_fn = pathJoin(chroot_path, self.cap_file)
|
|
|
|
|
if path.exists(filecap_fn):
|
|
|
|
|
os.unlink(filecap_fn)
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
def restore_file_capabilities(self):
|
|
|
|
|
"""
|
|
|
|
|
Восстановить информацию о file capabilities при помощи команды filecap
|
|
|
|
|
"""
|
|
|
|
|
chroot_path = self.clVars.Get('cl_builder_path')
|
|
|
|
|
filecap = getProgPath("/usr/bin/filecap")
|
|
|
|
|
p = process(filecap, chroot_path)
|
|
|
|
|
filecap_fn = pathJoin(chroot_path, self.cap_file)
|
|
|
|
|
if path.exists(filecap_fn):
|
|
|
|
|
self.startTask(_("Restoring file capabilities"))
|
|
|
|
|
for line in readLinesFile(filecap_fn):
|
|
|
|
|
line = line.strip()
|
|
|
|
|
if not line:
|
|
|
|
|
continue
|
|
|
|
|
fn, caps = line.partition(" ")[::2]
|
|
|
|
|
fn = pathJoin(chroot_path, fn)
|
|
|
|
|
caps = [x.strip() for x in caps.split()]
|
|
|
|
|
process(filecap, fn, *caps).success()
|
|
|
|
|
self.endTask()
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
def _update_binhost_packages(self):
|
|
|
|
|
"""
|
|
|
|
|
Выполнить команду обновления файла binhost (Packages.gz)
|
|
|
|
|