Setting up Local AOSP Git/Gerrit Server

594 views
Skip to first unread message

Gani Koduri

unread,
Sep 19, 2019, 8:38:14 PM9/19/19
to Repo and Gerrit Discussion
Hi,

I am looking for setting up a local AOSP repo using the base version provided by 3rd Party and I am new to this repo world :-)

I did some research and came up with few queries for expert advice. Please help.

This is what I want to achieve: 
1. I wanted this repo to act as a base version for all the development work on a local Git Server. 
2. Even I was thinking to have Gerrit installed for this code base. So, that all review process stays on my site. [Not sure if this is achievable though] 
3. At the same time, I will need the code updates from 3rd Party at regular intervals and also, I will be required to push my development changes to the 3rd Party.

I found that there is --mirror option of repo command. 
I am trying to understand if that will help to achieve the above goals. 

I have following queries: 

1. In case of setting up repo mirror from AOSP googlesource, i see that mirror manifest is used for syncing. 
    Does it mean, 3rd Party has to take care of creating this mirror manifest ? or can i use platform/manifest to trigger repo init with mirror option ? 

2. Mirror option gets the revision history and can help to sync to 3rd Party code regularly. 
    Can this even help me to push code to the 3rd Party as well? But in this case, I cant have Gerrit in the local Git server right ?
    Does it mean, all code to be pushed to 3rd Party and I shall be using Gerrit on 3rd Party server for review process.

3. If it was just a single git repository, i found that git fetch from one repo repository(3rd Party) and git push to other repository(Local Git Server) by switching the git remote . 
    Since, AOSP is having multiple git branches, i think shall find a solution using repo command. Otherwise, using git fetch/push for each git project will be tedious. 

4. How about removing all the .git from the code I get from 3rd Party recursively in the code i sync from 3rd Party and trigger git init. 
    This shall be OK to develop locally, but when i want to push the changes to 3rd Party Git server, this approach will fail ? 

Please bear with my ignorance if I assumed so many things in my queries. 
Kindly suggest your opinion.

Thanks & Regards
Gani

David Pursehouse

unread,
Sep 19, 2019, 9:05:23 PM9/19/19
to Gani Koduri, Repo and Gerrit Discussion
On Fri, Sep 20, 2019 at 9:38 AM Gani Koduri <gani....@gmail.com> wrote:
Hi,

I am looking for setting up a local AOSP repo using the base version provided by 3rd Party and I am new to this repo world :-)


Welcome to the Gerrit/repo project.  Please note that this mailing list is moderated, and mails from new contributors need to be approved.  I guess you didn't realise this, as there were 10+ resent copies of this mail in the queue :)

 
I did some research and came up with few queries for expert advice. Please help.

This is what I want to achieve: 
1. I wanted this repo to act as a base version for all the development work on a local Git Server. 
2. Even I was thinking to have Gerrit installed for this code base. So, that all review process stays on my site. [Not sure if this is achievable though] 
3. At the same time, I will need the code updates from 3rd Party at regular intervals and also, I will be required to push my development changes to the 3rd Party.


Assuming you want to do development internally, and then when the changes are ready (i.e. after internal review) you will push them to the 3rd party (external/upstream) review server.  I think this is a typical workflow for AOSP development.  What you will need to do, more or less is:

1. Import the repos from the 3rd party server to your internal server, essentially clone each one with --mirror from the external and push to the internal. This can be done with the repo tool and some scripting.
2. Developers clone from the internal and push changes for review on the internal (but don't submit)
3. After changes are reviewed internally they are pushed for review upstream
4. Set up regular sync from the external to the internal; when changes get submitted upstream they get automatically pushed internally.  If you're using Gerrit, it will automatically close those changes

 
I found that there is --mirror option of repo command. 
I am trying to understand if that will help to achieve the above goals. 

I have following queries: 

1. In case of setting up repo mirror from AOSP googlesource, i see that mirror manifest is used for syncing. 
    Does it mean, 3rd Party has to take care of creating this mirror manifest ? or can i use platform/manifest to trigger repo init with mirror option ? 

You can use platform/manifest.  You'll need to set up automation for this, probably in Jenkins or some other similar tool to repo sync with mirror option from the external server, and then push into the internal server.  Look into the "forall" command which will be useful here.
 

2. Mirror option gets the revision history and can help to sync to 3rd Party code regularly. 
    Can this even help me to push code to the 3rd Party as well? But in this case, I cant have Gerrit in the local Git server right ?
    Does it mean, all code to be pushed to 3rd Party and I shall be using Gerrit on 3rd Party server for review process.


Per above, use the mirror option to fetch from the external and push into your internal. Local developers should use the local gerrit; you should also sync the platform/manifest to your local, and developers should repo init/sync with that.  If you're using internal development branches on the projects, create a local branch on the manifest and update the projects' revisions accordingly.
 
3. If it was just a single git repository, i found that git fetch from one repo repository(3rd Party) and git push to other repository(Local Git Server) by switching the git remote . 
    Since, AOSP is having multiple git branches, i think shall find a solution using repo command. Otherwise, using git fetch/push for each git project will be tedious. 


Per above, use automation with the "forall" command in repo.
 
4. How about removing all the .git from the code I get from 3rd Party recursively in the code i sync from 3rd Party and trigger git init. 
    This shall be OK to develop locally, but when i want to push the changes to 3rd Party Git server, this approach will fail ? 


I don't really follow the idea here.  

 
Please bear with my ignorance if I assumed so many things in my queries. 
Kindly suggest your opinion.

Thanks & Regards
Gani

--
--
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/repo-discuss/d7bd75b1-4f4e-4d70-add5-56909e40db07%40googlegroups.com.

Gani Koduri

unread,
Sep 23, 2019, 2:35:29 AM9/23/19
to Repo and Gerrit Discussion
Thank you David for your detailed responses. 
I will be executing your suggestion this week. Will keep you posted..

Thanks again...
To unsubscribe, email repo-d...@googlegroups.com

More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-d...@googlegroups.com.

Gani Koduri

unread,
Sep 24, 2019, 12:19:01 AM9/24/19
to Repo and Gerrit Discussion
For step 1:
1. Import the repos from the 3rd party server to your internal server, essentially clone each one with --mirror from the external and push to the internal. This can be done with the repo tool and some scripting.

==> I have triggered repo mirror sync from google code. I am trying this as PoC first. 
repo init -u https://android.googlesource.com/mirror/manifest --mirror

Sync is taking quite a long time since yesterday. 
I am observing that this mirror option is creating a lot of ".git" directories for different AOSP git projects. 

For me to push these projects to the local git server. 
I assume i shall be creating bare git repositories for all the git projects and then trigger git push for all projects using repo forall command.

I wanted to understand if there is any easier way using repo command we can achieve this. Please suggest.

I am trying to get hold on Manifest file now. I assume this file also plays a big role for using repo commands. 

Thanks,
Gani

Gani Koduri

unread,
Sep 30, 2019, 8:53:07 PM9/30/19
to Repo and Gerrit Discussion
Thanks a lot David for your inputs. I was able to successfully implement this. 
It just works seamlessly. 
Reply all
Reply to author
Forward
0 new messages