#! /bin/bash # Example env variables and its values # kernel_config='omap2plus_defconfig' # export board_type='panda' # kernel_flavour='omap4' # rootfs_type='nano' set -xe trap cleanup EXIT cleanup() { if test "$matching_remote_trees" = "$remote_tree_alias_name" ; then # Cleaning up remote tree that was added git remote rm "$remote_tree_alias_name" fi if test "$matching_remote_branch" = "$remote_branch_name" ; then # Cleaning up remote branch that was added git reset --hard HEAD git checkout $GIT_BRANCH git branch -D $remote_branch_name fi } if test -z "$GIT_REMOTE_URL" ; then echo "Please specify the GIT_REMOTE_URL" exit 1 fi if test -z "$GIT_REMOTE_REF" ; then echo "Please specify the GIT_REMOTE_REF" exit 1 fi if test -z "$rootfs_type"; then rootfs_type='nano' fi remote_tree_name=`basename $GIT_REMOTE_URL | awk -F '.git' '{print $1}'` remote_tree_alias_name="$remote_tree_name-alias" remote_branch_name="$remote_tree_name-branch" git remote add "$remote_tree_alias_name" $GIT_REMOTE_URL git fetch $remote_tree_alias_name matching_remote_trees=`git remote -v | grep "$remote_tree_alias_name" | awk '{ print $1}' | uniq` git checkout -b $remote_branch_name $GIT_REMOTE_REF matching_remote_branch=`git branch | grep "$remote_branch_name" | awk -F ' ' '{ print $2}'` export rootfs_type export bundle_stream_name=`echo $JOB_NAME | sed -e 's/_.*//' -e 's/\./_/g'` kernel_config_name=`echo ${kernel_config} | sed -e 's/_defconfig//g'` export kernel_version=`git describe --match='v*' | sed -e 's/^v//'``echo -${kernel_config_name}-linaro-${kernel_flavour} | sed -e 's/_/-/g'` # Below is the list of values that will be used in the json files export KERNEL_GIT=$GIT_REMOTE_URL export KERNEL_COMMIT="`git rev-parse HEAD`" echo "DEBUG: The remote branch: $remote_branch_name will be built now for the commit id $KERNEL_VERSION" . $WORKSPACE/lci-build-tools/jenkins_common_lib #Calling the function build_instructions which includes the kernel build instructions build_instructions