擷取android源碼時repo的錯誤

來源:互聯網
上載者:User

標籤:des   android   http   io   ar   color   os   sp   for   

今天用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 "[email protected]"
  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  <[email protected](none)> not allowed

解決:
看來的告知自己的身份才行。
運行:
[[email protected] ~/Android/Android2.0/source 18:44:28]$ git config --global user.email "[email protected]"
[[email protected] ~/Android/Android2.0/source 18:44:28]$ git config --global user.name "Cavin Lee"
再運行repo:
[[email protected] ~/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 [[email protected]]: 

Your identity is: Cavin Lee <[email protected]>
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(出現這個提示說明成功了)

接下來同步代碼:
[[email protected] ~/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

注意代碼縮排問題,相應的程式碼片段縮排要完全一樣。

擷取android源碼時repo的錯誤

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.