public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Alexander Smirnov <asmirnov@ilbers.de>
To: isar-users@googlegroups.com
Cc: Alexander Smirnov <asmirnov@ilbers.de>
Subject: [PATCH v2 3/3] scripts/ci_build: Make CI script more generic
Date: Fri,  4 May 2018 15:27:14 +0300	[thread overview]
Message-ID: <20180504122714.1201-4-asmirnov@ilbers.de> (raw)
In-Reply-To: <20180504122714.1201-1-asmirnov@ilbers.de>

Make this script more generic, so it could be used by any CI and by user
as well. Also add parameter to specify build folder.

Usage:
  ci_build [-q | -d] -b BUILD_DIR

And this command will build all the default Isar images.

Signed-off-by: Alexander Smirnov <asmirnov@ilbers.de>
---
 scripts/ci_build.sh | 72 +++++++++++++++++++++++++++++++++++++++++++++--------
 1 file changed, 61 insertions(+), 11 deletions(-)

diff --git a/scripts/ci_build.sh b/scripts/ci_build.sh
index e941f8c..fec0000 100755
--- a/scripts/ci_build.sh
+++ b/scripts/ci_build.sh
@@ -1,28 +1,78 @@
-# Script for Jenkins build
+# Script for CI system build
 #
 # Alexander Smirnov <asmirnov@ilbers.de>
-# Copyright (c) 2016-2017 ilbers GmbH
+# Copyright (c) 2016-2018 ilbers GmbH
 
 #!/bin/sh
 
+ES_BUG=3
+
 # Export $PATH to use 'parted' tool
 export PATH=$PATH:/sbin
 
-# Get parameters from the command line
-WORKSPACE=$1
-GIT_COMMIT=$2
-
 # Go to Isar root
 cd $(dirname $0)/..
 
-# Setup build folder for current revision
-if [ ! -d /build/$WORKSPACE/$GIT_COMMIT ]; then
-        mkdir -p /build/$WORKSPACE/$GIT_COMMIT
+# Start build in Isar tree by default
+BUILD_DIR=./build
+
+BB_ARGS="-v"
+
+show_help() {
+    echo "This script builds all the default Isar images."
+    echo
+    echo "Usage:"
+    echo "    $0 [params]"
+    echo
+    echo "Parameters:"
+    echo "    -b, --build BUILD_DIR set path to build directory. If not set,"
+    echo "                          the build will be started in current path."
+    echo "    -d, --debug           enable debug bitbake output."
+    echo "    -q, --quite           suppress verbose bitbake output."
+    echo "    --help                display this message and exit."
+    echo
+    echo "Exit status:"
+    echo " 0  if OK,"
+    echo " 3  if invalid parameters are passed."
+}
+
+# Parse command line to get user configuration
+while [ $# -gt 0 ]
+do
+    key="$1"
+
+    case $key in
+    -h|--help)
+        show_help
+        exit 0
+        ;;
+    -b|--build)
+        BUILD_DIR="$2"
+        shift
+        ;;
+    -d|--debug)
+        BB_ARGS="$BB_ARGS -d"
+        ;;
+    -q|--quite)
+        BB_ARGS=""
+        ;;
+    *)
+        echo "error: invalid parameter '$key', please try '--help' to get list of supported parameters"
+        exit $ES_BUG
+        ;;
+    esac
+
+    shift
+done
+
+# Setup build folder for the current build
+if [ ! -d $BUILD_DIR ]; then
+        mkdir -p $BUILD_DIR
 fi
-source isar-init-build-env /build/$WORKSPACE/$GIT_COMMIT
+source isar-init-build-env $BUILD_DIR
 
 # Start build for all possible configurations
-bitbake -v \
+bitbake $BB_ARGS \
         multiconfig:qemuarm-wheezy:isar-image-base \
         multiconfig:qemuarm-jessie:isar-image-base \
         multiconfig:qemuarm-stretch:isar-image-base \
-- 
2.1.4


  parent reply	other threads:[~2018-05-04 12:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-04 12:27 [PATCH v2 0/3] Update scripts Alexander Smirnov
2018-05-04 12:27 ` [PATCH v2 1/3] scripts/vm_smoke_test: Add quite parameter Alexander Smirnov
2018-05-04 12:27 ` [PATCH v2 2/3] scripts/vm_smoke_test: Check if QEMU didn't start Alexander Smirnov
2018-05-04 12:27 ` Alexander Smirnov [this message]
2018-05-04 18:23 ` [PATCH v2 0/3] Update scripts Henning Schild

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180504122714.1201-4-asmirnov@ilbers.de \
    --to=asmirnov@ilbers.de \
    --cc=isar-users@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox