增加解决依赖删除包反馈
This commit is contained in:
parent
d3905a2dfd
commit
448f410487
|
@ -121,7 +121,7 @@ class UpdateManager():
|
|||
logging.error(e)
|
||||
|
||||
#进行升级的操作
|
||||
def start_install(self,partial_upgrade_list = []):
|
||||
def start_install(self,force_install = False,partial_upgrade_list = []):
|
||||
#检查磁盘的状态
|
||||
if self.check_free_space(self.cache) == False:
|
||||
return
|
||||
|
@ -129,7 +129,7 @@ class UpdateManager():
|
|||
try:
|
||||
self.is_upgrading = True
|
||||
install_backend = get_backend(self, InstallBackend.ACTION_INSTALL)
|
||||
install_backend.start(partial_upgrade_list=partial_upgrade_list)
|
||||
install_backend.start(force_install,partial_upgrade_list=partial_upgrade_list)
|
||||
except Exception as e:
|
||||
logging.error(e)
|
||||
|
||||
|
|
|
@ -92,9 +92,10 @@ class UpdateManagerDbusController(dbus.service.Object):
|
|||
return False
|
||||
|
||||
#全部升级
|
||||
@dbus.service.method(UPDATER_DBUS_INTERFACE,out_signature='bs')
|
||||
def DistUpgradeAll(self):
|
||||
@dbus.service.method(UPDATER_DBUS_INTERFACE,in_signature='b',out_signature='bs')
|
||||
def DistUpgradeAll(self,_force_install):
|
||||
try:
|
||||
force_install = bool(_force_install)
|
||||
if not self.parent.update_list:
|
||||
logging.info('Perform \"UpdateDetect\" first')
|
||||
return False,'Perform \"UpdateDetect\" first'
|
||||
|
@ -103,16 +104,17 @@ class UpdateManagerDbusController(dbus.service.Object):
|
|||
logging.info('In the process of updating or Upgrading...')
|
||||
return False,'In the process of updating or Upgrading...'
|
||||
else:
|
||||
logging.info('method DistUpgradeSystem ...')
|
||||
self.parent.start_install()
|
||||
logging.info('method DistUpgradeSystem and force_install:%r...',force_install)
|
||||
self.parent.start_install(force_install)
|
||||
return True,'success'
|
||||
except Exception as e:
|
||||
return False,str(e)
|
||||
|
||||
#部分升级
|
||||
@dbus.service.method(UPDATER_DBUS_INTERFACE,in_signature='as',out_signature='bs')
|
||||
def DistUpgradePartial(self,_partial_upgrade_list):
|
||||
@dbus.service.method(UPDATER_DBUS_INTERFACE,in_signature='bas',out_signature='bs')
|
||||
def DistUpgradePartial(self,_force_install,_partial_upgrade_list):
|
||||
try:
|
||||
force_install = bool(_force_install)
|
||||
if not self.parent.update_list:
|
||||
logging.info('Perform \"UpdateDetect\" first')
|
||||
return False,'Perform \"UpdateDetect\" first'
|
||||
|
@ -124,8 +126,8 @@ class UpdateManagerDbusController(dbus.service.Object):
|
|||
partial_upgrade_list = [str(i) for i in _partial_upgrade_list]
|
||||
|
||||
if partial_upgrade_list:
|
||||
logging.info('dbus partial_upgrade(%s)',partial_upgrade_list)
|
||||
self.parent.start_install(partial_upgrade_list)
|
||||
logging.info('dbus partial_upgrade(%s),force_install:%r',partial_upgrade_list,force_install)
|
||||
self.parent.start_install(force_install,partial_upgrade_list)
|
||||
return True,'dbus upgrading'
|
||||
else:
|
||||
logging.info('input upgrade list(%s) not in local upgrade_list(%s)',partial_upgrade_list,partial_upgrade_list)
|
||||
|
@ -234,6 +236,12 @@ class UpdateManagerDbusController(dbus.service.Object):
|
|||
currenty_bytes, total_bytes,\
|
||||
current_cps)
|
||||
|
||||
#升级完成的信号
|
||||
@dbus.service.signal(UPDATER_DBUS_INTERFACE,signature='bbasss')
|
||||
def ProblemResolverStatus(self, resolver_status, remove_status,remove_pkgs,error_string='',error_desc='',):
|
||||
logging.info("emit ProblemResolverStatus:resolver_status = %r , resolver_status = %r , remove_pkgs = %a, error_string = %s , error_desc = %s ",\
|
||||
resolver_status,remove_status,remove_pkgs, error_string,error_desc)
|
||||
|
||||
# 信号是否可取消
|
||||
@dbus.service.signal(UPDATER_DBUS_INTERFACE, signature='b')
|
||||
def Cancelable(self, Cancelable):
|
||||
|
|
|
@ -23,6 +23,10 @@ class InstallBackend():
|
|||
self.now_upgrade_list = []
|
||||
|
||||
def _make_problem_resolver(self,partial_upgrade_list):
|
||||
_success = True
|
||||
header = ''
|
||||
desc = ''
|
||||
|
||||
pkgs_install = []
|
||||
pkgs_upgrade = []
|
||||
|
||||
|
@ -102,16 +106,29 @@ class InstallBackend():
|
|||
# pkg missing from fresh_cache can't be modified
|
||||
pass
|
||||
|
||||
return new_pkgs_install,new_pkgs_upgrade,new_pkgs_remove
|
||||
return _success,new_pkgs_install,new_pkgs_upgrade,new_pkgs_remove,header,desc
|
||||
except Exception as e:
|
||||
logging.error(e)
|
||||
return [],[],[]
|
||||
_success = False
|
||||
#FIXME: 中文 依赖解决器出现异常
|
||||
header = _("Problem resolver Exception occur")
|
||||
desc = str(e)
|
||||
logging.error(header + desc)
|
||||
return _success,[],[],[],header,desc
|
||||
|
||||
def start(self,partial_upgrade_list = []):
|
||||
def start(self,force_install = False,partial_upgrade_list = []):
|
||||
#FIXME: 在下载升级的能抑制系统关闭或者睡眠 参考ubuntu此部分代码
|
||||
|
||||
if self.action == self.ACTION_INSTALL:
|
||||
pkgs_install,pkgs_upgrade,pkgs_remove = self._make_problem_resolver(partial_upgrade_list)
|
||||
_success,pkgs_install,pkgs_upgrade,pkgs_remove,header,desc = self._make_problem_resolver(partial_upgrade_list)
|
||||
|
||||
is_remove_pkgs = len(pkgs_remove) != 0
|
||||
|
||||
if force_install == False:
|
||||
self.window_main.dbusController.ProblemResolverStatus(_success,is_remove_pkgs,pkgs_remove,header,desc)
|
||||
|
||||
if _success == False or (force_install == False and is_remove_pkgs == True):
|
||||
self.window_main.dbusController.UpdateDownloadFinished(False,self.now_upgrade_list,header,desc)
|
||||
return
|
||||
|
||||
try:
|
||||
logging.info("commit install:%d , upgrade:%d remove:%d",len(pkgs_install),len(pkgs_upgrade),len(pkgs_remove))
|
||||
|
|
|
@ -47,10 +47,12 @@ if __name__ == "__main__":
|
|||
signal.signal(signal.SIGHUP, signal.SIG_IGN)
|
||||
signal.signal(signal.SIGINT,signal_handler_term)
|
||||
|
||||
if options.debug:
|
||||
logging.basicConfig(format=FORMAT,level=logging.DEBUG)
|
||||
else:
|
||||
logging.basicConfig(format=FORMAT,level=logging.INFO,filename = logfile(),filemode = 'a')
|
||||
logging.basicConfig(format=FORMAT,level=logging.DEBUG)
|
||||
|
||||
# if options.debug:
|
||||
# logging.basicConfig(format=FORMAT,level=logging.DEBUG)
|
||||
# else:
|
||||
# logging.basicConfig(format=FORMAT,level=logging.INFO,filename = logfile(),filemode = 'a')
|
||||
|
||||
if os.getuid() != 0:
|
||||
print(_("You need to be root to run this application"))
|
||||
|
|
Loading…
Reference in New Issue