]> Frank Brehm's Git Trees - profitbricks/jenkins-build-scripts.git/commitdiff
fix upload, add cleanup after upload, add some more comments
authorHolger Levsen <holger@layer-acht.org>
Thu, 25 Jul 2013 12:41:25 +0000 (14:41 +0200)
committerHolger Levsen <holger@layer-acht.org>
Thu, 25 Jul 2013 12:41:25 +0000 (14:41 +0200)
maven_post_build_debian_wrapper.sh

index 823b767225f9ed4aa84688e14532469177e774ce..410a6e0dfb587daf9fe2b53dcdbbb22037632b5d 100755 (executable)
@@ -59,9 +59,9 @@ function validateInput
                # set proper DISTRIBUTION for feature branches
                DISTRIBUTION=$(echo "dev-${GIT_BRANCH_NAME}" | tr '/' '-')
        fi
-       REPO="dev-squeeeze"
+       REPO="dev-squeeze"
        APPEND_TO_VERSION="experimental"
-    elif ! containsElement $DISTRIBUTION "${VALID_DISTROS[@]}" ; then
+    elif ! containsElement $DISTRIBUTION "${VALID_DISTROS[@]}" || [ -z "$DISTRIBUTION" ] ; then
         echo "\$DISTRIBUTION is set to $DISTRIBUTION but thats not a valid distribution, which are: $VALID_DISTROS"
         exit 1
        if [ "$DISTRIBUTION" = "unstable" ] || [ "$DISTRIBUTION" = "pre-staging" ] ; then
@@ -85,6 +85,7 @@ function validateInput
 #############
 cd $WORKSPACE
 validateInput
+export
 set -e         # fail on error
 set -x                 # echo commands executed
 
@@ -106,12 +107,15 @@ fi
 dpkg-buildpackage -us -uc -b
 
 # upload to reprepro
-SOURCE=$(dpkg-parsechangelog 2>/dev/null|grep ^Source:|cut -d " " -f2)
+SOURCE=$(dpkg-parsechangelog 2>/dev/null|grep ^Source:|cut -d " " -f2) # get the name of the source package
+CHANGES_FILE=${SOURCE}_${VERSION}_amd64.changes
 cd $WORKSPACE/..
-# TODO: move configuration up
-dcmd scp ${SOURCE}_${VERSION}_amd64.changes alexandria.pb.local:/srv/$REPO/incoming/profitbricks/
+# upload
+dcmd scp $CHANGES_FILE reprepro@alexandria.pb.local:/srv/$REPO/incoming/profitbricks/
+# cleanp
+dcmd rm $CHANGES_FILE
+rm $CHANGES_FILE ${SOURCE}_${VERSION}_amd64.build
 cd $WORKSPACE
-# TODO: cleanup uploaded files
 
 # push back to git repo if build from master or hotfix/
 if [ "$GIT_BRANCH_NAME" = "master" ] || [ "${GIT_BRANCH_NAME:0:7}" = "hotfix/" ] ; then
@@ -127,7 +131,7 @@ fi
 # show the changelog
 dpkg-parsechangelog
 
-set +x
+# call cleanup function
 cleanup
 
 # push back integration branch if we merged a feature branch
@@ -138,5 +142,4 @@ if [ ${GIT_BRANCH_NAME:0:8} = "feature/" ] ; then
        fi
 fi
 
-#TODO: remove this debug output
-export
+# the end