Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

recovery building

  • Loading branch information...
commit 6875ce182b678175c70e87a9d79e2d40ab8d23bd 1 parent ffbd0b0
@koush koush authored
Showing with 149 additions and 0 deletions.
  1. +127 −0 build-recovery.sh
  2. +22 −0 recovery-job.sh
View
127 build-recovery.sh
@@ -0,0 +1,127 @@
+#!/usr/bin/env bash
+
+function check_result {
+ if [ "0" -ne "$?" ]
+ then
+ echo $1
+ exit 1
+ fi
+}
+
+if [ -z "$HOME" ]
+then
+ echo HOME not in environment, guessing...
+ export HOME=$(awk -F: -v v="$USER" '{if ($1==v) print $6}' /etc/passwd)
+fi
+
+if [ -z "$WORKSPACE" ]
+then
+ echo WORKSPACE not specified
+ exit 1
+fi
+
+CLEAN_TYPE=clean
+
+REPO_BRANCH=ics
+
+if [ -z "$LUNCH" ]
+then
+ echo LUNCH not specified
+ exit 1
+fi
+
+if [ -z "$RELEASE_TYPE" ]
+then
+ echo RELEASE_TYPE not specified
+ exit 1
+fi
+
+if [ -z "$SYNC_PROTO" ]
+then
+ SYNC_PROTO=http
+fi
+
+# colorization fix in Jenkins
+export CL_PFX="\"\033[34m\""
+export CL_INS="\"\033[32m\""
+export CL_RST="\"\033[0m\""
+
+cd $WORKSPACE
+rm -rf archive
+mkdir -p archive
+export BUILD_NO=$BUILD_NUMBER
+unset BUILD_NUMBER
+
+export PATH=~/bin:$PATH
+
+export USE_CCACHE=1
+export BUILD_WITH_COLORS=0
+
+REPO=$(which repo)
+if [ -z "$REPO" ]
+then
+ mkdir -p ~/bin
+ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
+ chmod a+x ~/bin/repo
+fi
+
+git config --global user.name $(whoami)@$NODE_NAME
+git config --global user.email jenkins@cyanogenmod.com
+
+mkdir -p $REPO_BRANCH
+cd $REPO_BRANCH
+
+rm -rf .repo/manifests*
+repo init -u $SYNC_PROTO://github.com/CyanogenMod/android.git -b $REPO_BRANCH
+check_error "repo init failed."
+
+# make sure ccache is in PATH
+export PATH="$PATH:/opt/local/bin/:$PWD/prebuilt/$(uname|awk '{print tolower($0)}')-x86/ccache"
+
+if [ -f ~/.jenkins_profile ]
+then
+ . ~/.jenkins_profile
+fi
+
+echo Manifest:
+cat .repo/manifests/default.xml
+
+rm -f .repo/local_manifest.xml
+
+echo Syncing...
+repo sync -d > /dev/null 2> /tmp/jenkins-sync-errors.txt
+check_result "repo sync failed."
+echo Sync complete.
+
+if [ -f $WORKSPACE/hudson/$REPO_BRANCH-setup.sh ]
+then
+ $WORKSPACE/hudson/$REPO_BRANCH-setup.sh
+fi
+
+. build/envsetup.sh
+lunch $LUNCH
+check_result "lunch failed."
+
+# save manifest used for build (saving revisions as current HEAD)
+repo manifest -o $WORKSPACE/archive/manifest.xml -r
+
+if [ ! "$(ccache -s|grep -E 'max cache size'|awk '{print $4}')" = "50.0" ]
+then
+ ccache -M 50G
+fi
+
+make $CLEAN_TYPE
+mka recoveryzip recoveryimage
+check_result "Build failed."
+
+if [ -f $OUT/utilties/update.zip ]
+then
+ cp $OUT/utilties/update.zip $WORKSPACE/archive/recovery.zip
+fi
+if [ -f $OUT/recovery.img ]
+then
+ cp $OUT/recovery.img $WORKSPACE/archive
+fi
+
+# chmod the files in case UMASK blocks permissions
+chmod -R ugo+r $WORKSPACE/archive
View
22 recovery-job.sh
@@ -0,0 +1,22 @@
+if [ -z "$HOME" ]
+then
+ echo HOME not in environment, guessing...
+ export HOME=$(awk -F: -v v="$USER" '{if ($1==v) print $6}' /etc/passwd)
+fi
+
+cd $WORKSPACE
+mkdir -p ../android
+cd ../android
+export WORKSPACE=$PWD
+
+if [ ! -d hudson ]
+then
+ git clone git://github.com/CyanogenMod/hudson.git
+fi
+
+cd hudson
+## Get rid of possible local changes
+git reset --hard
+git pull -s resolve
+
+exec ./build-recovery.sh
Please sign in to comment.
Something went wrong with that request. Please try again.