Skip to content

Loading…

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

Merged
merged 4 commits into from

4 participants

@jhford

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 treeid.sh 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.

@jhford

@cgjones, does this look OK to you?

@jhford

This is the diff to treeid.sh

diff --git a/treeid.sh b/treeid.sh
index f1185e2..8a758a3 100755
--- a/treeid.sh
+++ b/treeid.sh
@@ -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)
 fi

-if [[ -d device/samsung/maguro ]]; then
-   # Android ICS tree
-   echo ${MANIFEST_ID} ics all
-   exit
-fi
-
-# Android GB tree
-echo ${MANIFEST_ID} gb all
-exit
+# 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/version_defaults.mk) 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
+esac
@michaelwu
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/vendorsetup.sh ?). This patching infrastructure is fairly specific to codeaurora and I'd like to avoid hard coding the logic into this repo.

@jhford

I didn't write vendorsetup.sh, 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.

@michaelwu
Mozilla-B2G member

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

@jhford

Note that this change is strongly tied to this repository, which we'll need to add to the b2g-manifests repository. The vendorsetup.sh and treeid.sh 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.

https://github.com/mozilla-b2g/gonk-patches

@cgjones
Mozilla-B2G member

r=cjones

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

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 build.sh
View
8 build.sh
@@ -52,7 +52,15 @@ function configure_device() {
return $?
}
+export REPO=$PWD/repo
+export B2G_TREEID_SH="$PWD/patches/treeid.sh"
+export B2G_HASHED_FILES="$PWD/patches/vendorsetup.sh ${B2G_TREEID_SH}"
+export B2G_PATCH_DIRS_OVERRIDE=patches
+
. setup.sh &&
+if [ -f patches/vendorsetup.sh ] ; then
+ . patches/vendorsetup.sh
+fi &&
configure_device &&
time nice -n19 make $MAKE_FLAGS $@
Something went wrong with that request. Please try again.