From db794e13be8b0c4f8ad7e91501b337594fa28a35 Mon Sep 17 00:00:00 2001 From: curried Date: Tue, 12 Aug 2025 23:36:47 +0800 Subject: [PATCH 1/6] Fix updater build config deps problem Signed-off-by: curried --- BUILD.gn | 7 +------ bundle.json | 4 +++- test/unittest/script/BUILD.gn | 9 +++------ updater_default_cfg.gni | 11 ++++++++--- 4 files changed, 15 insertions(+), 16 deletions(-) diff --git a/BUILD.gn b/BUILD.gn index ce77ae8e..8d5e3050 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -57,12 +57,7 @@ group("unittest") { "test/unittest/flashd_test:flashd_utils_unittest", ] } - if (updater_cfg_file == "") { - deps += [ - "test/unittest/script:user_instruction", - "test/unittest/script:user_instruction_invalid", - ] - } + if (updater_ui_support) { deps += [ "test/unittest/service_test:updater_service_unittest", diff --git a/bundle.json b/bundle.json index 375512ad..343501b8 100644 --- a/bundle.json +++ b/bundle.json @@ -40,7 +40,9 @@ "syscap": [], "features": [ "updater_ui_support", - "updater_cfg_file" + "updater_cfg_file", + "updater_feature_use_ptable", + "updater_feature_use_as_executable" ], "adapted_system_type": [ "standard" ], "rom": "", diff --git a/test/unittest/script/BUILD.gn b/test/unittest/script/BUILD.gn index 9aa58ee5..7ccb04c7 100644 --- a/test/unittest/script/BUILD.gn +++ b/test/unittest/script/BUILD.gn @@ -75,13 +75,10 @@ ohos_unittest("script_unittest") { "${updater_path}/services/package:libupdaterpackage", "${updater_path}/services/script:gen_yacc", "${updater_path}/utils:libutils", + "${updater_path}/test/unittest/script:user_instruction", + "${updater_path}/test/unittest/script:user_instruction_invalid", ] - if (updater_cfg_file != "") { - deps += [ - "${updater_path}/test/unittest/script:user_instruction", - "${updater_path}/test/unittest/script:user_instruction_invalid", - ] - } + configs = [ "${updater_path}/test/unittest:utest_config" ] external_deps = [ "bounds_checking_function:libsec_static", diff --git a/updater_default_cfg.gni b/updater_default_cfg.gni index 130b14a9..67446ede 100644 --- a/updater_default_cfg.gni +++ b/updater_default_cfg.gni @@ -16,6 +16,8 @@ import("//build/ohos.gni") init_feature_ab_partition = true declare_args() { updater_cfg_file = "" + updater_feature_use_ptable = true + updater_feature_use_as_executable = false updater_ui_support = true if (!defined(global_parts_info.arkui_ui_lite)) { updater_ui_support = false @@ -32,13 +34,16 @@ declare_args() { } } -if (updater_cfg_file != "") { +if (!updater_feature_use_as_executable) { updater_sign_on_server = true - import("${updater_cfg_file}") +} + +if (updater_feature_use_ptable) { + use_ptable = "enable" } template("updater_gen") { - if (updater_cfg_file != "") { + if (!updater_feature_use_as_executable) { ohos_source_set(target_name) { forward_variables_from(invoker, "*") } -- Gitee From 62daec1e048ba9955bdfb1b7783d3f2072cab715 Mon Sep 17 00:00:00 2001 From: curried Date: Wed, 13 Aug 2025 22:10:13 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E5=B0=86=E5=8A=9F=E8=83=BD=E7=89=B9?= =?UTF-8?q?=E6=80=A7=E5=BC=80=E5=85=B3updater=5Fsign=5Fon=5Fserver?= =?UTF-8?q?=E6=8A=BD=E8=B1=A1=E6=88=90=E4=B8=80=E4=B8=AA=E7=8B=AC=E7=AB=8B?= =?UTF-8?q?=E7=89=B9=E6=80=A7=E6=9D=A5=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: curried --- bundle.json | 3 ++- updater_default_cfg.gni | 9 +++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/bundle.json b/bundle.json index 343501b8..1e9e2f9d 100644 --- a/bundle.json +++ b/bundle.json @@ -42,7 +42,8 @@ "updater_ui_support", "updater_cfg_file", "updater_feature_use_ptable", - "updater_feature_use_as_executable" + "updater_feature_updater_gen_executable", + "updater_feature_sign_on_server" ], "adapted_system_type": [ "standard" ], "rom": "", diff --git a/updater_default_cfg.gni b/updater_default_cfg.gni index 67446ede..37c38b04 100644 --- a/updater_default_cfg.gni +++ b/updater_default_cfg.gni @@ -17,7 +17,8 @@ init_feature_ab_partition = true declare_args() { updater_cfg_file = "" updater_feature_use_ptable = true - updater_feature_use_as_executable = false + updater_feature_updater_gen_executable = false + updater_feature_sign_on_server = true updater_ui_support = true if (!defined(global_parts_info.arkui_ui_lite)) { updater_ui_support = false @@ -25,7 +26,7 @@ declare_args() { updater_hdc_depend = true updater_absolutely_path = "//base/update/updater" hdc_base = "//developtools/hdc" - updater_sign_on_server = false + updater_sign_on_server = true updater_zlib_enable = true if (defined(global_parts_info) && @@ -34,7 +35,7 @@ declare_args() { } } -if (!updater_feature_use_as_executable) { +if (updater_feature_sign_on_server) { updater_sign_on_server = true } @@ -43,7 +44,7 @@ if (updater_feature_use_ptable) { } template("updater_gen") { - if (!updater_feature_use_as_executable) { + if (!updater_feature_updater_gen_executable) { ohos_source_set(target_name) { forward_variables_from(invoker, "*") } -- Gitee From 6286e3d5b4b76e73e2d201025a210ebb9575427c Mon Sep 17 00:00:00 2001 From: curried Date: Fri, 15 Aug 2025 11:40:18 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E9=AA=8C=E8=AF=81gn=E8=84=9A=E6=9C=AC?= =?UTF-8?q?=E5=AF=B9feature=E7=AE=A1=E6=8E=A7=E6=98=AF=E5=90=A6=E6=9C=89?= =?UTF-8?q?=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: curried --- services/BUILD.gn | 7 ++++++- services/flashd/BUILD.gn | 3 +++ services/flow_update/update_bin/BUILD.gn | 3 +++ services/updater_binary/BUILD.gn | 3 +++ services/updater_binary/update_processor.cpp | 1 + services/updater_binary/update_processor_stream.cpp | 2 ++ updater_default_cfg.gni | 13 +++++++++++++ 7 files changed, 31 insertions(+), 1 deletion(-) diff --git a/services/BUILD.gn b/services/BUILD.gn index 1d822028..7d8f50cb 100755 --- a/services/BUILD.gn +++ b/services/BUILD.gn @@ -89,10 +89,13 @@ ohos_static_library("libupdater_static") { deps += [ "${updater_path}/services/flashd:libflashd", ] } + print("GNI_TEST_ libupdater_static") if (defined(use_ptable)) { + print("GNI_TEST_ libupdater_static defined use_ptable") include_dirs += [ "${updater_path}/services/ptable_parse" ] deps += [ "${updater_path}/services/ptable_parse:libptableparse" ] defines += [ "UPDATER_USE_PTABLE" ] + print("GNI_TEST_ libupdater_static defines", defines) } external_deps = [ @@ -164,11 +167,13 @@ ohos_static_library("libupdater") { } public_configs = [ ":libupdater_exported_headers" ] - + print("GNI_TEST_ libupdater") if (defined(use_ptable)) { + print("GNI_TEST_ libupdater defined use_ptable") include_dirs += [ "${updater_path}/services/ptable_parse" ] deps += [ "${updater_path}/services/ptable_parse:libptableparse" ] defines += [ "UPDATER_USE_PTABLE" ] + print("GNI_TEST_ libupdater defines", defines) } ldflags = [] diff --git a/services/flashd/BUILD.gn b/services/flashd/BUILD.gn index d8f02b30..d228da51 100644 --- a/services/flashd/BUILD.gn +++ b/services/flashd/BUILD.gn @@ -214,10 +214,13 @@ ohos_static_library("libflashd") { "${updater_path}/utils/json", ] + print("GNI_TEST_ libflashd") if (defined(use_ptable)) { + print("GNI_TEST_ libflashd defined use_ptable") include_dirs += [ "${updater_path}/services/ptable_parse" ] deps += [ "${updater_path}/services/ptable_parse:libptableparse" ] defines += [ "UPDATER_USE_PTABLE" ] + print("GNI_TEST_ libflashd defines", defines) } external_deps = [ diff --git a/services/flow_update/update_bin/BUILD.gn b/services/flow_update/update_bin/BUILD.gn index 83e3d6df..4f06044c 100644 --- a/services/flow_update/update_bin/BUILD.gn +++ b/services/flow_update/update_bin/BUILD.gn @@ -52,10 +52,13 @@ ohos_static_library("libBinFlowUpdate") { "init:libfsmanager_static_real", "openssl:libcrypto_static", ] + print("GNI_TEST_ libBinFlowUpdate") if (defined(use_ptable)) { + print("GNI_TEST_ libBinFlowUpdate defined use_ptable") deps += [ "${updater_path}/services/ptable_parse:libptableparse" ] external_deps += [ "cJSON:cjson_static" ] defines = [ "UPDATER_USE_PTABLE" ] + print("GNI_TEST_ libBinFlowUpdate defines", defines) } subsystem_name = "updater" part_name = "updater" diff --git a/services/updater_binary/BUILD.gn b/services/updater_binary/BUILD.gn index afbb7c39..66e7aaa6 100644 --- a/services/updater_binary/BUILD.gn +++ b/services/updater_binary/BUILD.gn @@ -71,10 +71,13 @@ ohos_static_library("libupdater_binary") { defines = [ "OPENSSL_SUPPRESS_DEPRECATED" ] + print("GNI_TEST_ libupdater_binary") if (defined(use_ptable)) { + print("GNI_TEST_ libupdater_binary defined use_ptable") include_dirs = [ "${updater_path}/services/ptable_parse" ] deps += [ "${updater_path}/services/ptable_parse:libptableparse" ] defines += [ "UPDATER_USE_PTABLE" ] + print("GNI_TEST_ libupdater_binary defines", defines) } external_deps = [ diff --git a/services/updater_binary/update_processor.cpp b/services/updater_binary/update_processor.cpp index b204ba9c..e9b1ef3a 100644 --- a/services/updater_binary/update_processor.cpp +++ b/services/updater_binary/update_processor.cpp @@ -443,6 +443,7 @@ int UScriptInstructionRawImageWrite::GetWritePathAndOffset(const std::string &pa uint64_t &offset, uint64_t &partitionSize) { #ifdef UPDATER_USE_PTABLE +#error("GNI_TEST_ UPDATER_USE_PTABLE is defined") DevicePtable& devicePtb = DevicePtable::GetInstance(); Ptable::PtnInfo ptnInfo; if (!devicePtb.GetPartionInfoByName(partitionName, ptnInfo)) { diff --git a/services/updater_binary/update_processor_stream.cpp b/services/updater_binary/update_processor_stream.cpp index 624836af..3835e345 100755 --- a/services/updater_binary/update_processor_stream.cpp +++ b/services/updater_binary/update_processor_stream.cpp @@ -28,6 +28,7 @@ #include "pkg_manager.h" #ifdef UPDATER_USE_PTABLE #include "ptable_manager.h" +#error("GNI_TEST_ UPDATER_USE_PTABLE is defined") #endif #include "script_instruction.h" #include "script_manager.h" @@ -182,6 +183,7 @@ int ProcessUpdaterStream(bool retry, int pipeFd, const std::string &packagePath, } #ifdef UPDATER_USE_PTABLE +#error("GNI_TEST_ UPDATER_USE_PTABLE is defined") // 分区表操作 if (!PackagePtable::GetInstance().WritePtableWithFile()) { LOG(ERROR) << "write ptable with file fail"; diff --git a/updater_default_cfg.gni b/updater_default_cfg.gni index 37c38b04..a48c7e91 100644 --- a/updater_default_cfg.gni +++ b/updater_default_cfg.gni @@ -29,6 +29,13 @@ declare_args() { updater_sign_on_server = true updater_zlib_enable = true + print("GNI_TEST_ declare_args updater_cfg_file:", updater_cfg_file) + print("GNI_TEST_ declare_args updater_feature_use_ptable:", updater_feature_use_ptable) + print("GNI_TEST_ declare_args updater_feature_sign_on_server:", updater_feature_sign_on_server) + print("GNI_TEST_ declare_args updater_ui_support:", updater_ui_support) + print("GNI_TEST_ declare_args updater_sign_on_server:", updater_sign_on_server) + print("GNI_TEST_ declare_args updater_zlib_enable:", updater_zlib_enable) + if (defined(global_parts_info) && !defined(global_parts_info.third_party_zlib)) { updater_zlib_enable = false @@ -36,11 +43,17 @@ declare_args() { } if (updater_feature_sign_on_server) { + print("GNI_TEST_ global 000 updater_feature_sign_on_server:", updater_feature_sign_on_server) updater_sign_on_server = true + print("GNI_TEST_ global 111 updater_feature_sign_on_server:", updater_feature_sign_on_server) + print("GNI_TEST_ global updater_sign_on_server:", updater_sign_on_server) } if (updater_feature_use_ptable) { + print("GNI_TEST_ global 000 updater_feature_use_ptable:", updater_feature_use_ptable) use_ptable = "enable" + print("GNI_TEST_ global 111 updater_feature_use_ptable:", updater_feature_use_ptable) + print("GNI_TEST_ global use_ptable:", use_ptable) } template("updater_gen") { -- Gitee From 6b6949ba276fe5ed6cf2856c02bc192dc42cddec Mon Sep 17 00:00:00 2001 From: curried Date: Fri, 15 Aug 2025 12:28:52 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E4=B8=8D=E5=8F=AF?= =?UTF-8?q?=E6=89=93=E5=8D=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: curried --- updater_default_cfg.gni | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/updater_default_cfg.gni b/updater_default_cfg.gni index a48c7e91..3261da87 100644 --- a/updater_default_cfg.gni +++ b/updater_default_cfg.gni @@ -29,7 +29,7 @@ declare_args() { updater_sign_on_server = true updater_zlib_enable = true - print("GNI_TEST_ declare_args updater_cfg_file:", updater_cfg_file) + # print("GNI_TEST_ declare_args updater_cfg_file:", updater_cfg_file) print("GNI_TEST_ declare_args updater_feature_use_ptable:", updater_feature_use_ptable) print("GNI_TEST_ declare_args updater_feature_sign_on_server:", updater_feature_sign_on_server) print("GNI_TEST_ declare_args updater_ui_support:", updater_ui_support) -- Gitee From eb30ab0c3d7623f71158a4f8214d334264c7072f Mon Sep 17 00:00:00 2001 From: curried Date: Fri, 15 Aug 2025 13:00:15 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E7=BA=A0=E6=AD=A3=E6=89=93=E5=8D=B0?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: curried --- services/BUILD.gn | 4 ++-- services/flashd/BUILD.gn | 2 +- services/flow_update/update_bin/BUILD.gn | 2 +- services/updater_binary/BUILD.gn | 2 +- updater_default_cfg.gni | 20 +++++++++----------- 5 files changed, 14 insertions(+), 16 deletions(-) diff --git a/services/BUILD.gn b/services/BUILD.gn index 7d8f50cb..0ef23547 100755 --- a/services/BUILD.gn +++ b/services/BUILD.gn @@ -95,7 +95,7 @@ ohos_static_library("libupdater_static") { include_dirs += [ "${updater_path}/services/ptable_parse" ] deps += [ "${updater_path}/services/ptable_parse:libptableparse" ] defines += [ "UPDATER_USE_PTABLE" ] - print("GNI_TEST_ libupdater_static defines", defines) + print("GNI_TEST_ libupdater_static defines append UPDATER_USE_PTABLE") } external_deps = [ @@ -173,7 +173,7 @@ ohos_static_library("libupdater") { include_dirs += [ "${updater_path}/services/ptable_parse" ] deps += [ "${updater_path}/services/ptable_parse:libptableparse" ] defines += [ "UPDATER_USE_PTABLE" ] - print("GNI_TEST_ libupdater defines", defines) + print("GNI_TEST_ libupdater defines append UPDATER_USE_PTABLE") } ldflags = [] diff --git a/services/flashd/BUILD.gn b/services/flashd/BUILD.gn index d228da51..21eb1b26 100644 --- a/services/flashd/BUILD.gn +++ b/services/flashd/BUILD.gn @@ -220,7 +220,7 @@ ohos_static_library("libflashd") { include_dirs += [ "${updater_path}/services/ptable_parse" ] deps += [ "${updater_path}/services/ptable_parse:libptableparse" ] defines += [ "UPDATER_USE_PTABLE" ] - print("GNI_TEST_ libflashd defines", defines) + print("GNI_TEST_ libflashd defines append UPDATER_USE_PTABLE") } external_deps = [ diff --git a/services/flow_update/update_bin/BUILD.gn b/services/flow_update/update_bin/BUILD.gn index 4f06044c..3210dfb5 100644 --- a/services/flow_update/update_bin/BUILD.gn +++ b/services/flow_update/update_bin/BUILD.gn @@ -58,7 +58,7 @@ ohos_static_library("libBinFlowUpdate") { deps += [ "${updater_path}/services/ptable_parse:libptableparse" ] external_deps += [ "cJSON:cjson_static" ] defines = [ "UPDATER_USE_PTABLE" ] - print("GNI_TEST_ libBinFlowUpdate defines", defines) + print("GNI_TEST_ libBinFlowUpdate defines append UPDATER_USE_PTABLE") } subsystem_name = "updater" part_name = "updater" diff --git a/services/updater_binary/BUILD.gn b/services/updater_binary/BUILD.gn index 66e7aaa6..d15dbb3a 100644 --- a/services/updater_binary/BUILD.gn +++ b/services/updater_binary/BUILD.gn @@ -77,7 +77,7 @@ ohos_static_library("libupdater_binary") { include_dirs = [ "${updater_path}/services/ptable_parse" ] deps += [ "${updater_path}/services/ptable_parse:libptableparse" ] defines += [ "UPDATER_USE_PTABLE" ] - print("GNI_TEST_ libupdater_binary defines", defines) + print("GNI_TEST_ libupdater_binary defines append UPDATER_USE_PTABLE") } external_deps = [ diff --git a/updater_default_cfg.gni b/updater_default_cfg.gni index 3261da87..cf0e873b 100644 --- a/updater_default_cfg.gni +++ b/updater_default_cfg.gni @@ -30,11 +30,11 @@ declare_args() { updater_zlib_enable = true # print("GNI_TEST_ declare_args updater_cfg_file:", updater_cfg_file) - print("GNI_TEST_ declare_args updater_feature_use_ptable:", updater_feature_use_ptable) - print("GNI_TEST_ declare_args updater_feature_sign_on_server:", updater_feature_sign_on_server) - print("GNI_TEST_ declare_args updater_ui_support:", updater_ui_support) - print("GNI_TEST_ declare_args updater_sign_on_server:", updater_sign_on_server) - print("GNI_TEST_ declare_args updater_zlib_enable:", updater_zlib_enable) + print("GNI_TEST_ declare_args updater_feature_use_ptable:") + print("GNI_TEST_ declare_args updater_feature_sign_on_server:") + print("GNI_TEST_ declare_args updater_ui_support:") + print("GNI_TEST_ declare_args updater_sign_on_server:") + print("GNI_TEST_ declare_args updater_zlib_enable:") if (defined(global_parts_info) && !defined(global_parts_info.third_party_zlib)) { @@ -43,17 +43,15 @@ declare_args() { } if (updater_feature_sign_on_server) { - print("GNI_TEST_ global 000 updater_feature_sign_on_server:", updater_feature_sign_on_server) + print("GNI_TEST_ global 000 updater_feature_sign_on_server: true") updater_sign_on_server = true - print("GNI_TEST_ global 111 updater_feature_sign_on_server:", updater_feature_sign_on_server) - print("GNI_TEST_ global updater_sign_on_server:", updater_sign_on_server) + print("GNI_TEST_ global updater_sign_on_server: true") } if (updater_feature_use_ptable) { - print("GNI_TEST_ global 000 updater_feature_use_ptable:", updater_feature_use_ptable) + print("GNI_TEST_ global 000 updater_feature_use_ptable: true") use_ptable = "enable" - print("GNI_TEST_ global 111 updater_feature_use_ptable:", updater_feature_use_ptable) - print("GNI_TEST_ global use_ptable:", use_ptable) + print("GNI_TEST_ global use_ptable: 'enable'") } template("updater_gen") { -- Gitee From fe31482b0383496a8e1a8bee706d415d11224ac6 Mon Sep 17 00:00:00 2001 From: curried Date: Fri, 15 Aug 2025 13:41:37 +0800 Subject: [PATCH 6/6] remove error Signed-off-by: curried --- services/updater_binary/update_processor.cpp | 2 +- services/updater_binary/update_processor_stream.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/services/updater_binary/update_processor.cpp b/services/updater_binary/update_processor.cpp index e9b1ef3a..2e15f023 100644 --- a/services/updater_binary/update_processor.cpp +++ b/services/updater_binary/update_processor.cpp @@ -443,7 +443,7 @@ int UScriptInstructionRawImageWrite::GetWritePathAndOffset(const std::string &pa uint64_t &offset, uint64_t &partitionSize) { #ifdef UPDATER_USE_PTABLE -#error("GNI_TEST_ UPDATER_USE_PTABLE is defined") +// #error("GNI_TEST_ UPDATER_USE_PTABLE is defined") DevicePtable& devicePtb = DevicePtable::GetInstance(); Ptable::PtnInfo ptnInfo; if (!devicePtb.GetPartionInfoByName(partitionName, ptnInfo)) { diff --git a/services/updater_binary/update_processor_stream.cpp b/services/updater_binary/update_processor_stream.cpp index 3835e345..65f0ec0e 100755 --- a/services/updater_binary/update_processor_stream.cpp +++ b/services/updater_binary/update_processor_stream.cpp @@ -28,7 +28,7 @@ #include "pkg_manager.h" #ifdef UPDATER_USE_PTABLE #include "ptable_manager.h" -#error("GNI_TEST_ UPDATER_USE_PTABLE is defined") +// #error("GNI_TEST_ UPDATER_USE_PTABLE is defined") #endif #include "script_instruction.h" #include "script_manager.h" @@ -183,7 +183,7 @@ int ProcessUpdaterStream(bool retry, int pipeFd, const std::string &packagePath, } #ifdef UPDATER_USE_PTABLE -#error("GNI_TEST_ UPDATER_USE_PTABLE is defined") +// #error("GNI_TEST_ UPDATER_USE_PTABLE is defined") // 分区表操作 if (!PackagePtable::GetInstance().WritePtableWithFile()) { LOG(ERROR) << "write ptable with file fail"; -- Gitee