|
|
@ -2185,7 +2185,7 @@ class _file(_error):
|
|
|
|
F_TEMPL = open(nameFileTemplate, "r")
|
|
|
|
F_TEMPL = open(nameFileTemplate, "r")
|
|
|
|
except:
|
|
|
|
except:
|
|
|
|
self.setError(_("unable to open the file:")
|
|
|
|
self.setError(_("unable to open the file:")
|
|
|
|
+ nameFileConfig)
|
|
|
|
+ nameFileTemplate)
|
|
|
|
return False
|
|
|
|
return False
|
|
|
|
return F_TEMPL
|
|
|
|
return F_TEMPL
|
|
|
|
|
|
|
|
|
|
|
@ -2786,7 +2786,7 @@ class templateFunction(_error, _warning, _shareTemplate, _shareTermsFunction):
|
|
|
|
if os.path.exists(fileName):
|
|
|
|
if os.path.exists(fileName):
|
|
|
|
FD = open(fileName)
|
|
|
|
FD = open(fileName)
|
|
|
|
replace = FD.read().strip()
|
|
|
|
replace = FD.read().strip()
|
|
|
|
FD.close
|
|
|
|
FD.close()
|
|
|
|
if replace and lenTerms >= 2 and terms[0] == "empty":
|
|
|
|
if replace and lenTerms >= 2 and terms[0] == "empty":
|
|
|
|
replace ="\n".join(filter(lambda x: not self.reEmptyLoad.search(x),
|
|
|
|
replace ="\n".join(filter(lambda x: not self.reEmptyLoad.search(x),
|
|
|
|
replace.split("\n")))
|
|
|
|
replace.split("\n")))
|
|
|
@ -3091,7 +3091,7 @@ class templateFunction(_error, _warning, _shareTemplate, _shareTermsFunction):
|
|
|
|
return textTemplateTmp
|
|
|
|
return textTemplateTmp
|
|
|
|
self.printERROR(_(funArgv))
|
|
|
|
self.printERROR(_(funArgv))
|
|
|
|
raise TemplatesInterrupt(_("Execution of templates was "
|
|
|
|
raise TemplatesInterrupt(_("Execution of templates was "
|
|
|
|
"interrupted with the error"),
|
|
|
|
"interrupted with an error"),
|
|
|
|
TemplatesInterrupt.ABORT)
|
|
|
|
TemplatesInterrupt.ABORT)
|
|
|
|
|
|
|
|
|
|
|
|
def getElogTimestamp(self):
|
|
|
|
def getElogTimestamp(self):
|
|
|
@ -3113,18 +3113,25 @@ class templateFunction(_error, _warning, _shareTemplate, _shareTermsFunction):
|
|
|
|
return int(val)
|
|
|
|
return int(val)
|
|
|
|
return 0
|
|
|
|
return 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
elogFile = '/var/log/emerge.log'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
|
|
|
|
def getLastElog(cls):
|
|
|
|
|
|
|
|
# get last timestamp
|
|
|
|
|
|
|
|
lastStr = ""
|
|
|
|
|
|
|
|
for l in readLinesFile(cls.elogFile):
|
|
|
|
|
|
|
|
lastStr = l
|
|
|
|
|
|
|
|
return lastStr.partition(':')[0]
|
|
|
|
|
|
|
|
|
|
|
|
def funcElog(self,funArgv, resS, localVars, textTemplateTmp, nameTemp):
|
|
|
|
def funcElog(self,funArgv, resS, localVars, textTemplateTmp, nameTemp):
|
|
|
|
"""Function for work with emerge.log"""
|
|
|
|
"""Function for work with emerge.log"""
|
|
|
|
# TODO: need remove
|
|
|
|
|
|
|
|
return textTemplateTmp
|
|
|
|
|
|
|
|
funArgv = funArgv.strip()
|
|
|
|
funArgv = funArgv.strip()
|
|
|
|
rePkg = re.compile(r'completed emerge \(\d+ of \d+\) (\S+)\s',re.S)
|
|
|
|
rePkg = re.compile(r'completed emerge \(\d+ of \d+\) (\S+)\s',re.S)
|
|
|
|
logFile = '/var/log/emerge.log'
|
|
|
|
|
|
|
|
replace = ""
|
|
|
|
replace = ""
|
|
|
|
if funArgv:
|
|
|
|
if funArgv:
|
|
|
|
lastTimestamp = self.getElogTimestamp()
|
|
|
|
lastTimestamp = self.getElogTimestamp()
|
|
|
|
skip = True
|
|
|
|
skip = True
|
|
|
|
for line in reversed(list(readLinesFile(logFile))):
|
|
|
|
for line in reversed(list(readLinesFile(self.elogFile))):
|
|
|
|
timestamp,op,info = line.partition(':')
|
|
|
|
timestamp,op,info = line.partition(':')
|
|
|
|
if timestamp.isdigit() and lastTimestamp and \
|
|
|
|
if timestamp.isdigit() and lastTimestamp and \
|
|
|
|
int(timestamp) < lastTimestamp:
|
|
|
|
int(timestamp) < lastTimestamp:
|
|
|
@ -3136,9 +3143,7 @@ class templateFunction(_error, _warning, _shareTemplate, _shareTermsFunction):
|
|
|
|
replace = pkgInfo['PVR']
|
|
|
|
replace = pkgInfo['PVR']
|
|
|
|
break
|
|
|
|
break
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
# get last timestamp
|
|
|
|
replace = self.getLastElog()
|
|
|
|
replace = readFile(logFile).rpartition(
|
|
|
|
|
|
|
|
'\n')[2].lpartition(':')[0]
|
|
|
|
|
|
|
|
textTemplateTmp = textTemplateTmp[:resS.start()] + replace + \
|
|
|
|
textTemplateTmp = textTemplateTmp[:resS.start()] + replace + \
|
|
|
|
textTemplateTmp[resS.end():]
|
|
|
|
textTemplateTmp[resS.end():]
|
|
|
|
return textTemplateTmp
|
|
|
|
return textTemplateTmp
|
|
|
@ -3441,8 +3446,7 @@ class templateFunction(_error, _warning, _shareTemplate, _shareTermsFunction):
|
|
|
|
for portdir in queuePortdir():
|
|
|
|
for portdir in queuePortdir():
|
|
|
|
if not portdir in self.cachePortdir:
|
|
|
|
if not portdir in self.cachePortdir:
|
|
|
|
lPortdir = len(portdir)+1
|
|
|
|
lPortdir = len(portdir)+1
|
|
|
|
self.cachePortdir[portdir] = \
|
|
|
|
self.cachePortdir[portdir] = list(set(
|
|
|
|
list(set(
|
|
|
|
|
|
|
|
map(lambda x:x[lPortdir:].rpartition('/')[0],
|
|
|
|
map(lambda x:x[lPortdir:].rpartition('/')[0],
|
|
|
|
glob.glob("%s/*/*/*.ebuild"%portdir))))
|
|
|
|
glob.glob("%s/*/*/*.ebuild"%portdir))))
|
|
|
|
if package in self.cachePortdir[portdir]:
|
|
|
|
if package in self.cachePortdir[portdir]:
|
|
|
@ -4313,7 +4317,7 @@ gettext -d cl_template "$*"
|
|
|
|
self.printWARNING("")
|
|
|
|
self.printWARNING("")
|
|
|
|
self.printWARNING(_("Headers of directory templates and headers "
|
|
|
|
self.printWARNING(_("Headers of directory templates and headers "
|
|
|
|
"of files on the first level should include "
|
|
|
|
"of files on the first level should include "
|
|
|
|
"an action variable."))
|
|
|
|
"an action variable"))
|
|
|
|
self.printWARNING(_("Example:"))
|
|
|
|
self.printWARNING(_("Example:"))
|
|
|
|
self.printWARNING("# Calculate ac_install_merge==on")
|
|
|
|
self.printWARNING("# Calculate ac_install_merge==on")
|
|
|
|
return skipDirs + skipTemplates
|
|
|
|
return skipDirs + skipTemplates
|
|
|
@ -4574,7 +4578,7 @@ gettext -d cl_template "$*"
|
|
|
|
self.filesApply = map(lambda x:autoUpdateDict.get(x,x),self.filesApply)
|
|
|
|
self.filesApply = map(lambda x:autoUpdateDict.get(x,x),self.filesApply)
|
|
|
|
if filter(lambda x:"._cfg" in x, self.filesApply):
|
|
|
|
if filter(lambda x:"._cfg" in x, self.filesApply):
|
|
|
|
self.printWARNING(_("Some config files need updating. "
|
|
|
|
self.printWARNING(_("Some config files need updating. "
|
|
|
|
"Perform dispatch-conf."))
|
|
|
|
"Perform run dispatch-conf."))
|
|
|
|
if self.dispatchConf and \
|
|
|
|
if self.dispatchConf and \
|
|
|
|
self.objVar.Get('cl_dispatch_conf') == 'dispatch' and \
|
|
|
|
self.objVar.Get('cl_dispatch_conf') == 'dispatch' and \
|
|
|
|
self.objVar.Get('cl_ebuild_phase') == '':
|
|
|
|
self.objVar.Get('cl_ebuild_phase') == '':
|
|
|
@ -4809,7 +4813,7 @@ gettext -d cl_template "$*"
|
|
|
|
if not objHead.headerTerm:
|
|
|
|
if not objHead.headerTerm:
|
|
|
|
if objHead.getError():
|
|
|
|
if objHead.getError():
|
|
|
|
self.setError(_("Incorrect template") + ": " +\
|
|
|
|
self.setError(_("Incorrect template") + ": " +\
|
|
|
|
templateDirFile)
|
|
|
|
templateDirFile)
|
|
|
|
return ("", False, [])
|
|
|
|
return ("", False, [])
|
|
|
|
|
|
|
|
|
|
|
|
# add packeges for reconfigure
|
|
|
|
# add packeges for reconfigure
|
|
|
@ -4819,7 +4823,7 @@ gettext -d cl_template "$*"
|
|
|
|
if not self.functObj.checkCorrectPkgName(x)):
|
|
|
|
if not self.functObj.checkCorrectPkgName(x)):
|
|
|
|
self.printWARNING(
|
|
|
|
self.printWARNING(
|
|
|
|
_("Wrong package '%s' for 'merge' in the template")%
|
|
|
|
_("Wrong package '%s' for 'merge' in the template")%
|
|
|
|
wrongPkg + ": " + nameFileTemplate)
|
|
|
|
wrongPkg + ": " + templateDirFile)
|
|
|
|
for pkg in mergePkgs:
|
|
|
|
for pkg in mergePkgs:
|
|
|
|
if not pkg in self.objVar.Get('cl_merge_pkg_new') and \
|
|
|
|
if not pkg in self.objVar.Get('cl_merge_pkg_new') and \
|
|
|
|
not pkg in self.objVar.Get('cl_merge_pkg_pass') and \
|
|
|
|
not pkg in self.objVar.Get('cl_merge_pkg_pass') and \
|
|
|
@ -5133,7 +5137,7 @@ gettext -d cl_template "$*"
|
|
|
|
self.F_TEMPL = self.openTemplFile(self.nameFileTemplate)
|
|
|
|
self.F_TEMPL = self.openTemplFile(self.nameFileTemplate)
|
|
|
|
if not self.F_TEMPL:
|
|
|
|
if not self.F_TEMPL:
|
|
|
|
self.setError(_("Failed to open the template") + ": " +\
|
|
|
|
self.setError(_("Failed to open the template") + ": " +\
|
|
|
|
templateDirFile)
|
|
|
|
self.nameFileTemplate)
|
|
|
|
return False
|
|
|
|
return False
|
|
|
|
self.textTemplate = self.F_TEMPL.read()
|
|
|
|
self.textTemplate = self.F_TEMPL.read()
|
|
|
|
self.closeTemplFile()
|
|
|
|
self.closeTemplFile()
|
|
|
@ -5589,7 +5593,9 @@ gettext -d cl_template "$*"
|
|
|
|
optFile)
|
|
|
|
optFile)
|
|
|
|
if not objHeadNew:
|
|
|
|
if not objHeadNew:
|
|
|
|
return filesApply
|
|
|
|
return filesApply
|
|
|
|
self.templateModify()
|
|
|
|
if filesApply and not filter(lambda x:"calculate/ini.env" in x,
|
|
|
|
|
|
|
|
filesApply):
|
|
|
|
|
|
|
|
self.templateModify()
|
|
|
|
if templateFileType != "bin":
|
|
|
|
if templateFileType != "bin":
|
|
|
|
# Вычисляем условные блоки
|
|
|
|
# Вычисляем условные блоки
|
|
|
|
objHeadNew.body = self.applyTermsTemplate(objHeadNew.body,
|
|
|
|
objHeadNew.body = self.applyTermsTemplate(objHeadNew.body,
|
|
|
|