def __prepare(self):
"""
Prepares the patching root ready for RPM patching.
"""
global developer_disable_patching
if developer_disable_patching:
logging.debug("RPM patcher will not be prepared.")
return
graphs = self._graphs
self.__prepare_image(graphs)
self.patching_root = temporaries.mount_firmware(self.images_directory)
host_arch = platform.machine()
host_arches = self.__produce_architecture_synonyms_list(host_arch)
if self.architecture not in host_arches:
self.__deploy_qemu_package()
combirepo_dir = os.path.abspath(os.path.dirname(__file__))
rpmrebuild_file = os.path.join(combirepo_dir, 'data/rpmrebuild.tar')
already_present_rpmrebuilds = files.find_fast(self.patching_root,
"rpmrebuild.*")
for already_present_rpmrebuild in already_present_rpmrebuilds:
if os.path.isdir(already_present_rpmrebuild):
shutil.rmtree(already_present_rpmrebuild)
elif os.path.isfile(already_present_rpmrebuild):
os.remove(already_present_rpmrebuild)
hidden_subprocess.call("Extracting the rpmrebuild ",
["tar", "xf", rpmrebuild_file, "-C",
self.patching_root])
queue = multiprocessing.Queue()
child = multiprocessing.Process(target=self.__install_rpmrebuild,
args=(queue,))
child.start()
child.join()
if queue.empty():
logging.error("Failed to install rpmrebuild into chroot.")
sys.exit("Error.")
else:
result = queue.get()
if result:
logging.debug("Installation of rpmrebuild successfully "
"completed.")
else:
raise Exception("Impossible happened.")
评论列表
文章目录