From 1491e1e36c9e27998d85a26f54a5c30a3ca20a09 Mon Sep 17 00:00:00 2001 From: wangsong Date: Sat, 25 May 2024 15:49:24 +0800 Subject: [PATCH] changelog:3.0.0.0-ok23 --- .../SystemUpdater/Core/Database.py | 1 - .../backend/BackendOstreeNext.py | 2 +- .../tests/test-admin-upgrade-endoflife.sh | 50 ++++++++++--------- 3 files changed, 28 insertions(+), 25 deletions(-) diff --git a/backend-immutable/SystemUpdater/Core/Database.py b/backend-immutable/SystemUpdater/Core/Database.py index 3072e34..d7d7b4f 100644 --- a/backend-immutable/SystemUpdater/Core/Database.py +++ b/backend-immutable/SystemUpdater/Core/Database.py @@ -286,7 +286,6 @@ class Sqlite3Server(object): logging.error(exc) pkgappname = matedata.get("update-name",{}).get("zh_CN", "") - logging.info(pkgappname) pkgversion = matedata.get("version", "") pkgdescription = matedata.get("description","") pkgchangelog = matedata.get("changelog", "") diff --git a/backend-immutable/SystemUpdater/backend/BackendOstreeNext.py b/backend-immutable/SystemUpdater/backend/BackendOstreeNext.py index 1557d9f..0f0391f 100644 --- a/backend-immutable/SystemUpdater/backend/BackendOstreeNext.py +++ b/backend-immutable/SystemUpdater/backend/BackendOstreeNext.py @@ -401,7 +401,7 @@ class LoadCacheBackend(BackendBaseOstree): def _rollback_deployment(self,sysroot,osname): out_pending,out_rollback = sysroot.query_deployments_for(osname) - if out_rollback: + if out_rollback and not out_rollback.is_pinned(): rollback_origin = out_rollback.get_origin() refspec = rollback_origin.get_string("origin","refspec") ret,origin_remote,origin_ref = OSTree.parse_refspec(refspec) diff --git a/backend-immutable/tests/test-admin-upgrade-endoflife.sh b/backend-immutable/tests/test-admin-upgrade-endoflife.sh index 2e60d11..640a708 100755 --- a/backend-immutable/tests/test-admin-upgrade-endoflife.sh +++ b/backend-immutable/tests/test-admin-upgrade-endoflife.sh @@ -1,13 +1,7 @@ #!/bin/bash -# 主要做的: -# - 初始化一个ostree仓库:testos-repo -# - 在osdata目录创建模拟一些系统文件 and 提交两次到testos-repo 仓库 -# - 复制osdata数据到osdata-devel,做出修改然后再次提交 -# - 用init-fs创建sysroot 和 os-init 和 syslinux -# - 提交一个新的commit用空目录,标记初始分支($BUILD_MASTER_BRACH)为EOL 重新定向到新分支(testos/buildmaster/newbranch) -run_system=$(pwd)/../kylin-system-updater +updater_program=$(pwd)/../kylin-system-updater set -euo pipefail @@ -53,15 +47,15 @@ test_deploy_limit() { echo "" echo "检查更新" - sudo gdbus call --system --dest $bus_name --object-path $object_path --method $interface_name.$update_method > /dev/null + gdbus call --system --dest $bus_name --object-path $object_path --method $interface_name.$update_method > /dev/null moniter_signal_success $update_finished_signal echo "部署下载" - sudo gdbus call --system --dest $bus_name --object-path $object_path --method $interface_name.$download_method > /dev/null + gdbus call --system --dest $bus_name --object-path $object_path --method $interface_name.$download_method > /dev/null moniter_signal_success $download_finished_signal echo "部署内容" - sudo gdbus call --system --dest $bus_name --object-path $object_path --method $interface_name.$deploy_method > /dev/null + gdbus call --system --dest $bus_name --object-path $object_path --method $interface_name.$deploy_method > /dev/null moniter_signal_success $deploy_finished_signal # 部署完成后的检查 @@ -73,26 +67,36 @@ test_deploy_limit() { done } -# 创建ostree仓库 仓库类型 and boot类型 包括默认开启一个远程 -setup_os_repository "archive" "syslinux" +fn_simulate_ostree_system() { + # 模拟ostree系统的环境 进行测试 + # 主要做的: + # - 初始化一个ostree仓库:testos-repo + # - 在osdata目录创建模拟一些系统文件 and 提交两次到testos-repo 仓库 + # - 复制osdata数据到osdata-devel,做出修改然后再次提交 + # - 用init-fs创建sysroot 和 os-init 和 syslinux + # - 提交一个新的commit用空目录,标记初始分支($BUILD_MASTER_BRACH)为EOL 重新定向到新分支(testos/buildmaster/newbranch) -cd ${test_tmpdir} -${CMD_PREFIX} ostree --repo=sysroot/ostree/repo remote add --set=gpg-verify=false testos $(cat httpd-address)/ostree/testos-repo + # 创建ostree仓库 仓库类型 and boot类型 包括默认开启一个远程 + setup_os_repository "archive" "syslinux" -${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull testos $BUILD_MASTER_BRACH > /dev/null -rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse $BUILD_MASTER_BRACH) -echo "拉取分支:$BUILD_MASTER_BRACH 从远程仓库testos-repo and revision=${rev}" + cd ${test_tmpdir} + ${CMD_PREFIX} ostree --repo=sysroot/ostree/repo remote add --set=gpg-verify=false testos $(cat httpd-address)/ostree/testos-repo -echo "部署分支:$BUILD_MASTER_BRACH" -${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:$BUILD_MASTER_BRACH > /dev/null -assert_has_dir sysroot/boot/ostree/testos-${bootcsum} + ${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull testos $BUILD_MASTER_BRACH > /dev/null + rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse $BUILD_MASTER_BRACH) + echo "拉取分支:$BUILD_MASTER_BRACH 从远程仓库testos-repo and revision=${rev}" -exec 3< <($run_system -r -d --sysroot=$test_tmpdir/sysroot --os=testos 2>&1) + echo "部署分支:$BUILD_MASTER_BRACH" + ${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:$BUILD_MASTER_BRACH > /dev/null + assert_has_dir sysroot/boot/ostree/testos-${bootcsum} +} + +fn_simulate_ostree_system + +exec 3< <($updater_program -r -d --sysroot=$test_tmpdir/sysroot --os=testos 2>&1) # 等待dbus服务启动 sleep 3 test_deploy_limit 1 - - echo "ok update and redirect" \ No newline at end of file