Browse Source

Добавлена проверка соответсивия названий repo_name переменным

tags/3.2.0_alpha12
Mike Khiretskiy 7 years ago
parent
commit
c9913031f8
2 changed files with 17 additions and 20 deletions
  1. +16
    -19
      update/update.py
  2. +1
    -1
      update/variables/update.py

+ 16
- 19
update/update.py View File

@@ -35,7 +35,8 @@ from package_tools import Git, Layman,\

Colors = TextState.Colors
from calculate.lib.utils.files import (getProgPath, STDOUT, removeDir,
PercentProgress, process, getRunCommands)
PercentProgress, process, getRunCommands,
readFile)
from calculate.lib.cl_lang import (setLocalTranslate, getLazyLocalTranslate,
RegexpLocalization, _)
import emerge_parser
@@ -227,6 +228,18 @@ class Update:
egenCache = getProgPath('/usr/bin/egencache')
if not egenCache:
raise UpdateError(_("The Portage tool is not found"))
path_rep = self.clVars.Select('cl_update_rep_path',
where='cl_update_rep_name',
eq=repname, limit=1)
repo_name = readFile(
path.join(path_rep,"profiles/repo_name")).strip()
if repo_name != repname:
self.printWARNING(
_("Repository '{repo_name}' called '{repname}'"
" in cl_update_rep_name").format(
repo_name=repo_name, repname=repname))
raise UpdateError(_("Failed to update the cache of the {rname} "
"repository").format(rname=repname))
cpu_num = self.clVars.Get('hr_cpu_num')
p = process(egenCache, "--repo=%s" % repname, "--update",
"--jobs=%s" % cpu_num, stderr=STDOUT)
@@ -267,24 +280,8 @@ class Update:
if not eixupdate:
raise UpdateError(_("The Eix tool is not found"))
self.addProgress()
excludeList = []
if self.clVars.Get('cl_update_eixupdate_force') == 'force':
countRep = len(self.clVars.Get('cl_update_rep_name'))
else:
for rep in self.clVars.Get('cl_update_rep_name'):
# подстановка имен
mapNames = {'portage': 'gentoo'}
if not rep in self.clVars.Get('cl_update_sync_rep'):
excludeList.extend(["-x", mapNames.get(rep, rep)])
countRep = len(self.clVars.Get('cl_update_sync_rep'))
if (self.clVars.Get('cl_update_other_set') == 'on' or
self.clVars.Get('cl_update_eixupdate_force') == 'force'):
countRep += len(self.clVars.Get('update.cl_update_other_rep_name'))
else:
for rep in self.clVars.Get('update.cl_update_other_rep_name'):
excludeList.extend(['-x', rep])
p = PercentProgress(eixupdate, "-F", *excludeList, part=countRep or 1,
atty=True)
countRep = len(self.clVars.Get('main.cl_portdir_overlay'))+1
p = PercentProgress(eixupdate, "-F", part=countRep or 1, atty=True)
for perc in p.progress():
self.setProgress(perc)
if p.failed():


+ 1
- 1
update/variables/update.py View File

@@ -348,7 +348,7 @@ class VariableClUpdateOtherRepData(ReadonlyTableVariable):
self.Get('cl_update_layman_make'))
layman_overlays = layman.get_installed()
for rpath in self.Get('cl_portdir_overlay'):
repo_file = path.join(rpath,"profiles/repo_name")
repo_file = path.join(rpath, "profiles/repo_name")
rname = readFile(repo_file).strip() or path.basename(rpath)
if rname in layman_overlays and not rname in repNames:
yield (rname, rpath)


Loading…
Cancel
Save