3 function checkout_commit() {
4 build_dir=/opt/kvmfornfv/
5 mkdir -p /tmp/kvmfornfv
7 source ${build_dir}/ci/apex.conf
9 #Cloning into /tmp/kvmfornfv from local repository
10 git clone $build_dir $SRC
11 if [ "$branch" == "master" ] || [ "$branch" == "danube" ];then
12 echo "Checking out on $branch branch"
13 echo "Commit-id is ${commit_id}"
14 git checkout -f ${commit_id}
16 echo "Please check the commit-id provided in apex.conf"
26 kernel_src_dir=$SRC/kernel
27 rpmbuild_dir=$SRC/kvmfornfv_rpmbuild.$$
28 artifact_dir=${rpmbuild_dir}/RPMS/x86_64
29 mkdir -p $artifact_dir
30 config_file="${kernel_src_dir}/arch/x86/configs/opnfv.config"
33 echo "usage: ${0} output_dir"
38 if [[ -z "$@" ]]; then
42 if [ ! -d ${output_dir} -o ! -w ${output_dir} ] ; then
43 echo "${0}: Output directory '${output_dir}' does not exist or cannot \
48 if [ ! -d ${kernel_src_dir} ] ; then
49 echo "${0}: Directory '${kernel_src_dir}' does not exist, run this script \
50 from the root of kvmfornfv source tree"
54 if [ ! -f ${config_file} ] ; then
55 echo "${0}: ${config_file} does not exist"
63 cp -f ${config_file} "${kernel_src_dir}/.config"
65 # Make timestamp part of version string for automated kernel boot verification
66 date "+-%y%m%d%H%M" > "${kernel_src_dir}/localversion-zzz"
68 (cd ${kernel_src_dir}; make RPMOPTS="--define '_topdir ${rpmbuild_dir}'" rpm-pkg)
69 if [ ${?} -ne 0 ] ; then
70 echo "${0}: Kernel build failed"
71 rm -rf ${rpmbuild_dir}
75 cp -f ${artifact_dir}/* ${output_dir}
76 mv ${output_dir}/* ${build_dir}/build_output/
78 rm -rf ${rpmbuild_dir}