Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to properly run repo sync after forking AOSP manifest?

Recently I decided to dive into the Android Open Source Project world. This is how I picture my life will be with AOSP:

In order to dig into the AOSP world, I need to get my hands dirty and modify code in the projects. And I am going to do it on three different computers so I need to store my work in remote git repositories. So I need to fork the AOSP manifest in my own github account and work from that.

Say later I try to play with the frameworks project, then I need to fork this project into my own github account as well:

<project path="frameworks/base" name="platform/frameworks/base" groups="pdk-cw-fs,pdk-fs" />

Ideally, when I do a local repo sync, the frameworks/base project will be fetched from my own github account and all other projects will be fetched from google git repo.

Here is what I did in action:

What I want to do is forking the AOSP manifest git repo to my github and work from there. Then I do:

repo sync -u [email protected]:my_own_github_account/platform_manifest.git

Then I do:

repo sync

However I received a lot of error in the console like:

fatal: remote error: 
  my_own_github_account/platform/external/libopus is not a valid repository name
  Email [email protected] for help

It seems repo will assume the projects will come from the same base as the manifest project. I am not sure how to properly do a repo sync with a forked manifest.

Additionally, I am not sure if the way I tried to start work on AOSP is silly or unprofessional. If so I will appreciate it if you can point me to the right way of doing it. Thanks in advance.

like image 977
darklord Avatar asked Apr 04 '16 00:04

darklord


1 Answers

Actually I found this post here almost perfectly answered my question: https://www.primianotucci.com/blog/fork-android-on-github.

The reason I cannot do repo sync is because of this line in repo file:

<remote  name="aosp"
           fetch=".."
           review="https://android-review.googlesource.com/" />

The two dots means fetching projects relative to the repo manifest project itself. That's why repo is trying to sync from my_own_github_account

Then I changed it to

  <remote  name="aosp"
           fetch="https://android.googlesource.com" />

Then the repo sync works properly.

What if for a specific project I want to sync from my own github account?

Of course you need to mirror that project to your own github account. Then modify the manifest file like this:

Add this line to manifest file:

 <remote name="origin" fetch="https://github.com/my_own_github_account" />

The name is the remote fetching source you want to use for your own sub project.

Then add this:

<project path="frameworks/base" name="platform/base"
            remote="origin" revision="your_default_revision" />

Note that in order to override the default remote fetching source you need to add remote="origin".

Then when you do repo sync, repo will fetch framework/base from your own github account and fetch other projects from google source.

like image 142
darklord Avatar answered Sep 29 '22 14:09

darklord