• (转)获取android源码时repo的错误


    今天用repo获取android源码:
    ../bin/repo init -u git://android.git.kernel.org/platform/manifest.git
    出现问题:
    问题一:
    Traceback (most recent call last):
    File "./repo", line 590, in <module>
        main(sys.argv[1:])
    File "./repo", line 557, in main
        _Init(args)
    File "./repo", line 176, in _Init
        _CheckGitVersion()
    File "./repo", line 205, in _CheckGitVersion
        proc = subprocess.Popen(cmd, stdout=subprocess.PIPE)
    File "/usr/lib/python2.5/subprocess.py", line 594, in __init__
        errread, errwrite)
    File "/usr/lib/python2.5/subprocess.py", line 1147, in _execute_child
        raise child_exception
    OSError: [Errno 2] No such file or directory

    原因:没有装git,faint
    解决:
    sudo apt-get install git
    sudo apt-get install git-core

    问题二:
    装好了git,再次运行:
    Traceback (most recent call last):
      File "/home/calvin/Android/Android2.0/source/.repo/repo/main.py", line 235, in <module>
        _Main(sys.argv[1:])
      File "/home/calvin/Android/Android2.0/source/.repo/repo/main.py", line 217, in _Main
        repo._Run(argv)
      File "/home/calvin/Android/Android2.0/source/.repo/repo/main.py", line 123, in _Run
        cmd.Execute(copts, cargs)
      File "/home/calvin/Android/Android2.0/source/.repo/repo/subcmds/init.py", line 223, in Execute
        self._ConfigureUser()
      File "/home/calvin/Android/Android2.0/source/.repo/repo/subcmds/init.py", line 165, in _ConfigureUser
        name  = self._Prompt('Your Name', mp.UserName)
      File "/home/calvin/Android/Android2.0/source/.repo/repo/project.py", line 306, in UserName
        self._LoadUserIdentity()
      File "/home/calvin/Android/Android2.0/source/.repo/repo/project.py", line 319, in _LoadUserIdentity
        u = self.bare_git.var('GIT_COMMITTER_IDENT')
      File "/home/calvin/Android/Android2.0/source/.repo/repo/project.py", line 1324, in runner
        p.stderr))
    error.GitError: manifests var: 
    *** Please tell me who you are.

    Run

      git config --global user.email "you@example.com"
      git config --global user.name "Your Name"

    to set your account's default identity.
    Omit --global to set the identity only in this repository.

    fatal: empty ident  <calvin@lihao-desktop.(none)> not allowed

    解决:
    看来的告知自己的身份才行。
    运行:
    [calvin@lihao-desktop ~/Android/Android2.0/source 18:44:28]$ git config --global user.email "lihao921@gmail.com"
    [calvin@lihao-desktop ~/Android/Android2.0/source 18:44:28]$ git config --global user.name "Cavin Lee"
    再运行repo:
    [calvin@lihao-desktop ~/Android/Android2.0/source 18:45:00]$ ../bin/repo init -u git://android.git.kernel.org/platform/manifest.git

    Your Name  [Cavin Lee]: 
    Your Email [lihao921@gmail.com]: 

    Your identity is: Cavin Lee <lihao921@gmail.com>
    is this correct [y/n]? y

    Testing colorized output (for 'repo diff', 'repo status'):
      black    red      green    yellow   blue     magenta   cyan     white 
      bold     dim      ul       reverse 
    Enable color display in this user account (y/n)? y

    repo initialized in /home/calvin/Android/Android2.0/source(出现这个提示说明成功了)

    接下来同步代码:
    [calvin@lihao-desktop ~/Android/Android2.0/source 18:54:50]$ ../bin/repo sync

    问题三:
    同步代码时不断出现诸如 remote end hung up unexpectedly错误:
    Fetching projects:   1% (2/158)  
    Initializing project platform/bootable/bootloader/legacy ...
    fatal: The remote end hung up unexpectedly
    error: Cannot fetch platform/bootable/bootloader/legacy
    看样子是server的问题。
    解决:
    参考:http://android.amberfog.com/?p=230
    http://code.google.com/p/android/issues/detail?id=4488

    sudo gedit  .repo/repo/subcmds/sync.py
    修改_Fetch函数为:
      def _Fetch(self, projects):
        fetched 
    = set()
        pm 
    = Progress('Fetching projects', len(projects))
        
    for project in projects:
          pm.update()
          
    while True:
           
    if project.Sync_NetworkHalf():
            fetched.add(project.gitdir)
            
    break
           
    else:
            
    print >>sys.stderr, 'error: Cannot fetch %s' % project.name
        pm.end()
        
    return fetched
    注意代码缩进问题,相应的代码段缩进要完全一样。
  • 相关阅读:
    写简单游戏,学编程语言-python篇
    RSS阅读器python实现概述
    python简易爬虫来实现自动图片下载
    SQL SERVER 2008 R2 SP3 发布
    动态规划问题总结 (转载)
    typedef with const 联合的说明
    C++ 初始化列表
    C++de构造函数
    排序算法温习
    java中读取properties配置文件用例
  • 原文地址:https://www.cnblogs.com/lihaiping/p/repo.html
Copyright © 2020-2023  润新知