Откат изменений
master 3.7.3.3
root 1 year ago
parent 7ed6fc2847
commit 4aaab34ac8

@ -151,19 +151,11 @@ class Profile():
self.repository = repository
self.profile = profile
self.arch = arch
self._path = None
@property
def path(self):
if self._path:
return self._path
return path.join(self.repository.directory,"profiles", self.profile)
@path.setter
def path(self, value):
self._path = value
return value
@classmethod
def from_string(cls, repository, s):
parts = [x for x in s.split() if x]
@ -271,11 +263,6 @@ class ProfileRepository():
profiles_desc = path.join(self.directory, "profiles/profiles.desc")
return list(filter(None, (Profile.from_string(self, line)
for line in readLinesFile(profiles_desc))))
@staticmethod
def get_local_profiles(directory):
profiles_desc = path.join(directory, "profiles/profiles.desc")
return list(filter(None, (Profile.from_string(Profile, line)
for line in readLinesFile(profiles_desc))))
def __repr__(self):
return "<ProfileRepository %s url=%s>" % (self.directory, self.url)

@ -47,33 +47,73 @@ class ClUpdateProfileAction(Action):
'method': 'Update.migrateCacheRepository('
'cl_update_profile_url,cl_update_profile_branch,'
'cl_update_profile_storage)',
'condition': lambda Get: Get('cl_update_profile_url')},
{'name': 'profile_from_url',
'group': __('setting up from url'),
'tasks': [
{'message': __("Repository transfer"),
'condition': lambda Get: not (
Get('cl_update_profile_storage').is_local(
Get('cl_update_profile_url'),
Get('cl_update_profile_branch'))) and Get('cl_update_profile_check_sync_allowed'),
},
{'name': 'reconfigure_vars1',
'method': 'Update.invalidateVariables("cl_update_profile_storage")',
},
{'name': 'check_datavars',
'error': _("Profile not found in master"),
'condition': lambda Get: not Get('update.cl_update_profile_datavars'),
},
{'name': 'drop_binhosts',
'method': 'Update.drop_binhosts(update.cl_update_profile_datavars)',
},
{'name': 'reconfigure_vars',
'method': 'Update.reconfigureProfileVars(cl_update_profile_datavars,'
'cl_chroot_path)',
},
],
'message': __("Repository transfer"),
'condition': lambda Get: not (
Get('cl_update_profile_storage').is_local(
Get('cl_update_profile_url'),
Get('cl_update_profile_branch'))) and Get('cl_update_profile_check_sync_allowed')
},
{'name': 'reconfigure_vars1',
'method': 'Update.invalidateVariables("cl_update_profile_storage")',
'depend': Tasks.has('migrate_repository')
},
{'name': 'check_datavars',
'error': _("Profile not found in master"),
'condition': lambda Get: not Get('update.cl_update_profile_datavars')
},
{'name': 'drop_binhosts',
'method': 'Update.drop_binhosts(update.cl_update_profile_datavars)'
},
{'name': 'reconfigure_vars',
'method': 'Update.reconfigureProfileVars(cl_update_profile_datavars,'
'cl_chroot_path)'
},
{'name': 'reps_synchronization',
'group': __("Repositories synchronization"),
'tasks': [
{'name': 'sync_reps',
'foreach': 'cl_update_profile_sync_rep',
'message': __("Checking {eachvar:capitalize} updates"),
'method': 'Update.syncRepositories(eachvar)',
'condition': lambda Get: Get('cl_update_profile_check_sync_allowed')
},
{'name': 'sync_reps:regen_cache',
'foreach': 'cl_update_sync_overlay_rep',
'message': __("Updating the {eachvar:capitalize} repository cache"),
'essential': False,
'method': 'Update.regenCache(eachvar)',
'condition': (
lambda Get: (Get('cl_update_outdate_set') == 'on' and
Get('cl_update_metadata_force') != 'skip' or
Get('cl_update_metadata_force') == 'force'))
},
{'name': 'emerge_metadata',
'message': __("Metadata transfer"),
'method': 'Update.emergeMetadata()',
'condition': (
lambda Get: (Get('cl_update_outdate_set') == 'on' and
Get('cl_update_metadata_force') != 'skip' or
Get('cl_update_metadata_force') == 'force'))
},
{'name': 'eix_update',
'message': __("Updating the eix cache for "
"{cl_update_eix_repositories}"),
'method': 'Update.eixUpdate(cl_repository_name)',
'condition': (
lambda Get: (Get('cl_update_outdate_set') == 'on' and
Get('cl_update_eixupdate_force') != 'skip' or
Get('cl_update_eixupdate_force') == 'force'))
},
# сообщение удачного завершения при обновлении репозиториев
{'name': 'success_syncrep',
'message': __("Synchronization finished"),
'depend': (Tasks.success() & Tasks.has_any("sync_reps",
"sync_other_reps",
"emerge_metadata",
"eix_update")),
}
]
},
{'name': 'reps_synchronization',
'group': __("Setting up the profile"),
'tasks': [

@ -28,7 +28,7 @@ from calculate.lib.datavars import (Variable, VariableError,
SimpleDataVars, DataVarsError)
from calculate.lib.utils.binhosts import (Binhosts, PackagesIndex, HOURS,
BinhostSignError)
from calculate.lib.utils.files import readFile, listDirectory, process, pathJoin, readLinesFile
from calculate.lib.utils.files import readFile, listDirectory, process, pathJoin
from calculate.lib.configparser import ConfigParser
from calculate.lib.cl_lang import setLocalTranslate
@ -36,7 +36,7 @@ from calculate.lib.utils.text import simplify_profiles, _u8
from calculate.lib.utils.git import Git, GitError
from calculate.lib.utils.portage import ReposConf, PortageState
from ..profile import (RepositoryStorageSet, DEFAULT_BRANCH,
LocalStorage, ProfileRepository, CacheStorage, Profile)
LocalStorage, ProfileRepository, CacheStorage)
from calculate.lib.variables import linux as lib_linux
from calculate.lib.variables import env
@ -1094,7 +1094,7 @@ class VariableClUpdateProfileUrl(Variable):
def check(self, value):
if not value:
return True
raise VariableError(_("Need to specify profile repository"))
try:
branch = self.Get(self.branch)
self.Get(self.storage).get_profiles(value, branch)
@ -1104,33 +1104,31 @@ class VariableClUpdateProfileUrl(Variable):
raise VariableError(_("Repository %s has no profiles") %
value)
# def get(self):
# try:
# if not self.value:
# return self.value
# profile = self.Get(self.profile)
# if profile:
# while (profile != self.current_root and
# ".git" not in listDirectory(profile) and
# "repo_name" not in listDirectory(
# path.join(profile,"profiles"))):
# profile = path.dirname(profile)
# if profile == self.current_root:
# return self.value
# if ".git" not in listDirectory(profile):
# repo_name = readFile(path.join(
# profile,"profiles/repo_name")).strip()
# if (repo_name in self.rep_names and
# self.Get('cl_action') == self.check_action):
# raise CriticalError(
# _("You need to update the repositories before "
# "you change the profile"))
# return Git.get_url(profile, "origin")
# except CriticalError as e:
# raise VariableError(str(e))
# except Exception as e:
# pass
# return self.value
def get(self):
try:
profile = self.Get(self.profile)
if profile:
while (profile != self.current_root and
".git" not in listDirectory(profile) and
"repo_name" not in listDirectory(
path.join(profile,"profiles"))):
profile = path.dirname(profile)
if profile == self.current_root:
return self.value
if ".git" not in listDirectory(profile):
repo_name = readFile(path.join(
profile,"profiles/repo_name")).strip()
if (repo_name in self.rep_names and
self.Get('cl_action') == self.check_action):
raise CriticalError(
_("You need to update the repositories before "
"you change the profile"))
return Git.get_url(profile, "origin")
except CriticalError as e:
raise VariableError(str(e))
except Exception as e:
pass
return self.value
class VariableClUpdateProfileRepoName(ReadonlyVariable):
@ -1207,30 +1205,19 @@ class VariableClProfileData(ReadonlyTableVariable):
return [x for x in profiles if x.arch == arch]
def get(self, hr=HumanReadable.No):
if self.Get('cl_update_profile_url'):
rep = self.Get(self.repository)
if not rep:
return [[]]
profiles = rep.get_profiles()
if not profiles:
return [[]]
repo_name = profiles[0].repository.repo_name
else:
full_path = self.Get('cl_profile_system')
storage_path = self.Get('cl_update_repos_storage')
if storage_path in full_path:
repo_name = full_path.split(storage_path)[1].replace('/', ' ').split()[0]
profiles_desc = path.join(storage_path, repo_name, "profiles/profiles.desc")
profiles = ProfileRepository.get_local_profiles(path.join(storage_path, repo_name))
for profile in profiles:
profile.path = path.join(storage_path, repo_name, 'profiles', profile.profile)
rep = self.Get(self.repository)
if not rep:
return [[]]
profiles = rep.get_profiles()
if not profiles:
return [[]]
repo_name = profiles[0].repository.repo_name
filtered_profiles = self.profile_filter(profiles)
full_name = [x.profile for x in filtered_profiles]
profile_path = [x.path for x in filtered_profiles]
profile_arch = [x.arch for x in filtered_profiles]
short_name = simplify_profiles(full_name)
full_name = ["%s:%s" % (repo_name, x) for x in full_name]
return list(zip(full_name,
short_name,
profile_path,
@ -1363,6 +1350,10 @@ class VariableClUpdateProfileSystem(Variable):
return True
if not dv.Get('os_linux_name'):
raise VariableError("")
if repo_name not in list(dv.Get('cl_update_rep_name')):
raise VariableError(
_("Overlay %s is not specified "
"in cl_update_rep_name") % repo_name)
except (DataVarsError, VariableError) as e:
if str(e):
message = ". " + str(e)
@ -1389,6 +1380,9 @@ class VariableClUpdateProfileSystem(Variable):
return ""
def choice(self):
url = self.Get(self.url)
if not url:
return []
arch = self.Get(self.gentoo_arch)
profiles = list(zip(*self.Select([self.profiles_shortname,
self.profiles_fullname],

@ -129,8 +129,8 @@ class Wsdl(WsdlBase):
'groups': [
lambda group: group(_("Repository"),
brief=('cl_update_profile_repo_name',),
# hide=('cl_update_profile_url',
# 'cl_update_profile_sync_set'),
hide=('cl_update_profile_url',
'cl_update_profile_sync_set'),
normal=('cl_update_profile_url',),
expert=('cl_update_profile_sync_set',)),
lambda group: group(_("Profile"),

Loading…
Cancel
Save