]> Frank Brehm's Git Trees - profitbricks/jenkins-build-scripts.git/commitdiff
correct indentations
authorTobias von der Krone <tobias.vonderkrone@profitbricks.com>
Mon, 29 Jul 2013 07:19:12 +0000 (09:19 +0200)
committerTobias von der Krone <tobias.vonderkrone@profitbricks.com>
Mon, 29 Jul 2013 07:19:12 +0000 (09:19 +0200)
maven_post_build_debian_wrapper.sh

index d071faa9ee626c9134e8227c61348b94ba897b8c..62bab2ed407052547fa1c127aab8c609917dda4a 100755 (executable)
@@ -15,41 +15,40 @@ function cleanup {
     git checkout -- debian/changelog
     # remove files created by debian build
     git clean -fd debian
-    echo cleaup done
+    echo cleanup done
 }
 
-function validateSettings
-{
+function validateSettings {
     REPO=pb-${SUITE}
     VERSION=$(mvn -B -N help:evaluate -Dexpression=project.version 2>/dev/null| grep -v "^\[")
-    if [[ -z "${VERSION}" ]] ; then
+    if [[ -z "${VERSION}" ]]; then
         echo "ERROR: Cannot get version from maven using 'mvn -B -N help:evaluate -Dexpression=project.version'"
-       mvn -B -N help:evaluate -Dexpression=project.version
+        mvn -B -N help:evaluate -Dexpression=project.version
         exit 1
     fi
 
     if [ "$GIT_BRANCH_NAME" = "integration" ] || [ ${GIT_BRANCH_NAME:0:8} = "feature/" ] || [ ${GIT_BRANCH_NAME:0:3} = "poc/" ] || [ ${GIT_BRANCH_NAME:0:7} = "bugfix/" ]; then
-       APPEND_TO_VERSION="experimental"
-       REPO="dev-${SUITE}"
-       if [ "$GIT_BRANCH_NAME" = "integration" ] ; then
-               DISTRIBUTION="dev-integration"
-       else
-               # set proper DISTRIBUTION for feature branches
-               DISTRIBUTION=$(echo "dev-${GIT_BRANCH_NAME}" | tr '/' '-')
-       fi
-    elif [ "$GIT_BRANCH_NAME" = "master" ] || [ ${GIT_BRANCH_NAME:0:7} = "hotfix/" ] ; then
+        APPEND_TO_VERSION="experimental"
+        REPO="dev-${SUITE}"
+        if [ "$GIT_BRANCH_NAME" = "integration" ]; then
+            DISTRIBUTION="dev-integration"
+        else
+            # set proper DISTRIBUTION for feature branches
+            DISTRIBUTION=$(echo "dev-${GIT_BRANCH_NAME}" | tr '/' '-')
+        fi
+    elif [ "$GIT_BRANCH_NAME" = "master" ] || [ ${GIT_BRANCH_NAME:0:7} = "hotfix/" ]; then
         APPEND_TO_VERSION=""
-       DISTRIBUTION="production-proposed-updates"
+        DISTRIBUTION="production-proposed-updates"
     else
-       DISTRIBUTION="unstable"
-       APPEND_TO_VERSION="develop"
+        DISTRIBUTION="unstable"
+        APPEND_TO_VERSION="develop"
     fi
 
-    if [ ! -z "$APPEND_TO_VERSION" ] ; then
-       # remove -SNAPSHOT
+    if [ ! -z "$APPEND_TO_VERSION" ]; then
+        # remove -SNAPSHOT
         VERSION=$(echo $VERSION | sed -s "s#-SNAPSHOT##g")
-       BUILD_START=$(date +%Y%m%d%H%M%S)
-       VERSION="${VERSION}~${APPEND_TO_VERSION}${BUILD_START}+${BUILD_NUMBER}+g${GIT_COMMIT:0:7}"
+        BUILD_START=$(date +%Y%m%d%H%M%S)
+        VERSION="${VERSION}~${APPEND_TO_VERSION}${BUILD_START}+${BUILD_NUMBER}+g${GIT_COMMIT:0:7}"
     fi
 
     SOURCE=$(dpkg-parsechangelog 2>/dev/null|grep ^Source:|cut -d " " -f2) # get the name of the source package
@@ -63,41 +62,41 @@ function validateSettings
 # MAIN
 #############
 
-SUITE=$1               # this has to be either squeeze or wheezy currently
-if [[ -z "${SUITE}" ]] ; then
-        SUITE="squeeze"
-       echo "Warning: SUITE not defined, defaulting to \"squeeze\"."
+SUITE=$1        # this has to be either squeeze or wheezy currently
+if [[ -z "${SUITE}" ]]; then
+    SUITE="squeeze"
+    echo "Warning: SUITE not defined, defaulting to \"squeeze\"."
 fi
 cd $WORKSPACE
 validateSettings
 export
-set -e         # fail on error
-set -x                 # echo commands executed
+set -e      # fail on error
+set -x      # echo commands executed
 
 # write correct debian/changelog
-if [ "$GIT_BRANCH_NAME" = "master" ] || [ "${GIT_BRANCH_NAME:0:7}" = "hotfix/" ] ; then
-       # generate debian/changelog entries since the last upload
-       git-dch  -a --ignore-branch --no-full --no-meta --id-length=7 -N $VERSION
-       # make sure distribution in changelog is set correctly
-       # (read the comments for the sed command 5 lines below to understand this)
-       sed -i "0,/).*\$/s//) $DISTRIBUTION; urgency=low/" debian/changelog
+if [ "$GIT_BRANCH_NAME" = "master" ] || [ "${GIT_BRANCH_NAME:0:7}" = "hotfix/" ]; then
+    # generate debian/changelog entries since the last upload
+    git-dch  -a --ignore-branch --no-full --no-meta --id-length=7 -N $VERSION
+    # make sure distribution in changelog is set correctly
+    # (read the comments for the sed command 5 lines below to understand this)
+    sed -i "0,/).*\$/s//) $DISTRIBUTION; urgency=low/" debian/changelog
 else
-       # change version in changelog
-       dch -i --no-auto-nmu "Generated by jenkins"
-       git-dch  -a --ignore-branch --no-full --no-meta --id-length=7
-       # replace first occurance of a version (enclosed in brackets) with real version
-       # (we cannot use (git-)dch as the version might be lower than the last),
-       # and also set distribution here.
-       # sed explained: look for the first occurance of (.*).*$ - so thats something
-       # in brackets until the end of the line. = first line of a debian/changelog
-       sed -i "0,/(.*).*\$/s//($VERSION) $DISTRIBUTION; urgency=low/" debian/changelog
+    # change version in changelog
+    dch -i --no-auto-nmu "Generated by jenkins"
+    git-dch  -a --ignore-branch --no-full --no-meta --id-length=7
+    # replace first occurance of a version (enclosed in brackets) with real version
+    # (we cannot use (git-)dch as the version might be lower than the last),
+    # and also set distribution here.
+    # sed explained: look for the first occurance of (.*).*$ - so thats something
+    # in brackets until the end of the line. = first line of a debian/changelog
+    sed -i "0,/(.*).*\$/s//($VERSION) $DISTRIBUTION; urgency=low/" debian/changelog
 fi
 # check that we replaced things correctly...
 D=$(dpkg-parsechangelog 2>/dev/null|grep ^Distribution:|cut -d " " -f2)
-if [ "$D" != "$DISTRIBUTION" ] ; then
-       figlet "Wrong distribution!"
-       dpkg-parsechangelog
-       exit 1
+if [ "$D" != "$DISTRIBUTION" ]; then
+    figlet "Wrong distribution!"
+    dpkg-parsechangelog
+    exit 1
 fi
 figlet "$DISTRIBUTION"
 
@@ -111,20 +110,20 @@ cd $WORKSPACE/..
 dcmd scp $CHANGES_FILE reprepro@alexandria.pb.local:/srv/$REPO/incoming/profitbricks/
 ssh reprepro@alexandria.pb.local /srv/$REPO/bin/pb_processincoming
 figlet "Uploaded."
-# cleanp
+# cleanup
 dcmd rm $CHANGES_FILE
 cd $WORKSPACE
 
 # push back to git repo if build from master or hotfix/
-if [ "$GIT_BRANCH_NAME" = "master" ] || [ "${GIT_BRANCH_NAME:0:7}" = "hotfix/" ] ; then
-       git add debian/changelog
-       git commit -m "Automatic commit by jenkins after build of $BUILD_NUMBER"
-       # ~ and : are not valid in git tags, replace them:
-       TAG=$(echo $VERSION | tr '~' '_' | tr ':' ',')
-       git tag $TAG
-       git push origin $GIT_BRANCH_NAME
-       git push origin $TAG
-       figlet "Tagged."
+if [ "$GIT_BRANCH_NAME" = "master" ] || [ "${GIT_BRANCH_NAME:0:7}" = "hotfix/" ]; then
+    git add debian/changelog
+    git commit -m "Automatic commit by jenkins after build of $BUILD_NUMBER"
+    # ~ and : are not valid in git tags, replace them:
+    TAG=$(echo $VERSION | tr '~' '_' | tr ':' ',')
+    git tag $TAG
+    git push origin $GIT_BRANCH_NAME
+    git push origin $TAG
+    figlet "Tagged."
 fi
 
 # show the changelog
@@ -136,10 +135,10 @@ cleanup
 # push back integration branch if we merged a feature branch
 if [ ${GIT_BRANCH_NAME:0:8} = "feature/" ] || [ ${GIT_BRANCH_NAME:0:7} = "bugfix/" ]; then
         if [[ "$BUILD_TRIGGERS" == *"merge"* ]]; then
-               git push origin integration
-               figlet "Pushed to integration."
-               git checkout origin/$GIT_BRANCH_NAME -b $GIT_BRANCH_NAME
-       fi
+        git push origin integration
+        figlet "Pushed to integration."
+        git checkout origin/$GIT_BRANCH_NAME -b $GIT_BRANCH_NAME
+    fi
 fi
 
 # the end