[docker][experimental] Allow COLLECTD_TAG to be passed to container build
[barometer.git] / src / collectd / Makefile
index 0479163..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
@@ -47,8 +49,13 @@ CONFIG_CMD += --with-libjevents=/usr/local
 CONFIG_CMD += --enable-exec
 CONFIG_CMD += --enable-python
 CONFIG_CMD += --enable-threshold
+CONFIG_CMD += --enable-write_redis
 CONFIG_CMD += --disable-perl
 CONFIG_CMD += --with-librdkafka=/usr
+CONFIG_CMD += --disable-lvm
+ifdef WITH_DPDK
+CONFIG_CMD += LIBDPDK_CFLAGS='-mssse3'
+endif
 
 .PHONY: install force_install config force_make
 
@@ -63,8 +70,6 @@ config $(WORK_DIR)/Makefile: $(WORK_DIR)/configure
        @echo "Configure done"
 
 force_make: $(WORK_DIR)/Makefile
-       $(AT)cd $(WORK_DIR) && git pull $(COLLECTD_URL) $(COLLECTD_TAG)
-       @echo "git pull done"
        $(AT) $(MAKE) -C $(WORK_DIR) $(MORE_MAKE_FLAGS)
        @echo "Make done"
 
@@ -80,7 +85,9 @@ ifndef DOCKER
 endif
        $(AT)sudo ./ovs_pmd_stats_config.sh
        $(AT)sudo ./snmp_mib_config.sh
-       $(AT)sudo ./include_config.sh
+
+       @echo "Using sample configs: $(SAMPLE_CONF_VARIANT_NAME)"
+       $(AT)sudo ./include_config.sh $(SAMPLE_CONF_VARIANT_NAME)
        @echo "Make install done"
 
 install: force_install
@@ -105,19 +112,22 @@ sanity:
 
 .PHONY: boot
 # boot collectd is the process to produce the script 'configure'
-boot $(WORK_DIR)/configure:
+boot $(WORK_DIR)/configure: $(TAG_DONE_FLAG)
        @echo "booting up collectd"
        $(AT)cd $(WORK_DIR); $(BUILD_CMD)
        @echo "done booting collectd"
 
-boot $(WORK_DIR)/configure: $(TAG_DONE_FLAG)
-
 $(WORK_DIR):
        $(AT)git clone $(COLLECTD_URL)
 
 $(TAG_DONE_FLAG): $(WORK_DIR)
-       $(AT)cd collectd; git checkout $(COLLECTD_TAG)
+       @echo "Checking out collectd from tag: $(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
+ifeq ($(COLLECTD_USE_EXPERIMENTAL_PR), y)
+       @echo "Applying experimental pull requests"
+       $(AT)cd $(WORK_DIR); ../collectd_apply_pull_request.sh
 endif
        $(AT)touch $@