Merge branch 'backend_dev' of gitlab2.kylin.com:kylin-desktop/update-manager-group/kylin-system-updater into backend_dev
This commit is contained in:
commit
901236c34f
|
@ -181,27 +181,28 @@ class UpdateManager():
|
|||
deb_cache = Cache()
|
||||
broken_count = deb_cache._depcache.broken_count
|
||||
if broken_count > 0:
|
||||
errormsg = ''
|
||||
pkg_list_str = " ".join(pkgs_list)
|
||||
# args = ["dpkg", "-r"]
|
||||
# args.extend([pkg_list_str])
|
||||
|
||||
# p = subprocess.Popen(args, stdout=subprocess.PIPE)
|
||||
# (ver, error)= p.communicate()
|
||||
# print(ver + error)
|
||||
# print(p.returncode)
|
||||
# # p.stdin.write(errormsg)
|
||||
# # p.stdin.close()
|
||||
# logging.error(p.stdin)
|
||||
|
||||
# pkg_list_str = " ".join(pkgs_list)
|
||||
return os.spawnlp(os.P_WAIT, "dpkg", "dpkg", "-r", pkg_list_str)
|
||||
_success,header,desc = self._dpkg_purge_pkgs(pkgs_list)
|
||||
if _success == True:
|
||||
logging.info(header)
|
||||
self.dbusController.PurgePackagesFinished(_success,'',desc)
|
||||
else:
|
||||
self.dbusController.PurgePackagesFinished(_success,header,desc)
|
||||
else:
|
||||
purge_backend = get_backend(self, InstallBackend.ACTION_REMOVE_PACKAGES)
|
||||
purge_backend.start(partial_upgrade_list = pkgs_list)
|
||||
except Exception as e:
|
||||
logging.error(e)
|
||||
|
||||
def _dpkg_purge_pkgs(self,pkgs_list):
|
||||
success = False
|
||||
pkg_list_str = " ".join(pkgs_list)
|
||||
args = ["dpkg", "-r"]
|
||||
args.extend([pkg_list_str])
|
||||
|
||||
p = subprocess.run(args, stdout=subprocess.PIPE,stderr=subprocess.STDOUT,text=True)
|
||||
success = p.returncode == 0
|
||||
return success,p.stdout,''
|
||||
|
||||
#更新结束之后会调到此获取要升级的列表 and 更新cache 生成升级组列表JSON
|
||||
def start_available(self):
|
||||
_success,header,desc = self.refresh_cache()
|
||||
|
|
|
@ -76,4 +76,5 @@ if __name__ == "__main__":
|
|||
if app.configs.getWithDefault("SystemStatus", "isabnormalreboot", False) == True:
|
||||
app.start_update()
|
||||
|
||||
app.start_purge_pkgs(['kylin-video'])
|
||||
app.run()
|
Loading…
Reference in New Issue