[docker][experimental] Allow COLLECTD_TAG to be passed to container build
[barometer.git] / src / collectd / Makefile
index 8eea00f..ec45f94 100644 (file)
@@ -1,19 +1,20 @@
 # makefile to manage collectd package
 #
 
-# Copyright 2016-2017 OPNFV
+# Copyright 2016-2019 Intel Corporation and OPNFV. All rights reserved.
 #
 # Licensed 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
+# 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.
+#
 
 #
 # Contributors:
@@ -24,7 +25,8 @@ include ../mk/master.mk
 include ../package-list.mk
 
 WORK_DIR = collectd
-TAG_DONE_FLAG = $(WORK_DIR)/.$(COLLECTD_TAG).done
+# $COLLECTD_TAG can contain "/", which is being replaced with "-" here
+TAG_DONE_FLAG := $(WORK_DIR)/.$(subst /,-,"$(COLLECTD_TAG)").done
 BUILD_CMD = ./build.sh
 CONFIG_CMD =
 CONFIG_CMD += ./configure
@@ -120,7 +122,7 @@ $(WORK_DIR):
 
 $(TAG_DONE_FLAG): $(WORK_DIR)
        @echo "Checking out collectd from tag: $(COLLECTD_TAG)"
-       $(AT)cd collectd; git checkout $(COLLECTD_TAG)
+       $(AT)cd collectd; git fetch origin $(COLLECTD_TAG); git checkout FETCH_HEAD
 ifneq ($(PATCH_FILE),)
        $(AT)cd $(WORK_DIR); patch -p1 < ../$(PATCH_FILE)
 endif