1 ##############################################################################
2 # Copyright (c) 2016 Red Hat Inc.
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ##############################################################################
10 export USE_MASTER = ""
13 export RPM_DIST = $(shell rpm -E %dist)
14 export RPMVERS = $(shell grep Version $(shell pwd)/rpm_specs/opnfv-apex.spec | head -n 1 | awk '{ print $$2 }')
16 export BUILD_ROOT = $(shell pwd)
17 export BUILD_DIR = $(shell dirname $$(pwd))/.build
18 export CACHE_DIR = $(shell dirname $$(pwd))/.cache
19 export RPM_DIR_ARGS = -D '_topdir $(BUILD_DIR)' -D '_builddir $(BUILD_DIR)' -D '_sourcedir $(BUILD_DIR)' -D '_rpmdir $(BUILD_DIR)' -D '_specdir $(BUILD_DIR)' -D '_srcrpmdir $(BUILD_DIR)'
20 export RPMCOM = $(BUILD_DIR)/noarch/python34-opnfv-apex-$(RPMVERS)-$(shell echo ${RELEASE} | tr -d '_-').noarch.rpm
22 export NETVPP_VERS := $(shell grep Version $(shell pwd)/rpm_specs/networking-vpp.spec | head -n 1 | awk '{ print $$2 }')
23 export NETVPP_REPO := "https://github.com/fepan/networking-vpp"
24 export NETVPP_BRANCH := "test-fdio-fix"
25 export NETVPP_COMMIT := $(shell git ls-remote $(NETVPP_REPO) $(NETVPP_BRANCH) | awk '{print substr($$1,1,7)}')
39 rpm-check: apex-rpm-check
43 rm -rf $(BUILD_DIR)/noarch
44 rm -rf $(BUILD_DIR)/BUILDROOT
46 $(BUILD_DIR)/opnfv-apex.tar.gz:
48 pushd ../ && git archive --format=tar.gz --prefix=opnfv-apex-$(RPMVERS)/ HEAD > $(BUILD_DIR)/opnfv-apex.tar.gz
50 .PHONY: apex-rpm-check
51 apex-rpm-check: $(BUILD_DIR)/opnfv-apex.tar.gz
52 rpmbuild --clean -bi -bl rpm_specs/opnfv-apex.spec $(RPM_DIR_ARGS) -D "_release $(shell echo $(RELEASE) | tr -d '_-')"
55 rpm: $(BUILD_DIR)/opnfv-apex.tar.gz $(RPMCOM)
58 @echo "Building the Apex RPM"
60 rpmbuild --clean -ba rpm_specs/opnfv-apex.spec $(RPM_DIR_ARGS) -D "_release $(shell echo $(RELEASE) | tr -d '_-')"
67 $(BUILD_DIR)/python-networking-vpp.tar.gz:
68 @echo "Preparing the networking-vpp RPM prerequisites"
69 git clone $(NETVPP_REPO) -b $(NETVPP_BRANCH) $(BUILD_DIR)/python-networking-vpp-$(NETVPP_VERS)
70 tar czf $(BUILD_DIR)/python-networking-vpp.tar.gz -C $(BUILD_DIR) python-networking-vpp-$(NETVPP_VERS)
72 .PHONY: networking-vpp-rpm
73 networking-vpp-rpm: $(BUILD_DIR)/noarch/python-networking-vpp-*.noarch.rpm
75 $(BUILD_DIR)/noarch/python-networking-vpp-*.noarch.rpm: $(BUILD_DIR)/python-networking-vpp.tar.gz
76 @echo "Building the Networking VPP RPM"
77 rpmbuild --clean -ba --target noarch rpm_specs/networking-vpp.spec $(RPM_DIR_ARGS) -D 'git .git$(NETVPP_COMMIT)'
87 #######################
89 #######################
91 .PHONY: python-pep8-check
101 @echo "Running yamllint against all .yaml files"
102 cd ../ && yamllint $(shell cd ../ && git ls-tree -r HEAD --name-only | grep 'yaml$$')
109 @echo "Running rpmlint against all RPM spec files"
110 rpmlint rpm_specs/*.spec