在生成差分包的时候提示
File"../build/tools/releasetools/edify_generator.py",line 213, in SetPermissions
self.script.append('set_perm(%d, %d, 0%o, "%s");' % (uid, gid,mode, fn))
script.SetPermissions("/"+item.name, item.uid, item.gid,item.mode)
TypeError: %d format: a number is required, not NoneType
在网上搜索出现这个问题是由于有中文命名的文件导致,但是怎么查出是哪个地方的中文文件导致了这个错误,通过在edify_generator.py加打印可确认文件名字。
def SetPermissions(self, fn, uid, gid, mode, selabel, capabilities):
"""Set file ownership and permissions."""
if not self.info.get("use_set_metadata", False):
self.script.append('set_perm(%d, %d, 0%o, "%s");' % (uid, gid, mode, fn))
else:
print "=================fn %s ==========" % (fn,)
if capabilities is None: capabilities = "0x0"
cmd = 'set_metadata("%s", "uid", %d, "gid", %d, "mode", 0%o, ' \
'"capabilities", %s' % (fn, uid, gid, mode, capabilities)
if selabel is not None:
cmd += ', "selabel", "%s"' % ( selabel )
cmd += ');'
print "=================cmd %s ==========" % (cmd,)
self.script.append(cmd)
在网上搜索出现这个问题是由于有中文命名的文件导致,但是怎么查出是哪个地方的中文文件导致了这个错误,通过在edify_generator.py加打印可确认文件名字。
def SetPermissions(self, fn, uid, gid, mode, selabel, capabilities):
"""Set file ownership and permissions."""
if not self.info.get("use_set_metadata", False):
self.script.append('set_perm(%d, %d, 0%o, "%s");' % (uid, gid, mode, fn))
else:
print "=================fn %s ==========" % (fn,)
if capabilities is None: capabilities = "0x0"
cmd = 'set_metadata("%s", "uid", %d, "gid", %d, "mode", 0%o, ' \
'"capabilities", %s' % (fn, uid, gid, mode, capabilities)
if selabel is not None:
cmd += ', "selabel", "%s"' % ( selabel )
cmd += ');'
print "=================cmd %s ==========" % (cmd,)
self.script.append(cmd)