赞
踩
OTA介绍:
随着设备系统日新月异,用户如何及时获取系统的更新,体验新版本带来的新的体验,以及提升系统的稳定和安全性成为了每个厂商都面临的严峻问题。
OTA(Over the Air)提供对设备远程升级的能力。升级子系统对用户屏蔽了底层芯片的差异,对外提供了统一的升级接口。基于接口进行二次开发后,可以让厂商的设备(如IP摄像头等)轻松支持远程升级能力,即通过移动通信的接口从远程服务器下载新的软件更新包,对自身系统进行升级,从而满足厂商的应用管理需求。
OpenHarmony OTA升级方式:
从OTA包的升级方式来说分为本地升级和网络OTA升级。
OTA包类型
从OTA包的类型来说,可分为全量OTA包、差分(增量)OTA包、变分区OTA包。
OTA实现原理:利用升级包制作工具,将编译出的版本打包生成升级包。厂商设备集成 OTA 升级能力后,将升级包上传至服务器,通过升级应用下载升级包,触发并完成升级。
OpenHarmony采用AB升级机制,即设备有一套备份的B系统,在A系统运行时,可以在正常使用的状态下,静默更新B系统,升级成功后,重启切换新系统,实现版本更新的机制。
OpenHarmony OTA升级的约束与限制
:
本章介绍OpenHarmony 4.0 OTA全量包的制作和本地升级步骤。
在运行脚本制作OTA包前,先安装必要的工具
$ sudo apt update
$ sudo apt upgrade
$ sudo apt install bsdiff
$ sudo pip install xmltodict asn1crypto imgdiff cryptography e2fsdroid
为了验证OTA的升级成功与否,可在升级包制作前,对源码添加易于识别的差异,例如:
修改授权管理应用TAG信息
applications/standard/permission_manager/permissionmanager/src/main/ets/ServiceExtAbility/ServiceExtAbility.ts
import deviceInfo from '@ohos.deviceInfo';
-var TAG = "PermissionManager_Log:";
+var TAG = "PermissionManager_Log A:";
const BG_COLOR = '#00000000'
全量编译源码
$ ./build.sh --product-name=rk3568 --ccache
得到系统镜像文件images和二进制升级文件updater_binary:
out/rk3568/packages/phone/images/
├── boot_linux.img
├── chip_prod.img
├── config.cfg
├── MiniLoaderAll.bin
├── parameter.txt
├── ramdisk.img
├── resource.img
├── sys_prod.img
├── system.img
├── uboot.img
├── updater.img
├── userdata.img
└── vendor.img
进入OTA打包工具目录,并创建target_package、output_package和sign_cert文件夹
$ cd base/update/packaging_tools
$ mkdir target_package output_package sign_cert
sign_cert放入公钥:signing_cert.crt,取自base/update/updater/test/unittest/test_data/src/signing_cert.crt
target_package放入要打包生成OTA全量包的如下文件
#BOARD.list 添加一行"RK3568",内容如下:
HI3516
RK3568
注意:
HI3516必须有,否则OTA包校验失败而导致OTA升级失败,因为代码匹配BOARD时,固定了默认值:
base/updater/updater/utils/utils.cpp
std::string GetLocalBoardId()
{
return "HI3516";
}
#VERSION.mbn 内容如下
OpenHarmony 4.0.10.15
fileVersion
为2(4.0更新的校验方式)softVersion
改为当前软件版本compType
改为0,表示全量(1 表示增量)/vendor.img
和./system.img
<?xml version="1.0"?>
<package>
<head name="Component header information">
<info fileVersion="02" prdID="RK3568" softVersion="4.0.10.15" date="2023-08-02" time="16:25">head info</info>
</head>
<group name = "Component information">
<component compAddr="vendor" compId="12" resType="05" compType="0" compVer="1.0">./vendor.img</component>
<component compAddr="system" compId="18" resType="05" compType="0" compVer="1.0">./system.img</component>
</group>
</package>
得target_package目录结构如下:
$ tree target_package/
target_package/
├── MiniLoaderAll.bin
├── boot_linux.img
├── chip_prod.img
├── config.cfg
├── eng_system.img
├── parameter.txt
├── ramdisk.img
├── resource.img
├── rsa_private_key2048.pem
├── sys_prod.img
├── system.img
├── uboot.img
├── updater.img
├── updater_binary
├── updater_config
│ ├── BOARD.list
│ ├── VERSION.mbn
│ └── updater_specified_config.xml
├── userdata.img
└── vendor.img
packaging_tools$ python3 build_update.py ./target_package/ ./output_package/ -pk ./target_package/rsa_private_key2048.pem
2023-12-09 10:25:45 INFO : VERSION.mbn file parsing complete! path: ./target_package/updater_config/VERSION.mbn
2023-12-09 10:25:45 INFO : BOARD.list file parsing complete! path: ./target_package/updater_config/BOARD.list
2023-12-09 10:25:45 INFO : XML file parsing completed!
2023-12-09 10:25:45 INFO : []
2023-12-09 10:25:51 INFO : Image vendor full processing completed
2023-12-09 10:26:15 INFO : Image system full processing completed
2023-12-09 10:26:15 INFO : All full image processing completed! image count: 2
2023-12-09 10:26:16 INFO : Get hash content success! path: ./target_package/updater_config/VERSION.mbn
2023-12-09 10:26:16 INFO : Get hash content success! path: ./target_package/updater_config/BOARD.list
2023-12-09 10:26:17 INFO : Get hash content success! path: /home/xxx/ohos/OpenHarmony_v4.0_release/base/update/packaging_tools/target_package/full_imagevendoro3df0vi_
2023-12-09 10:26:26 INFO : Get hash content success! path: /home/xxx/ohos/OpenHarmony_v4.0_release/base/update/packaging_tools/target_package/full_imagesystemy76hegkf
2023-12-09 10:26:26 INFO : Write package header complete
2023-12-09 10:26:26 INFO : Add component b'/version_list'
2023-12-09 10:26:26 INFO : component information StartOffset:180
2023-12-09 10:26:26 INFO : Add component b'/board_list'
2023-12-09 10:26:26 INFO : component information StartOffset:267
2023-12-09 10:26:26 INFO : Add component b'/vendor'
2023-12-09 10:26:26 INFO : component information StartOffset:354
2023-12-09 10:26:26 INFO : Add component b'/system'
2023-12-09 10:26:26 INFO : component information StartOffset:441
2023-12-09 10:26:26 INFO : Write hashdata sign tlv complete
2023-12-09 10:26:26 INFO : .bin package header signing success! SignOffset: 806
2023-12-09 10:26:26 INFO : Add component to package StartOffset:806
2023-12-09 10:26:26 INFO : Write component complete ComponentSize:22
2023-12-09 10:26:26 INFO : Add component to package StartOffset:828
2023-12-09 10:26:26 INFO : Write component complete ComponentSize:14
2023-12-09 10:26:26 INFO : Add component to package StartOffset:842
2023-12-09 10:26:27 INFO : Write component complete ComponentSize:268431360
2023-12-09 10:26:27 INFO : Add component to package StartOffset:268432202
2023-12-09 10:26:38 INFO : Write component complete ComponentSize:1610608640
2023-12-09 10:26:38 INFO : Write update package complete
2023-12-09 10:26:38 INFO : Create update package .bin complete! path: /home/xxx/ohos/OpenHarmony_v4.0_release/base/update/packaging_tools/output_package/update_bin-fqvz8mcy
2023-12-09 10:26:38 INFO : Verse-script.us generation complete!
2023-12-09 10:26:38 INFO : loadScript.us generation complete!
2023-12-09 10:26:38 INFO : []
2023-12-09 10:27:20 INFO : []
2023-12-09 10:27:23 INFO : Resource cleaning completed!
得到生成的全量包:packaging_tools\output_package\updater_full.zip
将制作好的全量包updater_full.zip
放入设备,并设置reboot模式
> hdc file send xxx\OHOS\OpenHarmony_v4.0_Release\OTA_Package\output_package\updater_full.zip /data/updater/updater.zip
FileTransfer finish, Size:315251542, File count = 1, time:35248ms rate:8943.81kB/s
> hdc shell
#write_updater updater /data/updater/updater.zip
#reboot updater
OpenHarmony 3.2 OTA本地升级
升级成功后,设备自动重启。
打开桌面音乐应用
弹出用于授权弹框
使用IDE 过滤“PermissionManager_Log A”,结果如下
08-05 20:26:14.659 1659-1659/? I A0fefe/JsApp: PermissionManager_Log A:ServiceExtensionAbility onCreate, ability name is com.ohos.permissionmanager.GrantAbility
08-05 20:26:14.664 1659-1659/? I A0fefe/JsApp: PermissionManager_Log A:ServiceExtensionAbility onRequest. start id is 1
08-05 20:26:14.664 1659-1659/? I A0fefe/JsApp: PermissionManager_Log A:want: {"deviceId":"","bundleName":"com.ohos.permissionmanager","abilityName":"com.ohos.permissionmanager.GrantAbility","moduleName":"permissionmanager","uri":"","type":"","flags":0,"action":"","parameters":{"component.startup.newRules":true,"moduleName":"permissionmanager","ohos.aafwk.param.callerPid":1625,"ohos.aafwk.param.callerToken":537601482,"ohos.aafwk.param.callerUid":20010030,"ohos.ability.params.callback":{"type":"RemoteObject","value":{}},"ohos.ability.params.token":{"type":"RemoteObject","value":{}},"ohos.user.grant.permission":["ohos.permission.DISTRIBUTED_DATASYNC"],"ohos.user.grant.permission.state":[1]},"entities":[]}
08-05 20:26:14.669 1659-1659/? I A0fefe/JsApp: PermissionManager_Log A:create window
说明全量OTA升级成功且生效。
若升级失败,重启设备后取出/data/updater/log/updater_log,结合代码进行具体分析。
> hdc file recv /data/updater/log/updater_log C:\Users\xxx\Desktop\ota.log
例如:
现象:OTA全量升级,升级进度条即将跑完时,提示升级失败。
log部分内容如下:
2017-08-05 12:24:11 [INFO]UPDATER pkg_upgradefile.cpp 306 : Component packedSize 1610608640 unpackedSize 1610608640 /system
2017-08-05 12:24:30 [INFO]UPDATER pkg_pkgfile.cpp 70 : ExtractFile /data/updater/build_tools.zip.tmp
2017-08-05 12:24:30 [INFO]UPDATER pkg_zipfile.cpp 578 : packedSize: 1067369 unpackedSize: 1067800 offset header: 314190358 data: 314190403
2017-08-05 12:24:30 [INFO]UPDATER pkg_zipfile.cpp 161 : LoadPackage /data/updater/build_tools.zip.tmp :1067800
2017-08-05 12:24:30 [INFO]UPDATER pkg_zipfile.cpp 634 : packedSize: 94 unpackedSize: 156 offset header: 0 data: 45 Verse-script.us
2017-08-05 12:24:30 [INFO]UPDATER pkg_zipfile.cpp 634 : packedSize: 1067341 unpackedSize: 1661888 offset header: 139 data: 183 updater_binary
2017-08-05 12:24:30 [INFO]UPDATER pkg_zipfile.cpp 634 : packedSize: 31 unpackedSize: 33 offset header: 1067524 data: 1067567 loadScript.us
2017-08-05 12:24:30 [INFO]UPDATER updater.cpp 211 : Package bin file verified. start to install package...
2017-08-05 12:24:30 [INFO]UPDATER pkg_pkgfile.cpp 70 : ExtractFile /board_list
2017-08-05 12:24:30 [INFO]UPDATER pkg_upgradefile.cpp 515 : Unpack /board_list data offset:1205 packedSize:6 unpackedSize:6
2017-08-05 12:24:30 [INFO]UPDATER updater_preprocess.cpp 86 : Check board list success
2017-08-05 12:24:30 [INFO]UPDATER updater_preprocess.cpp 60 : current version:OpenHarmony 4.0.10.13
2017-08-05 12:24:30 [INFO]UPDATER pkg_pkgfile.cpp 70 : ExtractFile /version_list
2017-08-05 12:24:30 [INFO]UPDATER pkg_upgradefile.cpp 515 : Unpack /version_list data offset:1184 packedSize:21 unpackedSize:21
2017-08-05 12:24:30 [ERROR]UPDATER updater.cpp 213 : Version Check Fail...
2017-08-05 12:24:32 [INFO]UPDATER misc_info.cpp 94 : WriteUpdaterMiscMsg::misc path : /dev/block/platform/fe310000.sdhci/by-name/misc
2017-08-05 12:24:32 [INFO]UPDATER updater_ui_facade.cpp 101 : current progress 52
2017-08-05 12:24:34 [INFO]UPDATER updater_ui_facade.cpp 101 : current progress 76
2017-08-05 12:24:36 [INFO]UPDATER updater_ui_facade.cpp 101 : current progress 88
2017-08-05 12:24:38 [INFO]UPDATER updater_ui_facade.cpp 101 : current progress 94
2017-08-05 12:24:40 [INFO]UPDATER updater_ui_facade.cpp 101 : current progress 97
2017-08-05 12:24:42 [INFO]UPDATER updater_ui_facade.cpp 101 : current progress 98
2017-08-05 12:24:44 [INFO]UPDATER updater_ui_facade.cpp 101 : current progress 99
2017-08-05 12:24:46 [ERROR]UPDATER updater_main.cpp 417 : InstallUpdaterPackage failed! Pkg is /data/updater/updater.zip
2017-08-05 12:24:46 [ERROR]UPDATER utils.cpp 453 : open result file failed
2017-08-05 12:24:46 [ERROR]UPDATER dump.h 44 : 1
2017-08-05 12:24:46 [ERROR]UPDATER updater_main.cpp 437 : read result file error /data/updater/updater_result
2017-08-05 12:24:46 [INFO]UPDATER updater_main.cpp 455 : post over, writeBuffer = /data/updater/updater.zip|fail
2017-08-05 12:24:46 [INFO]UPDATER utils.cpp 465 : WriteDumpResult: /data/updater/updater.zip|fail
2017-08-05 12:25:00 [INFO]UPDATER updater_ui.cpp 103 : On Label Reboot
2017-08-05 12:25:00 [INFO]UPDATER utils.cpp 522 : updater mode
2017-08-05 12:25:00 [INFO]UPDATER mount.cpp 125 : /data already mounted
2017-08-05 12:25:00 [INFO]UPDATER mount.cpp 125 : /data/updater/log already mounted
分析:从log可以看出升级至99%时,安装OTA包异常,问题原因是Version Check Fail…,于是检查updater_specified_config.xml和VERSION.mbn,版本信息错位的写为OpenHarmony 4.0.10.14。
解决方案:修改updater_specified_config.xml和VERSION.mbn中版本信息与设备当前软件版本OpenHarmony 4.0.10.13一致,重新制作OTA全量包后升级。
4.0 release 分支需合入PR
修改组件对应的块错误
base/update/packaging_tools/blocks_manager.py
--- a/blocks_manager.py
+++ b/blocks_manager.py
@@ -27,6 +27,12 @@ class BlocksManager(object):
def __init__(self, range_data=None):
self.monotonic = False
if isinstance(range_data, str):
+ tmp_range = []
+ if range_data != "0":
+ for i in range_data.split():
+ if i != "0":
+ tmp_range.append(i)
+ range_data = ' '.join(tmp_range)
self.__parse_data_text(range_data)
elif range_data:
if len(range_data) % 2 != 0:
为了方便后续验证差分包升级是否有效,添加差异方便验证:
applications/standard/permission_manager/permissionmanager/src/main/ets/ServiceExtAbility/ServiceExtAbility.ts
import deviceInfo from '@ohos.deviceInfo';
-var TAG = "PermissionManager_Log:";
+var TAG = "PermissionManager_Log B:";
const BG_COLOR = '#00000000'
全量编译源码
$ ./build.sh -p rk3568 --ccache
得到系统镜像文件images和二进制升级文件updater_binary:
out/rk3568/packages/phone/images/
├── boot_linux.img
├── chip_prod.img
├── config.cfg
├── MiniLoaderAll.bin
├── parameter.txt
├── ramdisk.img
├── resource.img
├── sys_prod.img
├── system.img
├── uboot.img
├── updater.img
├── userdata.img
└── vendor.img
packaging_tools$mkdir lib
packaging_tools$cp -rf ../../../out/rk3568/clang_x64/updater/updater/diff lib/
packaging_tools$ cp -rf ../../../out/rk3568/clang_x64/thirdparty/e2fsprogs/* lib/
得到lib文件夹内容如下:
packaging_tools$ tree lib
lib
├── diff #取自out/rk3568/clang_x64/updater/updater/
├── e2fsck #及以下.so文件取自out/rk3568/clang_x64/thirdparty/e2fsprogs
├── e2fsdroid
├── libext2_blkid.so
├── libext2_com_err.so
├── libext2_e2p.so
├── libext2_misc.so
├── libext2_quota.so
├── libext2_uuid.so
├── libext2fs.so
└── mke2fs
packaging_tools$ cp -rf target_package/ source_package
更新target_package目录文件
packaging_tools$ cp -rf ../../../out/rk3568/packages/phone/images/* target_package/
packaging_tools$ cp -rf ../../../out/rk3568/packages/phone/system/bin/updater_binary target_package/updater_binary
softVersion
和compType
#updater_specified_config.xml, 修改softVersion需大于当前系统版本; compType设为1,表示增量;内容如下:
<?xml version="1.0"?>
<package>
<head name="Component header information">
<info fileVersion="01" prdID="RK3568" softVersion="4.0.10.16" date="2023-08-02" time="16:25">head info</info>
</head>
<group name = "Component information">
<component compAddr="vendor" compId="12" resType="05" compType="1" compVer="1.0">./vendor.img</component>
<component compAddr="system" compId="18" resType="05" compType="1" compVer="1.0">./system.img</component>
</group>
</package>
命令如下:
python3 build_update.py ./target_package/ ./output_package/ -s ./source_package/ -pk ./target_package/rsa_private_key2048.pem
packaging_tools$ python3 build_update.py ./target_package/ ./output_package/ -s ./source_package/ -pk ./target_package/rsa_private_key2048.pem
2023-12-09 11:13:03 INFO : VERSION.mbn file parsing complete! path: ./target_package/updater_config/VERSION.mbn
2023-12-09 11:13:03 INFO : BOARD.list file parsing complete! path: ./target_package/updater_config/BOARD.list
2023-12-09 11:13:03 INFO : XML file parsing completed!
2023-12-09 11:13:03 INFO : []
2023-12-09 11:13:03 INFO : []
2023-12-09 11:13:03 INFO : Apply DIFF type!
2023-12-09 11:13:03 INFO : Apply DIFF type!
2023-12-09 11:13:03 INFO : Apply DIFF type!
...
hoosedialog/input_method_choose_dialog.hap <blocks_manager.BlocksManager object at 0x7f219c499bb0>)
2023-12-09 11:13:40 INFO : Get hash content success! path: ./target_package/updater_config/VERSION.mbn
2023-12-09 11:13:40 INFO : Get hash content success! path: ./target_package/updater_config/BOARD.list
2023-12-09 11:13:40 INFO : Write package header complete
2023-12-09 11:13:40 INFO : Add component b'/version_list'
2023-12-09 11:13:40 INFO : component information StartOffset:180
2023-12-09 11:13:40 INFO : Add component b'/board_list'
2023-12-09 11:13:40 INFO : component information StartOffset:267
2023-12-09 11:13:40 INFO : Write hashdata sign tlv complete
2023-12-09 11:13:40 INFO : .bin package header signing success! SignOffset: 632
2023-12-09 11:13:40 INFO : Add component to package StartOffset:632
2023-12-09 11:13:40 INFO : Write component complete ComponentSize:22
2023-12-09 11:13:40 INFO : Add component to package StartOffset:654
2023-12-09 11:13:40 INFO : Write component complete ComponentSize:14
2023-12-09 11:13:40 INFO : Write update package complete
2023-12-09 11:13:40 INFO : Create update package .bin complete! path: /home/xxx/ohos/OpenHarmony_v4.0_release/base/update/packaging_tools/output_package/update_bin-lt9vc35q
2023-12-09 11:13:40 INFO : Verse-script.us generation complete!
2023-12-09 11:13:40 INFO : loadScript.us generation complete!
2023-12-09 11:13:40 INFO : []
2023-12-09 11:13:40 INFO : []
2023-12-09 11:13:41 INFO : Resource cleaning completed!
得到差分包output_package/updater_diff.zip
升级方法同全量包,将制作好的差分包updater_diff.zip
放入设备,并设置reboot模式
> hdc file send xxx\OHOS\OpenHarmony_v4.0_Release\OTA_Package\output_package\updater_diff.zip /data/updater/updater.zip
FileTransfer finish, Size:315251542, File count = 1, time:35248ms rate:8943.81kB/s
> hdc shell
#write_updater updater /data/updater/updater.zip
#reboot updater
使用IDE 过滤“PermissionManager_Log”,结果如下
08-05 20:26:14.659 1659-1659/? I A0fefe/JsApp: PermissionManager_Log B:ServiceExtensionAbility onCreate, ability name is com.ohos.permissionmanager.GrantAbility
08-05 20:26:14.664 1659-1659/? I A0fefe/JsApp: PermissionManager_Log B:ServiceExtensionAbility onRequest. start id is 1
08-05 20:26:14.664 1659-1659/? I A0fefe/JsApp: PermissionManager_Log B:want:
...
说明增量OTA升级成功且生效。
sudo pip install xmltodict
sudo pip install asn1crypto
packaging_tools下创建lib文件夹,放入以下文件
packaging_tools$ tree lib
lib
├── diff #取自out/rk3568/clang_x64/updater/updater/
├── e2fsck #及以下.so文件取自out/rk3568/clang_x64/thirdparty/e2fsprogs
├── e2fsdroid
├── libext2_blkid.so
├── libext2_com_err.so
├── libext2_e2p.so
├── libext2_misc.so
├── libext2_quota.so
├── libext2_uuid.so
├── libext2fs.so
└── mke2fs
packaging_tools$ python3 build_update.py ./target_package/ ./output_package/ -s ./source_package/ -pk ./target_package/rsa_private_key2048.pem
2023-12-09 11:05:58 INFO : VERSION.mbn file parsing complete! path: ./target_package/updater_config/VERSION.mbn
2023-12-09 11:05:58 INFO : BOARD.list file parsing complete! path: ./target_package/updater_config/BOARD.list
2023-12-09 11:05:58 INFO : XML file parsing completed!
2023-12-09 11:05:58 INFO : []
2023-12-09 11:05:58 ERROR : There is no incremental image, the - S parameter is not required!
2023-12-09 11:05:58 ERROR : Uncaught exception
Traceback (most recent call last):
File "build_update.py", line 897, in <module>
main()
File "build_update.py", line 861, in main
if incremental_processing(
File "build_update.py", line 768, in incremental_processing
raise RuntimeError
RuntimeError
2023-12-09 11:05:58 INFO : Exception occurred, Resource cleaning completed!
制作差分包,未检测到差异镜像,检查target_package/updater_config/updater_specified_config.xml softVersion
和compType
;softVersion需大于当前版本,compType为1。
packaging_tools$ python3 build_update.py ./target_package/ ./output_package/ -s ./source_package/ -pk ./target_package/rsa_private_key2048.pem
2023-12-07 10:05:38 INFO : VERSION.mbn file parsing complete! path: ./target_package/updater_config/VERSION.mbn
2023-12-07 10:05:38 INFO : BOARD.list file parsing complete! path: ./target_package/updater_config/BOARD.list
2023-12-07 10:05:38 INFO : XML file parsing completed!
2023-12-07 10:05:38 INFO : []
2023-12-07 10:05:38 ERROR : Uncaught exception
Traceback (most recent call last):
File "build_update.py", line 897, in <module>
main()
File "build_update.py", line 861, in main
if incremental_processing(
File "build_update.py", line 757, in incremental_processing
if increment_image_processing(
File "build_update.py", line 654, in increment_image_processing
IncUpdateImage(each_src_image_path, each_src_map_path)
File "/home/xxx/ohos/OpenHarmony_v4.0_release/base/update/packaging_tools/image_class.py", line 128, in __init__
self.parse_raw_image_file(image_path, map_path)
File "/home/xxx/ohos/OpenHarmony_v4.0_release/base/update/packaging_tools/image_class.py", line 167, in parse_raw_image_file
self.parse_block_map_file(map_path, f_r)
File "/home/xxx/ohos/OpenHarmony_v4.0_release/base/update/packaging_tools/image_class.py", line 188, in parse_block_map_file
raise RuntimeError
RuntimeError
2023-12-07 10:05:38 INFO : Exception occurred, Resource cleaning completed!
4.0 release分支,合入PR:
修改组件对应的块错误
base/update/packaging_tools/blocks_manager.py
--- a/blocks_manager.py
+++ b/blocks_manager.py
@@ -27,6 +27,12 @@ class BlocksManager(object):
def __init__(self, range_data=None):
self.monotonic = False
if isinstance(range_data, str):
+ tmp_range = []
+ if range_data != "0":
+ for i in range_data.split():
+ if i != "0":
+ tmp_range.append(i)
+ range_data = ' '.join(tmp_range)
self.__parse_data_text(range_data)
elif range_data:
if len(range_data) % 2 != 0:
packaging_tools$ python3 build_update.py ./target_package/ ./output_package/ -pk ./target_package/rsa_private_key2048.pem
2024-01-23 15:59:18 ERROR : Uncaught exception
Traceback (most recent call last):
File "build_update.py", line 55, in <module>
import patch_package_process
File "/home/xxx/OpenHarmony_4.0r/base/update/packaging_tools/patch_package_process.py", line 23, in <module>
from blocks_manager import BlocksManager
File "/home/xxx/OpenHarmony_4.0r/base/update/packaging_tools/blocks_manager.py", line 31
if range_data != "0":
^
IndentationError: unindent does not match any outer indentation level
/blocks_manager.py line 31附近存在代码格式缩进错误,查看文件:
更正缩进格式后运行正常。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。