I am trying to download the Android source code and am following the procedure described in https://source.android.com/source/downloading.html, which consists of installing the repo script and then running
$ repo init -u https://android.googlesource.com/platform/manifest
$ repo sync
to get the main branch. I have also tried using the -f -j1
flags to go through errors and use only one core, as was suggested somewhere online. At this point, I think I am very close to getting the entire thing downloaded but it will invariably stop towards the end when working on ipsec-tools. It always gives the following output:
Fetching project platform/external/ipsec-tools
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1 100 1 0 0 3 0 --:--:-- --:--:-- --:--:-- 3
100 1690k 100 1690k 0 0 2307k 0 --:--:-- --:--:-- --:--:-- 2307k
fatal: Not a git repository: '/home/sebastian/WORKING_DIR/.repo/projects/external/ipsec-tools.git'
fatal: Not a git repository: '/home/sebastian/WORKING_DIR/.repo/projects/external/ipsec-tools.git'
fatal: Not a git repository: '/home/sebastian/WORKING_DIR/.repo/projects/external/ipsec-tools.git'
Traceback (most recent call last):
File "/home/sebastian/WORKING_DIR/.repo/repo/main.py", line 500, in <module>
_Main(sys.argv[1:])
File "/home/sebastian/WORKING_DIR/.repo/repo/main.py", line 476, in _Main
result = repo._Run(argv) or 0
File "/home/sebastian/WORKING_DIR/.repo/repo/main.py", line 155, in _Run
result = cmd.Execute(copts, cargs)
File "/home/sebastian/WORKING_DIR/.repo/repo/subcmds/sync.py", line 635, in Execute
fetched = self._Fetch(to_fetch, opt)
File "/home/sebastian/WORKING_DIR/.repo/repo/subcmds/sync.py", line 339, in _Fetch
self._FetchProjectList(**kwargs)
File "/home/sebastian/WORKING_DIR/.repo/repo/subcmds/sync.py", line 234, in _FetchProjectList
success = self._FetchHelper(opt, project, *args, **kwargs)
File "/home/sebastian/WORKING_DIR/.repo/repo/subcmds/sync.py", line 275, in _FetchHelper
no_tags=opt.no_tags, archive=self.manifest.IsArchive)
File "/home/sebastian/WORKING_DIR/.repo/repo/project.py", line 1110, in Sync_NetworkHalf
no_tags=no_tags)):
File "/home/sebastian/WORKING_DIR/.repo/repo/project.py", line 1845, in _RemoteFetch
self.bare_git.pack_refs('--all', '--prune')
File "/home/sebastian/WORKING_DIR/.repo/repo/project.py", line 2483, in runner
p.stderr))
error.GitError: platform/external/ipsec-tools pack-refs: fatal: Not a git repository: '/home/sebastian/WORKING_DIR/.repo/projects/external/ipsec-tools.git'
Since it says it is not a git repository, I just went on a hunch and ran git init
on the directory it indicated, which didn't work. I also tried deleting the entire ipsec-tools.git directory and running repo sync again so that it would start from scratch but it always gives the same error.
Any ideas?
Its not necessary to start sync
from scratch. Android is a huge repository to download from scratch and in interest of saving time and internet one can remove specific git repository (generally I have seen only 1 git directory being corrupt) and re-run the sync.
repo
stores projects in
.repo/projects
but these are only soft links to actual git data, which is stored in
.repo/project-objects
follow the links in 'projects' and remove both the repositories and run sync again. It worked for me.
Sample for platform/frameworks/support:
rm -fr .repo/projects/frameworks/support.git/ .repo/project-objects/platform/frameworks/support.git/
Sync only this project:
repo sync -j4 platform/frameworks/support
[I wanted to add this as comment, but its not allowing me - so added as answer]
rm -Rf platform/external/ipsec-tools # from current path
rm -Rf .repo/projects/platform/external/ipsec-tools.git # soft links
rm -Rf .repo/project-objects/platform/external/ipsec-tools.git # actual git data
Better sync only the offending one:
repo sync platform/external/ipsec-tools
That worked for me for lineageos.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With