关于Amdroid 4.0编译生成Recovery的一个错误:ValueError: too many values to unpack

在制作差分包的过程中发现这个问题,后来发现这个项目在编译的过程中就已经报错了,只是不影响.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/{Project Name}/{Project Name}-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



参考:http://blog.csdn.net/npjocj/article/details/12624043

你可能感兴趣的:(关于Amdroid 4.0编译生成Recovery的一个错误:ValueError: too many values to unpack)