|
|
@ -301,7 +301,8 @@ class fileHeader(_terms):
|
|
|
|
# Тип вставки шаблона
|
|
|
|
# Тип вставки шаблона
|
|
|
|
typeAppend = ""
|
|
|
|
typeAppend = ""
|
|
|
|
# Возможные типы вставки шаблонов
|
|
|
|
# Возможные типы вставки шаблонов
|
|
|
|
_fileAppend = "join", "before", "after", "replace", "remove", "skip"
|
|
|
|
_fileAppend = "join", "before", "after", "replace", "remove", "skip",\
|
|
|
|
|
|
|
|
"patch"
|
|
|
|
# Интерпретатор (#!/bin/bash) (#!/usr/bin/python)
|
|
|
|
# Интерпретатор (#!/bin/bash) (#!/usr/bin/python)
|
|
|
|
execStr = ""
|
|
|
|
execStr = ""
|
|
|
|
# Символ комментария
|
|
|
|
# Символ комментария
|
|
|
@ -419,7 +420,7 @@ class fileHeader(_terms):
|
|
|
|
|
|
|
|
|
|
|
|
def _getType(self):
|
|
|
|
def _getType(self):
|
|
|
|
"""Выдать тип файла"""
|
|
|
|
"""Выдать тип файла"""
|
|
|
|
if self.params.has_key("format"):
|
|
|
|
if "format" in self.params:
|
|
|
|
return self.params["format"]
|
|
|
|
return self.params["format"]
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
return "raw"
|
|
|
|
return "raw"
|
|
|
@ -432,6 +433,9 @@ class fileHeader(_terms):
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
if self.fileType != "raw" and self.fileType != "bin" and\
|
|
|
|
if self.fileType != "raw" and self.fileType != "bin" and\
|
|
|
|
self.fileType != "":
|
|
|
|
self.fileType != "":
|
|
|
|
|
|
|
|
if "format" in self.params and self.params["format"] == "patch":
|
|
|
|
|
|
|
|
self.params["append"] = "patch"
|
|
|
|
|
|
|
|
return "patch"
|
|
|
|
self.params["append"] = "join"
|
|
|
|
self.params["append"] = "join"
|
|
|
|
return "join"
|
|
|
|
return "join"
|
|
|
|
self.params["append"] = "replace"
|
|
|
|
self.params["append"] = "replace"
|
|
|
@ -4336,6 +4340,34 @@ re.M|re.S)
|
|
|
|
if objHeadNew.fileType:
|
|
|
|
if objHeadNew.fileType:
|
|
|
|
formatTemplate = objHeadNew.fileType
|
|
|
|
formatTemplate = objHeadNew.fileType
|
|
|
|
typeAppendTemplate = objHeadNew.typeAppend
|
|
|
|
typeAppendTemplate = objHeadNew.typeAppend
|
|
|
|
|
|
|
|
if formatTemplate == "patch":
|
|
|
|
|
|
|
|
if typeAppendTemplate != "patch":
|
|
|
|
|
|
|
|
self.setError(\
|
|
|
|
|
|
|
|
_("False option append=%(type)s in template %(file)s")\
|
|
|
|
|
|
|
|
%{"type":typeAppendTemplate,"file":nameFileTemplate})
|
|
|
|
|
|
|
|
return False
|
|
|
|
|
|
|
|
# создаем объект формата шаблона
|
|
|
|
|
|
|
|
objTempl = self.getFormatObj(formatTemplate, self.textTemplate)
|
|
|
|
|
|
|
|
if not objTempl:
|
|
|
|
|
|
|
|
self.setError(\
|
|
|
|
|
|
|
|
_("Incorrect header parmeter format=%s in template")\
|
|
|
|
|
|
|
|
%formatTemplate + " " + nameFileTemplate)
|
|
|
|
|
|
|
|
return False
|
|
|
|
|
|
|
|
if objHeadOld and objHeadOld.body:
|
|
|
|
|
|
|
|
self.textConfig = objHeadOld.body
|
|
|
|
|
|
|
|
# обработка конфигурационного файла
|
|
|
|
|
|
|
|
self.textTemplate = objTempl.processingFile(self.textConfig)
|
|
|
|
|
|
|
|
if objTempl.getError():
|
|
|
|
|
|
|
|
self.setError(_("False template") + ": " +\
|
|
|
|
|
|
|
|
nameFileTemplate)
|
|
|
|
|
|
|
|
return False
|
|
|
|
|
|
|
|
if objHeadNew.execStr:
|
|
|
|
|
|
|
|
self.textConfig = objHeadNew.execStr+title+\
|
|
|
|
|
|
|
|
self.textTemplate
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
self.textConfig = title + self.textTemplate
|
|
|
|
|
|
|
|
self.saveConfFile()
|
|
|
|
|
|
|
|
return filesApply
|
|
|
|
# Создаем объект в случае параметра format в заголовке
|
|
|
|
# Создаем объект в случае параметра format в заголовке
|
|
|
|
if (typeAppendTemplate == "replace" or\
|
|
|
|
if (typeAppendTemplate == "replace" or\
|
|
|
|
typeAppendTemplate == "before" or\
|
|
|
|
typeAppendTemplate == "before" or\
|
|
|
|