htrace-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cmcc...@apache.org
Subject incubator-htrace git commit: HTRACE-292. "htracedTool version" should display the git hash, and -Dgit.version option should be available for build (cmccabe)
Date Fri, 06 Nov 2015 02:57:23 GMT
Repository: incubator-htrace
Updated Branches:
  refs/heads/master 38ad7da02 -> b22336bff


HTRACE-292. "htracedTool version" should display the git hash, and -Dgit.version option should
be available for build (cmccabe)


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

Branch: refs/heads/master
Commit: b22336bff3b49ca96db07145c1bfba651b2b3428
Parents: 38ad7da
Author: Colin Patrick Mccabe <cmccabe@cloudera.com>
Authored: Thu Nov 5 18:56:56 2015 -0800
Committer: Colin Patrick Mccabe <cmccabe@cloudera.com>
Committed: Thu Nov 5 18:56:56 2015 -0800

----------------------------------------------------------------------
 htrace-htraced/go/gobuild.sh                             | 11 ++++++++---
 .../go/src/org/apache/htrace/htracedTool/cmd.go          |  2 +-
 htrace-htraced/pom.xml                                   |  2 ++
 3 files changed, 11 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-htrace/blob/b22336bf/htrace-htraced/go/gobuild.sh
----------------------------------------------------------------------
diff --git a/htrace-htraced/go/gobuild.sh b/htrace-htraced/go/gobuild.sh
index 3e9b30a..de9e687 100755
--- a/htrace-htraced/go/gobuild.sh
+++ b/htrace-htraced/go/gobuild.sh
@@ -49,7 +49,7 @@ if [ $# -gt 0 ]; then
     ACTION="${1}"
     shift
 fi
-RELEASE_VERSION=${RELEASE_VERSION:-unknown}
+RELEASE_VERSION=${RELEASE_VERSION:-unknown_release}
 
 # Set up directories.  The build/ directory is where build dependencies and
 # build binaries should go.
@@ -122,10 +122,15 @@ install)
     popd &> /dev/null
 
     # Discover the git version
-    GIT_VERSION=$(git rev-parse HEAD)
-    [ $? -eq 0 ] || GIT_VERSION="unknown"
+    if [ "x${GIT_VERSION}" == "x" ]; then
+        pushd "${SCRIPT_DIR}" &> /dev/null || die "failed to cd to ${SCRIPT_DIR}"
+        GIT_VERSION=$(git rev-parse HEAD)
+        [ $? -eq 0 ] || GIT_VERSION="unknown_git"
+        popd &> /dev/null
+    fi
 
     # Inject the release and git version into the htraced ldflags.
+    echo "Building ${RELEASE_VERSION} [${GIT_VERSION}]"
     FLAGS="-X main.RELEASE_VERSION ${RELEASE_VERSION} -X main.GIT_VERSION ${GIT_VERSION}"
     go install ${TAGS} -ldflags "${FLAGS}" -v org/apache/htrace/... "$@" \
         || die "go install failed."

http://git-wip-us.apache.org/repos/asf/incubator-htrace/blob/b22336bf/htrace-htraced/go/src/org/apache/htrace/htracedTool/cmd.go
----------------------------------------------------------------------
diff --git a/htrace-htraced/go/src/org/apache/htrace/htracedTool/cmd.go b/htrace-htraced/go/src/org/apache/htrace/htracedTool/cmd.go
index 98b1646..04dc269 100644
--- a/htrace-htraced/go/src/org/apache/htrace/htracedTool/cmd.go
+++ b/htrace-htraced/go/src/org/apache/htrace/htracedTool/cmd.go
@@ -182,7 +182,7 @@ func main() {
 
 // Print the version of the htrace binary.
 func printVersion() int {
-	fmt.Printf("Running htrace command version %s.\n", RELEASE_VERSION)
+	fmt.Printf("Running htracedTool %s [%s].\n", RELEASE_VERSION, GIT_VERSION)
 	return EXIT_SUCCESS
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-htrace/blob/b22336bf/htrace-htraced/pom.xml
----------------------------------------------------------------------
diff --git a/htrace-htraced/pom.xml b/htrace-htraced/pom.xml
index 28cf929..b67af6d 100644
--- a/htrace-htraced/pom.xml
+++ b/htrace-htraced/pom.xml
@@ -28,6 +28,7 @@ language governing permissions and limitations under the License. -->
 
   <properties>
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    <git.version></git.version>
     <leveldb.prefix></leveldb.prefix>
   </properties>
   <build>
@@ -111,6 +112,7 @@ language governing permissions and limitations under the License. -->
                 <exec executable="./gobuild.sh"
                       dir="${basedir}//go/"
                       failonerror="true">
+                  <env key="GIT_VERSION" value="${git.version}"/>
                   <env key="RELEASE_VERSION" value="${project.version}"/>
                   <env key="LEVELDB_PREFIX" value="${leveldb.prefix}"/>
                 </exec>


Mime
View raw message