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
26 clean: images-clean rpms-clean iso-clean tacker-clean congress-clean vpp-clean
29 images: undercloud overcloud-full overcloud-opendaylight overcloud-onos
32 images-clean: undercloud-clean overcloud-full-clean overcloud-opendaylight-clean overcloud-onos-clean
36 rpms: common-rpm undercloud-rpm opendaylight-rpm onos-rpm
39 rpms-check: common-rpm-check undercloud-rpm-check opendaylight-rpm-check onos-rpm-check
42 rpms-clean: common-rpm-clean undercloud-rpm-clean opendaylight-rpm-clean onos-rpm-clean
44 opnfv-apex-common.tar.gz:
45 pushd ../ && git archive --format=tar.gz --prefix=opnfv-apex-common-$(RPMVERS)/ HEAD > build/opnfv-apex-common.tar.gz
47 .PHONY: common-rpm-check
48 common-rpm-check: opnfv-apex-common.tar.gz
49 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 '_-')"
52 common-rpm: opnfv-apex-common.tar.gz $(RPMCOM)
55 @echo "Building the Apex Common RPM"
56 # build the common RPM
57 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 '_-')"
65 # clean previous coverage data
66 rm -rf ../tests/.coverage
67 rm -rf ../tests/htmlcov
69 cd ../tests && PYTHONPATH=../lib/python/ nosetests-3.4 . --with-coverage --cover-package apex --cover-package apex_python_utils --cover-html --cover-min-percentage 90
72 cd ../tests && coverage3 report --include '*lib/python/*' -m
74 #######################
76 #######################
78 .PHONY: python-pep8-check
90 @rm -rf openstack-tacker-2015.2
91 @rm -f openstack-tacker.tar.gz
93 openstack-tacker.tar.gz:
94 @echo "Preparing the Tacker RPM prerequisites"
95 git clone http://github.com/trozet/tacker -b SFC_colorado openstack-tacker-2015.2
96 tar czf openstack-tacker.tar.gz openstack-tacker-2015.2
99 tacker-rpm: openstack-tacker.tar.gz openstack-tacker-2015.2-1.trozet.noarch.rpm
101 openstack-tacker-2015.2-1.trozet.noarch.rpm:
102 @echo "Building the Tacker RPM"
103 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`)'
109 .PHONY: tackerclient-clean
112 @rm -rf python-tackerclient-2015.2
113 @rm -f python-tackerclient.tar.gz
115 python-tackerclient.tar.gz:
116 @echo "Preparing the TackerClient RPM prerequisites"
117 git clone http://github.com/trozet/python-tackerclient -b SFC_refactor python-tackerclient-2015.2
118 tar czf python-tackerclient.tar.gz python-tackerclient-2015.2
120 .PHONY: tackerclient-rpm
121 tackerclient-rpm: python-tackerclient.tar.gz python-tackerclient-2015.2-1.trozet.noarch.rpm
123 python-tackerclient-2015.2-1.trozet.noarch.rpm:
124 @echo "Building the TackerClient RPM"
125 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`)'
131 .PHONY: congress-clean
134 @rm -rf openstack-congress-2016.1
135 @rm -f openstack-congress.tar.gz
137 openstack-congress.tar.gz:
138 @echo "Preparing the Congress RPM prerequisites"
139 git clone http://github.com/openstack/congress -b stable/mitaka openstack-congress-2016.1
140 cd openstack-congress-2016.1 && curl -O https://radez.fedorapeople.org/openstack-congress.service
141 tar czf openstack-congress.tar.gz openstack-congress-2016.1
144 congress-rpm: openstack-congress.tar.gz openstack-congress-2016.1-1.noarch.rpm
146 openstack-congress-2016.1-1.noarch.rpm:
147 @echo "Building the Congress RPM"
148 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`)'
155 MAVEN = apache-maven-3.3.9
156 MAVEN_FILE = $(MAVEN)-bin.tar.gz
160 @rm -f vpp-bin.tar.gz
162 @rm -rf honeycomb $(MAVEN) $(MAVEN_FILE) honeycomb-1.0.0-99.noarch.rpm
163 @rm -rf networking-vpp networking-vpp.noarch.rpm
166 vpp-build: vpp-bin.tar.gz
168 vpp-bin.tar.gz: vpp honeycomb $(MAVEN)
169 $(MAKE) -C $(VPP_DIR) UNATTENDED=yes install-dep bootstrap build pkg-rpm
170 $(MAKE) -C $(VPP_DIR)/build-root PLATFORM=vpp TAG=vpp_debug vpp-api-install
171 pushd vpp/vpp-api/python && python setup.py bdist
172 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
173 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
174 pushd honeycomb && ../$(MAVEN)/bin/mvn clean install -DskipTests
175 pushd honeycomb/packaging/rpm/ && BUILD_NUMBER=99 ./rpmbuild.sh
177 mv vpp/build-root/*.rpm vpp-bin/
178 mv honeycomb/packaging/rpm/RPMS/noarch/*.rpm .
179 mv vpp/vpp-api/python/dist/*.tar.gz vpp-bin/
180 tar czf vpp-bin.tar.gz vpp-bin
183 git clone https://gerrit.fd.io/r/vpp
186 git clone https://gerrit.fd.io/r/p/honeycomb.git
188 $(MAVEN): $(MAVEN_FILE)
189 tar zxvf apache-maven-3.3.9-bin.tar.gz
190 cp mvn_settings.xml $(MAVEN)/conf/settings.xml
193 wget http://www.webhostingjams.com/mirror/apache/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz
195 .PHONY: networking-vpp-rpm
196 networking-vpp-rpm: networking-vpp.noarch.rpm
198 networking-vpp.noarch.rpm: networking-vpp
199 pushd networking-vpp && rpmbuild --clean -bb ../rpm_specs/networking-vpp.spec
200 mv networking-vpp/build/rpm/noarch/*.rpm networking-vpp.noarch.rpm
203 git clone https://git.openstack.org/openstack/networking-vpp
209 .PHONY: undercloud-clean
211 @rm -f images/undercloud.*
214 undercloud: images/undercloud.qcow2
216 images/undercloud.qcow2: tackerclient-rpm
217 @echo "Building the Apex Undercloud Image"
220 opnfv-apex-undercloud.tar.gz: images/undercloud.qcow2
221 @echo "Preparing the Apex Undercloud RPM prerequisites"
222 pushd ../ && git archive --format=tar --prefix=opnfv-apex-undercloud-$(RPMVERS)/ HEAD > build/opnfv-apex-undercloud.tar
223 tar -rf opnfv-apex-undercloud.tar \
224 --xform="s:images/undercloud.qcow2:opnfv-apex-undercloud-$(RPMVERS)/build/undercloud.qcow2:" images/undercloud.qcow2
225 gzip -f opnfv-apex-undercloud.tar
227 .PHONY: undercloud-rpm-check
228 undercloud-rpm-check: opnfv-apex-undercloud.tar.gz
229 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 '_-')"
231 .PHONY: undercloud-rpm
232 undercloud-rpm: opnfv-apex-undercloud.tar.gz $(RPMUDR)
235 @echo "Building the Apex Undercloud RPM"
236 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 '_-')"
242 .PHONY: overcloud-full-clean
243 overcloud-full-clean:
244 @rm -rf images/overcloud-full.d
245 @rm -f images/overcloud-full.*
247 .PHONY: overcloud-full
248 overcloud-full: images/overcloud-full.qcow2
250 images/overcloud-full.qcow2: tacker-rpm tackerclient-rpm congress-rpm networking-vpp-rpm
251 @echo "Building the Apex Base Overcloud Image"
258 .PHONY: overcloud-opendaylight-clean
259 overcloud-opendaylight-clean:
260 @rm -f images/overcloud-full-opendaylight.qcow2
262 .PHONY: overcloud-opendaylight
263 overcloud-opendaylight: images/overcloud-full-opendaylight.qcow2
265 images/overcloud-full-opendaylight.qcow2: images/overcloud-full.qcow2
266 @echo "Building the Apex OpenDaylight Overcloud Image"
267 @./overcloud-opendaylight.sh
269 opnfv-apex.tar.gz: images/overcloud-full-opendaylight.qcow2
270 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
272 .PHONY: opendaylight-rpm-check
273 opendaylight-rpm-check: opnfv-apex.tar.gz
274 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 '_-')"
276 .PHONY: opendaylight-rpm
277 opendaylight-rpm: opnfv-apex.tar.gz $(RPMODL)
280 @echo "Building the Apex OpenDaylight RPM"
281 # build the overcloud RPM
282 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 '_-')"
288 .PHONY: overcloud-onos-clean
289 overcloud-onos-clean:
290 @rm -f images/overcloud-full-onos.qcow2
291 @rm -rf images/puppet-onos
292 @rm -f images/puppet-onos.tar.gz
294 .PHONY: overcloud-onos
295 overcloud-onos: images/overcloud-full-onos.qcow2
297 images/overcloud-full-onos.qcow2: images/overcloud-full.qcow2
298 @echo "Building the Apex ONOS Overcloud Image"
301 .PHONY: onos-rpm-clean
303 @rpmbuild --clean rpm_specs/opnfv-apex-onos.spec -D "release $(shell echo $RELEASE | tr -d '_-')"
305 opnfv-apex-onos.tar.gz: images/overcloud-full-onos.qcow2
306 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
308 .PHONY: onos-rpm-check
309 onos-rpm-check: opnfv-apex-onos.tar.gz
310 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 '_-')"
313 onos-rpm: opnfv-apex-onos.tar.gz $(RPMONO)
316 @echo "Building the Apex ONOS RPM"
317 # build the overcloud RPM
318 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 curl $(CENTDNLD) -z $(CENTISO) -o $(CENTISO) --verbose --silent --location
333 .PHONY: mount-centiso umount-centiso
334 mount-centiso: $(CENTISO)
335 @echo "Mounting CentOS ISO in $(CENTDIR)"
337 @fuseiso $(CENTISO) $(CENTDIR)
341 @echo "Unmounting CentOS ISO from $(CENTDIR)"
342 @fusermount -u $(CENTDIR)
347 iso: iso-clean images rpms $(CENTISO)
348 @echo "Building the Apex ISO"
349 @mkdir centos release
350 cd centos && bsdtar -xf ../$(shell basename $(CENTISO))
351 # modify the installer iso's contents
353 @cp -f isolinux.cfg centos/isolinux/isolinux.cfg
354 @ln $(RPMCOM) centos/Packages
355 @ln $(RPMUDR) centos/Packages
356 @ln $(RPMODL) centos/Packages
357 @ln $(RPMONO) centos/Packages
358 # add packages to the centos packages
359 cd centos/Packages && yumdownloader openvswitch
360 cd centos/Packages && yumdownloader openstack-tripleo
361 cd centos/Packages && yumdownloader jq
362 cd centos/Packages && yumdownloader python34
363 cd centos/Packages && yumdownloader python34-libs
364 cd centos/Packages && yumdownloader python34-yaml
365 cd centos/Packages && yumdownloader python34-setuptools
366 cd centos/Packages && yumdownloader ipxe-roms-qemu
367 cd centos/Packages && curl -O https://radez.fedorapeople.org/python34-markupsafe-0.23-9.el7.centos.x86_64.rpm
368 cd centos/Packages && curl -O https://radez.fedorapeople.org/python3-jinja2-2.8-5.el7.centos.noarch.rpm
369 cd centos/Packages && curl -O http://artifacts.opnfv.org/apex/dependencies/python3-ipmi-0.3.0-1.noarch.rpm
370 # regenerate yum repo data
371 @echo "Generating new yum metadata"
372 createrepo --update -g ../c7-opnfv-x86_64-comps.xml centos
374 @echo "Building OPNFV iso"
375 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
377 @printf "\n\nISO is built at $(ISO)\n\n"
383 .PHONY: python3-jinja2
384 python3-jinja2: python3-markupsafe python-jinja2-2.8-5.fc24.src.rpm
385 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
386 rpm2cpio python-jinja2-2.8-5.fc24.src.rpm | cpio -idmv
387 sed -i 's/python3-devel/python34-devel/' python-jinja2.spec
388 sed -i 's/python3-setuptools/python34-setuptools/' python-jinja2.spec
389 sed -i 's/python3-pytest/python34-pytest/' python-jinja2.spec
390 sed -i 's/python3-markupsafe/python34-markupsafe/' python-jinja2.spec
391 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"
393 .PHONY: python3-jinja2-clean
394 python3-jinja2-clean:
395 rm -f python-jinja2-2.8-5.fc24.src.rpm
396 rm -f python-jinja2.spec
397 rm -f Jinja2-2.8.tar.gz
399 ########################
400 # python3-markupsafe #
401 ########################
403 .PHONY: python3-markupsafe
404 python3-markupsafe: python-markupsafe-0.23-9.fc24.src.rpm
405 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
406 rpm2cpio python-markupsafe-0.23-9.fc24.src.rpm | cpio -idmv
407 sed -i 's/python3-devel/python34-devel/' python-markupsafe.spec
408 sed -i 's/python3-setuptools/python34-setuptools/' python-markupsafe.spec
409 sed -i 's/python3-pytest/python34-pytest/' python-markupsafe.spec
410 sed -i 's/python3-markupsafe/python34-markupsafe/' python-markupsafe.spec
411 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"
413 .PHONY: python3-markupsafe-clean
414 python3-markupsafe-clean:
415 rm -f python-markupsafe-0.23-9.fc24.src.rpm
416 rm -f python-markupsafe.spec
417 rm -f MarkupSafe-0.23.tar.gz