Merge branch 'openkylin/nile' of gitee.com:openkylin/kylin-system-updater into openkylin/nile

This commit is contained in:
luoxueyi 2024-06-03 16:00:28 +08:00
commit 0bfa27b0e9
2 changed files with 22 additions and 15 deletions

View File

@ -281,32 +281,30 @@ class DeployBackend(BackendBaseOstree):
self._progress_to_plymouth(60)
logging.info("start deploy available_refs:%s new_revision:%s...",refs,new_revision)
ret,new_deployment = sysroot.deploy_tree(self.osname,new_revision,self.origin,self.merge_deployment,None,None)
ret,upgrade_deployment = sysroot.deploy_tree(self.osname,new_revision,self.origin,self.merge_deployment,None,None)
# 进行部署时 保留历史部署
flags = OSTree.SysrootSimpleWriteDeploymentFlags.RETAIN
sysroot.simple_write_deployment(self.osname,new_deployment,self.merge_deployment,flags,None)
sysroot.simple_write_deployment(self.osname,upgrade_deployment,self.merge_deployment,flags,None)
self._progress_to_plymouth(90)
# 获取当前部署 数量
cur_deployment = []
cur_deployment.append(new_deployment)
special_deployment = []
has_deployment = []
old_deployments = sysroot.get_deployments()
# 部署的列表
for deploys in old_deployments:
# 对为hotfix和pin的部署进行过滤
# 放hotfix和pin 部署
if deploys.get_unlocked() == OSTree.DeploymentUnlockedState.HOTFIX and deploys.is_pinned():
continue
special_deployment.append(special_deployment)
# 其他升级保存的部署
elif not upgrade_deployment.equal(deploys):
has_deployment.append(deploys)
if not new_deployment.equal(deploys):
cur_deployment.append(deploys)
logging.info("Number of current deployments:%d and all:%d",len(cur_deployment),len(old_deployments))
if len(cur_deployment) > 5:
logging.info("Number of current deployments:%d and all:%d",len(has_deployment),len(old_deployments))
if len(has_deployment) > 5:
logging.info("The number of deployments exceed 5 and delete the 5 after the depoyment...")
ret = sysroot.write_deployments(cur_deployment[:5],None)
new_deployment = [upgrade_deployment] + special_deployment + has_deployment[:5]
ret = sysroot.write_deployments(new_deployment,None)
self._progress_to_plymouth(95)
# 健全性检查

9
debian/changelog vendored
View File

@ -1,3 +1,12 @@
kylin-system-updater (3.0.0.0-ok25) nile; urgency=medium
* BUG: 无
* 需求号: 无
* 其他改动说明: 修复超过5个部署之后部署丢失的问题
* 其他改动影响域:无
-- wangsong <wangsong@kylinos.cn> Sat, 01 Jun 2024 15:20:58 +0800
kylin-system-updater (3.0.0.0-ok24) nile; urgency=medium
* BUG: 无