Skip to content


allow storing gonk upstream changes as patches instead of forks #190

merged 4 commits into from

4 participants


This patch imports codeaurora forum code into our repostiory, annotating the revision and remote used to pull it down. There is a change to the function, which naïvely parses the makefile to figure out which version of Android is in use. This is done because the default method of testing for ICS/GB checks if the galaxy nexus devices files are present, which they never are for us. The regular expression doesn't check whether there are multiple un-commented definitions, or whether the definition found is actually the correct definition. There are no patches included with this patch, adding the gonk-patches repository to the b2g-manifests will be a follow up.


@cgjones, does this look OK to you?


This is the diff to

diff --git a/ b/
index f1185e2..8a758a3 100755
--- a/
+++ b/
@@ -40,12 +43,20 @@ if [[ -f .repo/manifest.xml ]] ; then
    MANIFEST_ID=$(sed -e \ '/<default.*/!d ; s/^.*revision="// ; s/".*$// ; s/refs\/tags\///' .repo/manifest.xml)

-if [[ -d device/samsung/maguro ]]; then
-   # Android ICS tree
-   echo ${MANIFEST_ID} ics all
-   exit
-# Android GB tree
-echo ${MANIFEST_ID} gb all
+# Parse the default value of PLATFORM_VERSION.  Assumption is that there is
+# only going to be one uncommented definition of PLATFORM_VERSION.  This is
+# true for Android 2.3 and 4.0
+case $(sed -e '/^.*[^#]PLATFORM_VERSION .*=/!d  ; s/.*PLATFORM_VERSION.*=[^0-9]*\([0-9]\.[0-9]\).*/\1/' build/core/ in
+    # The first asterisk is probably bad
+    4.1|4.2)
+        echo ${MANIFEST_ID} jb all
+        ;;
+    4.0)
+        echo ${MANIFEST_ID} ics all
+        ;;
+    2.3)
+        echo ${MANIFEST_ID} gb all
+        ;;
+    *)
+        echo ${MANIFEST_ID} all
Mozilla-B2G member

Three space indent? Well, at least everyone is unhappy.

I'd like a similar autodetection approach that we have for blob extraction - run a patching script if one is found at the patching repo path ($B2G/patches/ ?). This patching infrastructure is fairly specific to codeaurora and I'd like to avoid hard coding the logic into this repo.


I didn't write, changing the indenting levels would make sharing code very difficult. Most of the code in this file is specifically about patching and the rest has no effect on how we use it.

I agree that putting this logic in B2G is a bad idea. I'm going to put it into the new gonk-patches repository, and only run the script if it's present.

Mozilla-B2G member

Yeah, I realize you didn't write this. Just making fun of it. :)


Note that this change is strongly tied to this repository, which we'll need to add to the b2g-manifests repository. The and scripts in the root of the patches repository are where the action happens, and they are 99% clean imports from upstream.

This patch set should probably be collapsed before landing.

Mozilla-B2G member


@cgjones cgjones merged commit 424e6e2 into mozilla-b2g:master

I really don't understand why people still use patches rather than git branches in 2013. Why you just don't want to create a manifest branch for each device? Or a manifest branch for each major release like what CyanogenMod does. Shell scripts and patches? Please!!!!!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 8 additions and 0 deletions.
  1. +8 −0
@@ -52,7 +52,15 @@ function configure_device() {
return $?
+export REPO=$PWD/repo
+export B2G_TREEID_SH="$PWD/patches/"
+export B2G_HASHED_FILES="$PWD/patches/ ${B2G_TREEID_SH}"
+export B2G_PATCH_DIRS_OVERRIDE=patches
. &&
+if [ -f patches/ ] ; then
+ . patches/
+fi &&
configure_device &&
time nice -n19 make $MAKE_FLAGS $@
Something went wrong with that request. Please try again.