From eb43a3188a9cc7506ec18d06612bb8917245b024 Mon Sep 17 00:00:00 2001 From: Philippe Caseiro Date: Thu, 20 Aug 2015 17:35:43 +0200 Subject: [PATCH] Now we can build a particular tag --- hooks/git/create-changelog-prebuild | 19 ++++++++++++++++--- lib/build.sh | 2 ++ package.sh | 9 ++++++--- 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/hooks/git/create-changelog-prebuild b/hooks/git/create-changelog-prebuild index 934850b..f99d912 100755 --- a/hooks/git/create-changelog-prebuild +++ b/hooks/git/create-changelog-prebuild @@ -1,5 +1,4 @@ #!/usr/bin/env bash - source "${TAMARIN_UTIL}" if [ -f debian/changelog ] || [ ! -d .git ]; then @@ -9,7 +8,22 @@ fi # Get commits log as changelog -tags=$(git tag master -l "release/*"|sort -r) +BUILD_BRANCH=$(get_opt build_branch dist/ubuntu/precise/master) +BUILD_TAG=$(get_opt build_tag "last") + +echo "BUILD TAG IS ${BUILD_TAG}" + +if [[ ${BUILD_TAG} == "last" ]] +then + git checkout ${BUILD_BRANCH} + tags=$(git tag master -l "release/*"|sort -r) +else + info "DEBUG DEBUG DEBUG " + tagbranch="build-tag-${BUILD_TAG}" + git checkout -b ${tagbranch} + set_opt "tag_branch" "${tag_branch}" + tags="${BUILD_TAG}" +fi if [[ -z ${tags} ]] then @@ -17,7 +31,6 @@ then exit 2 fi -git checkout $(get_opt build_branch dist/ubuntu/precise/master) touch debian/changelog for tag in ${tags} diff --git a/lib/build.sh b/lib/build.sh index d13f3b7..a3f3ffc 100755 --- a/lib/build.sh +++ b/lib/build.sh @@ -10,6 +10,7 @@ SRC_DIR="${BASE_DIR}/src" PROJECT_NAME=${1} BUILD_BRANCH=${2} BUILD_DIR=${3} +BUILD_TAG=${4} function build_project() { @@ -19,6 +20,7 @@ function build_project() set_opt project_name "${PROJECT_NAME}" set_opt build_dir "${BUILD_DIR}" set_opt build_branch "${BUILD_BRANCH}" + set_opt build_tag "${BUILD_TAG}" local workspace=$(mktemp -p ${BUILD_DIR} -d)/${PROJECT_NAME} info "Build dir is ${workspace}" diff --git a/package.sh b/package.sh index d168f07..8df1e37 100755 --- a/package.sh +++ b/package.sh @@ -62,10 +62,10 @@ EOF if [[ -z ${BUILD_DIR} ]] then - echo " CMD /root/.tamarin/lib/build.sh ${projectName} ${BUILD_BRANCH} /tmp" >> "$temp_dir/Dockerfile" + echo " CMD /root/.tamarin/lib/build.sh ${projectName} ${BUILD_BRANCH} /tmp ${BUILD_TAG}" >> "$temp_dir/Dockerfile" else echo " VOLUME /build" >> "$temp_dir/Dockerfile" - echo " CMD /root/.tamarin/lib/build.sh ${projectName} ${BUILD_BRANCH} /build" >> "$temp_dir/Dockerfile" + echo " CMD /root/.tamarin/lib/build.sh ${projectName} ${BUILD_BRANCH} /build ${BUILD_TAG}" >> "$temp_dir/Dockerfile" fi exec_hooks "containerbuild" "$temp_dir" @@ -116,7 +116,7 @@ function main { # # Parsing options # -while getopts "kp:d:i:b:B:" option +while getopts "kp:d:i:b:B:t:" option do case $option in k) @@ -137,6 +137,9 @@ do B) BUILD_BRANCH=${OPTARG} ;; + t) + BUILD_TAG=${OPTARG} + ;; *) show_usage ;;