更新代码
This commit is contained in:
parent
1f7210dc36
commit
1e5ff1d8bd
|
@ -223,8 +223,8 @@ class UpdateList():
|
|||
#FIXME: 最好将这个常量通过配置文件读
|
||||
self.GROUPS_JSON_PKG = 'kylin-update-desktop-config'
|
||||
|
||||
self.input_config_path = '/usr/share/kylin-update-desktop-config/data'
|
||||
self.output_config_path = '/home/kylin/wangsong/outconfig'
|
||||
self.INPUT_CONFIG_PATH = '/usr/share/kylin-update-desktop-config/data'
|
||||
self.OUTPUT_CONFIG_PATH = '/home/kylin/wangsong/outconfig'
|
||||
|
||||
# a stable machine uniq id
|
||||
try:
|
||||
|
@ -493,15 +493,15 @@ class UpdateList():
|
|||
|
||||
def _make_json(self,cache,pkgs_install, pkgs_upgrade, pkgs_remove):
|
||||
try:
|
||||
files = os.listdir(self.input_config_path) #获得文件夹中所有文件的名称列表
|
||||
files = os.listdir(self.INPUT_CONFIG_PATH) #获得文件夹中所有文件的名称列表
|
||||
for file in files:
|
||||
#判是否是目录以及是否以JSON结尾
|
||||
if not os.path.isdir(file) and file.endswith('.json'):
|
||||
with open(self.input_config_path+"/"+file,'r') as f:
|
||||
with open(self.INPUT_CONFIG_PATH+"/"+file,'r') as f:
|
||||
data = json.load(f)
|
||||
|
||||
output_json = {}
|
||||
output_config_name = self.output_config_path + '/' + data['package'] + '_output.json'
|
||||
output_config_name = self.OUTPUT_CONFIG_PATH + '/' + data['package'] + '_output.json'
|
||||
|
||||
install_pkgs_list = data['install_list']
|
||||
upgrade_pkgs_list = data['upgrade_list']
|
||||
|
@ -588,7 +588,7 @@ class UpdateList():
|
|||
logging.error(e)
|
||||
|
||||
|
||||
def update(self, cache,start_install_alone, eventloop_callback=None):
|
||||
def update(self, cache, eventloop_callback=None):
|
||||
self.held_back = []
|
||||
upgrade_pkgs = []
|
||||
|
||||
|
|
|
@ -138,7 +138,6 @@ class UpdateManager():
|
|||
#更新结束之后会调到此获取要升级的列表 and 安装完成后也会再重新调此方法,更新cache
|
||||
def start_available(self, cancelled_update=False):
|
||||
self.refresh_cache()
|
||||
logging.info("update finished ...")
|
||||
|
||||
def refresh_cache(self):
|
||||
_success = True
|
||||
|
@ -199,14 +198,15 @@ class UpdateManager():
|
|||
logging.warning("groups JSON ConfigPkgs(%s) install failed...",self.update_list.GROUPS_JSON_PKG)
|
||||
logging.error(e)
|
||||
|
||||
#判断目录是JSON配置文件夹是否存在 不存在重新安装包进行更新
|
||||
if not os.path.exists(self.update_list.input_config_path):
|
||||
#判断目录是JSON配置文件夹是否缺失 缺失后进行修复 卸载重新安装步骤
|
||||
if not os.path.exists(self.update_list.INPUT_CONFIG_PATH):
|
||||
#将软件包卸载 之后进行重新安装here --> purge --> start_available 进行判断是否安装未安装重新安装
|
||||
self.start_install_alone(pkgs_purge = [self.update_list.GROUPS_JSON_PKG])
|
||||
#直接退出
|
||||
return
|
||||
|
||||
try:
|
||||
_success = self.update_list.update(self.cache,self.start_install_alone)
|
||||
_success = self.update_list.update(self.cache)
|
||||
except SystemError as e:
|
||||
header = _("Could not calculate the upgrade")
|
||||
desc = _("An unresolvable problem occurred while "
|
||||
|
|
Loading…
Reference in New Issue