From 353bd1754c738e7e197dd4f2c056b4850efc32cb Mon Sep 17 00:00:00 2001 From: Daniel Schwager Date: Sat, 28 Jan 2012 11:20:26 +0100 Subject: [PATCH] Moved STATUS information from project.cfg to builder.cfg --- conf/opsi-builder.cfg | 11 +++++++++++ lib/builder-targets.sh | 31 ++++++++++++++++++++----------- sample/builder-product.cfg | 8 -------- 3 files changed, 31 insertions(+), 19 deletions(-) diff --git a/conf/opsi-builder.cfg b/conf/opsi-builder.cfg index 4c9f76f..46ec5f7 100644 --- a/conf/opsi-builder.cfg +++ b/conf/opsi-builder.cfg @@ -9,6 +9,15 @@ ################################# TMP_DIR=/tmp +# STATUS - defines the stabability of the build +# Valid values: +# integration: this is used by a continuous integration server. +# NOTE: The 'RELEASE'-variable inside builder-project.cfg +# will be increased AUTOMATICALLY !! +# testing : it's in the testing/QM process +# release : passed the testing and go's to productive +STATUS="integration" + ############################### # CREATOR ############################### @@ -20,6 +29,8 @@ CREATOR_TAG=xx CREATOR_NAME="Your name" CREATOR_EMAIL="your-email@domain.de" + + ################################## # OPSI repository settings ################################# diff --git a/lib/builder-targets.sh b/lib/builder-targets.sh index 21a7ea1..652f214 100644 --- a/lib/builder-targets.sh +++ b/lib/builder-targets.sh @@ -14,32 +14,41 @@ builder_config() { test -d ${TMP_DIR} builder_check_error "temp directory not available: $TMP_DIR" - # Source product release configuration + # project dependent configuration local config=${PRODUCT_DIR}/builder-product.cfg test -f ${config} || builder_check_error "can't read product config: ${config}" . ${config} - # change some variable dynamically - # - autogenerate release number, if we are in status "integration" + # set default build configuration and source the user dependent file + local config=$BASEDIR/conf/opsi-builder.cfg + . ${config} + + # Source local build configuration (must be done AFTER sourcing the builder-product.cfg.cfg) + if [ -f "$OPSI_BUILDER" ] ; then + config=$OPSI_BUILDER + else + test -f $HOME/.opsi-builder.cfg && config=$HOME/.opsi-builder.cfg + fi + + # Read ONLY the STATUS variable from the build configuration file + eval "`grep -E "^STATUS=" $config`" + + # change some variable from the builder-product.cfg dynamically: + # autogenerate release number, if we are in status "integration" if [ "$STATUS" = "integration" ] ; then # OPSI/control:RELEASE is limited to max 16 chars - take care in regards to the CREATOR_TAG RELEASE="`date +%Y%m%d%H%M`" fi - # set default build configuration and source the user dependent file - . $BASEDIR/conf/opsi-builder.cfg + # Read configurationfile + . ${config} + echo "Loaded builder configuration: $config" - # Source local build configuration (must be done AFTER sourcing the release.cfg) - config=$HOME/.opsi-builder.cfg - test -f ${config} && . ${config} && echo "Loaded builder configuration: ${config}" - test -f "$OPSI_BUILDER" && . $OPSI_BUILDER && echo "Loaded builder configuration: $OPSI_BUILDER" - # Check variables if [ -z ${OPSI_REPOS_BASE_DIR} ] || [ ! -d ${OPSI_REPOS_BASE_DIR} ] ; then echo "configuration error: OPSI_REPOS_BASE_DIR directory does not exist: $OPSI_REPOS_BASE_DIR" exit 2 fi - } ##################### diff --git a/sample/builder-product.cfg b/sample/builder-product.cfg index 501aa34..833b068 100644 --- a/sample/builder-product.cfg +++ b/sample/builder-product.cfg @@ -8,14 +8,6 @@ RELEASE="3" PRIORITY="0" ADVICE="" -# STATUS - defines the stabability of the build -# Valid values: -# integration: this is used by a continuous integration server. -# Note: The RELEASE will be set AUTOMATICALLY !! -# testing : it's in the testing/QM process -# release : passed the testing and go's to productive -STATUS="integration" - # TYPE - defines, if the install files are public or restricted. # Valid value: restrict | public TYPE="public"