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
27 clean: images-clean rpms-clean iso-clean tacker-clean congress-clean vpp-clean
30 images: undercloud overcloud-full overcloud-opendaylight overcloud-onos overcloud-opendaylight-sfc
33 images-clean: undercloud-clean overcloud-full-clean overcloud-opendaylight-clean overcloud-onos-clean overcloud-opendaylight-sfc-clean
37 rpms: common-rpm undercloud-rpm opendaylight-rpm onos-rpm opendaylight-sfc-rpm
40 rpms-check: common-rpm-check undercloud-rpm-check opendaylight-rpm-check onos-rpm-check opendaylight-sfc-rpm-check
43 rpms-clean: common-rpm-clean undercloud-rpm-clean opendaylight-rpm-clean onos-rpm-clean opendaylight-sfc-rpm-clean
45 opnfv-apex-common.tar.gz:
46 pushd ../ && git archive --format=tar.gz --prefix=opnfv-apex-common-$(RPMVERS)/ HEAD > build/opnfv-apex-common.tar.gz
48 .PHONY: common-rpm-check
49 common-rpm-check: opnfv-apex-common.tar.gz
50 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 '_-')"
53 common-rpm: opnfv-apex-common.tar.gz $(RPMCOM)
56 @echo "Building the Apex Common RPM"
57 # build the common RPM
58 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 '_-')"
66 # clean previous coverage data
67 rm -rf ../tests/.coverage
68 rm -rf ../tests/htmlcov
70 cd ../tests && PYTHONPATH=../lib/python/ nosetests-3.4 . --with-coverage --cover-package apex --cover-package apex_python_utils --cover-html --cover-min-percentage 90
73 cd ../tests && coverage3 report --include '*lib/python/*' -m
75 #######################
77 #######################
79 .PHONY: python-pep8-check
91 @rm -rf openstack-tacker-2015.2
92 @rm -f openstack-tacker.tar.gz
94 openstack-tacker.tar.gz:
95 @echo "Preparing the Tacker RPM prerequisites"
96 git clone http://github.com/trozet/tacker -b SFC_colorado openstack-tacker-2015.2
97 tar czf openstack-tacker.tar.gz openstack-tacker-2015.2
100 tacker-rpm: openstack-tacker.tar.gz openstack-tacker-2015.2-1.trozet.noarch.rpm
102 openstack-tacker-2015.2-1.trozet.noarch.rpm:
103 @echo "Building the Tacker RPM"
104 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`)'
110 .PHONY: tackerclient-clean
113 @rm -rf python-tackerclient-2015.2
114 @rm -f python-tackerclient.tar.gz
116 python-tackerclient.tar.gz:
117 @echo "Preparing the TackerClient RPM prerequisites"
118 git clone http://github.com/trozet/python-tackerclient -b SFC_refactor python-tackerclient-2015.2
119 tar czf python-tackerclient.tar.gz python-tackerclient-2015.2
121 .PHONY: tackerclient-rpm
122 tackerclient-rpm: python-tackerclient.tar.gz python-tackerclient-2015.2-1.trozet.noarch.rpm
124 python-tackerclient-2015.2-1.trozet.noarch.rpm:
125 @echo "Building the TackerClient RPM"
126 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`)'
132 .PHONY: congress-clean
135 @rm -rf openstack-congress-2016.1
136 @rm -f openstack-congress.tar.gz
138 openstack-congress.tar.gz:
139 @echo "Preparing the Congress RPM prerequisites"
140 git clone http://github.com/openstack/congress -b stable/mitaka openstack-congress-2016.1
141 cd openstack-congress-2016.1 && curl -O https://radez.fedorapeople.org/openstack-congress.service
142 tar czf openstack-congress.tar.gz openstack-congress-2016.1
145 congress-rpm: openstack-congress.tar.gz openstack-congress-2016.1-1.noarch.rpm
147 openstack-congress-2016.1-1.noarch.rpm:
148 @echo "Building the Congress RPM"
149 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`)'
156 MAVEN = apache-maven-3.3.9
157 MAVEN_FILE = $(MAVEN)-bin.tar.gz
161 @rm -f vpp-bin.tar.gz
163 @rm -rf honeycomb $(MAVEN) $(MAVEN_FILE) honeycomb-1.0.0-99.noarch.rpm
164 @rm -rf networking-vpp networking-vpp.noarch.rpm
167 vpp-build: vpp-bin.tar.gz
169 vpp-bin.tar.gz: vpp honeycomb $(MAVEN)
170 $(MAKE) -C $(VPP_DIR) UNATTENDED=yes install-dep bootstrap build pkg-rpm
171 $(MAKE) -C $(VPP_DIR)/build-root PLATFORM=vpp TAG=vpp_debug vpp-api-install
172 pushd vpp/vpp-api/python && python setup.py bdist
173 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
174 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
175 pushd honeycomb && ../$(MAVEN)/bin/mvn clean install -DskipTests
176 pushd honeycomb/packaging/rpm/ && BUILD_NUMBER=99 ./rpmbuild.sh
178 mv vpp/build-root/*.rpm vpp-bin/
179 mv honeycomb/packaging/rpm/RPMS/noarch/*.rpm .
180 mv vpp/vpp-api/python/dist/*.tar.gz vpp-bin/
181 tar czf vpp-bin.tar.gz vpp-bin
184 git clone https://gerrit.fd.io/r/vpp
187 git clone https://gerrit.fd.io/r/p/honeycomb.git
189 $(MAVEN): $(MAVEN_FILE)
190 tar zxvf apache-maven-3.3.9-bin.tar.gz
191 cp mvn_settings.xml $(MAVEN)/conf/settings.xml
194 wget http://www.webhostingjams.com/mirror/apache/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz
196 .PHONY: networking-vpp-rpm
197 networking-vpp-rpm: networking-vpp.noarch.rpm
199 networking-vpp.noarch.rpm: networking-vpp
200 pushd networking-vpp && python setup.py bdist_rpm --binary-only
201 mv networking-vpp/dist/*.rpm networking-vpp.noarch.rpm
204 git clone -b stable_vlan_rewrite https://github.com/fepan/networking-vpp.git
210 .PHONY: undercloud-clean
212 @rm -f images/undercloud.*
215 undercloud: images/undercloud.qcow2
217 images/undercloud.qcow2: tackerclient-rpm
218 @echo "Building the Apex Undercloud Image"
221 opnfv-apex-undercloud.tar.gz: images/undercloud.qcow2
222 @echo "Preparing the Apex Undercloud RPM prerequisites"
223 pushd ../ && git archive --format=tar --prefix=opnfv-apex-undercloud-$(RPMVERS)/ HEAD > build/opnfv-apex-undercloud.tar
224 tar -rf opnfv-apex-undercloud.tar \
225 --xform="s:images/undercloud.qcow2:opnfv-apex-undercloud-$(RPMVERS)/build/undercloud.qcow2:" images/undercloud.qcow2
226 gzip -f opnfv-apex-undercloud.tar
228 .PHONY: undercloud-rpm-check
229 undercloud-rpm-check: opnfv-apex-undercloud.tar.gz
230 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 '_-')"
232 .PHONY: undercloud-rpm
233 undercloud-rpm: opnfv-apex-undercloud.tar.gz $(RPMUDR)
236 @echo "Building the Apex Undercloud RPM"
237 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 '_-')"
243 .PHONY: overcloud-full-clean
244 overcloud-full-clean:
245 @rm -rf images/overcloud-full.d
246 @rm -f images/overcloud-full.*
248 .PHONY: overcloud-full
249 overcloud-full: images/overcloud-full.qcow2
251 images/overcloud-full.qcow2: tacker-rpm tackerclient-rpm congress-rpm networking-vpp-rpm
252 @echo "Building the Apex Base Overcloud Image"
259 .PHONY: overcloud-opendaylight-clean
260 overcloud-opendaylight-clean:
261 @rm -f images/overcloud-full-opendaylight.qcow2
263 .PHONY: overcloud-opendaylight
264 overcloud-opendaylight: images/overcloud-full-opendaylight.qcow2
266 images/overcloud-full-opendaylight.qcow2: images/overcloud-full.qcow2
267 @echo "Building the Apex OpenDaylight Overcloud Image"
268 @./overcloud-opendaylight.sh
270 opnfv-apex.tar.gz: images/overcloud-full-opendaylight.qcow2
271 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
273 .PHONY: opendaylight-rpm-check
274 opendaylight-rpm-check: opnfv-apex.tar.gz
275 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 '_-')"
277 .PHONY: opendaylight-rpm
278 opendaylight-rpm: opnfv-apex.tar.gz $(RPMODL)
281 @echo "Building the Apex OpenDaylight RPM"
282 # build the overcloud RPM
283 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 '_-')"
289 .PHONY: overcloud-onos-clean
290 overcloud-onos-clean:
291 @rm -f images/overcloud-full-onos.qcow2
292 @rm -rf images/puppet-onos
293 @rm -f images/puppet-onos.tar.gz
295 .PHONY: overcloud-onos
296 overcloud-onos: images/overcloud-full-onos.qcow2
298 images/overcloud-full-onos.qcow2: images/overcloud-full.qcow2
299 @echo "Building the Apex ONOS Overcloud Image"
302 .PHONY: onos-rpm-clean
304 @rpmbuild --clean rpm_specs/opnfv-apex-onos.spec -D "release $(shell echo $RELEASE | tr -d '_-')"
306 opnfv-apex-onos.tar.gz: images/overcloud-full-onos.qcow2
307 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
309 .PHONY: onos-rpm-check
310 onos-rpm-check: opnfv-apex-onos.tar.gz
311 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 '_-')"
314 onos-rpm: opnfv-apex-onos.tar.gz $(RPMONO)
317 @echo "Building the Apex ONOS RPM"
318 # build the overcloud RPM
319 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 '_-')"
325 .PHONY: overcloud-opendaylight-sfc-clean
326 overcloud-opendaylight-sfc-clean:
327 @rm -f images/overcloud-full-opendaylight-sfc.qcow2
329 .PHONY: overcloud-opendaylight-sfc
330 overcloud-opendaylight-sfc: images/overcloud-full-opendaylight-sfc.qcow2
332 images/overcloud-full-opendaylight-sfc.qcow2: images/overcloud-full-opendaylight.qcow2
333 @echo "Building the Apex OpenDaylight Overcloud Image"
334 @./overcloud-opendaylight-sfc.sh
336 opnfv-apex-opendaylight-sfc.tar.gz: images/overcloud-full-opendaylight-sfc.qcow2
337 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
339 .PHONY: opendaylight-sfc-rpm-check
340 opendaylight-sfc-rpm-check: opnfv-apex-opendaylight-sfc.tar.gz
341 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 '_-')"
343 .PHONY: opendaylight-sfc-rpm
344 opendaylight-sfc-rpm: opnfv-apex-opendaylight-sfc.tar.gz $(RPMSFC)
347 @echo "Building the Apex OpenDaylight SFC RPM"
348 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 '_-')"
355 curl $(CENTDNLD) -z $(CENTISO) -o $(CENTISO) --verbose --silent --location
363 .PHONY: mount-centiso umount-centiso
364 mount-centiso: $(CENTISO)
365 @echo "Mounting CentOS ISO in $(CENTDIR)"
367 @fuseiso $(CENTISO) $(CENTDIR)
371 @echo "Unmounting CentOS ISO from $(CENTDIR)"
372 @fusermount -u $(CENTDIR)
377 iso: iso-clean images rpms $(CENTISO)
378 @echo "Building the Apex ISO"
379 @mkdir centos release
380 cd centos && bsdtar -xf ../$(shell basename $(CENTISO))
381 # modify the installer iso's contents
383 @cp -f isolinux.cfg centos/isolinux/isolinux.cfg
384 @ln $(RPMCOM) centos/Packages
385 @ln $(RPMUDR) centos/Packages
386 @ln $(RPMODL) centos/Packages
387 @ln $(RPMONO) centos/Packages
388 @ln $(RPMSFC) centos/Packages
389 # add packages to the centos packages
390 cd centos/Packages && yumdownloader openvswitch
391 cd centos/Packages && yumdownloader openstack-tripleo
392 cd centos/Packages && yumdownloader jq
393 cd centos/Packages && yumdownloader python34
394 cd centos/Packages && yumdownloader python34-libs
395 cd centos/Packages && yumdownloader python34-yaml
396 cd centos/Packages && yumdownloader python34-setuptools
397 cd centos/Packages && yumdownloader ipxe-roms-qemu
398 cd centos/Packages && curl -O https://radez.fedorapeople.org/python34-markupsafe-0.23-9.el7.centos.x86_64.rpm
399 cd centos/Packages && curl -O https://radez.fedorapeople.org/python3-jinja2-2.8-5.el7.centos.noarch.rpm
400 cd centos/Packages && curl -O http://artifacts.opnfv.org/apex/dependencies/python3-ipmi-0.3.0-1.noarch.rpm
401 # regenerate yum repo data
402 @echo "Generating new yum metadata"
403 createrepo --update -g ../c7-opnfv-x86_64-comps.xml centos
405 @echo "Building OPNFV iso"
406 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
408 @printf "\n\nISO is built at $(ISO)\n\n"
414 .PHONY: python3-jinja2
415 python3-jinja2: python3-markupsafe python-jinja2-2.8-5.fc24.src.rpm
416 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
417 rpm2cpio python-jinja2-2.8-5.fc24.src.rpm | cpio -idmv
418 sed -i 's/python3-devel/python34-devel/' python-jinja2.spec
419 sed -i 's/python3-setuptools/python34-setuptools/' python-jinja2.spec
420 sed -i 's/python3-pytest/python34-pytest/' python-jinja2.spec
421 sed -i 's/python3-markupsafe/python34-markupsafe/' python-jinja2.spec
422 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"
424 .PHONY: python3-jinja2-clean
425 python3-jinja2-clean:
426 rm -f python-jinja2-2.8-5.fc24.src.rpm
427 rm -f python-jinja2.spec
428 rm -f Jinja2-2.8.tar.gz
430 ########################
431 # python3-markupsafe #
432 ########################
434 .PHONY: python3-markupsafe
435 python3-markupsafe: python-markupsafe-0.23-9.fc24.src.rpm
436 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
437 rpm2cpio python-markupsafe-0.23-9.fc24.src.rpm | cpio -idmv
438 sed -i 's/python3-devel/python34-devel/' python-markupsafe.spec
439 sed -i 's/python3-setuptools/python34-setuptools/' python-markupsafe.spec
440 sed -i 's/python3-pytest/python34-pytest/' python-markupsafe.spec
441 sed -i 's/python3-markupsafe/python34-markupsafe/' python-markupsafe.spec
442 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"
444 .PHONY: python3-markupsafe-clean
445 python3-markupsafe-clean:
446 rm -f python-markupsafe-0.23-9.fc24.src.rpm
447 rm -f python-markupsafe.spec
448 rm -f MarkupSafe-0.23.tar.gz