调整代码的位置

This commit is contained in:
wangsong 2021-11-29 11:01:12 +08:00
parent 4842678381
commit 9fedcaf6f6
1 changed files with 60 additions and 59 deletions

View File

@ -195,6 +195,66 @@ class UpdateManager():
if self.cache != None and self.cache.get_changes():
self.cache.clear()
def refresh_cache(self):
_success = True
header = ''
desc = ''
try:
#第一次进入 之后update不进入
if self.cache is None:
self.cache = MyCache(None)
else:
self.cache.open(None)
self.cache._initDepCache()
except AssertionError:
header = _("Software index is broken")
desc = _("It is impossible to install or remove any software. "
"Please use the package manager \"Synaptic\" or run "
"\"sudo apt-get install -f\" in a terminal to fix "
"this issue at first.")
_success = False
return _success,header,desc
except SystemError as e:
header = _("Could not initialize the package information")
desc = _("An unresolvable problem occurred while "
"initializing the package information.\n\n"
"Please report this bug against the 'kylin-system-updater' "
"package and include the following error "
"message:\n") + str(e)
_success = False
return _success,header,desc
#提高生成对象的位置
self.update_list = UpdateList(self)
#1、 检查出现安装过程异常重启 出现的话 进行异常修复
if self.configs.getWithDefault("SystemStatus", "isabnormalreboot", False) == True:
header = self.INSTALL_ALONE_PROGRESS
self.configs.setValue("SystemStatus","isabnormalreboot",str(False),True)
logging.warning("start fix Abnormal Reboot broken pkgs...")
self.start_fix_broken()
return False,header,desc
#检查当前系统的状态 是否存在系统为破损状态 导致出现异常
self._check_cache_broken(self.cache)
#检查自己是否需要升级更新
_success,header,desc = self._check_self_upgrade(self.cache)
if _success == False:
return _success,header,desc
#检查更新分组配置表
_success,header,desc = self._check_group_config(self.cache)
if _success == False and self.configs.getWithDefault("ConfigPkgStatus", "mustexistconfigpkg", True) == True:
return _success,header,desc
try:
_success,header,desc = self.update_list.update(self.cache)
except SystemError as e:
pass
return _success,header,desc
def _check_self_upgrade(self,cache):
_success = True
header = ''
@ -287,65 +347,6 @@ class UpdateManager():
return _success,header,desc
def refresh_cache(self):
_success = True
header = ''
desc = ''
try:
#第一次进入 之后update不进入
if self.cache is None:
self.cache = MyCache(None)
else:
self.cache.open(None)
self.cache._initDepCache()
except AssertionError:
header = _("Software index is broken")
desc = _("It is impossible to install or remove any software. "
"Please use the package manager \"Synaptic\" or run "
"\"sudo apt-get install -f\" in a terminal to fix "
"this issue at first.")
_success = False
return _success,header,desc
except SystemError as e:
header = _("Could not initialize the package information")
desc = _("An unresolvable problem occurred while "
"initializing the package information.\n\n"
"Please report this bug against the 'kylin-system-updater' "
"package and include the following error "
"message:\n") + str(e)
_success = False
return _success,header,desc
#提高生成对象的位置
self.update_list = UpdateList(self)
#1、 检查出现安装过程异常重启 出现的话 进行异常修复
if self.configs.getWithDefault("SystemStatus", "isabnormalreboot", False) == True:
header = self.INSTALL_ALONE_PROGRESS
self.configs.setValue("SystemStatus","isabnormalreboot",str(False),True)
logging.warning("start fix Abnormal Reboot broken pkgs...")
self.start_fix_broken()
return False,header,desc
#检查当前系统的状态 是否存在系统为破损状态 导致出现异常
self._check_cache_broken(self.cache)
#检查自己是否需要升级更新
_success,header,desc = self._check_self_upgrade(self.cache)
if _success == False:
return _success,header,desc
#检查更新分组配置表
_success,header,desc = self._check_group_config(self.cache)
if _success == False and self.configs.getWithDefault("ConfigPkgStatus", "mustexistconfigpkg", True) == True:
return _success,header,desc
try:
_success,header,desc = self.update_list.update(self.cache)
except SystemError as e:
pass
return _success,header,desc
def is_reboot_required(self):
"""If a reboot is required to get all changes into effect."""
return os.path.exists(os.path.join(apt_pkg.config.find_dir("Dir"),