增加kare兼容
This commit is contained in:
parent
451e47ee1c
commit
7b202b80d5
|
@ -130,6 +130,37 @@ class UpdateManager():
|
|||
except Exception as e:
|
||||
logging.error(e)
|
||||
|
||||
def start_deb_install(self, deb_path = "", _check_local_dep = False, _auto_satisfy = False, source = '', sender=None):
|
||||
try:
|
||||
kareiInterface = dbus.Interface(dbus.SystemBus().get_object('org.kylin.kare', '/org/kylin/kare'),
|
||||
dbus_interface='org.kylin.kare')
|
||||
logging.info("kare install:%s", deb_path)
|
||||
kareRet = kareiInterface.install ("openkylin2.0", deb_path)
|
||||
|
||||
if kareRet:
|
||||
self.dbus_send.InstalldebFinished(True,'kare install call success','')
|
||||
else:
|
||||
self.dbus_send.InstalldebFinished(False,'kare install call error','')
|
||||
except Exception as e:
|
||||
logging.error("kare install error:%s", str(e))
|
||||
self.dbus_send.InstalldebFinished(False, str(e), 'kare install call error')
|
||||
|
||||
def start_purge_pkgs(self,pkgs_list,sender=None):
|
||||
try:
|
||||
kareiInterface = dbus.Interface(dbus.SystemBus().get_object('org.kylin.kare', '/org/kylin/kare'),
|
||||
dbus_interface='org.kylin.kare')
|
||||
for pl in pkgs_list:
|
||||
logging.info("kare remove:%s", pl)
|
||||
kareRet = kareiInterface.remove(pl)
|
||||
|
||||
if kareRet:
|
||||
self.dbus_send.PurgePackagesFinished (True,'kare remove call success','')
|
||||
else:
|
||||
self.dbus_send.PurgePackagesFinished (False,'kare remove error','')
|
||||
except Exception as e:
|
||||
logging.error("kare remove error:%s", str(e))
|
||||
self.dbus_send.PurgePackagesFinished (False,'kare remove error','')
|
||||
|
||||
def _make_meta_for_panel(self,data,output_path):
|
||||
groups_base_info = {}
|
||||
output_json = {}
|
||||
|
|
|
@ -324,6 +324,69 @@ class UpdateManagerDbusController(dbus.service.Object):
|
|||
# sender_name,os_version, update_version)
|
||||
return os_version,update_version
|
||||
|
||||
@dbus.service.method(UPDATER_DBUS_INTERFACE,in_signature='ssbbs',out_signature='is',sender_keyword='sender')
|
||||
def InstallDebFile(self,source = "unKnown", path = "", _check_local_dep = False, _auto_satisfy = False, user_lang = '', sender=None):
|
||||
try:
|
||||
if self.now_working != ACTION_DEFUALT_STATUS:
|
||||
logging.warning('PurgePackages In the process of Updating or Upgrading...')
|
||||
return self.RETURN_BUSY_STATE,self.RETURN_BUSY_DESC
|
||||
|
||||
#当传入为空时 直接返回
|
||||
if str(user_lang) == '':
|
||||
logging.info("The incoming language is null...")
|
||||
|
||||
check_local_dep = bool(_check_local_dep)
|
||||
auto_satisfy = bool(_auto_satisfy)
|
||||
deb_path = str(path)
|
||||
|
||||
sender_name = get_proc_from_dbus_name(sender)
|
||||
self._check_prohibit_user(sender_name)
|
||||
logging.info(COLORMETHOR_PREFIX+'Method'+COLORLOG_SUFFIX+' InstallDebFile and check_local_dep:%r, auto_satisfy:%r, current_lang:%s , InstallDebFile sender: %s .',\
|
||||
check_local_dep,auto_satisfy,user_lang,sender_name)
|
||||
logging.info("Will install: %s.",path)
|
||||
self.parent.start_deb_install(deb_path, _check_local_dep, _auto_satisfy, source, sender)
|
||||
return self.RETURN_SUCCESS_CODE,self.RETURN_SUCCESS_DESC
|
||||
except Exception as e:
|
||||
logging.error(str(e))
|
||||
return self.RETURN_UNKNOWN_CODE,str(e)
|
||||
|
||||
@dbus.service.method(UPDATER_DBUS_INTERFACE,in_signature='asss',out_signature='is',sender_keyword='sender')
|
||||
def PurgePackages(self,_purge_list,cur_user,user_lang = '',sender=None):
|
||||
try:
|
||||
if self.now_working != ACTION_DEFUALT_STATUS:
|
||||
logging.warning('PurgePackages In the process of Updating or Upgrading...')
|
||||
return self.RETURN_BUSY_STATE,self.RETURN_BUSY_DESC
|
||||
|
||||
if str(user_lang) == '':
|
||||
logging.info("The incoming language is null...")
|
||||
|
||||
purge_list = [str(pkg) for pkg in _purge_list]
|
||||
sender_name = get_proc_from_dbus_name(sender)
|
||||
logging.info(COLORMETHOR_PREFIX+'Method'+COLORLOG_SUFFIX+' PurgePackages Sender:%s and purge list is:%s...',sender_name, purge_list)
|
||||
self._check_prohibit_user(sender_name)
|
||||
|
||||
# if True:
|
||||
# #需要对aptdeamon加这两个环境变量 才可以提示弹窗
|
||||
# self.set_aptdeamon_environ("XAUTHORITY","/home/"+str(cur_user)+"/.Xauthority")
|
||||
# self.set_aptdeamon_environ("DISPLAY",":0")
|
||||
|
||||
self.parent.sqlite3_server.current_purge_pkgs = purge_list
|
||||
self.parent.start_purge_pkgs(purge_list, sender)
|
||||
return self.RETURN_SUCCESS_CODE,self.RETURN_SUCCESS_DESC
|
||||
except Exception as e:
|
||||
logging.error(str(e))
|
||||
return self.RETURN_UNKNOWN_CODE,str(e)
|
||||
|
||||
@dbus.service.signal(UPDATER_DBUS_INTERFACE,signature='bss')
|
||||
def InstalldebFinished(self, success,error_string='',error_desc=''):
|
||||
logging.info(COLORLOG_PREFIX + "Emitting"+ COLORLOG_SUFFIX + " InstalldebFinished success = %r , error_string = %s , error_desc = %s ",\
|
||||
success,error_string,error_desc)
|
||||
|
||||
@dbus.service.signal(UPDATER_DBUS_INTERFACE,signature='bss')
|
||||
def PurgePackagesFinished(self, success,error_string='',error_desc=''):
|
||||
logging.info(COLORLOG_PREFIX + "Emitting"+ COLORLOG_SUFFIX + " PurgePackagesFinished success = %r , error_string = %s , error_desc = %s ",\
|
||||
success,error_string,error_desc)
|
||||
|
||||
WRITABLE_PROPERTIES = ()
|
||||
|
||||
# pylint: disable-msg=C0103,C0322
|
||||
|
|
Loading…
Reference in New Issue