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 = ""
11 export CENTDNLD = http://mirrors.cat.pdx.edu/centos/7.2.1511/isos/x86_64/CentOS-7-x86_64-DVD-1511.iso
12 export CENTISO = $(shell pwd)/$(shell basename $(CENTDNLD))
14 export ISO = $(shell pwd)/release/OPNFV-CentOS-7-x86_64-${RELEASE}.iso
15 export RPMVERS = $(shell grep Version $(shell pwd)/rpm_specs/opnfv-apex.spec | head -n 1 | awk '{ print $$2 }')
16 export RPMCOM = $(shell pwd)/noarch/opnfv-apex-common-$(RPMVERS)-$(shell echo ${RELEASE} | tr -d '_-').noarch.rpm
17 export RPMUDR = $(shell pwd)/noarch/opnfv-apex-undercloud-$(RPMVERS)-$(shell echo ${RELEASE} | tr -d '_-').noarch.rpm
18 export RPMODL = $(shell pwd)/noarch/opnfv-apex-$(RPMVERS)-$(shell echo ${RELEASE} | tr -d '_-').noarch.rpm
19 export RPMONO = $(shell pwd)/noarch/opnfv-apex-onos-$(RPMVERS)-$(shell echo ${RELEASE} | tr -d '_-').noarch.rpm
20 export RPMSFC = $(shell pwd)/noarch/opnfv-apex-opendaylight-sfc-$(RPMVERS)-$(shell echo ${RELEASE} | tr -d '_-').noarch.rpm
22 all_networks="admin_network private_network storage_network external_network api_network"
30 clean: images-clean rpms-clean iso-clean tacker-clean congress-clean vpp-clean
33 images: undercloud overcloud-full overcloud-opendaylight overcloud-onos overcloud-opendaylight-sfc
36 images-clean: undercloud-clean overcloud-full-clean overcloud-opendaylight-clean overcloud-onos-clean overcloud-opendaylight-sfc-clean
40 rpms: common-rpm undercloud-rpm opendaylight-rpm onos-rpm opendaylight-sfc-rpm
43 rpms-check: common-rpm-check undercloud-rpm-check opendaylight-rpm-check onos-rpm-check opendaylight-sfc-rpm-check
46 rpms-clean: common-rpm-clean undercloud-rpm-clean opendaylight-rpm-clean onos-rpm-clean opendaylight-sfc-rpm-clean
48 opnfv-apex-common.tar.gz:
49 pushd ../ && git archive --format=tar.gz --prefix=opnfv-apex-common-$(RPMVERS)/ HEAD > build/opnfv-apex-common.tar.gz
51 .PHONY: common-rpm-check
52 common-rpm-check: opnfv-apex-common.tar.gz
53 rpmbuild --clean -bi -bl rpm_specs/opnfv-apex-common.spec -D '_topdir %(echo `pwd`)' -D '_builddir %(echo `pwd`)' -D '_sourcedir %(echo `pwd`)' -D '_rpmdir %(echo `pwd`)' -D '_specdir %(echo `pwd`)' -D '_srcrpmdir %(echo `pwd`)' -D "release $(shell echo $(RELEASE) | tr -d '_-')"
56 common-rpm: opnfv-apex-common.tar.gz $(RPMCOM)
59 @echo "Building the Apex Common RPM"
60 # build the common RPM
61 rpmbuild --clean -ba rpm_specs/opnfv-apex-common.spec -D '_topdir %(echo `pwd`)' -D '_builddir %(echo `pwd`)' -D '_sourcedir %(echo `pwd`)' -D '_rpmdir %(echo `pwd`)' -D '_specdir %(echo `pwd`)' -D '_srcrpmdir %(echo `pwd`)' -D "release $(shell echo $(RELEASE) | tr -d '_-')"
69 # clean previous coverage data
70 rm -rf ../tests/.coverage
71 rm -rf ../tests/htmlcov
73 cd ../tests && PYTHONPATH=../lib/python/ nosetests-3.4 . --with-coverage --cover-package apex --cover-package apex_python_utils --cover-html --cover-min-percentage 85
76 cd ../tests && coverage3 report --include '*lib/python/*' -m
78 #######################
80 #######################
82 .PHONY: python-pep8-check
94 @rm -rf openstack-tacker-2015.2
95 @rm -f openstack-tacker.tar.gz
97 openstack-tacker.tar.gz:
98 @echo "Preparing the Tacker RPM prerequisites"
99 git clone http://github.com/trozet/tacker -b SFC_colorado openstack-tacker-2015.2
100 tar czf openstack-tacker.tar.gz openstack-tacker-2015.2
103 tacker-rpm: openstack-tacker.tar.gz openstack-tacker-2015.2-1.trozet.noarch.rpm
105 openstack-tacker-2015.2-1.trozet.noarch.rpm:
106 @echo "Building the Tacker RPM"
107 rpmbuild --clean -bb --target noarch rpm_specs/openstack-tacker.spec -D '_topdir %(echo `pwd`)' -D '_builddir %(echo `pwd`)' -D '_sourcedir %(echo `pwd`)' -D '_rpmdir %(echo `pwd`)' -D '_specdir %(echo `pwd`)' -D '_srcrpmdir %(echo `pwd`)'
113 .PHONY: tackerclient-clean
116 @rm -rf python-tackerclient-2015.2
117 @rm -f python-tackerclient.tar.gz
119 python-tackerclient.tar.gz:
120 @echo "Preparing the TackerClient RPM prerequisites"
121 git clone http://github.com/trozet/python-tackerclient -b SFC_refactor python-tackerclient-2015.2
122 tar czf python-tackerclient.tar.gz python-tackerclient-2015.2
124 .PHONY: tackerclient-rpm
125 tackerclient-rpm: python-tackerclient.tar.gz python-tackerclient-2015.2-1.trozet.noarch.rpm
127 python-tackerclient-2015.2-1.trozet.noarch.rpm:
128 @echo "Building the TackerClient RPM"
129 rpmbuild --clean -bb --target noarch rpm_specs/python-tackerclient.spec -D '_topdir %(echo `pwd`)' -D '_builddir %(echo `pwd`)' -D '_sourcedir %(echo `pwd`)' -D '_rpmdir %(echo `pwd`)' -D '_specdir %(echo `pwd`)' -D '_srcrpmdir %(echo `pwd`)'
135 .PHONY: congress-clean
138 @rm -rf openstack-congress-2016.1
139 @rm -f openstack-congress.tar.gz
141 openstack-congress.tar.gz:
142 @echo "Preparing the Congress RPM prerequisites"
143 git clone http://github.com/openstack/congress -b stable/mitaka openstack-congress-2016.1
144 cd openstack-congress-2016.1 && curl -O https://radez.fedorapeople.org/openstack-congress.service
145 tar czf openstack-congress.tar.gz openstack-congress-2016.1
148 congress-rpm: openstack-congress.tar.gz openstack-congress-2016.1-1.noarch.rpm
150 openstack-congress-2016.1-1.noarch.rpm:
151 @echo "Building the Congress RPM"
152 rpmbuild --clean -bb --target noarch rpm_specs/openstack-congress.spec -D '_topdir %(echo `pwd`)' -D '_builddir %(echo `pwd`)' -D '_sourcedir %(echo `pwd`)' -D '_rpmdir %(echo `pwd`)' -D '_specdir %(echo `pwd`)' -D '_srcrpmdir %(echo `pwd`)'
159 MAVEN = apache-maven-3.3.9
160 MAVEN_FILE = $(MAVEN)-bin.tar.gz
164 @rm -f vpp-bin.tar.gz
166 @rm -rf honeycomb $(MAVEN) $(MAVEN_FILE) honeycomb-1.0.0-99.noarch.rpm
167 @rm -rf networking-vpp networking-vpp.noarch.rpm
170 vpp-build: vpp-bin.tar.gz
172 vpp-bin.tar.gz: vpp honeycomb $(MAVEN)
173 $(MAKE) -C $(VPP_DIR) UNATTENDED=yes install-dep bootstrap build pkg-rpm
174 $(MAKE) -C $(VPP_DIR)/build-root PLATFORM=vpp TAG=vpp_debug vpp-api-install
175 pushd vpp/vpp-api/python && python setup.py bdist
176 pushd vpp/build-root/build-vpp-native/vpp-api/java/ && ../../../../../$(MAVEN)/bin/mvn install:install-file -Dfile=jvpp-registry-16.12.jar -DgroupId=io.fd.vpp -DartifactId=jvpp-registry -Dversion=16.12-SNAPSHOT -Dpackaging=jar
177 pushd vpp/build-root/build-vpp-native/vpp-api/java/ && ../../../../../$(MAVEN)/bin/mvn install:install-file -Dfile=jvpp-core-16.12.jar -DgroupId=io.fd.vpp -DartifactId=jvpp-core -Dversion=16.12-SNAPSHOT -Dpackaging=jar
178 pushd honeycomb && ../$(MAVEN)/bin/mvn clean install -DskipTests
179 pushd honeycomb/packaging/rpm/ && BUILD_NUMBER=99 ./rpmbuild.sh
181 mv vpp/build-root/*.rpm vpp-bin/
182 mv honeycomb/packaging/rpm/RPMS/noarch/*.rpm .
183 mv vpp/vpp-api/python/dist/*.tar.gz vpp-bin/
184 tar czf vpp-bin.tar.gz vpp-bin
187 git clone https://gerrit.fd.io/r/vpp
190 git clone https://gerrit.fd.io/r/p/honeycomb.git
192 $(MAVEN): $(MAVEN_FILE)
193 tar zxvf apache-maven-3.3.9-bin.tar.gz
194 cp mvn_settings.xml $(MAVEN)/conf/settings.xml
197 wget http://www.webhostingjams.com/mirror/apache/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz
199 .PHONY: networking-vpp-rpm
200 networking-vpp-rpm: networking-vpp.noarch.rpm
202 networking-vpp.noarch.rpm: networking-vpp
203 pushd networking-vpp && python setup.py bdist_rpm --binary-only
204 mv networking-vpp/dist/*.rpm networking-vpp.noarch.rpm
207 git clone -b stable_vlan_rewrite https://github.com/fepan/networking-vpp.git
213 .PHONY: undercloud-clean
215 @rm -f images/undercloud.*
218 undercloud: images/undercloud.qcow2
220 images/undercloud.qcow2: tackerclient-rpm
221 @echo "Building the Apex Undercloud Image"
224 opnfv-apex-undercloud.tar.gz: images/undercloud.qcow2
225 @echo "Preparing the Apex Undercloud RPM prerequisites"
226 pushd ../ && git archive --format=tar --prefix=opnfv-apex-undercloud-$(RPMVERS)/ HEAD > build/opnfv-apex-undercloud.tar
227 tar -rf opnfv-apex-undercloud.tar \
228 --xform="s:images/undercloud.qcow2:opnfv-apex-undercloud-$(RPMVERS)/build/undercloud.qcow2:" images/undercloud.qcow2
229 gzip -f opnfv-apex-undercloud.tar
231 .PHONY: undercloud-rpm-check
232 undercloud-rpm-check: opnfv-apex-undercloud.tar.gz
233 rpmbuild --clean -bi -bl rpm_specs/opnfv-apex-undercloud.spec -D '_topdir %(echo `pwd`)' -D '_builddir %(echo `pwd`)' -D '_sourcedir %(echo `pwd`)' -D '_rpmdir %(echo `pwd`)' -D '_specdir %(echo `pwd`)' -D '_srcrpmdir %(echo `pwd`)' -D "release $(shell echo $(RELEASE) | tr -d '_-')"
235 .PHONY: undercloud-rpm
236 undercloud-rpm: opnfv-apex-undercloud.tar.gz $(RPMUDR)
239 @echo "Building the Apex Undercloud RPM"
240 rpmbuild --clean -ba rpm_specs/opnfv-apex-undercloud.spec -D '_topdir %(echo `pwd`)' -D '_builddir %(echo `pwd`)' -D '_sourcedir %(echo `pwd`)' -D '_rpmdir %(echo `pwd`)' -D '_specdir %(echo `pwd`)' -D '_srcrpmdir %(echo `pwd`)' -D "release $(shell echo $(RELEASE) | tr -d '_-')"
246 .PHONY: overcloud-full-clean
247 overcloud-full-clean:
248 @rm -rf images/overcloud-full.d
249 @rm -f images/overcloud-full.*
251 .PHONY: overcloud-full
252 overcloud-full: images/overcloud-full.qcow2
254 images/overcloud-full.qcow2: tacker-rpm tackerclient-rpm congress-rpm networking-vpp-rpm
255 @echo "Building the Apex Base Overcloud Image"
262 .PHONY: overcloud-opendaylight-clean
263 overcloud-opendaylight-clean:
264 @rm -f images/overcloud-full-opendaylight.qcow2
266 .PHONY: overcloud-opendaylight
267 overcloud-opendaylight: images/overcloud-full-opendaylight.qcow2
269 images/overcloud-full-opendaylight.qcow2: images/overcloud-full.qcow2
270 @echo "Building the Apex OpenDaylight Overcloud Image"
271 @./overcloud-opendaylight.sh
273 opnfv-apex.tar.gz: images/overcloud-full-opendaylight.qcow2
274 tar -czf opnfv-apex.tar.gz --xform="s:images/overcloud-full-opendaylight.qcow2:opnfv-apex-$(RPMVERS)/build/images/overcloud-full-opendaylight.qcow2:" images/overcloud-full-opendaylight.qcow2
276 .PHONY: opendaylight-rpm-check
277 opendaylight-rpm-check: opnfv-apex.tar.gz
278 rpmbuild --clean -bi -bl rpm_specs/opnfv-apex.spec -D '_topdir %(echo `pwd`)' -D '_builddir %(echo `pwd`)' -D '_sourcedir %(echo `pwd`)' -D '_rpmdir %(echo `pwd`)' -D '_specdir %(echo `pwd`)' -D '_srcrpmdir %(echo `pwd`)' -D "release $(shell echo $(RELEASE) | tr -d '_-')"
280 .PHONY: opendaylight-rpm
281 opendaylight-rpm: opnfv-apex.tar.gz $(RPMODL)
284 @echo "Building the Apex OpenDaylight RPM"
285 # build the overcloud RPM
286 rpmbuild --clean -ba rpm_specs/opnfv-apex.spec -D '_topdir %(echo `pwd`)' -D '_builddir %(echo `pwd`)' -D '_sourcedir %(echo `pwd`)' -D '_rpmdir %(echo `pwd`)' -D '_specdir %(echo `pwd`)' -D '_srcrpmdir %(echo `pwd`)' -D "release $(shell echo $(RELEASE) | tr -d '_-')"
292 .PHONY: overcloud-onos-clean
293 overcloud-onos-clean:
294 @rm -f images/overcloud-full-onos.qcow2
295 @rm -rf images/puppet-onos
296 @rm -f images/puppet-onos.tar.gz
298 .PHONY: overcloud-onos
299 overcloud-onos: images/overcloud-full-onos.qcow2
301 images/overcloud-full-onos.qcow2: images/overcloud-full.qcow2
302 @echo "Building the Apex ONOS Overcloud Image"
305 .PHONY: onos-rpm-clean
307 @rpmbuild --clean rpm_specs/opnfv-apex-onos.spec -D "release $(shell echo $RELEASE | tr -d '_-')"
309 opnfv-apex-onos.tar.gz: images/overcloud-full-onos.qcow2
310 tar -czf opnfv-apex-onos.tar.gz --xform="s:images/overcloud-full-onos.qcow2:opnfv-apex-onos-$(RPMVERS)/build/images/overcloud-full-onos.qcow2:" images/overcloud-full-onos.qcow2
312 .PHONY: onos-rpm-check
313 onos-rpm-check: opnfv-apex-onos.tar.gz
314 rpmbuild --clean -bi -bl rpm_specs/opnfv-apex-onos.spec -D '_topdir %(echo `pwd`)' -D '_builddir %(echo `pwd`)' -D '_sourcedir %(echo `pwd`)' -D '_rpmdir %(echo `pwd`)' -D '_specdir %(echo `pwd`)' -D '_srcrpmdir %(echo `pwd`)' -D "release $(shell echo $(RELEASE) | tr -d '_-')"
317 onos-rpm: opnfv-apex-onos.tar.gz $(RPMONO)
320 @echo "Building the Apex ONOS RPM"
321 # build the overcloud RPM
322 rpmbuild --clean -ba rpm_specs/opnfv-apex-onos.spec -D '_topdir %(echo `pwd`)' -D '_builddir %(echo `pwd`)' -D '_sourcedir %(echo `pwd`)' -D '_rpmdir %(echo `pwd`)' -D '_specdir %(echo `pwd`)' -D '_srcrpmdir %(echo `pwd`)' -D "release $(shell echo $(RELEASE) | tr -d '_-')"
328 .PHONY: overcloud-opendaylight-sfc-clean
329 overcloud-opendaylight-sfc-clean:
330 @rm -f images/overcloud-full-opendaylight-sfc.qcow2
332 .PHONY: overcloud-opendaylight-sfc
333 overcloud-opendaylight-sfc: images/overcloud-full-opendaylight-sfc.qcow2
335 images/overcloud-full-opendaylight-sfc.qcow2: images/overcloud-full-opendaylight.qcow2
336 @echo "Building the Apex OpenDaylight Overcloud Image"
337 @./overcloud-opendaylight-sfc.sh
339 opnfv-apex-opendaylight-sfc.tar.gz: images/overcloud-full-opendaylight-sfc.qcow2
340 tar -czf opnfv-apex-opendaylight-sfc.tar.gz --xform="s:images/overcloud-full-opendaylight-sfc.qcow2:opnfv-apex-opendaylight-sfc-$(RPMVERS)/build/images/overcloud-full-opendaylight-sfc.qcow2:" images/overcloud-full-opendaylight-sfc.qcow2
342 .PHONY: opendaylight-sfc-rpm-check
343 opendaylight-sfc-rpm-check: opnfv-apex-opendaylight-sfc.tar.gz
344 rpmbuild --clean -bi -bl rpm_specs/opnfv-apex-opendaylight-sfc.spec -D '_topdir %(echo `pwd`)' -D '_builddir %(echo `pwd`)' -D '_sourcedir %(echo `pwd`)' -D '_rpmdir %(echo `pwd`)' -D '_specdir %(echo `pwd`)' -D '_srcrpmdir %(echo `pwd`)' -D "release $(shell echo $(RELEASE) | tr -d '_-')"
346 .PHONY: opendaylight-sfc-rpm
347 opendaylight-sfc-rpm: opnfv-apex-opendaylight-sfc.tar.gz $(RPMSFC)
350 @echo "Building the Apex OpenDaylight SFC RPM"
351 rpmbuild --clean -ba rpm_specs/opnfv-apex-opendaylight-sfc.spec -D '_topdir %(echo `pwd`)' -D '_builddir %(echo `pwd`)' -D '_sourcedir %(echo `pwd`)' -D '_rpmdir %(echo `pwd`)' -D '_specdir %(echo `pwd`)' -D '_srcrpmdir %(echo `pwd`)' -D "release $(shell echo $(RELEASE) | tr -d '_-')"
358 curl $(CENTDNLD) -z $(CENTISO) -o $(CENTISO) --verbose --silent --location
366 .PHONY: mount-centiso umount-centiso
367 mount-centiso: $(CENTISO)
368 @echo "Mounting CentOS ISO in $(CENTDIR)"
370 @fuseiso $(CENTISO) $(CENTDIR)
374 @echo "Unmounting CentOS ISO from $(CENTDIR)"
375 @fusermount -u $(CENTDIR)
380 iso: iso-clean images rpms $(CENTISO)
381 @echo "Building the Apex ISO"
382 @mkdir centos release
383 cd centos && bsdtar -xf ../$(shell basename $(CENTISO))
384 # modify the installer iso's contents
386 @cp -f isolinux.cfg centos/isolinux/isolinux.cfg
387 @ln $(RPMCOM) centos/Packages
388 @ln $(RPMUDR) centos/Packages
389 @ln $(RPMODL) centos/Packages
390 @ln $(RPMONO) centos/Packages
391 @ln $(RPMSFC) centos/Packages
392 # add packages to the centos packages
393 cd centos/Packages && yumdownloader openvswitch
394 cd centos/Packages && yumdownloader openstack-tripleo
395 cd centos/Packages && yumdownloader jq
396 cd centos/Packages && yumdownloader python34
397 cd centos/Packages && yumdownloader python34-libs
398 cd centos/Packages && yumdownloader python34-yaml
399 cd centos/Packages && yumdownloader python34-setuptools
400 cd centos/Packages && yumdownloader ipxe-roms-qemu
401 cd centos/Packages && curl -O https://radez.fedorapeople.org/python34-markupsafe-0.23-9.el7.centos.x86_64.rpm
402 cd centos/Packages && curl -O https://radez.fedorapeople.org/python3-jinja2-2.8-5.el7.centos.noarch.rpm
403 # regenerate yum repo data
404 @echo "Generating new yum metadata"
405 createrepo --update -g ../c7-opnfv-x86_64-comps.xml centos
407 @echo "Building OPNFV iso"
408 mkisofs -b isolinux/isolinux.bin -no-emul-boot -boot-load-size 4 -boot-info-table -V "OPNFV CentOS 7 x86_64" -R -J -v -T -o $(ISO) centos
410 @printf "\n\nISO is built at $(ISO)\n\n"
416 .PHONY: python3-jinja2
417 python3-jinja2: python3-markupsafe python-jinja2-2.8-5.fc24.src.rpm
418 curl -O http://ftp.linux.ncsu.edu/pub/fedora/linux//development/24/Everything/source/tree/Packages/p/python-jinja2-2.8-5.fc24.src.rpm
419 rpm2cpio python-jinja2-2.8-5.fc24.src.rpm | cpio -idmv
420 sed -i 's/python3-devel/python34-devel/' python-jinja2.spec
421 sed -i 's/python3-setuptools/python34-setuptools/' python-jinja2.spec
422 sed -i 's/python3-pytest/python34-pytest/' python-jinja2.spec
423 sed -i 's/python3-markupsafe/python34-markupsafe/' python-jinja2.spec
424 rpmbuild -ba python-jinja2.spec -D '_topdir %(echo `pwd`)' -D '_builddir %(echo `pwd`)' -D '_sourcedir %(echo `pwd`)' -D '_rpmdir %(echo `pwd`)' -D '_specdir %(echo `pwd`)' -D '_srcrpmdir %(echo `pwd`)' -D "with_python3 1"
426 .PHONY: python3-jinja2-clean
427 python3-jinja2-clean:
428 rm -f python-jinja2-2.8-5.fc24.src.rpm
429 rm -f python-jinja2.spec
430 rm -f Jinja2-2.8.tar.gz
432 ########################
433 # python3-markupsafe #
434 ########################
436 .PHONY: python3-markupsafe
437 python3-markupsafe: python-markupsafe-0.23-9.fc24.src.rpm
438 curl -O http://ftp.linux.ncsu.edu/pub/fedora/linux//development/24/Everything/source/tree/Packages/p/python-markupsafe-0.23-9.fc24.src.rpm
439 rpm2cpio python-markupsafe-0.23-9.fc24.src.rpm | cpio -idmv
440 sed -i 's/python3-devel/python34-devel/' python-markupsafe.spec
441 sed -i 's/python3-setuptools/python34-setuptools/' python-markupsafe.spec
442 sed -i 's/python3-pytest/python34-pytest/' python-markupsafe.spec
443 sed -i 's/python3-markupsafe/python34-markupsafe/' python-markupsafe.spec
444 rpmbuild -ba python-markupsafe.spec -D '_topdir %(echo `pwd`)' -D '_builddir %(echo `pwd`)' -D '_sourcedir %(echo `pwd`)' -D '_rpmdir %(echo `pwd`)' -D '_specdir %(echo `pwd`)' -D '_srcrpmdir %(echo `pwd`)' -D "with_python3 1"
446 .PHONY: python3-markupsafe-clean
447 python3-markupsafe-clean:
448 rm -f python-markupsafe-0.23-9.fc24.src.rpm
449 rm -f python-markupsafe.spec
450 rm -f MarkupSafe-0.23.tar.gz