Clicking a repo branch on a local AOSP mirror

I am trying to create a new AOSP branch (on my development machine) and push it into a local mirror (on a server on the same local network). I cannot find the documentation of the repo tool which explains how to do this.

I created an AOSP source mirror on my server using:

$ mkdir -p ~/aosp/mirror $ cd ~/aosp/mirror $ repo init -u https://android.googlesource.com/mirror/manifest --mirror 

Then I sync on another computer:

  $ repo init -u <USERNAME>@<IP_OF_SERVER>:/home/<USERNAME>/aosp/mirror/platform/manifest.git -b android-4.2.2_1 $ repo sync 

So far so good. I use "-b android-4.2.2_1" because I need my development to use this version of JellyBean as the baseline.

Then I create a new branch using the "start repo":

 $ repo start my-branch-name --all 

Still good. The problem is that I cannot figure out how to push this branch to a remote server.

When I do repo info , I see:

 Manifest branch: refs/tags/android-4.2.2_r1 Manifest merge branch: android-4.2.2_r1 Manifest groups: all,-notdefault ---------------------------- Project: platform/abi/cpp Mount path: /home/<username>/<project_name>/android/abi/cpp Current revision: refs/tags/android-4.2.2_r1 Local Branches: 1 [my-branch-name] --------------------------- .... 

When I try to repo upload , I get:

 no branches ready for upload 

Then I tried repo forall -c "git push aosp my-branch-name" , which pushes local branches to each remote repository, but it seems like this is not the right way to do this. In particular, if I try to create a new client and try to synchronize it with a branch, it does not work.

 $ repo init -u <USERNAME>@<IP_OF_SERVER>:/home/<USERNAME>/aosp/mirror/platform/manifest.git -b my-branch-name error: revision my-branch-name in manifests not found 

What is the correct way to create a manifest branch?

+6
source share
1 answer

The repo start command creates a local branch based on the current upstream branch. Running repo upload will upload any local commits to the currently marked branch for viewing in the upstream branch hosted by the Gerrit server specified in the manifest file. If the type of click you want to do does not match this use case, you will have to use basic Git commands to click. You can still use repo start though (but you don't have to).

To create a manifest branch, repo start and repo upload not useful. Unlike other giants managed by Repo, you have to make all the changes to the Git manifest to the default branch, which Repo will check for you. Then use simple Git commands to make changes.

The following example shows how to create a new manifest branch named mybranch that is identical to the current upstream.

 cd .repo/manifests git push origin default:refs/heads/mybranch 

Now this in itself is not very useful, since the contents of your manifest are identical to the upstream branch - we just cloned that branch of the manifest, so you can run

 repo init -u ssh://git.example.com/platform/manifest -b mybranch 

The results will be identical to where you started:

 repo init -u ssh://git.example.com/platform/manifest -b android-4.2.2_1 

To make your mirror useful, you also need to split each Git specified in the manifest so that you get a branch on your server where you can make changes.

Theoretically, you can make changes to the same branches that you downloaded from your upstream, but this will create a mess the next time you try to synchronize with the upstream. Do not do that.

To create branches on the server, you can follow the same patterns as for the manifest:

 cd build git push ssh://git.example.com/platform/build HEAD:refs/heads/mybranch 

Note the use of HEAD, the symbolic name of the currently checked commit. Doing this for each Git is tedious, so use the repo forall command:

 repo forall -c 'git push aosp HEAD:refs/heads/mybranch' 

Note that the remote name is different from the Git manifest (IIRC).

See repo help forall for a list of environment variables available for commands executed by repo forall ( REPO_PROJECT , $REPO_LREV and $REPO_RREV are probably the most useful).

It is easy to drown with repo forall , so make it a good habit to add the echo command in advance so that you have commands that would be echoed to your terminal. If you are happy with the results, delete echo to run the commands for real.

You will now have the mybranch branch in all of your gits, including the manifest. It remains to change the manifest so that

 repo init -u ssh://git.example.com/platform/manifest -b mybranch 

will check mybranch in all gits.

 cd .repo/manifests vi default.xml [ Change the default revision from refs/tags/android-4.2.2_1 or whatever it says to 'mybranch'. ] git commit -a -m 'Changed default revision to mybranch.' git push origin default:refs/heads/mybranch 

Note that all gits do not necessarily use the default version (which you just changed to mybranch ). This probably refers to the android-4.2.2_1 manifest branch, but in other cases some gits will not use the default version, but instead override it with their own revision attribute. This is fine, but you will need to make additional manifest changes.

+9
source

Source: https://habr.com/ru/post/956517/


All Articles