From 843dfef73c86a8ad71afe36e2db9e711dddc199a Mon Sep 17 00:00:00 2001 From: shravani Date: Tue, 20 Dec 2016 15:09:34 +0530 Subject: Combine the common code for kernel building on deb/rpm This patch removes the duplication of code in rpm/debian build scripts. Change-Id: I88edc93df488bd01a43cd98e4f69f35e09f8f61c Signed-off-by: Shravani --- ci/build.sh | 41 ++++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 17 deletions(-) (limited to 'ci/build.sh') diff --git a/ci/build.sh b/ci/build.sh index 064c48a8b..918e3cab7 100755 --- a/ci/build.sh +++ b/ci/build.sh @@ -2,6 +2,7 @@ # # Common parameter parsing for kvmfornfv scripts # + function usage() { echo "" echo "Usage --> $0 [-p package_type] [-o output_dir] [-h]" @@ -14,29 +15,35 @@ function usage() { output_dir="" type="" +function run() { + case $1 in + centos) + cd $WORKSPACE/ci/build_rpm + sudo docker build -t kvm_rpm . + sudo docker run --privileged=true -v $WORKSPACE:/opt/kvmfornfv -t kvm_rpm \ + /opt/kvmfornfv/ci/build_interface.sh $1 + ;; + ubuntu) + cd $WORKSPACE/ci/build_deb + sudo docker build -t kvm_deb . + sudo docker run -v $WORKSPACE:/opt/kvmfornfv -t kvm_deb \ + /opt/kvmfornfv/ci/build_interface.sh $1 + ;; + *) echo "Not supported system"; exit 1;; + esac +} + function build_package() { choice=$1 - case "$choice" in - "centos") - echo "Build $choice Rpms" - cd ci/build_rpm - ./build_rpms.sh - cd $WORKSPACE - ;; - "ubuntu") - echo "Build $choice Debians" - cd ci/build_deb - ./build_debs.sh - cd $WORKSPACE + "centos"|"ubuntu") + echo "Build $choice Rpms/Debians" + run $choice ;; "both") echo "Build $choice Debians and Rpms" - cd ci/build_deb - ./build_debs.sh - cd ../build_rpm - ./build_rpms.sh - cd $WORKSPACE + run "centos" + run "ubuntu" ;; *) echo "Invalid package option" -- cgit 1.2.3-korg