Compare commits

...

183 Commits

Author SHA1 Message Date
root 273e38c5ec TG-293
11 months ago
root f70f7f8e97 Fix: поправлено имя переменной cl_update_binhost_set для cl-builder
1 year ago
root d9a4dc08ec TG-210
1 year ago
root 242863e85a TG-198
1 year ago
root 5efa64ed5a TG-148
1 year ago
root 75a9f4cce9 TG-154
1 year ago
root 4aaab34ac8 TG-148
1 year ago
root 7ed6fc2847 TG-125
1 year ago
root c2c6314a80 TG-125
1 year ago
root 59880c5ce3 исправление
1 year ago
root 54e3fc5881 TG-130
1 year ago
root 4426fbee48 TG-127
1 year ago
root a5b4e5fcc7 TG-127
1 year ago
root a86bd7f1ff TG-127
1 year ago
root f4dc9ce9d4 Merge branch 'master' of https://git.calculate-linux.org/calculate/calculate-utils-3-update
1 year ago
root 945c398bf7 TG-106
1 year ago
Павел Иванов 3eee4d2afd TG-108 fix type
1 year ago
root 052f9c9874 TG-70
1 year ago
root 9b04b1bca6 TG-93
1 year ago
root 48169a8f47 TG-85
1 year ago
root ac4cf20de9 TG-86
1 year ago
root 017fc09c31 TG-80 TG-50
1 year ago
root ee6aa3c018 TG-78
1 year ago
root 9faf04df67 TG-58
1 year ago
root 157c642386 TG-73
1 year ago
root 0aae4a0461 cl-update: fix: other repos sync fix
1 year ago
root 8b275377a5 TG-59
1 year ago
root b8f1789db3 feature: async binhost
1 year ago
root 5137d0f9ff изменено: pym/update/utils/cl_update.py
1 year ago
root 231512dd49 cl-update: remove inner var; fix cache logic for calculating
1 year ago
root c0e82e8a7b Fix: логика выполнения пересена в модуль действий
1 year ago
root 7644f43bd8 изменено: pym/update/update.py
1 year ago
root bbe7d914ce cl-update: Fix: detect_best_binhost logic. Add tmp solution for
1 year ago
root 5e2a3f16ca изменено: pym/update/update.py
1 year ago
root 0bca2fc5cd изменено: pym/update/update.py
1 year ago
root 9aad9102be Fix: cl-update-profile
1 year ago
root c7744229ef Fix: cl-update-profile migrate repo condition
1 year ago
root 61d86149ff calculate-utils: Fix cl-update-profile
1 year ago
root bf6b759bc2 изменено: pym/update/variables/update.py
1 year ago
root 7a01f44877 изменено: pym/update/update.py
1 year ago
root 1ee37f9c43 изменено: pym/update/variables/update.py
1 year ago
root d9f6f0f859 Добавлена обработка логикии версии 3.7.3.0 для cl-builder
1 year ago
Artur 4bb1f3184b изменено: pym/update/update.py
1 year ago
Artur 33c97c66a9 изменено: pym/update/update.py
1 year ago
root 09b21a9740 изменено: pym/update/variables/update.py
1 year ago
root eb9850069d изменено: pym/update/variables/update.py
1 year ago
root a9e5b78c64 изменено: pym/update/update.py
1 year ago
root 7ebe12260f изменено: pym/update/wsdl_update.py
1 year ago
root 061401ca2e изменено: pym/update/update.py
1 year ago
root a03581b798 изменено: pym/update/update.py
1 year ago
root c59f7b06fb изменено: pym/update/update.py
1 year ago
root 78e9deb98a изменено: pym/update/update.py
1 year ago
root 91d05b39e9 изменено: pym/update/update.py
1 year ago
root 9f69807513 изменено: pym/update/update.py
1 year ago
root 2abe2f904b изменено: pym/update/update.py
1 year ago
root f019452b97 изменено: pym/update/update.py
1 year ago
root 413c9155af изменено: pym/update/update.py
1 year ago
root 98bbebd1f6 изменено: pym/update/update.py
1 year ago
Павел Иванов 8534ea0481 Добавлена поддерка нового пути к портежам
2 years ago
Павел Иванов 3d3afa2f3a Удалено условие выбора директории портежей
2 years ago
Павел Иванов 15b833a22a Путь к портежам по умолчанию - /usr/portage
2 years ago
Павел Иванов 4d8f8bf675 Перенос /usr/portage в /var/db/repos/gentoo
2 years ago
idziubenko ec0a21e2c1 added binhost.level check
2 years ago
idziubenko 224ef40ba3 now prints "sync" instead of "update" in sync-only update
2 years ago
idziubenko 75afc8b3a1 added vanilla kernel to module rebuild
2 years ago
idziubenko 9bdb486617 feat: module rebuild now ignores non calculate sources
2 years ago
idziubenko ca364e1dbf feat: added spinner before downloading
2 years ago
idziubenko 7bfae86bcf feat: git: to https:
2 years ago
idziubenko 5535168364 set check for world updated as non-essential
2 years ago
idziubenko a68d23c18f FEAT: added check for non-calculate world update
2 years ago
idziubenko 5deecf793e fixed clear_migration_host
2 years ago
idziubenko 3843da48ef FEAT: added tag saving
2 years ago
idziubenko 94e768f5a9 FIX: fixed migration level increasing on interrupt
2 years ago
idziubenko 006597de02 fixed translation
2 years ago
idziubenko 3c1febf7cb FEAT: added --ignore-level, --force-level,
2 years ago
idziubenko 78033cb110 small translation fix
2 years ago
idziubenko 10ca94e46b fixed localization
2 years ago
idziubenko fa1f25fb93 tooltip encoding fix
2 years ago
idziubenko ccd4e8837d fixed potential error with update level
2 years ago
idziubenko 52b8ade427 updated output grammar
2 years ago
idziubenko 91dd507a21 minor fix to the way binhost_level is chosen
2 years ago
idziubenko 15b6d3b152 fixed builder-update bug
2 years ago
idziubenko 3142073819 fixed scenario when local level is higher than all binhost's
2 years ago
idziubenko 9dfc73b8a1 now if repo's .git is damaged redownloads repo, but doesn't alter folder
2 years ago
idziubenko 0bc12b3320 migration mode is now turned off when --branch is present
2 years ago
idziubenko 489ec1a7a5 fixed cl-builder-update crash when host machine doesn't have a chosen
2 years ago
idziubenko 10b5a0132d fixed builder_update using migration mode
2 years ago
idziubenko 9157e7061d fixed filling in empty update_level in calculate.env
2 years ago
idziubenko d99c45dda3 changed the way decect_best_binhost works with levels
2 years ago
idziubenko 529aa6bc74 added level restoration, general bugfixes
2 years ago
idziubenko 96874fe0ea multiple improvements to migration algo
2 years ago
idziubenko 98c4deae97 multiple improvements to migration algo
3 years ago
idziubenko 9d49a68b38 added output
3 years ago
idziubenko efe2b5bc3c changed behavior of increment_current_level
3 years ago
idziubenko 5fdb31e5c8 removed unneeded import
3 years ago
Иван Дзюбенко 2ff2810339 fixed set level
3 years ago
Иван Дзюбенко 3b79f758eb progress
3 years ago
Иван Дзюбенко 4c1f92d549 added migration host capabilities
3 years ago
idziubenko 1dd1cd46a4 preparation for migration project
3 years ago
idziubenko dbfc0a2110 fixed emerge-like output sometimes crashing
3 years ago
idziubenko 6952049842 pre update for future migration capabilities
3 years ago
idziubenko a2349f2273 ftp to https
3 years ago
idziubenko 7e4d754690 Fixed encoding bugs in update methods
3 years ago
idziubenko e6b5f2e11b fixed hashing
3 years ago
idziubenko 5ebcea46b0 imports to relative
3 years ago
idziubenko 8b356a3d22 fixed/reverted regex
3 years ago
idziubenko 1f2b817d6e list compr, general improvements
3 years ago
idziubenko 0826021939 Merge branch 'master' of git.calculate-linux.org:calculate/calculate-utils-3-update
3 years ago
idziubenko 10922f61c6 Py3 changes
3 years ago
Хирецкий Михаил 5596090d22 Setup fix
3 years ago
idziubenko 659f1d1920 i
3 years ago
Хирецкий Михаил beed790b61 Исправлена проверка обновления
3 years ago
Хирецкий Михаил 2451599fdf Добавлено обновление информации для domain-fastlogin
3 years ago
Хирецкий Михаил fc0315cd7d Исправлен сброс маркера наличия обновлений
3 years ago
Хирецкий Михаил c131228cbc Отключено выполнение обновления если не было изменений в репозиториях или /etc/portage
3 years ago
Хирецкий Михаил 3de843415e Добавлено изменение сборочных зависимостей бинарных пакетов в зависимости от bdeps
4 years ago
Хирецкий Михаил a08838f21d Добавлен параметр --dynamic-deps, при вызове depclean
4 years ago
Хирецкий Михаил 4002685a22 Добавлено создание previous.eix
4 years ago
Хирецкий Михаил 7fd17fd332 Исправлено определение запущенного emerge
4 years ago
Хирецкий Михаил 62dd0d255b Отказ от ветки master64
4 years ago
Хирецкий Михаил e4ed00c052 Использование master64 только для calculate,distros,gentoo
4 years ago
Хирецкий Михаил 9dee71ea21 Переход на ветку master64
4 years ago
Хирецкий Михаил 79bc71f3b6 Исправлена проверка запущенного emerge
4 years ago
Хирецкий Михаил 30e4e3e36d Опция --skip-revdep-rebuild заменена на --revdep-rebuild
4 years ago
Хирецкий Михаил f6bfde8c7e calculate.conf zz-calculate.conf
4 years ago
Хирецкий Михаил 8cdddda360 Переход с Layman на repos.conf
4 years ago
Хирецкий Михаил f204e530e8 Исрпавлено определение пакета текущего загруженного ядра
4 years ago
Хирецкий Михаил 3ece80cac4 Изменено назначение with-bdeps
5 years ago
Хирецкий Михаил 661e8c868e Исправлена ошибка кодировок
5 years ago
Хирецкий Михаил ba91aa0397 Изменёно значение --with-bdeps на y для depclean
5 years ago
Хирецкий Михаил a2243c79d7 Использование параметра with-bdeps только для depclean
5 years ago
Хирецкий Михаил 81b3b9535f Добавлено переименование custom.{short} файлов при переключении профиля
5 years ago
Хирецкий Михаил 84446e44bc Изменена переменная ac_update_sync
6 years ago
Хирецкий Михаил a7bb8b6349 Исравлено удаление устаревших пакетов
6 years ago
Хирецкий Михаил d95aa814d4 Изменён порядок провреки base binhost
6 years ago
Хирецкий Михаил d275ed169a Исправлен двойной вывод сообщения о том, что сервер не найден
6 years ago
Хирецкий Михаил 13cd521646 Исправлена фраза для перевода
6 years ago
Хирецкий Михаил 5e21141676 Обновлены фразы
6 years ago
Хирецкий Михаил 3986bf1b9b Исправлена настройка выбранного зеркала
6 years ago
Хирецкий Михаил 5a20e18d5e Исправлен вызов update_layman
6 years ago
Хирецкий Михаил c28b889044 Исправлено создание директории для временного каталога GPG
6 years ago
root 0dc306541f Переписан проверка подписи Packages
6 years ago
Хирецкий Михаил c859c815f3 Добавлена проверка подписи Packages
6 years ago
Хирецкий Михаил 1614dd4eea Добавлено обновление конфигурационных файлов при сканировании серверов обновлений
6 years ago
Хирецкий Михаил 6f46c24213 Изменены права на закрытые репозитории
6 years ago
Хирецкий Михаил 321f616059 Исправлена ошибка импорта
7 years ago
Хирецкий Михаил 9f916977cf Изменены права на закрытые репозитории
7 years ago
Хирецкий Михаил 9453f0196b Исправлено выполнение шаблонов при переключении профилей
7 years ago
Хирецкий Михаил 78161512fb Добавлена поддержка закрытых репозиториев
7 years ago
Хирецкий Михаил 000b720e7d Исправлено определение with-bdeps
7 years ago
Хирецкий Михаил 1e0187472f Исправлен вызов emerge
7 years ago
Хирецкий Михаил 439b9dd1ee Добавлены переменные для базового бинхоста. Расширены возможности вызова emerge.
7 years ago
Хирецкий Михаил 572ab1de99 Изменена синхронизация репозиториев
7 years ago
Хирецкий Михаил 53669b7f71 Исправлен вывод описания пакетов
7 years ago
Хирецкий Михаил 84e2721236 Изменены права на запуск методов
7 years ago
Хирецкий Михаил 794c480f77 Удален вывод версии в полном названии дистрибутива
7 years ago
Хирецкий Михаил 1168020f6d Вызов depclean при смене параметра --with-bdeps
7 years ago
Хирецкий Михаил cfed8845d5 Исправлены описания переменных
7 years ago
Хирецкий Михаил 20695d8513 Добавлен параметр --with-bdeps для возможности задействовать
7 years ago
Хирецкий Михаил 44a1cd2ec0 Исправлено выполнение команды через CommandExecutor
7 years ago
Хирецкий Михаил 75868e2454 Исправлено вычисление переменных на "сломаных" профилях
7 years ago
Хирецкий Михаил 9084ad5d5c Исправлено выполнение только синхронизации репозиториев
7 years ago
Хирецкий Михаил e3b204f335 Исправлен скрипт-обёртка для синхронизации layman`ом
7 years ago
Хирецкий Михаил 4deee242ee Исправлены Profile переменные
7 years ago
Хирецкий Михаил cc68cd25b5 Исправлена проверка обновления
7 years ago
Хирецкий Михаил 0822bf5fee Добавлена дополнительная проверка необходимости запуска emerge @preserved-rebuild
7 years ago
Хирецкий Михаил c03f98ddd0 Исправлено скачивание Packages.xz для небинарных систем
7 years ago
Хирецкий Михаил 45e124476a Исправлен вызов исправления настроек системы (при использовании --merge-world, rebuild-world)
7 years ago
Хирецкий Михаил 8d38cfe0c0 Изменён порядок репозиториев в сообщение update eix
7 years ago
Хирецкий Михаил d89445dd5c Изменён поряток выполнения emerge -uDN world
7 years ago
Хирецкий Михаил eca0cabfaf Отключено принудительное использование --with-bdeps для вычисления зависимостей
7 years ago
Хирецкий Михаил f60b09185d Исправлна попытка скачивать Packages если binhost пуст
7 years ago
Хирецкий Михаил d26c91369e Добавлено скачивание Packages если он отсутствует или у него не тот TTL
7 years ago
Хирецкий Михаил 2fbafa7f68 Множественные изменения
7 years ago
Хирецкий Михаил 9358b1a4a5 Добавлена возможность изменения номеров установленных пакетов
7 years ago
Хирецкий Михаил 3501cbac2d Добавлена новая задача поиск автозависимостей
7 years ago
Хирецкий Михаил 7ff158264e English update
7 years ago
Хирецкий Михаил 5dab34aa14 English update
7 years ago
Хирецкий Михаил 8a1456c182 Переименована ini.evn/[update] -> [system]
8 years ago
Хирецкий Михаил e832e2348b Изменён порядок репозиториев в сообщение update eix cache
8 years ago
Хирецкий Михаил 193736b850 Исправлен вывод списка обновляемых пакетов
8 years ago
Хирецкий Михаил 13279e6107 Изменён признак определения наличия обновлений: через файл /var/lib
8 years ago
Хирецкий Михаил e7e6acef3c Обновлены иконки
8 years ago

6
.gitignore vendored

@ -0,0 +1,6 @@
revert_changes_to_vmachine
push_to_vmachine*
.vscode
*.pyc
*.pyo
*.bak

@ -1,7 +1,7 @@
#!/bin/bash
# если выполняется обновление уже полученного репозитория
if [[ $1 == "pull" ]]
if [[ $1 == "pull" ]] || [[ $1 == "remote" ]]
then
# получить название репозитория
if [[ -f profiles/repo_name ]]
@ -20,8 +20,11 @@ native_reps=,$(/usr/libexec/calculate/cl-variable --value update.cl_update_rep_
# если обновляемый репозиторий от дистрибутива
if echo $native_reps | grep -q ,${repo_name},
then
# отбновить репозиторий через утилиты Calculate
/usr/sbin/cl-core --method update --rep $repo_name --sync-only on --skip-eix-update -T none
if [[ $1 == "pull" ]]
then
# отбновить репозиторий через утилиты Calculate
/usr/sbin/cl-core --method update --rep $repo_name --sync-only on --skip-eix-update -T none
fi
else
# выполнить обновление через git
/usr/bin/git $*

@ -55,7 +55,7 @@ class EmergeNeedRootError(EmergeError):
pass
class CommandExecutor(object):
class CommandExecutor():
"""
Запуск программы для объекта Emerge
"""
@ -75,21 +75,28 @@ class CommandExecutor(object):
def get_command(self):
return [self.cmd] + list(self.params)
#TODO make sure pexpect encoding doesn't mess up anything
#if it does, instead put log file as binary maybe?
def execute(self):
if self.child is None:
command_data = self.get_command()
self.child = pexpect.spawn(command_data[0], command_data[1:],
logfile=open(self.logfile, 'w'),
env=self.env, cwd=self.cwd, timeout=None)
env=self.env, cwd=self.cwd, timeout=None,
encoding="UTF-8", codec_errors='ignore')
return self.child
def close(self):
if self.child is not None:
self.child.close()
try:
self.child.close()
except pexpect.ExceptionPexpect:
self.child.close(force=True)
self.child = None
def success(self):
if self.child:
self.child.read()
if self.child.isalive():
self.child.wait()
return self.child.exitstatus == 0
@ -112,7 +119,8 @@ class EmergeCommand(CommandExecutor):
emerge_cmd = getProgPath("/usr/bin/emerge")
def __init__(self, packages, extra_params=None, env=None, cwd=None,
logfile=None, emerge_default_opts=None, use=""):
logfile=None, emerge_default_opts=None, env_update=None,
use=""):
extra_params = extra_params or []
if env is None:
if emerge_default_opts is None:
@ -127,9 +135,11 @@ class EmergeCommand(CommandExecutor):
if use:
env["USE"] = use
env.update(os.environ)
if env_update is not None:
env.update(env_update)
params = self.default_params + extra_params + packages
super(EmergeCommand, self).__init__(self.emerge_cmd, params=params,
super().__init__(self.emerge_cmd, params=params,
env=env, cwd=cwd, logfile=logfile)
@ -168,7 +178,7 @@ def Linux32(obj):
return obj
class InfoBlockInterface(object):
class InfoBlockInterface():
"""
Интерфейс для информационного блока
"""
@ -277,7 +287,7 @@ class InstallPackagesBlock(EmergeInformationBlock):
re_blocks = re.compile(r"\[{c}blocks{c} {c}b".format(c=_color_block))
def get_data(self, match):
super(InstallPackagesBlock, self).get_data(match)
super().get_data(match)
list_block = XmlConverter().transform(self.result).split('\n')
self.list = PackageList(map(EmergeUpdateInfo, list_block))
self.remove_list = PackageList(map(EmergeRemoveInfo, list_block))
@ -507,7 +517,7 @@ class NotifierInformationBlock(EmergeInformationBlock):
Информационный блок поддерживающий observing
"""
def __init__(self, parent):
super(NotifierInformationBlock, self).__init__(parent)
super().__init__(parent)
self.observers = []
def get_data(self, match):
@ -712,7 +722,7 @@ class EmergeParser(InfoBlockInterface):
while True:
index = child.expect_exact(self.elements.keys())
element = self.elements.values()[index]
element = list(self.elements.values())[index]
element.get_block(child)
if element.action:
if element.action(child) is False:
@ -728,7 +738,7 @@ class EmergeParser(InfoBlockInterface):
self.close()
class MtimeCheckvalue(object):
class MtimeCheckvalue():
def __init__(self, *fname):
self.fname = fname
@ -750,21 +760,21 @@ class MtimeCheckvalue(object):
class Md5Checkvalue(MtimeCheckvalue):
def value_func(self, fn):
return hashlib.md5(readFile(fn)).hexdigest()
return hashlib.md5(readFile(fn, binary=True)).hexdigest()
class GitCheckvalue(object):
def __init__(self, rpath):
class GitCheckvalue():
def __init__(self, git, rpath):
self.rpath = rpath
self.git = Git()
self.git = git
def checkvalues(self):
with ignore(GitError):
if self.git.is_git(self.rpath):
yield self.rpath, Git().getCurrentCommit(self.rpath)
yield self.rpath, self.git.getCurrentCommit(self.rpath)
class EmergeCache(object):
class EmergeCache():
"""
Кэш пакетов
"""

@ -15,19 +15,20 @@
# limitations under the License.
import sys
import os
from os import path
import shutil
from calculate.lib.utils.files import (listDirectory, readFile, readLinesFile,
makeDirectory, removeDir)
from calculate.lib.utils.git import Git
from update import UpdateError
from .update import UpdateError
from calculate.lib.cl_lang import setLocalTranslate, _
setLocalTranslate('cl_update3', sys.modules[__name__])
DEFAULT_BRANCH = Git.Reference.Master
class RepositoryStorageInterface(object):
class RepositoryStorageInterface():
def __iter__(self):
raise StopIteration
@ -40,15 +41,15 @@ class RepositoryStorageInterface(object):
class RepositoryStorage(RepositoryStorageInterface):
directory = '/tmp'
def __init__(self, directory):
def __init__(self, git, directory):
self.directory = directory
self.git = git
makeDirectory(directory)
def __iter__(self):
git = Git()
for dn in listDirectory(self.directory, onlyDir=True, fullPath=True):
if git.is_git(dn):
yield ProfileRepository(path.basename(dn), self)
if self.git.is_git(dn):
yield ProfileRepository(self.git, path.basename(dn), self)
def get_profiles(self, url, branch=DEFAULT_BRANCH):
return []
@ -89,7 +90,8 @@ class CacheStorage(ProfileStorage):
if rep.is_like(url, branch):
return rep
else:
return ProfileRepository.clone(url, self, branch or DEFAULT_BRANCH)
return ProfileRepository.clone(self.git, url, self,
branch or DEFAULT_BRANCH)
class RepositoryStorageSet(RepositoryStorageInterface):
"""
@ -139,7 +141,7 @@ class RepositoryStorageSet(RepositoryStorageInterface):
def __repr__(self):
return "Repository set"
class Profile(object):
class Profile():
"""
Профиль репозитория
"""
@ -149,14 +151,22 @@ class Profile(object):
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 = filter(None, s.split())
parts = [x for x in s.split() if x]
if len(parts) == 3 and parts[0] in cls.available_arch:
return Profile(repository, parts[1], parts[0])
return None
@ -168,13 +178,14 @@ class Profile(object):
self.repository.directory)
class ProfileRepository(object):
class ProfileRepository():
"""
Репозиторий либо скачивается, либо берется из кэша
"""
def __init__(self, name, storage):
def __init__(self, git, name, storage):
self._storage = storage
self.name = name
self.git = git
@property
def storage(self):
@ -196,23 +207,28 @@ class ProfileRepository(object):
str(e))
@classmethod
def clone(cls, url, storage, branch=DEFAULT_BRANCH):
def clone(cls, git, url, storage, branch=DEFAULT_BRANCH):
name = path.basename(url)
if name.endswith(".git"):
name = name[:-4]
git = Git()
rpath = path.join(storage.directory, name)
if path.exists(rpath):
removeDir(rpath)
if git.is_private_url(url):
try:
makeDirectory(rpath)
os.chmod(rpath, 0o700)
except OSError:
pass
git.cloneRepository(url, rpath, branch)
pr = cls(name, storage)
pr = cls(git, name, storage)
repo_name = pr.repo_name
if name != repo_name:
rpath_new = path.join(storage.directory, repo_name)
if path.exists(rpath_new):
removeDir(rpath_new)
shutil.move(rpath, rpath_new)
pr = cls(repo_name, storage)
pr = cls(git, repo_name, storage)
return pr
@property
@ -234,30 +250,32 @@ class ProfileRepository(object):
@property
def url(self):
git = Git()
return git.get_url(self.directory, "origin")
return self.git.get_url(self.directory, "origin")
@property
def branch(self):
git = Git()
return git.getBranch(self.directory)
return self.git.getBranch(self.directory)
def sync(self):
"""
Синхронизировать репозиторий
"""
git = Git()
if not git.pullRepository(self.directory, quiet_error=True):
git.resetRepository(self.directory, to_origin=True)
git.pullRepository(self.directory, quiet_error=True)
if not self.git.pullRepository(self.directory, quiet_error=True):
self.git.resetRepository(self.directory, to_origin=True)
self.git.pullRepository(self.directory, quiet_error=True)
def get_profiles(self):
"""
Получить список профилей репозитория
"""
profiles_desc = path.join(self.directory, "profiles/profiles.desc")
return filter(None, (Profile.from_string(self, line)
for line in readLinesFile(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)

File diff suppressed because it is too large Load Diff

@ -16,7 +16,6 @@
import os
from os import path
from itertools import ifilter
from calculate.core.datavars import DataVarsCore
from calculate.core.server.gen_pid import search_worked_process
from calculate.lib.cl_template import SystemIni
@ -24,12 +23,11 @@ from calculate.lib.utils.content import getCfgFiles
from calculate.lib.utils.files import getRunCommands, readFile, writeFile
class UpdateInfo(object):
class UpdateInfo():
"""
Информационный объект о процессе обновления
"""
section = "update"
varname = "updates"
update_file = "/var/lib/calculate/calculate-update/updates.available"
def __init__(self, dv=None):
if dv is None:
@ -46,15 +44,20 @@ class UpdateInfo(object):
"""
Проверить есть ли обновления по ini.env
"""
return SystemIni().getVar(cls.section, cls.varname) == u'on'
return path.exists(cls.update_file)
@classmethod
def set_update_ready(cls, value):
"""
Установить статус обновления
"""
SystemIni().setVar(cls.section,
{cls.varname:"on" if value else "off"})
try:
if value:
writeFile(cls.update_file).close()
else:
os.unlink(cls.update_file)
except OSError:
pass
def check_for_dispatch(self):
"""
@ -67,7 +70,7 @@ class UpdateInfo(object):
"""
Проверить есть ли уже запущенная копия console-gui
"""
return any(ifilter(lambda x: "cl-console-gui" in x, getRunCommands()))
return any([x for x in getRunCommands() if "cl-console-gui" in x])
def update_already_run(self):
"""

@ -25,3 +25,5 @@ class EmergeMark:
PreservedLibs = "update preserved libs"
RevdepRebuild = "revdep rebuild"
Prelink = "prelink"
Automagic = "check for auto depends"
SaveTag = "save latest calculate update tag"

@ -18,7 +18,7 @@ import sys
from calculate.core.server.func import Action
from calculate.lib.cl_lang import setLocalTranslate, getLazyLocalTranslate
from calculate.lib.utils.files import FilesError
from calculate.update.update import UpdateError
from ..update import UpdateError
from calculate.lib.utils.git import GitError
_ = lambda x: x

@ -15,23 +15,251 @@
# limitations under the License.
import sys
from calculate.core.server.func import Action, Tasks
from calculate.core.server.func import Action, Tasks, AllTasks
from calculate.lib.cl_lang import setLocalTranslate, getLazyLocalTranslate
from calculate.lib.cl_template import TemplatesError
from calculate.lib.utils.files import FilesError
from calculate.update.update import UpdateError
from calculate.update.emerge_parser import EmergeError
from calculate.lib.utils.binhosts import BinhostError
from calculate.lib.utils.files import FilesError, readFile
from ..update import UpdateError
from ..emerge_parser import EmergeError
from calculate.lib.utils.git import GitError
from calculate.lib.utils.portage import (EmergeLog,
from calculate.lib.utils.portage import (EmergeLog, isPkgInstalled,
EmergeLogNamedTask, PackageList)
from calculate.update.update_tasks import EmergeMark
from ..update_tasks import EmergeMark
_ = lambda x: x
setLocalTranslate('cl_update3', sys.modules[__name__])
__ = getLazyLocalTranslate(_)
class UpdateConditions(object):
def get_synchronization_tasks(object_name):
Object = lambda s: "%s.%s"%(object_name, s)
return [
{'name': 'reps_synchronization',
'group': __("Repositories synchronization"),
'tasks': [
# создать объект проверки PGP
{'name': 'prepare_gpg',
'method': Object("prepare_gpg()"),
},
# создать объект хранилище серверов обновлений
{'name': 'create_binhost_data',
'method': Object('create_binhost_data()')
},
{
'name': 'perform_migration_system_pre_check',
'method': Object('perform_migration_system_pre_check()'),
'condition': lambda Get, GetBool: (Get('cl_update_ignore_level') == 'off')
},
# проверить валиден ли текущий хост
{'name': 'check_current_binhost',
'message': __("Checking current binhost"),
'essential': False,
'method': Object('check_current_binhost(update.cl_update_binhost)'),
'condition': lambda GetBool, Get: (
not GetBool('update.cl_update_binhost_recheck_set') and
not Get('update.cl_update_binhost_choice') and
Get('update.cl_update_binhost_choice') != 'auto' and
Get('update.cl_update_sync_rep') and
Get('update.cl_update_binhost') and
Get('update.cl_update_use_migration_host') == 'off')
},
{'name': 'drop_packeges_cache',
'method': 'Update.drop_packages_cache()',
'depend': AllTasks.failed_all("check_current_binhost")
},
{'name': 'not_use_search:failed_base_binhost',
'error': __("Failed to use base binhost"),
'method': Object("delete_binhost()"),
'depend': AllTasks.failed_all("check_current_binhost")
},
{'name': 'check_chosen_binhost',
'message': _("Checking chosen binhost"),
'method': Object('check_chosen_binhost(update.cl_update_binhost_choice)'),
'essential': False,
'condition': lambda GetBool, Get: (
not GetBool('update.cl_update_binhost_recheck_set') and
Get('update.cl_update_binhost_choice') and
Get('update.cl_update_binhost_choice') != 'auto'),
'depend': AllTasks.hasnot("check_current_binhost")},
{'name': 'failed_check_chosen_binhost',
'method': Object('check_if_migration()'),
'depend': AllTasks.failed_all("check_chosen_binhost")},
{'name': 'group_find_binhost',
'group': '',
'while': (~AllTasks.has_any("detect_best_binhost") &
((AllTasks.failed_all("update_packages_cache")
& ~AllTasks.has_any("not_use_search")) |
~AllTasks.has_any("sync_reps"))) & Tasks.success(),
'condition': lambda GetBool, Get: (GetBool('update.cl_update_usetag_set') and
Get('update.cl_update_sync_rep')),
'tasks': [
# найти лучший сервер обновлений
{'name': 'detect_best_binhost',
'method': Object(f'detect_best_binhost({object_name.lower()}.cl_update_ignore_level)'),
'essential': False,
'depend': (Tasks.success() & ~AllTasks.has_any("not_use_search") &
(AllTasks.failed_one_of("check_current_binhost") |
AllTasks.failed_one_of("check_chosen_binhost") |
(AllTasks.hasnot("check_current_binhost") &
AllTasks.hasnot("check_chosen_binhost")) |
AllTasks.success_all("sync_reps"))),
'condition': lambda Get: Get('update.cl_update_use_migration_host') == 'off',
},
{'name': 'interrupt_on_no_leveled_binhost',
'method': Object("interrupt_on_no_leveled_binhost()"),
'essential': True,
'depend': (Tasks.success() & ~AllTasks.has_any("not_use_search") &
(~AllTasks.success_one_of("check_current_binhost")) &
AllTasks.failed_all("detect_best_binhost")),
'condition': lambda Get: Get('update.cl_update_use_migration_host') == 'off'
},
{'name': 'set_migration_binhost',
'method': Object('set_migration_host()'),
'depend': (Tasks.success() & ~AllTasks.has_any("not_use_search")|
AllTasks.success_all("sync_reps")),
'condition': lambda Get: Get('update.cl_update_use_migration_host') == 'on'
},
# запасная синхронизация, в ходе которой ветки обновляются до
# master
# {'name': 'sync_reps_fallback',
# 'foreach': 'update.cl_update_sync_rep',
# 'message':
# __("Fallback syncing the {eachvar:capitalize} repository"),
# 'method': Object('syncRepositories(eachvar,True)'),
# 'depend': Tasks.success() & AllTasks.failed_one_of("detect_best_binhost"),
# },
# # обновление переменных информации из binhost
# {'name': 'sync_reps_fallback:update_binhost_list',
# 'method': Object('update_binhost_list()'),
# 'depend': Tasks.success() & AllTasks.failed_one_of("detect_best_binhost"),
# },
# # найти лучший сервер обновлений
# {'name': 'sync_reps_fallback:detect_best_binhost',
# 'method': Object('detect_best_binhost()'),
# 'depend': Tasks.success() & AllTasks.failed_one_of("detect_best_binhost"),
# },
{'name': 'sync_reps',
'foreach': 'update.cl_update_sync_rep',
'message': __("Checking {eachvar:capitalize} updates"),
'method': Object('syncRepositories(eachvar)'),
'condition': lambda Get: Get('update.cl_update_sync_rep'),
'depend': Tasks.success() & ~AllTasks.success_all("update_packages_cache")
},
{'name': 'sync_reps:update_local_info_binhost',
'method': Object('update_local_info_binhost()'),
'condition': lambda Get: Get("update.cl_update_binhost_choice") == 'auto'
or not Get("update.cl_update_binhost_choice")
or Get("update.cl_update_binhost_recheck_set"),
'depend': AllTasks.hasnot('check_chosen_binhost')
},
{'name': 'sync_reps:update_binhost_list',
'essential': False,
'method': Object('update_binhost_list()'),
'condition': lambda GetBool: GetBool('update.cl_update_outdate_set')
},
{'name': 'sync_reps:update_packages_cache',
'message': __("Update packages index"),
'method': Object('download_packages(update.cl_update_portage_binhost,'
'update.cl_update_package_cache, update.cl_update_package_cache_sign,'
'update.cl_update_gpg)'),
'condition': lambda Get, GetBool: (
Get('update.cl_update_package_cache') and (
Get('update.cl_update_outdate_set') == 'on' or
Get('update.cl_update_package_cache_set') == 'on'))
},
],
},
{'name': 'no_server',
'error': __("Failed to find the binary updates server"),
'method': Object("delete_binhost()"),
# method: который должен удалить текущую информацию о сервере обновлений
'depend': (~Tasks.has_any("failed_base_binhost") & (Tasks.failed() |
Tasks.success() & AllTasks.failed_one_of("update_packages_cache"))),
'condition': lambda GetBool, Get: (GetBool('update.cl_update_usetag_set') and
Get('update.cl_update_sync_rep')),
},
{'name': 'sync_reps',
'foreach': 'update.cl_update_sync_rep',
'message': __("Checking {eachvar:capitalize} updates"),
'method': Object('syncRepositories(eachvar)'),
'condition': lambda Get, GetBool: (Get('update.cl_update_sync_rep') and
not GetBool('update.cl_update_usetag_set')),
},
{'name': 'update_rep_list',
'message': __("Repository cache update"),
'method': Object('update_rep_list()'),
'condition': lambda Get: (isPkgInstalled(
"app-eselect/eselect-repository", prefix=Get('cl_chroot_path')) and
Get('cl_chroot_path') != "/"),
'essential': False,
},
{'name': 'sync_other_reps',
'foreach': 'update.cl_update_other_rep_name',
'message': __("Syncing the {eachvar:capitalize} repository"),
'method': Object('syncOtherRepository(eachvar)'),
'condition': lambda GetBool: (GetBool('update.cl_update_other_set') or
not GetBool('update.cl_update_other_git_exists'))
},
{'name': 'trim_reps',
'foreach': 'update.cl_update_sync_rep',
'message': __("Cleaning the history of the "
"{eachvar:capitalize} repository"),
'method': Object('trimRepositories(eachvar)'),
'condition': lambda Get: (Get('update.cl_update_sync_rep') and
Get('update.cl_update_onedepth_set') == 'on')
},
{'name': 'sync_reps:regen_cache',
'foreach': 'update.cl_update_sync_overlay_rep',
'essential': False,
'method': Object('regenCache(eachvar)'),
'condition': (
lambda Get: (Get('update.cl_update_outdate_set') == 'on' and
Get('update.cl_update_egencache_force') != 'skip' or
Get('update.cl_update_egencache_force') == 'force'))
},
{'name': 'sync_other_reps:regen_other_cache',
'foreach': 'update.cl_update_other_rep_name',
'method': Object('regenCache(eachvar)'),
'essential': False,
},
{'name': 'eix_update',
'message': __("Updating the eix cache for "
"{update.cl_update_eix_repositories}"),
'method': Object('eixUpdate(cl_repository_name)'),
'condition': (
lambda Get: (Get('update.cl_update_outdate_set') == 'on' and
Get('update.cl_update_eixupdate_force') != 'skip' or
Get('update.cl_update_eixupdate_force') == 'force'))
},
{'name': 'update_setup_cache',
'message': __("Updating the cache of configurable packages"),
'method': Object('updateSetupCache()'),
'essential': False,
'condition': lambda Get: Get('update.cl_update_outdate_set') == 'on'
},
{'name': 'sync_reps:cleanpkg',
'message': __("Removing obsolete distfiles and binary packages"),
'method': Object('cleanpkg()'),
'condition': (
lambda Get: Get('update.cl_update_cleanpkg_set') == 'on' and
Get('update.cl_update_outdate_set') == 'on'),
'essential': False
},
# сообщение удачного завершения при обновлении репозиториев
{'name': 'success_syncrep',
'message': __("Synchronization finished"),
'depend': (Tasks.success() & Tasks.has_any("sync_reps",
"sync_other_reps",
"emerge_metadata",
"eix_update")),
}
]
},
]
class UpdateConditions():
@staticmethod
def was_installed(pkg, task_name):
def func():
@ -44,9 +272,26 @@ class UpdateConditions(object):
def func(Get):
task = EmergeLog(EmergeLogNamedTask(task_name))
return (bool(PackageList(task.list)[pkg])
or Get('cl_update_outdated_kernel_set') == 'on')
or Get('cl_update_force_depclean_set') == 'on'
or Get('cl_update_outdated_kernel_set') == 'on'
or Get('cl_update_world_hash_set') == 'on')
return func
@staticmethod
def force_preserved(Get):
pfile = "/var/lib/portage/preserved_libs_registry"
content = readFile(pfile).strip()
if not content or content[1:-1].strip() == '':
return False
else:
return True
@staticmethod
def check_world_updated_after_tag_save():
def func():
task = EmergeLog(EmergeLogNamedTask(EmergeMark.SaveTag))
return task.did_update_world_happen()
return func
class ClUpdateAction(Action):
"""
@ -54,7 +299,7 @@ class ClUpdateAction(Action):
"""
# ошибки, которые отображаются без подробностей
native_error = (FilesError, UpdateError,
TemplatesError,
TemplatesError, BinhostError,
GitError, EmergeError)
successMessage = None
@ -62,19 +307,44 @@ class ClUpdateAction(Action):
interruptMessage = __("Update manually interrupted")
emerge_tasks = [
{'name': 'save_bdeps_val',
'method': 'Update.save_with_bdeps()',
'essential': False
},
{'name': 'update_fastlogin_domain',
'method': "Update.update_fastlogin_domain_path()"
},
{'name': 'drop_portage_hash_on_sync',
'method': 'Update.drop_portage_state_hash()',
'condition': lambda Get: Get('cl_update_outdate_set') == 'on'
},
{'name': 'premerge_group',
'group': __("Checking for updates"),
'tasks': [
{'name': 'premerge',
'message': __("Calculating dependencies"),
'method': 'Update.premerge("-uDN","--with-bdeps=y","@world")',
'condition': lambda Get:Get('cl_update_sync_only_set') == 'off'
'method': 'Update.premerge("-uDN","@world")',
'condition': lambda Get: (
Get('cl_update_sync_only_set') == 'off' and
Get('cl_update_pretend_set') == 'on') and \
(Get('cl_update_world') != "update" or
Get('cl_update_outdate_set') == 'on' or
Get('cl_update_settings_changes_set') == 'on' or
Get('cl_update_binhost_recheck_set') == 'on' or
Get('cl_update_force_fix_set') == 'on' or
Get('update.cl_update_package_cache_set') == 'on')
}],
},
{'name': 'premerge:update',
'condition': lambda Get:Get('cl_update_pretend_set') == 'off',
'depend': Tasks.result("premerge", eq='yes')
},
{'name': 'update',
'condition': lambda Get:Get('cl_update_pretend_set') == 'off' and \
(Get('cl_update_world') != "update" or
Get('cl_update_outdate_set') == 'on' or
Get('cl_update_settings_changes_set') == 'on' or
Get('cl_update_binhost_recheck_set') == 'on' or
Get('cl_update_force_fix_set') == 'on' or
Get('cl_update_available_set') == 'on' or
Get('update.cl_update_package_cache_set') == 'on')
},
{'name': 'update_other',
'condition': lambda Get: ( Get('cl_update_pretend_set') == 'off' and
Get('cl_update_sync_only_set') == 'off')
@ -82,16 +352,20 @@ class ClUpdateAction(Action):
{'name': 'update:update_world',
'group': __("Updating packages"),
'tasks': [
{'name': 'update:update_world',
{'name': 'update_world',
'message': __("Calculating dependencies"),
'method': 'Update.emerge("","-uDN","--with-bdeps=y","@world")',
'method': 'Update.emerge_ask(cl_update_pretend_set,'
'"-uDN","@world")',
}
]
],
'condition': lambda Get: (Get('cl_update_sync_only_set') == 'off' and
(Get('update.cl_update_outdate_set') == 'on' or
Get('cl_update_settings_changes_set') == 'on'))
},
{'name': 'update:update_perl',
'group': __("Updating Perl"),
{'name': 'update_other:update_perl',
'group': __("Updating Perl modules"),
'tasks': [
{'name': 'update:perl_cleaner',
{'name': 'update_other:perl_cleaner',
'message': __('Find & rebuild packages and Perl header files '
'broken due to a perl upgrade'),
'method': 'Update.emergelike("perl-cleaner", "all")',
@ -120,7 +394,7 @@ class ClUpdateAction(Action):
'message': __('Updating Kernel modules'),
'method': 'Update.emerge("","@module-rebuild")',
'condition': UpdateConditions.was_installed(
'sys-kernel/.*source', EmergeMark.KernelModules),
'sys-kernel/(calculate-sources|gentoo-kernel|vanilla-kernel)', EmergeMark.KernelModules),
'decoration': 'Update.update_task("%s")' %
EmergeMark.KernelModules
},
@ -135,16 +409,17 @@ class ClUpdateAction(Action):
{'name': 'update_other:preserved_rebuild',
'message': __('Updating preserved libraries'),
'method': 'Update.emerge("","@preserved-rebuild")',
'condition': UpdateConditions.was_installed(
'.*', EmergeMark.PreservedLibs),
'condition': lambda Get: (UpdateConditions.was_installed(
'.*', EmergeMark.PreservedLibs)() or
UpdateConditions.force_preserved(Get)),
'decoration': 'Update.update_task("%s")' %
EmergeMark.PreservedLibs
},
},
{'name': 'update_other:revdev_rebuild',
'message': __('Checking reverse dependencies'),
'method': 'Update.revdep_rebuild("revdep-rebuild")',
'condition': lambda Get: (Get(
'cl_update_skip_rb_set') == 'off' and
'cl_update_revdep_rebuild_set') == 'on' and
UpdateConditions.was_installed(
'.*', EmergeMark.RevdepRebuild)()),
'decoration': 'Update.update_task("%s")' %
@ -158,8 +433,10 @@ class ClUpdateAction(Action):
},
]
},
{'name': 'update:set_upto_date_cache',
'method': 'Update.setUpToDateCache()'
{'name': 'set_upto_date_cache',
'method': 'Update.setUpToDateCache()',
'condition': lambda Get: Get('cl_update_sync_only_set') == 'off' and \
Get('cl_update_pretend_set') == 'off'
}
]
@ -174,123 +451,43 @@ class ClUpdateAction(Action):
{'name': 'check_run',
'method': 'Update.checkRun(cl_update_wait_another_set)'
},
{'name': 'reps_synchronization',
'group': __("Repositories synchronization"),
'tasks': [
# запасная синхронизация, в ходе которой ветки обновляются до
# master
{'name': 'sync_reps_fallback',
'foreach': 'cl_update_sync_rep',
'message':
__("Fallback syncing the {eachvar:capitalize} repository"),
'method': 'Update.syncRepositories(eachvar)',
'condition': lambda Get: ("getbinpkg" in Get('cl_features') and
not Get('cl_update_binhost_data')[0])
},
# обновление переменных информации из binhost
{'name': 'update_binhost_list',
'method': 'Update.update_binhost_list()',
'condition': lambda Get: ("getbinpkg" in Get('cl_features') and
not Get('cl_update_binhost_data')[0])
},
{'name': 'sync_reps',
'foreach': 'cl_update_sync_rep',
'message': __("Syncing the {eachvar:capitalize} repository"),
'method': 'Update.syncRepositories(eachvar)',
'condition': lambda Get: Get('cl_update_sync_rep')
},
{'name': 'check_binhost',
'method': 'Update.check_binhost()',
'condition': lambda Get: "getbinpkg" in Get('cl_features')
},
{'name': 'sync_other_reps',
'foreach': 'cl_update_other_rep_name',
'message': __("Syncing the {eachvar:capitalize} repository"),
'method': 'Update.syncLaymanRepository(eachvar)',
'condition': lambda Get: Get('cl_update_other_set') == 'on'
},
{'name': 'trim_reps',
'foreach': 'cl_update_sync_rep',
'message': __("Cleaning the history of the "
"{eachvar:capitalize} repository"),
'method': 'Update.trimRepositories(eachvar)',
'condition': lambda Get: (Get('cl_update_sync_rep') and
Get('cl_update_onedepth_set') == 'on')
},
{'name': 'sync_reps:regen_cache',
'foreach': 'cl_update_sync_overlay_rep',
'essential': False,
'method': 'Update.regenCache(eachvar)',
'condition': (
lambda Get: (Get('cl_update_outdate_set') == 'on' and
Get('cl_update_egencache_force') != 'skip' or
Get('cl_update_egencache_force') == 'force'))
},
{'name': 'sync_other_reps:regen_other_cache',
'foreach': 'cl_update_other_rep_name',
'method': 'Update.regenCache(eachvar)',
'essential': False,
},
{'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': 'update_setup_cache',
'message': __("Updating the cache of configurable packages"),
'method': 'Update.updateSetupCache()',
'essential': False,
'condition': lambda Get: Get('cl_update_outdate_set') == 'on'
},
{'name': 'sync_reps:cleanpkg',
'message': __("Removing obsolete distfiles and binary packages"),
'method': 'Update.cleanpkg()',
'condition': (lambda Get: Get('cl_update_cleanpkg_set') == 'on' and
Get('cl_update_outdate_set') == 'on'),
'essential': False
},
# сообщение удачного завершения при обновлении репозиториев
{'name': 'success_syncrep',
'message': __("Synchronization finished"),
'depend': (Tasks.success() & Tasks.has_any("sync_reps",
"sync_other_reps",
"emerge_metadata",
"eix_update")),
}
]
{'name': 'check_if_world_was_updated',
'method': 'Update.update_set_current_saved_tag()',
'essential': False,
'condition': lambda Get: (Get('cl_update_sync_only_set') == 'off' and \
Get('cl_update_pretend_set') == 'off' and \
UpdateConditions.check_world_updated_after_tag_save()())
},
{'name': 'reps_synchronization',
] + get_synchronization_tasks("Update") + [
{'name': 'system_configuration',
'group': __("System configuration"),
'tasks': [
{'name': 'binhost_changed',
'method': 'Update.message_binhost_changed()'
},
{'name': 'revision',
'message': __("Fixing the settings"),
'method': 'Update.applyTemplates(install.cl_source,'
'cl_template_clt_set,True,None,False)',
'condition': lambda Get: Get('cl_templates_locate')
},
'condition': lambda Get, GetBool: (Get('cl_templates_locate') and
(Get('cl_update_world') != "update" or
GetBool('cl_update_outdate_set') or
GetBool('cl_update_binhost_recheck_set') or
GetBool('cl_update_force_fix_set') or
GetBool('update.cl_update_package_cache_set')))
},
{'name': 'dispatch_conf',
'message': __("Updating configuration files"),
'method':'Update.dispatchConf()',
'condition': lambda Get: (Get('cl_dispatch_conf') != 'skip' and
Get('cl_update_pretend_set') == 'off')
},
{'name': 'binhost_changed',
'method': 'Update.message_binhost_changed()'
},
'method': 'Update.dispatchConf()',
'condition': lambda Get, GetBool: (Get('cl_dispatch_conf') != 'skip' and
Get('cl_update_pretend_set') == 'off' and
(GetBool('cl_update_outdate_set') or
GetBool('cl_update_binhost_recheck_set') or
GetBool('cl_update_force_fix_set') or
GetBool('update.cl_update_package_cache_set')))
},
]
}
}
] + emerge_tasks + [
{'name': 'failed',
'error': __("Update failed"),
@ -301,10 +498,56 @@ class ClUpdateAction(Action):
'depend': Tasks.failed_all("check_schedule")
},
# сообщение удачного завершения при обновлении ревизии
{'name': 'drop_portage_hash',
'method': 'Update.drop_portage_state_hash()',
'depend': Tasks.failed()
},
{'name': 'drop_world_hash',
'method': 'Update.drop_world_state_hash()',
'depend': Tasks.failed()},
{'name': 'update:set_current_level',
'method': 'Update.update_increment_current_level()',
'depend': (Tasks.success() & Tasks.hasnot("interrupt") &
Tasks.success_all("update") & Tasks.hasnot("check_schedule")),
'condition': lambda Get: Get('cl_update_sync_only_set') == 'off' and
Get('cl_update_pretend_set') == 'off' and
Get('update.cl_update_use_migration_host') == 'on'
},
{'name': 'update_world:set_latest_tag',
'method': 'Update.update_set_current_saved_tag()',
'depend': (Tasks.success() & Tasks.hasnot("interrupt") &
Tasks.success_all("update") & Tasks.hasnot("check_schedule")),
'condition': lambda Get: Get('cl_update_sync_only_set') == 'off' and
Get('cl_update_pretend_set') == 'off',
'decoration': 'Update.update_task("%s")' % EmergeMark.SaveTag
},
{'name': 'update:save_portage_hash',
'method': 'Update.save_portage_state_hash()',
'condition': lambda Get: Get('cl_update_sync_only_set') == 'off'
},
{'name': 'update:save_world_hash',
'method': 'Update.save_world_state_hash()',
'condition': lambda Get: Get('cl_update_sync_only_set') == 'off'
},
{'name': 'clear_migration_host',
'method': 'Update.delete_binhost()',
'depend': (Tasks.hasnot("check_schedule")),
'condition': lambda Get: Get('update.cl_update_use_migration_host') == 'on'
},
# сообщение удачного завершения при обновлении ревизии
{'name': 'success_rev',
'message': __("System update finished!"),
'condition': lambda Get: (Get('cl_update_rev_set') == 'on' and
Get('cl_update_pretend_set') == 'off')
Get('cl_update_pretend_set') == 'off' and
Get('cl_update_sync_only_set') == 'off')
},
# сообщение удачного завершения при обновлении ревизии
{'name': 'success_sync_only',
'message': __("System sync finished!"),
'condition': lambda Get: (Get('cl_update_rev_set') == 'on' and
Get('cl_update_pretend_set') == 'off' and
Get('cl_update_sync_only_set') == 'on')
},
# сообщение удачного завершения при пересоздании world
{'name': 'success_world',

@ -18,8 +18,9 @@ import sys
from calculate.core.server.func import Action, Tasks
from calculate.lib.cl_lang import setLocalTranslate, getLazyLocalTranslate
from calculate.lib.cl_template import TemplatesError
from calculate.lib.utils.binhosts import BinhostError
from calculate.lib.utils.files import FilesError
from calculate.update.update import UpdateError
from ..update import UpdateError
from calculate.lib.utils.git import GitError
_ = lambda x: x
@ -33,7 +34,7 @@ class ClUpdateProfileAction(Action):
"""
# ошибки, которые отображаются без подробностей
native_error = (FilesError,
TemplatesError,
TemplatesError, BinhostError,
UpdateError, GitError)
successMessage = __("The profile was successfully updated")
@ -46,73 +47,32 @@ class ClUpdateProfileAction(Action):
'method': 'Update.migrateCacheRepository('
'cl_update_profile_url,cl_update_profile_branch,'
'cl_update_profile_storage)',
'message': __("Repository transfer"),
'condition': lambda Get: not (
Get('cl_update_profile_storage').is_local(
Get('cl_update_profile_url'),
Get('cl_update_profile_branch')))
},
{'name': 'reconfigure_vars1',
'method': 'Update.invalidateVariables("cl_update_profile_storage")',
'depend': Tasks.has('migrate_repository')
},
{'name': 'check_datavars',
'error': _("Profile not found in master branch"),
'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"),
'condition': lambda Get: Get('cl_update_profile_url')},
{'name': 'profile_from_url',
'group': __('setting up from url'),
'tasks': [
{'name': 'sync_reps',
'foreach': 'cl_update_profile_sync_rep',
'message': __("Syncing the {eachvar:capitalize} repository"),
'method': 'Update.syncRepositories(eachvar)',
# TODO: неиспользуемое условие
# 'condition': lambda Get: Get('cl_update_profile_sync_rep')
},
{'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")),
}
]
{'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)',
},
],
'depend': Tasks.has('migrate_repository')
},
{'name': 'reps_synchronization',
'group': __("Setting up the profile"),
@ -121,6 +81,9 @@ class ClUpdateProfileAction(Action):
'message': __("Switching to profile {cl_update_profile_system}"),
'method': 'Update.setProfile(cl_update_profile_system)'
},
{'name': 'rename_custom',
'method': 'Update.rename_custom_files()',
},
{'name': 'revision',
'message': __("Fixing the settings"),
'method': 'Update.applyProfileTemplates(cl_template_clt_set,'

@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import action
import update
from . import action
from . import update
section = "update"

@ -27,6 +27,7 @@ class VariableAcUpdateSync(ReadonlyVariable):
"""
def get(self):
action = self.Get("cl_action")
if action in ("sync", 'update_profile'):
if action in ("sync", 'update_profile') and \
not self.Get('cl_merge_pkg'):
return "on"
return "off"

File diff suppressed because it is too large Load Diff

@ -20,17 +20,18 @@ from calculate.lib.datavars import VariableError,DataVarsError
from calculate.core.server.func import WsdlBase
from calculate.install.install import InstallError
from calculate.update.update import Update, UpdateError
from .update import Update, UpdateError
from calculate.lib.utils.git import GitError
from utils.cl_update import ClUpdateAction
from utils.cl_update_profile import ClUpdateProfileAction
from utils.cl_setup_update import ClSetupUpdateAction
from .utils.cl_update import ClUpdateAction
from .utils.cl_update_profile import ClUpdateProfileAction
from .utils.cl_setup_update import ClSetupUpdateAction
from calculate.lib.cl_lang import setLocalTranslate, getLazyLocalTranslate, _
setLocalTranslate('cl_update3', sys.modules[__name__])
__ = getLazyLocalTranslate(_)
class Wsdl(WsdlBase):
methods = [
#
@ -67,27 +68,33 @@ class Wsdl(WsdlBase):
normal=(
'cl_update_binhost_stable_opt_set',
'cl_update_binhost_recheck_set',
'cl_update_with_bdeps_opt_set',
'cl_update_binhost_choice',
'cl_update_rep_hosting_choice',
),
expert=(
'cl_update_sync_only_set',
'cl_update_other_set',
'cl_update_pretend_set',
'cl_update_sync_rep',
'cl_update_emergelist_set',
'cl_update_check_rep_set',
'cl_update_world',
'cl_update_egencache_force',
'cl_update_eixupdate_force',
'cl_update_skip_rb_set',
'cl_update_wait_another_set',
'cl_update_autocheck_schedule_set',
'cl_update_onedepth_set',
'cl_update_cleanpkg_set',
'cl_update_branch_data',
'cl_templates_locate',
'cl_verbose_set', 'cl_dispatch_conf'),
next_label=_("Perform"))]},
'cl_update_other_set',
'cl_update_sync_only_set',
'cl_update_pretend_set',
'cl_update_sync_rep',
'cl_update_emergelist_set',
'cl_update_check_rep_set',
'cl_update_force_fix_set',
'cl_update_ignore_level',
'cl_update_force_level',
'cl_update_world',
'cl_update_gpg_force',
'cl_update_egencache_force',
'cl_update_eixupdate_force',
'cl_update_revdep_rebuild_set',
'cl_update_wait_another_set',
'cl_update_autocheck_schedule_set',
'cl_update_onedepth_set',
'cl_update_cleanpkg_set',
'cl_update_branch_data',
'cl_templates_locate',
'cl_verbose_set', 'cl_dispatch_conf'),
next_label=_("Run"))]},
#
# Сменить профиль
#
@ -99,7 +106,8 @@ class Wsdl(WsdlBase):
# заголовок метода
'title': __("Change the Profile"),
# иконка для графической консоли
'image': 'notification-display-brightness-full,gtk-dialog-info,'
'image': 'calculate-update-profile,'
'notification-display-brightness-full,gtk-dialog-info,'
'help-hint',
# метод присутствует в графической консоли
'gui': True,
@ -116,7 +124,7 @@ class Wsdl(WsdlBase):
'native_error': (VariableError, DataVarsError,
InstallError, UpdateError, GitError),
# значения по умолчанию для переменных этого метода
'setvars': {'cl_action!': 'update_profile'},
'setvars': {'cl_action!': 'update_profile', 'cl_update_world_default': "rebuild"},
# описание груп (список лямбда функций)
'groups': [
lambda group: group(_("Repository"),
@ -139,7 +147,7 @@ class Wsdl(WsdlBase):
'cl_update_profile_linux_fullname',
'cl_update_profile_depend_data')
)],
'brief': {'next': __("Perform"),
'brief': {'next': __("Run"),
'name': __("Set the profile")}},
#
# Настроить автопроверку обновлений
@ -152,13 +160,13 @@ class Wsdl(WsdlBase):
# заголовок метода
'title': __("Update Check"),
# иконка для графической консоли
'image': 'software-properties,preferences-desktop',
'image': 'calculate-setup-update,software-properties,preferences-desktop',
# метод присутствует в графической консоли
'gui': True,
# консольная команда
'command': 'cl-setup-update',
# права для запуска метода
'rights': ['update'],
'rights': ['setup_update'],
# объект содержащий модули для действия
'logic': {'Update': Update},
# описание действия

@ -18,7 +18,7 @@
# limitations under the License.
__app__ = "calculate-update"
__version__ = "3.2.2"
__version__ = "3.7.3" #TODO bump version
import os
from glob import glob
@ -67,7 +67,7 @@ class install_data(module_install_data.install_data):
os.chmod(out,chmod)
self.outfiles.append(out)
data_files = [('/usr/libexec/calculate', [('data/cl-git-wrapper', 0755)])]
data_files = [('/usr/libexec/calculate', [('data/cl-git-wrapper', 0o755)])]
packages = [
"calculate."+str('.'.join(root.split(os.sep)[1:]))

Loading…
Cancel
Save