You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mnemonic.apache.org by ga...@apache.org on 2017/01/03 01:30:03 UTC

incubator-mnemonic git commit: MNEMONIC-173: Missing exit code in build-tools' scripts MNEMONIC-107: Use MNEMONIC_HOME Environment Variable

Repository: incubator-mnemonic
Updated Branches:
  refs/heads/0.5.0-dev 22868d410 -> 4ace438cc


MNEMONIC-173: Missing exit code in build-tools' scripts
MNEMONIC-107: Use MNEMONIC_HOME Environment Variable


Project: http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/commit/4ace438c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/tree/4ace438c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/diff/4ace438c

Branch: refs/heads/0.5.0-dev
Commit: 4ace438cccb4cde5acc76d064b79bceca208c22a
Parents: 22868d4
Author: Wang, Gang(Gary) <ga...@intel.com>
Authored: Mon Jan 2 17:29:12 2017 -0800
Committer: Wang, Gang(Gary) <ga...@intel.com>
Committed: Mon Jan 2 17:29:12 2017 -0800

----------------------------------------------------------------------
 build-tools/bundle.sh             |  9 ++++++++-
 build-tools/find-mnemonic-home.sh | 23 +++++++++++++++++++++++
 build-tools/release.sh            | 29 ++++++++++++++++++-----------
 build-tools/runall.sh             |  8 +++++++-
 docker/Dockerfile                 |  2 ++
 5 files changed, 58 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/blob/4ace438c/build-tools/bundle.sh
----------------------------------------------------------------------
diff --git a/build-tools/bundle.sh b/build-tools/bundle.sh
index 8c7ef0a..cd90768 100755
--- a/build-tools/bundle.sh
+++ b/build-tools/bundle.sh
@@ -17,12 +17,17 @@
 # limitations under the License.
 #
 
+if [ -z "${MNEMONIC_HOME}" ]; then
+  source "$(dirname "$0")/find-mnemonic-home.sh" || { echo "Not found find-mnemonic-home.sh script."; exit 10; }
+fi
+pushd "$MNEMONIC_HOME" || { echo "the environment variable \$MNEMONIC_HOME contains invalid home directory of Mnemonic project."; exit 11; }
+
 bundle_path="./target/bundle_tmp"
 bundle_name="./target/bundle.jar"
 
 excluded_modules_arr=(mnemonic-utilities-service* mnemonic-nvml-pmem-service* mnemonic-nvml-vmem-service* mnemonic-pmalloc-service*)
 
-[[ x"${bundle_path}" = x"./target/"* ]] || ( echo "The bundle tmp path must begin with ./target/"; exit )
+[[ x"${bundle_path}" = x"./target/"* ]] || ( echo "The bundle tmp path must begin with ./target/"; exit 20 )
 mkdir -p ${bundle_path} || rm -f ${bundle_path}/*
 bn_arr=($(find . ! -path "${bundle_path}/*" -type f -name "*.pom.asc" -exec basename {} .pom.asc \; | xargs))
 for del in ${excluded_modules_arr[@]}
@@ -47,3 +52,5 @@ jar cf ${bundle_name} -C ${bundle_path} .
 echo "The bundle has been generated as follows."
 ls -1 ${bundle_name}
 
+popd
+

http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/blob/4ace438c/build-tools/find-mnemonic-home.sh
----------------------------------------------------------------------
diff --git a/build-tools/find-mnemonic-home.sh b/build-tools/find-mnemonic-home.sh
new file mode 100755
index 0000000..eb95c8a
--- /dev/null
+++ b/build-tools/find-mnemonic-home.sh
@@ -0,0 +1,23 @@
+#!/usr/bin/env bash
+
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+if [ -z "${MNEMONIC_HOME}" ]; then
+  export MNEMONIC_HOME="$(cd "$(dirname "$0")"/..; pwd)"
+fi
+

http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/blob/4ace438c/build-tools/release.sh
----------------------------------------------------------------------
diff --git a/build-tools/release.sh b/build-tools/release.sh
index f56958f..96bc0ed 100755
--- a/build-tools/release.sh
+++ b/build-tools/release.sh
@@ -29,14 +29,19 @@ continueprompt() {
 	read -p "Do you wish to continue [y/n] ? " yn
 	case $yn in
 	    [Yy]* ) break;;
-	    [Nn]* ) exit;;
+	    [Nn]* ) exit 2;;
 	    * ) echo "Please answer yes or no.";;
 	    esac
 	done
 }
 
+if [ -z "${MNEMONIC_HOME}" ]; then
+  source "$(dirname "$0")/find-mnemonic-home.sh" || { echo "Not found find-mnemonic-home.sh script."; exit 10; }
+fi
+pushd "$MNEMONIC_HOME" || { echo "the environment variable \$MNEMONIC_HOME contains invalid home directory of Mnemonic project."; exit 11; }
+
 [[ -n "$(git status --porcelain)" ]] &&
-    echo "please commit all changes first." && exit
+    echo "please commit all changes first." && exit 20
 
 [[ $# -ne 3 ]]  && usage
 
@@ -72,7 +77,7 @@ fi
 echo "Preparing to create a branch branch-${RELEASE_VERSION} for release"
 continueprompt
 
-git checkout -b branch-${RELEASE_VERSION} || { echo "Create branch failed"; exit; }
+git checkout -b branch-${RELEASE_VERSION} || { echo "Create branch failed"; exit 30; }
 
 mvn versions:set -DgenerateBackupPoms=false -DnewVersion=${RELEASE_VERSION}-incubating
 git commit . -m "Prepare for releasing ${RELEASE_VERSION}-incubating ${RELEASE_CANDIDATE_ID}"
@@ -84,23 +89,23 @@ git clean -xdf
 
 mvn clean prepare-package -DskipTests -Dremoteresources.skip=true &&
 mvn prepare-package -DskipTests -Dremoteresources.skip=true &&
-mvn deploy -DskipTests -Dremoteresources.skip=true -P apache-release || { echo "Preparation failed"; exit; }
+mvn deploy -DskipTests -Dremoteresources.skip=true -P apache-release || { echo "Preparation failed"; exit 40; }
 
 RELEASEBASENAME=apache-mnemonic-${RELEASE_VERSION}-incubating
 RELEASESRCBASENAME=${RELEASEBASENAME}-src
 RELEASESRCPKGFULLNAME=${RELEASESRCBASENAME}.tar.gz
 
-pushd target || { echo "Artifacts not found"; exit; }
-md5sum ${RELEASESRCPKGFULLNAME} > ${RELEASESRCPKGFULLNAME}.md5 || { echo "Generate md5 failed"; exit; }
-shasum -a 512 ${RELEASESRCPKGFULLNAME} > ${RELEASESRCPKGFULLNAME}.sha512 || { echo "Generate sha failed"; exit; }
+pushd target || { echo "Artifacts not found"; exit 50; }
+md5sum ${RELEASESRCPKGFULLNAME} > ${RELEASESRCPKGFULLNAME}.md5 || { echo "Generate md5 failed"; exit 60; }
+shasum -a 512 ${RELEASESRCPKGFULLNAME} > ${RELEASESRCPKGFULLNAME}.sha512 || { echo "Generate sha failed"; exit 70; }
 popd
 
 echo "Verifying packaged Source Artifacts"
 rm -rf ${RELEASEBASENAME}/
-tar xzf target/${RELEASESRCPKGFULLNAME} || { echo "Failed to unpack the source artifact"; exit; }
-pushd ${RELEASEBASENAME} || { echo "Unpacked source directory does not exist"; exit; }
-mvn clean install || { echo "Failed to compile the packaged source artifact"; exit; }
-build-tools/runall.sh || { echo "Failed to verify the packaged source artifact"; exit; }
+tar xzf target/${RELEASESRCPKGFULLNAME} || { echo "Failed to unpack the source artifact"; exit 80; }
+pushd ${RELEASEBASENAME} || { echo "Unpacked source directory does not exist"; exit 90; }
+mvn clean install || { echo "Failed to compile the packaged source artifact"; exit 100; }
+build-tools/runall.sh || { echo "Failed to verify the packaged source artifact"; exit 110; }
 popd
 rm -rf ${RELEASEBASENAME}/
 
@@ -132,3 +137,5 @@ continueprompt
 
 git push upstream master
 
+popd
+

http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/blob/4ace438c/build-tools/runall.sh
----------------------------------------------------------------------
diff --git a/build-tools/runall.sh b/build-tools/runall.sh
index ed6f8eb..e535ec2 100755
--- a/build-tools/runall.sh
+++ b/build-tools/runall.sh
@@ -17,6 +17,11 @@
 # limitations under the License.
 #
 
+if [ -z "${MNEMONIC_HOME}" ]; then
+  source "$(dirname "$0")/find-mnemonic-home.sh" || { echo "Not found find-mnemonic-home.sh script."; exit 10; }
+fi
+pushd "$MNEMONIC_HOME" || { echo "the environment variable \$MNEMONIC_HOME contains invalid home directory of Mnemonic project."; exit 11; }
+
 echo [INFO] Cleaning up and re-building...
 git ls-files --error-unmatch pom.xml > /dev/null 2>&1 && git clean -xdf > /dev/null
 
@@ -115,4 +120,5 @@ fi
 echo [SUCCESS] Test case DurableSinglyLinkedListNGSortTest for \"mnemonic-computing-services/mnemonic-utilities-service\" is completed!
 
 echo [DONE] All test cases are completed! Log files are available under folder testlog!
-exit 0
+
+popd

http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/blob/4ace438c/docker/Dockerfile
----------------------------------------------------------------------
diff --git a/docker/Dockerfile b/docker/Dockerfile
index 19425bf..f6f6883 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -64,6 +64,8 @@ RUN echo export MAVEN_OPTS="\" $([[ \"x\" != \"x${proxy_host}\" ]] && echo -Dpro
 RUN cd /ws && git clone https://github.com/apache/incubator-mnemonic.git && \
     cd incubator-mnemonic && source /etc/profile.d/mvn.sh && mvn clean package install
 
+ENV MNEMONIC_HOME /ws/incubator-mnemonic
+
 RUN cd /ws/incubator-mnemonic && build-tools/runall.sh
 
 WORKDIR /ws