Working with patchsets

In addition to git repositories, Linaro AOSP builds can use patchset files to apply additional patches on top of git checkouts.

This can be useful when applying the same patch on top of different code bases, or tracking Gerrit submissions, trying to keep a patch on top of a moving target (e.g. AOSP master branch), or when applying members-first or otherwise closed patches on top of an otherwise open build.

Some sample patchsets can be found in the git repository git://android-git.linaro.org/android-patchsets.git

Commands used in patchset files

Patchset files are shell scripts that can use a couple of extra commands (made available by sourcing a script defining them):

apply

Applies a patch from a Gerrit submission.

Usage

 apply REPOSITORY SUBMISSIONID/REVISION 

REPOSITORY is the repository to which the patch from the Gerrit submission must be applied, e.g. frameworks/base

SUBMISSIONID is the Gerrit submission ID, e.g. 175288 if you want to apply the patch from https://android-review.googlesource.com/175288

REVISION is the revision number of the submission. This starts with 1 for the first version submitted and is incremented by 1 for every updated patch submission.

Options

--linaro - Pull the patch from Linaro's Gerrit server (https://android-review.linaro.org/) rather than upstream AOSP's

--server https://some.url - Pull the patch from a 3rd party Gerrit server (e.g. Cyanogenmod's)

Examples

 apply frameworks/base 175288/1 

Applies the first version of the patch from AOSP Gerrit submission #175288 - https://android-review.googlesource.com/175288

 apply --linaro build 16156/1 

Applies the first version of the patch from Linaro Gerrit submission #16156 - https://android-review.linaro.org/16156

 apply --server ssh://git@dev-private-review.linaro.org/android/ external/zlib 240/1 

Applies the first version of patch 240 from Linaro's members-only Gerrit

cherrypick

Cherry-picks a patch from another git branch

Usage

 cherrypick REPOSITORY COMMITID 

REPOSITORY is the repository in which the patch needs to be applied, e.g. bionic

COMMITID is the patch's git commit ID.

Example

 cherrypick bionic ce46f5576ad0c9aefd842492949c4d2965e23e89 

Cherry-picks Bionic patch ce46f5576ad0c9aefd842492949c4d2965e23e89 from the master branch into the working tree

revert

Reverts a git commit

Usage

 revert REPOSITORY COMMITID 

REPOSITORY is the repository in which the patch needs to be reverted, e.g. bionic

COMMITID is the patch's git commit ID.

Example

 revert bionic ce46f5576ad0c9aefd842492949c4d2965e23e89 

Reverts Bionic commit ce46f5576ad0c9aefd842492949c4d2965e23e89 in the current working tree

Applying a patchset file

To apply the patchset file, go to the top level of the AOSP tree you want to apply the patchset to, and run the patchset file as a script, e.g.

cd /home/aosp/6.0
'''/tmp/android-patchsets/marshmallow-gcc5-patchset'''
. build/envsetup.sh
lunch aosp_hikey-userdebug
make droidcore -j24

Platform/Android/Working_with_patchsets (last modified 2016-04-19 09:41:10)