How to download only one Android source code project using repo
July 2014.
Situation
You want to submit a small patch to an Android source project.
You don't want to download the entire 14GB Android source code.
What you did
Initialize repo.
repo init -u https://android.googlesource.com/platform/manifest
Get https://gerrit.googlesource.com/git-repo
remote: Counting objects: 117, done
remote: Finding sources: 100% (117/117)
remote: Total 2879 (delta 1523), reused 2879 (delta 1523)
Receiving objects: 100% (2879/2879), 2.44 MiB | 696 KiB/s, done.
Resolving deltas: 100% (1523/1523), done.
From https://gerrit.googlesource.com/git-repo
* [new branch] maint -> origin/maint
* [new branch] master -> origin/master
* [new branch] stable -> origin/stable
* [new tag] v1.0 -> v1.0
* [new tag] v1.0.1 -> v1.0.1
[...]
Get https://android.googlesource.com/platform/manifest
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
curl: (22) The requested URL returned error: 404 Not Found
Server does not provide clone.bundle; ignoring.
remote: Counting objects: 110, done
remote: Finding sources: 100% (110/110)
remote: Total 1345 (delta 288), reused 1345 (delta 288)
Receiving objects: 100% (1345/1345), 1.13 MiB | 479 KiB/s, done.
Resolving deltas: 100% (288/288), done.
From https://android.googlesource.com/platform/manifest
[...]
* [new tag] android-sdk-support_r11 -> android-sdk-support_r11
Your Name [U-dl_muriers_em\ZWM]: Erwan Martin
Your Email [ZWM@dl_muriers_em.(none)]: public@fzwte.net
Your identity is: Erwan Martin
is this correct [y/N]? y
repo has been initialized in /home/ZWM
Sync the project.
repo sync platform/tools/base
Traceback (most recent call last):
File "/home/ZWM/.repo/repo/main.py", line 500, in
_Main(sys.argv[1:])
File "/home/ZWM/.repo/repo/main.py", line 476, in _Main
result = repo._Run(argv) or 0
File "/home/ZWM/.repo/repo/main.py", line 155, in _Run
result = cmd.Execute(copts, cargs)
File "/home/ZWM/.repo/repo/subcmds/sync.py", line 624, in Execute
submodules_ok=opt.fetch_submodules)
File "/home/ZWM/.repo/repo/command.py", line 184, in GetProjects
raise InvalidProjectGroupsError(arg)
error.InvalidProjectGroupsError
InvalidProjectGroupsError
? Whaaaaaat!?Why did that happen
Let's open
.repo/repo/command.py
and go where the command failed.
for project in projects:
if not missing_ok and not project.Exists:
raise NoSuchProjectError(arg)
if not project.MatchesGroups(groups):
raise InvalidProjectGroupsError(arg)
Apparently, a notion of group exists. Let's open the manifest and see in what group our project is.
[...]
notdefault
? That doesn't sound good.What you should have done
Init repo including group
tools
.
repo init -u https://android.googlesource.com/platform/manifest -g tools
[...]
Sync the project.
repo sync platform/tools/base
Fetching project platform/tools/base
[...]
Fetching projects: 100% (1/1), done.
Checking out files: 100% (5614/5614), done.
Create and checkout your branch.
repo start your-local-branch-name platform/tools/base
Work your magic and upload your changes.
repo upload
Reference
- Submitting Patches (source.android.com)
- Developing (source.android.com)
- Repo command reference (source.android.com)