|
|
@ -350,7 +350,8 @@ class _terms(_error, _shareTermsFunction):
|
|
|
|
if flagNotIniFunct:
|
|
|
|
if flagNotIniFunct:
|
|
|
|
if flagNotEmptyVals and\
|
|
|
|
if flagNotEmptyVals and\
|
|
|
|
("_ver" in vals[0] or\
|
|
|
|
("_ver" in vals[0] or\
|
|
|
|
(flagFunction and searchFunct.group(1)=="pkg") or\
|
|
|
|
(flagFunction and searchFunct.group(1) in \
|
|
|
|
|
|
|
|
("pkg","merge")) or\
|
|
|
|
(flagFunction and searchFunct.group(1)=="load" and\
|
|
|
|
(flagFunction and searchFunct.group(1)=="load" and\
|
|
|
|
re.search("\(\s*ver\s*,",vals[0]))):
|
|
|
|
re.search("\(\s*ver\s*,",vals[0]))):
|
|
|
|
# Проверка значения на версию
|
|
|
|
# Проверка значения на версию
|
|
|
@ -668,7 +669,8 @@ 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":
|
|
|
|
if "format" in self.params and self.params["format"] in \
|
|
|
|
|
|
|
|
("patch","diff"):
|
|
|
|
self.params["append"] = "patch"
|
|
|
|
self.params["append"] = "patch"
|
|
|
|
return "patch"
|
|
|
|
return "patch"
|
|
|
|
self.params["append"] = "join"
|
|
|
|
self.params["append"] = "join"
|
|
|
@ -3502,13 +3504,20 @@ class templateFunction(_error, _warning, _shareTemplate, _shareTermsFunction):
|
|
|
|
except TemplatesError as e:
|
|
|
|
except TemplatesError as e:
|
|
|
|
self.printWARNING(str(e))
|
|
|
|
self.printWARNING(str(e))
|
|
|
|
self.currentBelong = funcPkg
|
|
|
|
self.currentBelong = funcPkg
|
|
|
|
pkg = self.objVar.Get("cl_merge_pkg")
|
|
|
|
if self.objVar.Get('cl_action') == 'patch':
|
|
|
|
replace = ""
|
|
|
|
if funcPkg == "%s/%s"%(self.objVar.Get('core.cl_core_pkg_category'),
|
|
|
|
if pkg:
|
|
|
|
self.objVar.Get('core.cl_core_pkg_name')):
|
|
|
|
if funcPkg in pkg:
|
|
|
|
replace = self.objVar.Get('core.cl_core_pkg_version')
|
|
|
|
replace = "1"
|
|
|
|
else:
|
|
|
|
|
|
|
|
replace = ""
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
replace = "1"
|
|
|
|
pkg = self.objVar.Get("cl_merge_pkg")
|
|
|
|
|
|
|
|
replace = ""
|
|
|
|
|
|
|
|
if pkg:
|
|
|
|
|
|
|
|
if funcPkg in pkg:
|
|
|
|
|
|
|
|
replace = "1"
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
replace = "1"
|
|
|
|
textTemplateTmp = textTemplateTmp[:resS.start()] + replace +\
|
|
|
|
textTemplateTmp = textTemplateTmp[:resS.start()] + replace +\
|
|
|
|
textTemplateTmp[resS.end():]
|
|
|
|
textTemplateTmp[resS.end():]
|
|
|
|
return textTemplateTmp
|
|
|
|
return textTemplateTmp
|
|
|
@ -3815,6 +3824,8 @@ class Template(_file,_terms,_warning,xmlShare,templateFormat,_shareTemplate):
|
|
|
|
self.changedFiles = ChangedFiles()
|
|
|
|
self.changedFiles = ChangedFiles()
|
|
|
|
self.printSUCCESS = printSUCCESS
|
|
|
|
self.printSUCCESS = printSUCCESS
|
|
|
|
self.printERROR = printERROR
|
|
|
|
self.printERROR = printERROR
|
|
|
|
|
|
|
|
if printERROR:
|
|
|
|
|
|
|
|
self.setError = self.printERROR
|
|
|
|
self.printWARNING = printWARNING
|
|
|
|
self.printWARNING = printWARNING
|
|
|
|
self.askConfirm = askConfirm
|
|
|
|
self.askConfirm = askConfirm
|
|
|
|
self.stop = 0
|
|
|
|
self.stop = 0
|
|
|
@ -3879,6 +3890,8 @@ re.M|re.S)
|
|
|
|
self.functObj.printSUCCESS = self.printSUCCESS
|
|
|
|
self.functObj.printSUCCESS = self.printSUCCESS
|
|
|
|
self.functObj.printWARNING = self.printWARNING
|
|
|
|
self.functObj.printWARNING = self.printWARNING
|
|
|
|
self.functObj.printERROR = self.printERROR
|
|
|
|
self.functObj.printERROR = self.printERROR
|
|
|
|
|
|
|
|
if self.printERROR:
|
|
|
|
|
|
|
|
self.functObj.setError = self.printERROR
|
|
|
|
self.functObj.askConfirm = self.askConfirm
|
|
|
|
self.functObj.askConfirm = self.askConfirm
|
|
|
|
# Метод применения функций к шаблонам
|
|
|
|
# Метод применения функций к шаблонам
|
|
|
|
self.applyFuncTemplate = self.functObj.applyFuncTemplate
|
|
|
|
self.applyFuncTemplate = self.functObj.applyFuncTemplate
|
|
|
@ -4191,7 +4204,7 @@ gettext -d cl_template "$*"
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
return True
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
|
|
def templateModify(self,filesApl):
|
|
|
|
def templateModify(self):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
Files which created by apping templates
|
|
|
|
Files which created by apping templates
|
|
|
|
"""
|
|
|
|
"""
|
|
|
@ -4484,7 +4497,11 @@ gettext -d cl_template "$*"
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
self.printWARNING(_("Calculate Utilities have changed files")+":")
|
|
|
|
self.printWARNING(_("Calculate Utilities have changed files")+":")
|
|
|
|
reGrey = re.compile(r"\._cfg\d{4}_")
|
|
|
|
reGrey = re.compile(r"\._cfg\d{4}_")
|
|
|
|
|
|
|
|
rootPath = self.objVar.Get('cl_root_path')
|
|
|
|
for fn in sorted(list(set(filesApply))):
|
|
|
|
for fn in sorted(list(set(filesApply))):
|
|
|
|
|
|
|
|
if rootPath != '/' and self.objVar.Get('cl_action') == 'patch' and \
|
|
|
|
|
|
|
|
fn.startswith(rootPath):
|
|
|
|
|
|
|
|
fn = fn[len(rootPath)+1:]
|
|
|
|
if reGrey.search(fn):
|
|
|
|
if reGrey.search(fn):
|
|
|
|
self.printSUCCESS(" "*5 + \
|
|
|
|
self.printSUCCESS(" "*5 + \
|
|
|
|
"<font color=\"dark gray\">%s</font>"%fn)
|
|
|
|
"<font color=\"dark gray\">%s</font>"%fn)
|
|
|
@ -4495,6 +4512,8 @@ gettext -d cl_template "$*"
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
Update ._cfg0000 files
|
|
|
|
Update ._cfg0000 files
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
|
|
|
|
if self.objVar.Get('cl_ebuild_phase') == 'compile':
|
|
|
|
|
|
|
|
return
|
|
|
|
chrootPath = self.objVar.Get('cl_chroot_path')
|
|
|
|
chrootPath = self.objVar.Get('cl_chroot_path')
|
|
|
|
cfgs = getCfgFiles(self.objVar.Get('cl_config_protect'),
|
|
|
|
cfgs = getCfgFiles(self.objVar.Get('cl_config_protect'),
|
|
|
|
prefix=chrootPath)
|
|
|
|
prefix=chrootPath)
|
|
|
@ -4658,7 +4677,6 @@ gettext -d cl_template "$*"
|
|
|
|
nameEnvFile = os.path.basename(nameFileConfig)
|
|
|
|
nameEnvFile = os.path.basename(nameFileConfig)
|
|
|
|
self.functObj.timeConfigsIni[nameEnvFile] = float(time.time())
|
|
|
|
self.functObj.timeConfigsIni[nameEnvFile] = float(time.time())
|
|
|
|
self.filesApply += filesApl
|
|
|
|
self.filesApply += filesApl
|
|
|
|
self.templateModify(filesApl)
|
|
|
|
|
|
|
|
if filesApl:
|
|
|
|
if filesApl:
|
|
|
|
self._addFile(filesApl)
|
|
|
|
self._addFile(filesApl)
|
|
|
|
return True
|
|
|
|
return True
|
|
|
@ -5164,7 +5182,8 @@ gettext -d cl_template "$*"
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
pathOldFile = pathJoin(path,os.path.split(nameFileConfig)[1])
|
|
|
|
pathOldFile = pathJoin(path,os.path.split(nameFileConfig)[1])
|
|
|
|
pathOrigFile = pathOldFile
|
|
|
|
pathOrigFile = pathOldFile
|
|
|
|
if not self.userProfile:
|
|
|
|
if not self.userProfile and \
|
|
|
|
|
|
|
|
not self.objVar.Get('cl_ebuild_phase') == 'compile':
|
|
|
|
pathOldFile = self.fixNameFileConfig(pathOldFile)
|
|
|
|
pathOldFile = self.fixNameFileConfig(pathOldFile)
|
|
|
|
pathOldFile = self.checkOnNewConfigName(pathOldFile)
|
|
|
|
pathOldFile = self.checkOnNewConfigName(pathOldFile)
|
|
|
|
applyFiles = [pathOldFile]
|
|
|
|
applyFiles = [pathOldFile]
|
|
|
@ -5562,6 +5581,7 @@ gettext -d cl_template "$*"
|
|
|
|
optFile)
|
|
|
|
optFile)
|
|
|
|
if not objHeadNew:
|
|
|
|
if not objHeadNew:
|
|
|
|
return filesApply
|
|
|
|
return filesApply
|
|
|
|
|
|
|
|
self.templateModify()
|
|
|
|
if templateFileType != "bin":
|
|
|
|
if templateFileType != "bin":
|
|
|
|
# Вычисляем условные блоки
|
|
|
|
# Вычисляем условные блоки
|
|
|
|
objHeadNew.body = self.applyTermsTemplate(objHeadNew.body,
|
|
|
|
objHeadNew.body = self.applyTermsTemplate(objHeadNew.body,
|
|
|
@ -5616,7 +5636,7 @@ gettext -d cl_template "$*"
|
|
|
|
if objHeadNew.fileType:
|
|
|
|
if objHeadNew.fileType:
|
|
|
|
formatTemplate = objHeadNew.fileType
|
|
|
|
formatTemplate = objHeadNew.fileType
|
|
|
|
typeAppendTemplate = objHeadNew.typeAppend
|
|
|
|
typeAppendTemplate = objHeadNew.typeAppend
|
|
|
|
if formatTemplate == "patch":
|
|
|
|
if formatTemplate in ("patch","diff"):
|
|
|
|
if typeAppendTemplate != "patch":
|
|
|
|
if typeAppendTemplate != "patch":
|
|
|
|
self.setError(\
|
|
|
|
self.setError(\
|
|
|
|
_("Wrong option append=%(type)s in template %(file)s")\
|
|
|
|
_("Wrong option append=%(type)s in template %(file)s")\
|
|
|
@ -5633,16 +5653,23 @@ gettext -d cl_template "$*"
|
|
|
|
if objHeadOld and objHeadOld.body:
|
|
|
|
if objHeadOld and objHeadOld.body:
|
|
|
|
self.textConfig = objHeadOld.body
|
|
|
|
self.textConfig = objHeadOld.body
|
|
|
|
# обработка конфигурационного файла
|
|
|
|
# обработка конфигурационного файла
|
|
|
|
self.textTemplate = objTempl.processingFile(self.textConfig)
|
|
|
|
self.textTemplate = objTempl.processingFile(self.textConfig,
|
|
|
|
|
|
|
|
self.objVar.Get('cl_root_path'))
|
|
|
|
if objTempl.getError():
|
|
|
|
if objTempl.getError():
|
|
|
|
self.setError(_("Wrong template") + ": " +\
|
|
|
|
self.setError(_("Failed to use patch ") + \
|
|
|
|
nameFileTemplate)
|
|
|
|
nameFileTemplate)
|
|
|
|
return False
|
|
|
|
return False
|
|
|
|
|
|
|
|
elif formatTemplate == 'diff':
|
|
|
|
|
|
|
|
self.printSUCCESS(_("Appling patch")+ " " + \
|
|
|
|
|
|
|
|
os.path.basename(nameFileTemplate))
|
|
|
|
if execStr:
|
|
|
|
if execStr:
|
|
|
|
self.textConfig = execStr + title + self.textTemplate
|
|
|
|
self.textConfig = execStr + title + self.textTemplate
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
self.textConfig = title + self.textTemplate
|
|
|
|
self.textConfig = title + self.textTemplate
|
|
|
|
self.saveConfFile()
|
|
|
|
if formatTemplate in ("diff",):
|
|
|
|
|
|
|
|
return objTempl.patchFiles
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
self.saveConfFile()
|
|
|
|
if 'run' in objHeadNew.params:
|
|
|
|
if 'run' in objHeadNew.params:
|
|
|
|
if not self.executeTemplate(self.textConfig,
|
|
|
|
if not self.executeTemplate(self.textConfig,
|
|
|
|
objHeadNew.params['run']):
|
|
|
|
objHeadNew.params['run']):
|
|
|
@ -6031,7 +6058,6 @@ class templateClt(scanDirectoryClt, Template):
|
|
|
|
nameEnvFile = os.path.basename(nameFileConfig)
|
|
|
|
nameEnvFile = os.path.basename(nameFileConfig)
|
|
|
|
self.functObj.timeConfigsIni[nameEnvFile] = float(time.time())
|
|
|
|
self.functObj.timeConfigsIni[nameEnvFile] = float(time.time())
|
|
|
|
self.filesApply += filesApl
|
|
|
|
self.filesApply += filesApl
|
|
|
|
self.templateModify(filesApl)
|
|
|
|
|
|
|
|
return nameFileConfig
|
|
|
|
return nameFileConfig
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
return True
|
|
|
|
return True
|
|
|
@ -6462,7 +6488,7 @@ class ProgressTemplate(Template):
|
|
|
|
self.value = value
|
|
|
|
self.value = value
|
|
|
|
return True
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
|
|
def templateModify(self,filesApl):
|
|
|
|
def templateModify(self):
|
|
|
|
if self.firstValue and hasattr(self,"onFirstValue"):
|
|
|
|
if self.firstValue and hasattr(self,"onFirstValue"):
|
|
|
|
self.onFirstValue()
|
|
|
|
self.onFirstValue()
|
|
|
|
self.firstValue = False
|
|
|
|
self.firstValue = False
|
|
|
|