From b04bf1b2c514086d606eb5a5dc99618762ab3d18 Mon Sep 17 00:00:00 2001 From: Dongsu Park Date: Thu, 18 Apr 2013 13:38:58 +0200 Subject: [PATCH] extract_storage: change build number naming scheme for feature branch This is only a temporary solution to resolve build number conflicts on Gentoo systems. Without the change, it's nearly impossible to manage different ebuilds for both master/develop branches and feature branches. For the example above, new ebuilds for feature branch (build no. 150) should be recognized as a newer version than the last develop kernel. In reality, however, the develop kernel has its build number 395, and the feature build number 150 will be recognized as its previous version. To avoid such confusion, change build number naming scheme, from a simple number to a more precise string according to a format $(last_develop_buildno).$(feature_buildno) , where $(last_develop_buildno) is the most recent build number in the develop branch, and $(feature_buildno) is the current feature branch's build number. For example, if the last build number of develop branch is 395, and that of feature branch is 150, then the output string will be "395.150". --- extract_storage_kernel+modules.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/extract_storage_kernel+modules.sh b/extract_storage_kernel+modules.sh index 9399531..a2e5164 100755 --- a/extract_storage_kernel+modules.sh +++ b/extract_storage_kernel+modules.sh @@ -14,12 +14,29 @@ export DIST=squeeze export PB_SUITE=$DISTRIBUTION export TARGET_BASE=/srv/storage-kernels +function get_last_target_build_no() { + TARGET_NAME=$1 + + if [ -n "$TARGET_NAME" ]; then + retval=$(find $TARGET_BASE/$TARGET_NAME -maxdepth 1 -type d \ + | grep -v "^.$" | sort -n | tail -n 1 \ + | sed -e "s|^\.\/||g" | sed -e "s|.*\/\([^\.]*\)$|\1|g") + [ -z "$retval" ] && retval="0" + else + retval="0" + fi + + echo $retval +} + if [ "$DISTRIBUTION" = "production-proposed-updates" ] ; then export TARGET_NAME=master elif [ "$DISTRIBUTION" = "pre-staging" ] ; then export TARGET_NAME=develop elif [[ "$DISTRIBUTION" = dev-feature* ]] ; then export TARGET_NAME=$DISTRIBUTION + LAST_DEVELOP_BUILD_NO=$(get_last_target_build_no develop) + BUILD_NUMBER="$LAST_DEVELOP_BUILD_NO.$(printf %03d $BUILD_NUMBER)" FEATURE_APTCMD=" echo \"deb http://alexandria.pb.local/dev-repository $DISTRIBUTION main contrib non-free\" \ > /etc/apt/sources.list.d/profitbricks-linux-image-storage-$DISTRIBUTION.list -- 2.39.5