|
|
|
@ -205,6 +205,7 @@ class TemplateWrapper:
|
|
|
|
|
self.template_text = template_text
|
|
|
|
|
|
|
|
|
|
self.contents_matching = True
|
|
|
|
|
self.ca_is_missed = False
|
|
|
|
|
|
|
|
|
|
# Флаг, указывающий, что нужно удалить файл из target_path перед
|
|
|
|
|
# применением шаблона.
|
|
|
|
@ -527,7 +528,6 @@ class TemplateWrapper:
|
|
|
|
|
self.contents_matching = self.target_package.check_contents_data(
|
|
|
|
|
self.target_path,
|
|
|
|
|
symlink=self.target_is_link)
|
|
|
|
|
print("matching:", self.contents_matching)
|
|
|
|
|
|
|
|
|
|
# Если по целевому пути файл не относящийся к какому-либо пакету и
|
|
|
|
|
# присутствует параметр autoupdate -- удаляем этот файл.
|
|
|
|
@ -541,7 +541,11 @@ class TemplateWrapper:
|
|
|
|
|
if self.parameters.source:
|
|
|
|
|
self.input_path = self.parameters.source
|
|
|
|
|
elif self.cfg_list and not self.parameters.unbound:
|
|
|
|
|
self.input_path = self.archive_path
|
|
|
|
|
if os.path.exists(self.archive_path):
|
|
|
|
|
self.input_path = self.archive_path
|
|
|
|
|
else:
|
|
|
|
|
self.input_path = self.target_path
|
|
|
|
|
self.ca_is_missed = True
|
|
|
|
|
else:
|
|
|
|
|
self.input_path = self.target_path
|
|
|
|
|
|
|
|
|
@ -551,7 +555,11 @@ class TemplateWrapper:
|
|
|
|
|
if self.parameters.source:
|
|
|
|
|
self.input_path = self.parameters.source
|
|
|
|
|
else:
|
|
|
|
|
self.input_path = self.archive_path
|
|
|
|
|
if os.path.exists(self.archive_path):
|
|
|
|
|
self.input_path = self.archive_path
|
|
|
|
|
else:
|
|
|
|
|
self.input_path = self.target_path
|
|
|
|
|
self.ca_is_missed = True
|
|
|
|
|
|
|
|
|
|
self.output_path = self._get_cfg_path(self.target_path)
|
|
|
|
|
|
|
|
|
@ -598,7 +606,6 @@ class TemplateWrapper:
|
|
|
|
|
|
|
|
|
|
def add_to_contents(self, file_md5=None) -> None:
|
|
|
|
|
'''Метод для добавления целевого файла в CONTENTS.'''
|
|
|
|
|
print("add to contents")
|
|
|
|
|
if self.target_package is None:
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
@ -747,7 +754,8 @@ class TemplateExecutor:
|
|
|
|
|
# Словарь с данными о результате работы исполнительного метода.
|
|
|
|
|
self.executor_output = {'target_path': None,
|
|
|
|
|
'stdout': None,
|
|
|
|
|
'stderr': None}
|
|
|
|
|
'stderr': None,
|
|
|
|
|
'warning': None}
|
|
|
|
|
if parameters.append == 'skip':
|
|
|
|
|
return self.executor_output
|
|
|
|
|
|
|
|
|
@ -814,6 +822,11 @@ class TemplateExecutor:
|
|
|
|
|
self.executor_output['target_path'] =\
|
|
|
|
|
template_object.target_path
|
|
|
|
|
|
|
|
|
|
if template_object.ca_is_missed:
|
|
|
|
|
self.executor_output['warning'] = (
|
|
|
|
|
"archive file is missed,"
|
|
|
|
|
" target file was used instead")
|
|
|
|
|
|
|
|
|
|
return self.executor_output
|
|
|
|
|
|
|
|
|
|
def save_changes(self):
|
|
|
|
@ -952,7 +965,6 @@ class TemplateExecutor:
|
|
|
|
|
join_before=False, replace=False) -> None:
|
|
|
|
|
'''Метод описывающий действия при append = "join", если шаблон -- файл.
|
|
|
|
|
Объединяет шаблон с целевым файлом.'''
|
|
|
|
|
print("join file")
|
|
|
|
|
input_path = template_object.input_path
|
|
|
|
|
output_path = template_object.output_path
|
|
|
|
|
|
|
|
|
@ -1148,8 +1160,7 @@ class TemplateExecutor:
|
|
|
|
|
input_text = input_file.read()
|
|
|
|
|
return input_text
|
|
|
|
|
except UnicodeDecodeError:
|
|
|
|
|
raise TemplateExecutorError(
|
|
|
|
|
"can not join binary files.")
|
|
|
|
|
raise TemplateExecutorError("can not join binary files.")
|
|
|
|
|
return ''
|
|
|
|
|
|
|
|
|
|
def _remove_cfg_files(self, template_object: TemplateWrapper) -> None:
|
|
|
|
@ -2645,6 +2656,10 @@ class DirectoryProcessor:
|
|
|
|
|
if output['target_path'] is not None:
|
|
|
|
|
target_path = output['target_path']
|
|
|
|
|
|
|
|
|
|
if output['warning'] is not None:
|
|
|
|
|
self.output.set_warning(f"{output['warning']}."
|
|
|
|
|
f" Template: {template_path}")
|
|
|
|
|
|
|
|
|
|
# Если есть вывод от параметра run -- выводим как info.
|
|
|
|
|
if output['stdout'] is not None:
|
|
|
|
|
self.output.set_info("stdout from template: {}:\n{}\n".format(
|
|
|
|
|