|
|
|
@ -334,9 +334,7 @@ class _shareTemplate(object):
|
|
|
|
|
groupName = grp.getgrgid(gid).gr_name
|
|
|
|
|
except Exception:
|
|
|
|
|
raise TemplatesError(_("Group ID %s not found") % str(gid))
|
|
|
|
|
groupsNames = list(map(lambda x: x.gr_name,
|
|
|
|
|
filter(lambda x: userName in x.gr_mem,
|
|
|
|
|
grp.getgrall())))
|
|
|
|
|
groupsNames = [x.gr_name for x in grp.getgrall() if userName in x.gr_mem]
|
|
|
|
|
groupsNames = [groupName] + groupsNames
|
|
|
|
|
return uid, gid, homeDir, groupsNames
|
|
|
|
|
return uid, gid, homeDir
|
|
|
|
@ -404,8 +402,7 @@ class _terms(_error, _shareTermsFunction, _shareTemplate):
|
|
|
|
|
# 2.3_p45 ('2.3','_','p43')
|
|
|
|
|
# 2.3_rc4_p45 ('2.3_rc4','_','p43')
|
|
|
|
|
strWorkVersion, spl, suffix = strWorkVersion.rpartition("_")
|
|
|
|
|
suffSplList = list(filter(lambda x: suffix.startswith(x),
|
|
|
|
|
self._suffixDict.keys()))
|
|
|
|
|
suffSplList = [x for x in self._suffixDict.keys() if suffix.startswith(x)]
|
|
|
|
|
if suffSplList:
|
|
|
|
|
suffSpl = suffSplList[0]
|
|
|
|
|
lenSuffSpl = len(suffSpl)
|
|
|
|
@ -496,8 +493,8 @@ class _terms(_error, _shareTermsFunction, _shareTemplate):
|
|
|
|
|
elemB.append(lB)
|
|
|
|
|
|
|
|
|
|
# dereferencing suffix in suffixes list
|
|
|
|
|
ssA = list(map(lambda x: (self._suffixDict.get(x[0], 0), x[1]), ssA))
|
|
|
|
|
ssB = list(map(lambda x: (self._suffixDict.get(x[0], 0), x[1]), ssB))
|
|
|
|
|
ssA = [(self._suffixDict.get(x[0], 0), x[1]) for x in ssA]
|
|
|
|
|
ssB = [(self._suffixDict.get(x[0], 0), x[1]) for x in ssB]
|
|
|
|
|
for suffix, sufVer in reversed(ssA):
|
|
|
|
|
if ssB:
|
|
|
|
|
sB, svB = ssB.pop()
|
|
|
|
@ -806,7 +803,7 @@ class _terms(_error, _shareTermsFunction, _shareTemplate):
|
|
|
|
|
mass.append(v)
|
|
|
|
|
v = ""
|
|
|
|
|
flagQ = False
|
|
|
|
|
elif list(filter(lambda x: x in i, listTerm)):
|
|
|
|
|
elif [x for x in listTerm if x in i]:
|
|
|
|
|
flagQ = True
|
|
|
|
|
v = i
|
|
|
|
|
else:
|
|
|
|
@ -816,8 +813,7 @@ class _terms(_error, _shareTermsFunction, _shareTemplate):
|
|
|
|
|
else:
|
|
|
|
|
mass.append(i)
|
|
|
|
|
foundPar = list(set(mass) - set(listPar))
|
|
|
|
|
return not flagQ, list(filter(lambda x: not x in foundPar,
|
|
|
|
|
mass)), foundPar
|
|
|
|
|
return not flagQ, [x for x in mass if not x in foundPar], foundPar
|
|
|
|
|
|
|
|
|
|
listPar = re.split(r"\s+", linePar)
|
|
|
|
|
flagFoundQ = "'" in linePar
|
|
|
|
@ -2984,7 +2980,7 @@ class templateFunction(_error, _warning, _shareTemplate, _shareTermsFunction,
|
|
|
|
|
if drivers == "on":
|
|
|
|
|
yield id
|
|
|
|
|
|
|
|
|
|
data = list(filter(None, self.objVar.Get('builder.cl_builder_image_data')))
|
|
|
|
|
data = [x for x in self.objVar.Get('builder.cl_builder_image_data') if x]
|
|
|
|
|
if funArgv == 'submenu':
|
|
|
|
|
res = "\n".join(generateSubmenu(data))
|
|
|
|
|
elif funArgv == 'xorg':
|
|
|
|
@ -3054,10 +3050,12 @@ class templateFunction(_error, _warning, _shareTemplate, _shareTermsFunction,
|
|
|
|
|
_("the first parameter must be the resolution"))
|
|
|
|
|
|
|
|
|
|
re_resol = re.compile(r".*?(\d+)x(\d+).*")
|
|
|
|
|
res = list(map(lambda x: (int(x.group(1)), int(x.group(2)), x.group()),
|
|
|
|
|
filter(None,
|
|
|
|
|
map(re_resol.search,
|
|
|
|
|
listDirectory(wpath)))))
|
|
|
|
|
# res = list(map(lambda x: (int(x.group(1)), int(x.group(2)), x.group()),
|
|
|
|
|
# filter(None,
|
|
|
|
|
# map(re_resol.search,
|
|
|
|
|
# listDirectory(wpath)))))
|
|
|
|
|
res = [(int(x.group(1)), int(x.group(2)), x.group()) for x in
|
|
|
|
|
[re_resol.search(z) for z in listDirectory(wpath)] if x]
|
|
|
|
|
width = int(resol.group(1))
|
|
|
|
|
height = int(resol.group(2))
|
|
|
|
|
gep = sqrt(height ** 2 + width ** 2)
|
|
|
|
@ -3293,7 +3291,7 @@ class templateFunction(_error, _warning, _shareTemplate, _shareTermsFunction,
|
|
|
|
|
vals = textLine.split(".")
|
|
|
|
|
if len(vals) != 2:
|
|
|
|
|
raise self.raiseErrTemplate()
|
|
|
|
|
if list(filter(lambda x: not x.strip(), vals)):
|
|
|
|
|
if [x for x in vals if not x.strip()]:
|
|
|
|
|
raise self.raiseErrTemplate()
|
|
|
|
|
service, option = vals
|
|
|
|
|
if not service or not option:
|
|
|
|
@ -3797,10 +3795,8 @@ class Template(_file, _terms, _warning, xmlShare, _shareTemplate):
|
|
|
|
|
protectPaths = []
|
|
|
|
|
allContents = {}
|
|
|
|
|
if "CONFIG_PROTECT" in os.environ:
|
|
|
|
|
protectPaths = ["/etc"] + list(filter(lambda x: x.strip(),
|
|
|
|
|
os.environ["CONFIG_PROTECT"].split(
|
|
|
|
|
" ")))
|
|
|
|
|
protectPaths = list(map(lambda x: os.path.normpath(x), protectPaths))
|
|
|
|
|
protectPaths = ["/etc"] + [x for x in os.environ["CONFIG_PROTECT"].split(" ") if x.strip()]
|
|
|
|
|
protectPaths = [os.path.normpath(x) for x in protectPaths]
|
|
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
|
def removeComment(cls, text):
|
|
|
|
@ -4315,8 +4311,7 @@ gettext -d cl_template "$*"
|
|
|
|
|
skipTemplates = []
|
|
|
|
|
debug = False
|
|
|
|
|
for dirsTemplate in dirsTemplates:
|
|
|
|
|
filesAndDirs = list(map(lambda x: os.path.join(dirsTemplate, x),
|
|
|
|
|
listDirectory(dirsTemplate)))
|
|
|
|
|
filesAndDirs = [os.path.join(dirsTemplate, x) for x in listDirectory(dirsTemplate)]
|
|
|
|
|
for dirFile in filesAndDirs:
|
|
|
|
|
if os.path.isdir(dirFile):
|
|
|
|
|
flagDir = True
|
|
|
|
@ -4463,8 +4458,7 @@ gettext -d cl_template "$*"
|
|
|
|
|
scanObj.processingFile = lambda x, y: createDictTemplates(x, y,
|
|
|
|
|
self.dictTemplates)
|
|
|
|
|
# Считаем количество шаблонов
|
|
|
|
|
dirsTemplatesExists = list(filter(lambda x: os.path.exists(x), dirsTemplates))
|
|
|
|
|
|
|
|
|
|
dirsTemplatesExists = [x for x in dirsTemplates if os.path.exists(x)]
|
|
|
|
|
if not dirsTemplatesExists and not self.cltObj:
|
|
|
|
|
return self.createdDirs, self.filesApply
|
|
|
|
|
|
|
|
|
@ -4544,10 +4538,12 @@ gettext -d cl_template "$*"
|
|
|
|
|
filename = PkgContents.reCfg.sub("/", filename)
|
|
|
|
|
if not filename in self.cltObj.filterApplyTemplates:
|
|
|
|
|
self.cltObj.filterApplyTemplates[filename] = []
|
|
|
|
|
pkgs = list(filter(
|
|
|
|
|
lambda x: x not in
|
|
|
|
|
self.cltObj.filterApplyTemplates[filename],
|
|
|
|
|
list(map(lambda x: x[0], pkgs))))
|
|
|
|
|
# pkgs = list(filter(
|
|
|
|
|
# lambda x: x not in
|
|
|
|
|
# self.cltObj.filterApplyTemplates[filename],
|
|
|
|
|
# list(map(lambda x: x[0], pkgs))))
|
|
|
|
|
pkgs = [x for x in [z[0] for z in pkgs]
|
|
|
|
|
if x not in self.cltObj.filterApplyTemplates[filename]]
|
|
|
|
|
self.cltObj.filterApplyTemplates[filename].extend(pkgs)
|
|
|
|
|
old_mod = self.objVar.defaultModule
|
|
|
|
|
try:
|
|
|
|
@ -4624,9 +4620,7 @@ gettext -d cl_template "$*"
|
|
|
|
|
self.updateProtectedFiles()
|
|
|
|
|
if self.objVar.Get('cl_verbose_set') == 'on' and \
|
|
|
|
|
self.filesApply:
|
|
|
|
|
self.verboseOutput(
|
|
|
|
|
list(filter(lambda x: not x.endswith('/ini.env'),
|
|
|
|
|
self.filesApply)))
|
|
|
|
|
self.verboseOutput([x for x in self.filesApply if not x.endswith('/ini.env')])
|
|
|
|
|
self.objVar.Set('cl_merge_pkg_pass', [], force=True)
|
|
|
|
|
self.objVar.Set('cl_merge_pkg_new', [], force=True)
|
|
|
|
|
self.objVar.Set('cl_merge_pkg', [], force=True)
|
|
|
|
@ -4736,9 +4730,8 @@ gettext -d cl_template "$*"
|
|
|
|
|
pkgContents.writeContents()
|
|
|
|
|
except IOError:
|
|
|
|
|
self.printWARNING(_("Failed to modify %s contents") % pkg)
|
|
|
|
|
self.filesApply = list(map(lambda x: autoUpdateDict.get(x, x),
|
|
|
|
|
self.filesApply))
|
|
|
|
|
if list(filter(lambda x: "._cfg" in x, self.filesApply)):
|
|
|
|
|
self.filesApply = [autoUpdateDict.get(x, x) for x in self.filesApply]
|
|
|
|
|
if [x for x in self.filesApply if "._cfg" in x]:
|
|
|
|
|
if self.objVar.Get('cl_ebuild_phase') != '':
|
|
|
|
|
self.printWARNING(_("Some config files need updating. "
|
|
|
|
|
"Perform run dispatch-conf."))
|
|
|
|
@ -5115,8 +5108,7 @@ gettext -d cl_template "$*"
|
|
|
|
|
headerLine = self.getHeaderText(textTemplate)
|
|
|
|
|
if headerLine:
|
|
|
|
|
envparam = "%s=" % HParams.Environ
|
|
|
|
|
moduleParam = list(filter(lambda x: x.startswith(envparam),
|
|
|
|
|
headerLine.split()))
|
|
|
|
|
moduleParam = [x for x in headerLine.split() if x.startswith(envparam)]
|
|
|
|
|
if moduleParam:
|
|
|
|
|
self.objVar.defaultModule = moduleParam[0].partition('=')[2]
|
|
|
|
|
try:
|
|
|
|
@ -5401,12 +5393,14 @@ gettext -d cl_template "$*"
|
|
|
|
|
"""
|
|
|
|
|
# if file in PROTECT_MASK or not in PROTECT
|
|
|
|
|
chrootPath = self.objVar.Get('cl_chroot_path')
|
|
|
|
|
if not list(filter(pathFile.startswith,
|
|
|
|
|
map(lambda x: pathJoin(chrootPath, x),
|
|
|
|
|
self.objVar.Get('cl_config_protect')))) or \
|
|
|
|
|
list(filter(pathFile.startswith,
|
|
|
|
|
map(lambda x: pathJoin(chrootPath, x),
|
|
|
|
|
self.objVar.Get('cl_config_protect_mask')))):
|
|
|
|
|
# if not list(filter(pathFile.startswith,
|
|
|
|
|
# map(lambda x: pathJoin(chrootPath, x),
|
|
|
|
|
# self.objVar.Get('cl_config_protect')))) or \
|
|
|
|
|
# list(filter(pathFile.startswith,
|
|
|
|
|
# map(lambda x: pathJoin(chrootPath, x),
|
|
|
|
|
# self.objVar.Get('cl_config_protect_mask')))):
|
|
|
|
|
if not [x for x in [pathJoin(chrootPath, y) for y in self.objVar.Get('cl_config_protect')] if pathFile.startswith(x)] or \
|
|
|
|
|
[x for x in [pathJoin(chrootPath, y) for y in self.objVar.Get('cl_config_protect_mask')] if pathFile.startswith(x)]:
|
|
|
|
|
return pathFile
|
|
|
|
|
# if file was already modified by templates
|
|
|
|
|
if pathFile in self.changedFiles.data.keys():
|
|
|
|
@ -6042,8 +6036,7 @@ gettext -d cl_template "$*"
|
|
|
|
|
headerLine = self.getHeaderText(self.textTemplate)
|
|
|
|
|
if headerLine:
|
|
|
|
|
envparam = "%s=" % HParams.Environ
|
|
|
|
|
moduleParam = list(filter(lambda x: x.startswith(envparam),
|
|
|
|
|
headerLine.split()))
|
|
|
|
|
moduleParam = [x for x in headerLine.split() if x.startswith(envparam)]
|
|
|
|
|
if moduleParam:
|
|
|
|
|
self.objVar.defaultModule = moduleParam[0].partition('=')[2]
|
|
|
|
|
try:
|
|
|
|
|