peter 发表于 2021-7-21 16:21:49

windows git repo下载Android源码 windowserror 5错误

用windows搭建的git repo下载android源码,

前面挺顺利,但是到Syncing work tree步骤遇到报错
报错如下
File "E:\LocalProject\Oreo\.repo\repo\project.py", line 1294, in _CopyAndLinkF
    linkfile._Link()
File "E:\LocalProject\Oreo\.repo\repo\project.py", line 299, in _Link
    self.__linkIt(self.src_rel_to_dest, self.abs_dest)
File "E:\LocalProject\Oreo\.repo\repo\project.py", line 279, in __linkIt
    os.remove(absDest)
WindowsError: : u'E:\\LocalProject\\Oreo\\build/core定位到project.py文件,是这句 os.remove(absDest) 出错了,
跟下面这个贴子的大神改成这样
def __linkIt(self, relSrc, absDest):
    # link file if it does not exist or is out of date
    # if not os.path.islink(absDest) or (os.readlink(absDest) != relSrc):
    if not portable.os_path_islink(absDest) or (portable.os_path_realpath(absDest) != relSrc):
      try:
      # remove existing file first, since it might be read-only
      if os.path.lexists(absDest):
         #os.remove(absDest)
          if os.path.isfile(absDest):
                os.remove(absDest)
          else:
                os.removedirs(absDest)
      else:
          dest_dir = os.path.dirname(absDest)
          if not os.path.isdir(dest_dir):
            os.makedirs(dest_dir)
      # os.symlink(relSrc, absDest)
      portable.os_symlink(relSrc, absDest)
      except IOError:
      _error('Cannot link file %s to %s', relSrc, absDest)

问题解决了
参考
https://segmentfault.com/a/1190000015303640


新问题
error: invalid path 'frontend/client/src/autotest/public/Open+Sans:300.woff'
Traceback (most recent call last):
File "D:\git\tinkerR\.repo\repo/main.py", line 538, in <module>
    _Main(sys.argv)
File "D:\git\tinkerR\.repo\repo/main.py", line 512, in _Main
    result = repo._Run(argv) or 0
File "D:\git\tinkerR\.repo\repo/main.py", line 185, in _Run
    result = cmd.Execute(copts, cargs)
File "D:\git\tinkerR\.repo\repo\subcmds\sync.py", line 823, in Execute
    project.Sync_LocalHalf(syncbuf, force_sync=opt.force_sync)
File "D:\git\tinkerR\.repo\repo\project.py", line 1336, in Sync_LocalHalf
    self._InitWorkTree(force_sync=force_sync)
File "D:\git\tinkerR\.repo\repo\project.py", line 2503, in _InitWorkTree
    raise GitError("cannot initialize work tree")
error.GitError: cannot initialize work tree
解决方法:打开.repo\repo\project.py文件,屏蔽这两行
      #if GitCommand(self, cmd).Wait() != 0:
      #    raise GitError("cannot initialize work tree")


页: [1]
查看完整版本: windows git repo下载Android源码 windowserror 5错误