summaryrefslogtreecommitdiff
path: root/jenkins_maintainers_kernel_build_inst
blob: 5c68dd42472194b1774709c73c738cf87f3b8890 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#! /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