在製作差分包的過程中發現這個問題,後來發現這個項目在編譯的過程中就已經報錯了,只是不影響.img .bin文件的生成而已。
錯誤提示:
Traceback (most recent call last):
File "./build/tools/releasetools/ota_from_target_files", line 1107, in <module>
main(sys.argv[1:])
File "./build/tools/releasetools/ota_from_target_files", line 1075, in main
WriteFullOTAPackage(input_zip, output_zip, OPTIONS.fota)
File "./build/tools/releasetools/ota_from_target_files", line 460, in WriteFullOTAPackage
Item.GetMetadata(input_zip)
File "./build/tools/releasetools/ota_from_target_files", line 177, in GetMetadata
name, uid, gid, mode = line.split()
ValueError: too many values to unpack
make: *** [out/{Project Name}/target/product/<span style="font-family:Arial,Helvetica,sans-serif">{Project Name}</span>/<span style="font-family:Arial,Helvetica,sans-serif">{Project Name}</span>-ota-eng.root_2k.zip] Error 1
錯誤的函數:
def GetMetadata(cls, input_zip):
try:
# See if the target_files contains a record of what the uid,
# gid, and mode is supposed to be.
output = input_zip.read("META/filesystem_config.txt")
except KeyError:
# Run the external 'fs_config' program to determine the desired
# uid, gid, and mode for every Item object. Note this uses the
# one in the client now, which might not be the same as the one
# used when this target_files was built.
p = common.Run(["fs_config"], stdin=subprocess.PIPE,
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
suffix = { False: "", True: "/" }
input = "".join(["%s%s\n" % (i.name, suffix[i.dir])
for i in cls.ITEMS.itervalues() if i.name])
output, error = p.communicate(input)
assert not error
for line in output.split("\n"):
if not line: continue
name, uid, gid, mode = line.split()
i = cls.ITEMS.get(name, None)
if i is not None:
i.uid = int(uid)
i.gid = int(gid)
i.mode = int(mode, 8)
if i.dir:
i.children.sort(key=lambda i: i.name)
# set metadata for the files generated by this script.
i = cls.ITEMS.get("system/recovery-from-boot.p", None)
if i: i.uid, i.gid, i.mode = 0, 0, 0644
i = cls.ITEMS.get("system/etc/install-recovery.sh", None)
if i: i.uid, i.gid, i.mode = 0, 0, 0544
解決:這個問題最終解決了,首先回顧項目背景
改項目有通過暗碼可以切換19個運營商,因爲各個運營商開關機動畫,壁紙等不一樣,還有一些出廠自帶的apk,也對有的apk做了過濾,爲了能正常切換對應運營商實現不同定製,生成編譯文件系統中添加了 /SYSTEM/vendor/thirdparty目錄並且添加了客戶提供的幾個apk。
在編譯後filesystem_config.txt中也有該目錄的體現。但是因爲提交apk時直接按照客戶給的,沒有重命名apk,而apk名字中有空格,就導致了該問題。
錯誤2
Traceback (most recent call last):
File "./build/tools/releasetools/ota_from_target_files", line 1159, in <module>
main(sys.argv[1:])
File "./build/tools/releasetools/ota_from_target_files", line 1136, in main
OPTIONS.source_info_dict = common.LoadInfoDict(source_zip, OPTIONS.device_type)
File "/workspace/Q885SHIP/build/tools/releasetools/common.py", line 111, in LoadInfoDict
raise ValueError("can't find recovery API version in input target-files")
ValueError: can't find recovery API version in input target-files