taotoolkit 1.1.4__tar.gz → 1.1.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {taotoolkit-1.1.4 → taotoolkit-1.1.6}/PKG-INFO +1 -1
- {taotoolkit-1.1.4 → taotoolkit-1.1.6}/pyproject.toml +1 -1
- {taotoolkit-1.1.4 → taotoolkit-1.1.6}/taotoolkit/__init__.py +1 -1
- {taotoolkit-1.1.4 → taotoolkit-1.1.6}/taotoolkit/tao_common.py +1 -1
- {taotoolkit-1.1.4 → taotoolkit-1.1.6}/taotoolkit/tao_flash.py +42 -5
- {taotoolkit-1.1.4 → taotoolkit-1.1.6}/taotoolkit/tao_tuning.py +12 -6
- {taotoolkit-1.1.4 → taotoolkit-1.1.6}/taotoolkit.egg-info/PKG-INFO +1 -1
- {taotoolkit-1.1.4 → taotoolkit-1.1.6}/README.md +0 -0
- {taotoolkit-1.1.4 → taotoolkit-1.1.6}/setup.cfg +0 -0
- {taotoolkit-1.1.4 → taotoolkit-1.1.6}/taotoolkit/asrVrf.py +0 -0
- {taotoolkit-1.1.4 → taotoolkit-1.1.6}/taotoolkit/tao_camDvt.py +0 -0
- {taotoolkit-1.1.4 → taotoolkit-1.1.6}/taotoolkit/tao_cmdTool.py +0 -0
- {taotoolkit-1.1.4 → taotoolkit-1.1.6}/taotoolkit/tao_device.py +0 -0
- {taotoolkit-1.1.4 → taotoolkit-1.1.6}/taotoolkit/tao_vrfTool.py +0 -0
- {taotoolkit-1.1.4 → taotoolkit-1.1.6}/taotoolkit.egg-info/SOURCES.txt +0 -0
- {taotoolkit-1.1.4 → taotoolkit-1.1.6}/taotoolkit.egg-info/dependency_links.txt +0 -0
- {taotoolkit-1.1.4 → taotoolkit-1.1.6}/taotoolkit.egg-info/requires.txt +0 -0
- {taotoolkit-1.1.4 → taotoolkit-1.1.6}/taotoolkit.egg-info/top_level.txt +0 -0
|
@@ -17,7 +17,7 @@ from time import sleep
|
|
|
17
17
|
from bs4 import BeautifulSoup as bs
|
|
18
18
|
from datetime import datetime
|
|
19
19
|
from pathlib import Path
|
|
20
|
-
from typing import Dict, Any, Optional, Union
|
|
20
|
+
from typing import Dict, Any, Optional, Union, Tuple, List
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
from .tao_common import (
|
|
@@ -46,7 +46,9 @@ from .tao_device import DevOp
|
|
|
46
46
|
|
|
47
47
|
class jenkinsTool:
|
|
48
48
|
# logging.getLogger("urllib3").setLevel(logging.WARNING)
|
|
49
|
-
def __init__(
|
|
49
|
+
def __init__(
|
|
50
|
+
self, branch, buildTag, ciOwner, isUserDebug=0, retainUserData=0, jenkinsUser=None, jenkinsPassword=None, ignore=None
|
|
51
|
+
):
|
|
50
52
|
self.jenkinsUrl = "http://build.asrmicro.com/"
|
|
51
53
|
self.jenkinsUser = jenkinsUser if jenkinsUser else os.environ.get("JENKINS_USERNAME", "")
|
|
52
54
|
self.jenkinsPassword = jenkinsPassword if jenkinsPassword else os.environ.get("JENKINS_PASSWORD", "")
|
|
@@ -57,6 +59,7 @@ class jenkinsTool:
|
|
|
57
59
|
self.isUserDebug = True if isUserDebug == 1 else False
|
|
58
60
|
self.packageFile = "release.zip"
|
|
59
61
|
self.retainUserData = True if retainUserData == 1 else False # 是否保留用户数据,默认不保留
|
|
62
|
+
self.ignore = ignore if ignore else [] # 忽略包含指定字符串的board zip包和cfg文件
|
|
60
63
|
if sysVersion == "linux":
|
|
61
64
|
self.downloadPath = "/home/local/Downloads/jenkin" # 下载路径和解压路径
|
|
62
65
|
self.extractPath = self.downloadPath
|
|
@@ -85,6 +88,11 @@ class jenkinsTool:
|
|
|
85
88
|
if len(foundBoard) == 0:
|
|
86
89
|
buildType = "userdebug" if self.isUserDebug else "release"
|
|
87
90
|
eExit(f"no board found in {jobName} buildID {build_info['number']} buildType {buildType}")
|
|
91
|
+
if self.ignore:
|
|
92
|
+
foundBoard = {i: v for i, (k, v) in enumerate(foundBoard.items()) if not any(ig in v for ig in self.ignore)}
|
|
93
|
+
if not foundBoard:
|
|
94
|
+
eExit(f"all boards filtered out by ignore {self.ignore}")
|
|
95
|
+
|
|
88
96
|
for k, v in foundBoard.items():
|
|
89
97
|
print(k, v)
|
|
90
98
|
|
|
@@ -116,6 +124,10 @@ class jenkinsTool:
|
|
|
116
124
|
pickZipList.append(a)
|
|
117
125
|
|
|
118
126
|
logd(f"allZipList: {allZipList}")
|
|
127
|
+
if self.ignore:
|
|
128
|
+
pickZipList = [v for v in pickZipList if not any(ig in v["relativePath"] for ig in self.ignore)]
|
|
129
|
+
if not pickZipList:
|
|
130
|
+
eExit(f"all boards filtered out by ignore {self.ignore}")
|
|
119
131
|
if len(pickZipList) == 1:
|
|
120
132
|
zip_artifact = pickZipList[0]
|
|
121
133
|
elif len(pickZipList) == 0:
|
|
@@ -385,7 +397,10 @@ class jenkinsTool:
|
|
|
385
397
|
candidates = matched if matched else boards
|
|
386
398
|
if self.isUserDebug:
|
|
387
399
|
candidates = [b for b in candidates if "userdebug" in b] or candidates
|
|
388
|
-
|
|
400
|
+
if self.ignore:
|
|
401
|
+
candidates = [v for v in candidates if not any(ig in v for ig in self.ignore)]
|
|
402
|
+
if not candidates:
|
|
403
|
+
eExit(f"all boards filtered out by ignore {self.ignore}")
|
|
389
404
|
print(f"\n在文件服务器找到如下 board,请选择:")
|
|
390
405
|
for i, b in enumerate(candidates):
|
|
391
406
|
print(f" {i}: {b}")
|
|
@@ -642,6 +657,10 @@ class jenkinsTool:
|
|
|
642
657
|
if i.endswith(".cfg"):
|
|
643
658
|
if cfgFlag in i:
|
|
644
659
|
boardList.append(i)
|
|
660
|
+
if self.ignore:
|
|
661
|
+
boardList = {i: v for i, v in enumerate(boardList) if not any(ig in v for ig in self.ignore)}
|
|
662
|
+
if not boardList:
|
|
663
|
+
eExit(f"all boards filtered out by ignore {self.ignore}")
|
|
645
664
|
if len(boardList) == 1:
|
|
646
665
|
return boardList[0]
|
|
647
666
|
elif len(boardList) == 0:
|
|
@@ -695,6 +714,8 @@ class jenkinsTool:
|
|
|
695
714
|
for i in fileList:
|
|
696
715
|
if i.endswith(".cfg"):
|
|
697
716
|
cfgList.append(i)
|
|
717
|
+
if self.ignore:
|
|
718
|
+
cfgList = [i for i in cfgList if not any(ig in i for ig in self.ignore)]
|
|
698
719
|
if boardTag == None:
|
|
699
720
|
if len(cfgList) == 1:
|
|
700
721
|
cfgFIle = cfgList[0]
|
|
@@ -766,6 +787,10 @@ class jenkinsTool:
|
|
|
766
787
|
# 如果下载失败,列出所有board,用户选择一个board下载
|
|
767
788
|
boardUrl = f"http://10.1.24.40/{ciTag}/{buildNumber}"
|
|
768
789
|
boardDict = self.getJenkinsBoard(boardUrl)
|
|
790
|
+
if self.ignore:
|
|
791
|
+
boardDict = {i: v for i, (k, v) in enumerate(boardDict.items()) if not any(ig in v for ig in self.ignore)}
|
|
792
|
+
if not boardDict:
|
|
793
|
+
eExit(f"all boards filtered out by ignore {self.ignore}")
|
|
769
794
|
logi(f"choose a board from {self.joinBackslash(self.baseUrl,self.branch,buildNumber)}")
|
|
770
795
|
for k, v in boardDict.items():
|
|
771
796
|
print(k, v[:-1])
|
|
@@ -835,6 +860,7 @@ class JenkinsConfigManager:
|
|
|
835
860
|
"ratainUserData": "0", # 1=保留userdata, 0=不保留
|
|
836
861
|
"jenkinUser": "", # Jenkins用户名(空字符串表示未设置)
|
|
837
862
|
"jenkinPassword": "", # Jenkins密码或API Token(空字符串表示未设置)
|
|
863
|
+
"ignore": [], # 忽略包含指定字符串的board zip包和cfg文件
|
|
838
864
|
}
|
|
839
865
|
|
|
840
866
|
def get_field_descriptions(self) -> Dict[str, str]:
|
|
@@ -849,6 +875,7 @@ class JenkinsConfigManager:
|
|
|
849
875
|
"ratainUserData": "烧录时是否保留userdata: 1=保留, 0=不保留",
|
|
850
876
|
"jenkinUser": "Jenkins用户名(用于API认证,为空将读取环境变量JENKINS_USERNAME)",
|
|
851
877
|
"jenkinPassword": "Jenkins密码或API Token(建议使用API Token,为空将读取环境变量JENKINS_PASSWORD)",
|
|
878
|
+
"ignore": "忽略包含指定字符串的board zip包和cfg文件(列表)",
|
|
852
879
|
}
|
|
853
880
|
|
|
854
881
|
def get_field_choices(self) -> Dict[str, list]:
|
|
@@ -896,6 +923,7 @@ class JenkinsConfigManager:
|
|
|
896
923
|
"ratainUserData",
|
|
897
924
|
"jenkinUser",
|
|
898
925
|
"jenkinPassword",
|
|
926
|
+
"ignore",
|
|
899
927
|
]
|
|
900
928
|
|
|
901
929
|
# 构建要保存的参数字典(保持顺序)
|
|
@@ -1091,7 +1119,7 @@ class JenkinsConfigManager:
|
|
|
1091
1119
|
logd(f" 合并后的参数: {result}")
|
|
1092
1120
|
return argparse.Namespace(**result)
|
|
1093
1121
|
|
|
1094
|
-
def validate_params(self, params: Dict[str, Any]) ->
|
|
1122
|
+
def validate_params(self, params: Dict[str, Any]) -> Tuple[bool, List[str]]:
|
|
1095
1123
|
"""
|
|
1096
1124
|
验证参数是否符合要求
|
|
1097
1125
|
|
|
@@ -1165,6 +1193,14 @@ def create_argument_parser() -> argparse.ArgumentParser:
|
|
|
1165
1193
|
parser.add_argument(
|
|
1166
1194
|
"-r", "--ratainUserData", type=str, default="0", choices=["0", "1"], help="烧录是否保留userdata (1=保留, 0=不保留)"
|
|
1167
1195
|
)
|
|
1196
|
+
parser.add_argument(
|
|
1197
|
+
"-i",
|
|
1198
|
+
"--ignore",
|
|
1199
|
+
nargs="*",
|
|
1200
|
+
type=str,
|
|
1201
|
+
default=[],
|
|
1202
|
+
help="忽略包含指定字符串的board zip包和cfg文件 (可指定多个, 默认为空)",
|
|
1203
|
+
)
|
|
1168
1204
|
parser.add_argument("--jenkinUser", type=str, default="", help="jenkins用户名(可选), 为空将读取环境变量JENKINS_USERNAME")
|
|
1169
1205
|
parser.add_argument(
|
|
1170
1206
|
"--jenkinPassword", type=str, default="", help="jenkins密码或API Token(可选), 为空将读取环境变量JENKINS_PASSWORD"
|
|
@@ -1248,10 +1284,11 @@ def build_with_params(params: Dict[str, Any]):
|
|
|
1248
1284
|
ratainUserData = params.get("ratainUserData", 0)
|
|
1249
1285
|
buildNum = params.get("buildNum", 0)
|
|
1250
1286
|
board = params.get("board", "xxx")
|
|
1287
|
+
ignore = params.get("ignore", [])
|
|
1251
1288
|
logd(
|
|
1252
1289
|
f"branch: {branch}, buildType: {buildType}, ciOwner: {ciOwner}, isUerDebug: {isUerDebug}, ratainUserData: {ratainUserData} ,jenkinUser: {jenkinUser}, jenkinPassword: {jenkinPassword}"
|
|
1253
1290
|
)
|
|
1254
|
-
jenks = jenkinsTool(branch, buildType, ciOwner, isUerDebug, ratainUserData, jenkinUser, jenkinPassword)
|
|
1291
|
+
jenks = jenkinsTool(branch, buildType, ciOwner, isUerDebug, ratainUserData, jenkinUser, jenkinPassword, ignore)
|
|
1255
1292
|
jenks.downloadJenkins(buildNum, board)
|
|
1256
1293
|
|
|
1257
1294
|
|
|
@@ -794,13 +794,19 @@ class asrCamOp(DevOp):
|
|
|
794
794
|
)
|
|
795
795
|
elif os.path.isdir(path):
|
|
796
796
|
index = 0
|
|
797
|
+
shortIndex = 0
|
|
797
798
|
vrfFiles = findFilesWithSuffix(path, ".vrf")
|
|
798
799
|
if ignoreTag is not None:
|
|
799
800
|
for tag in ignoreTag:
|
|
800
801
|
vrfFiles = removeAnyContainStr(tag, vrfFiles, matchCase)
|
|
801
802
|
vrfFiles.sort(key=lambda x: x.split("_")[0])
|
|
802
803
|
for vrf in vrfFiles:
|
|
803
|
-
|
|
804
|
+
if "short" in vrf:
|
|
805
|
+
target = f"{id}_sensor_hdr_{shortIndex}.vrf"
|
|
806
|
+
shortIndex += 1
|
|
807
|
+
else:
|
|
808
|
+
target = f"{id}_sensor_{index}.vrf"
|
|
809
|
+
index += 1
|
|
804
810
|
if renameVrf:
|
|
805
811
|
out, _ = rCmd(
|
|
806
812
|
f"adb -s {self.serial} push {vrf} vendor/etc/camera/{target}",
|
|
@@ -815,7 +821,7 @@ class asrCamOp(DevOp):
|
|
|
815
821
|
showRet=True,
|
|
816
822
|
logLevel="info",
|
|
817
823
|
)
|
|
818
|
-
|
|
824
|
+
|
|
819
825
|
if "Read-only" in out:
|
|
820
826
|
eExit("device is Read-only, may need remount")
|
|
821
827
|
rCmd("adb shell am start -a android.media.action.STILL_IMAGE_CAMERA")
|
|
@@ -967,7 +973,7 @@ class asrCamOp(DevOp):
|
|
|
967
973
|
else:
|
|
968
974
|
eExit("抓取vrf失败")
|
|
969
975
|
|
|
970
|
-
def
|
|
976
|
+
def capVRFDove(self, name="null"):
|
|
971
977
|
outPath = self.curPath
|
|
972
978
|
if name == "null":
|
|
973
979
|
logi(f"capture vrf without name to {outPath}")
|
|
@@ -1053,7 +1059,7 @@ class asrCamOp(DevOp):
|
|
|
1053
1059
|
foundedVRF = False
|
|
1054
1060
|
foundedJPG = False
|
|
1055
1061
|
pulledNameList = []
|
|
1056
|
-
max_attempts =
|
|
1062
|
+
max_attempts = 2
|
|
1057
1063
|
totalVRFNum = 0
|
|
1058
1064
|
for _ in range(max_attempts):
|
|
1059
1065
|
fileList = self.getSuffixList(vrfPath, "jpg", "jpeg", "vrf")
|
|
@@ -1156,13 +1162,13 @@ def CLI_capVrf(argsList):
|
|
|
1156
1162
|
if asrCam.soc in ["lark", "larkl", "larkpro"]:
|
|
1157
1163
|
asrCam.capVRFLark()
|
|
1158
1164
|
else:
|
|
1159
|
-
asrCam.
|
|
1165
|
+
asrCam.capVRFDove()
|
|
1160
1166
|
else:
|
|
1161
1167
|
name = args.file
|
|
1162
1168
|
if asrCam.soc in ["lark", "larkl", "larkpro"]:
|
|
1163
1169
|
asrCam.capVRFLark(name)
|
|
1164
1170
|
else:
|
|
1165
|
-
asrCam.
|
|
1171
|
+
asrCam.capVRFDove(name)
|
|
1166
1172
|
asrCam.setRawDump(0)
|
|
1167
1173
|
|
|
1168
1174
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|