You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficcontrol.apache.org by GitBox <gi...@apache.org> on 2019/10/21 18:57:11 UTC

[GitHub] [trafficcontrol] ocket8888 commented on a change in pull request #3990: Fix deliveryservice_stats API to use already-vendored influxdb client, fix RPM builds to discover all vendor dirs

ocket8888 commented on a change in pull request #3990: Fix deliveryservice_stats API to use already-vendored influxdb client, fix RPM builds to discover all vendor dirs
URL: https://github.com/apache/trafficcontrol/pull/3990#discussion_r337184755
 
 

 ##########
 File path: traffic_monitor/build/traffic_monitor.spec
 ##########
 @@ -35,55 +35,12 @@ Installs traffic_monitor
 %setup
 
 %build
-export GOPATH=$(pwd)
-# Create build area with proper gopath structure
-mkdir -p src pkg bin || { echo "Could not create directories in $(pwd): $!"; exit 1; }
-
-go_get_version() {
-  local src=$1
-  local version=$2
-  (
-   cd $src && \
-   git checkout $version && \
-   go get -v \
-  )
-}
-
-# build all internal go dependencies (expects package being built as argument)
-build_dependencies () {
-    IFS=$'\n'
-    array=($(go list -f '{{ join .Deps "\n" }}' | grep trafficcontrol | grep -v $1))
-    prefix=github.com/apache/trafficcontrol
-    for (( i=0; i<${#array[@]}; i++ )); do
-        curPkg=${array[i]};
-        curPkgShort=${curPkg#$prefix};
-        echo "checking $curPkg";
-        godir=$GOPATH/src/$curPkg;
-        if [ ! -d "$godir" ]; then
-          ( echo "building $curPkg" && \
-            mkdir -p "$godir" && \
-            cd "$godir" && \
-            cp -r "$TC_DIR$curPkgShort"/* . && \
-            build_dependencies "$curPkgShort" && \
-            go get -v && \
-            echo "go building $curPkgShort at $(pwd)" && \
-            go build \
-          ) || { echo "Could not build go $curPkgShort at $(pwd): $!"; exit 1; };
-        fi
-     done
-}
-
-#build traffic_monitor binary
+# copy traffic_monitor binary
 godir=src/github.com/apache/trafficcontrol/traffic_monitor
-oldpwd=$(pwd)
 ( mkdir -p "$godir" && \
   cd "$godir" && \
-  cp -r "$TC_DIR"/traffic_monitor/* . && \
-  build_dependencies traffic_monitor  && \
-  #with proper vendoring go get would be  unneeded.
-  go get -d -v && \
-  go build -ldflags "-X main.GitRevision=`git rev-parse HEAD` -X main.BuildTimestamp=`date +'%Y-%M-%dT%H:%M:%s'` -X main.Version=%{traffic_control_version}" \
-) || { echo "Could not build go program at $(pwd): $!"; exit 1; }
+  cp -r "$TC_DIR"/traffic_monitor/* .
+) || { echo "Could not copy go program at $(pwd): $!"; exit 1; }
 
 Review comment:
   If you'd care to use it, RPM specfiles have a builtin macro for logging and exiting with an error (which will also log to stderr): `%{error:...}`.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services