forked from gridcentric/cobalt
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
148 lines (123 loc) · 4.72 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
#!/usr/bin/make -f
# The path to the nova source code. Keeping it empty will assume that
# nova is already on the python path.
NOVA_PATH ?=
# The path to the vms source code. Keeping it empty will asusme that
# vms is already on the python path
VMS_PATH ?=
# Allow a python version spec.
PYTHON_VERSION ?= $(shell python -V 2>&1 |cut -d' ' -f2|cut -d'.' -f1,2)
# Ensure that the correct python version is used.
PYTHON ?= python$(PYTHON_VERSION)
# This command is used to setup the package directories.
INSTALL_DIR := install -d -m0755 -p
INSTALL_BIN := install -m0755 -p
INSTALL_DATA := install -m0644 -p
# The version of the extensions.
VERSION ?= 1.0
RELEASE ?= 0
# This matches the OpenStack release version.
OPENSTACK_RELEASE ?= unknown
# The timestamp release for the extensions.
TIMESTAMP := $(shell date "+%Y-%m-%dT%H:%M:%S%:z")
# **** TARGETS ****
full : $(NOVA_PATH)/.venv/bin/activate
$(NOVA_PATH)/tools/with_venv.sh $(MAKE) all
.PHONY : full
$(NOVA_PATH)/.venv/bin/activate :
@python $(NOVA_PATH)/tools/install_venv.py
all : test package pylint
.PHONY : all
# Package the extensions.
package : deb tgz
.PHONY : package
# Build the python egg files.
build-nova : build-nova-gridcentric
build-nova : build-nova-api-gridcentric
build-nova : build-novaclient-gridcentric
build-nova : build-nova-compute-gridcentric
.PHONY : build-nova
build-horizon : build-horizon-gridcentric
.PHONY : build-horizon
build : build-nova build-horizon
.PHONY : build
build-nova-gridcentric : test-nova
@rm -rf nova/build/ dist/nova-gridcentric
@cd nova && PACKAGE=nova-gridcentric VERSION=$(VERSION) \
$(PYTHON) setup.py install --prefix=$(CURDIR)/dist/nova-gridcentric/usr
PHONY: build-nova-gridcentric
build-nova-api-gridcentric : test-nova
@rm -rf nova/build/ dist/nova-api-gridcentric
@cd nova && PACKAGE=nova-api-gridcentric VERSION=$(VERSION) \
$(PYTHON) setup.py install --prefix=$(CURDIR)/dist/nova-api-gridcentric/usr
@sed -i -e "s/'.*' ##TIMESTAMP##/'$(TIMESTAMP)' ##TIMESTAMP##/" \
`find dist/nova-api-gridcentric/ -name gridcentric_extension.py`
.PHONY: build-nova-api-gridcentric
build-novaclient-gridcentric : test-nova
@rm -rf nova/build/ dist/novaclient-gridcentric
@cd nova && PACKAGE=novaclient-gridcentric VERSION=$(VERSION) \
$(PYTHON) setup.py install --prefix=$(CURDIR)/dist/novaclient-gridcentric/usr
.PHONY: build-novaclient-gridcentric
build-nova-compute-gridcentric : test-nova
@rm -rf nova/build/ dist/nova-compute-gridcentric
@cd nova && PACKAGE=nova-compute-gridcentric VERSION=$(VERSION) \
$(PYTHON) setup.py install --prefix=$(CURDIR)/dist/nova-compute-gridcentric/usr
@$(INSTALL_DIR) dist/nova-compute-gridcentric/etc/init
@$(INSTALL_DATA) nova/etc/nova-gc.conf dist/nova-compute-gridcentric/etc/init
.PHONY: build-nova-compute-gridcentric
build-horizon-gridcentric : test-horizon.xml
@rm -rf horizon/build/ dist/horizon-gridcentric
@cd horizon && VERSION=$(VERSION) \
$(PYTHON) setup.py install --prefix=$(CURDIR)/dist/horizon-gridcentric/usr
.PHONY: build-horizon-gridcentric
deb-nova : deb-nova-gridcentric
deb-nova : deb-nova-api-gridcentric
deb-nova : deb-novaclient-gridcentric
deb-nova : deb-nova-compute-gridcentric
.PHONY : deb-nova
deb-horizon : deb-horizon-gridcentric
.PHONY : deb-horizon
deb : deb-nova deb-horizon
.PHONY : deb
deb-% : build-%
@rm -rf debbuild && $(INSTALL_DIR) debbuild
@rsync -ruav packagers/deb/$*/ debbuild
@rsync -ruav dist/$*/ debbuild
@sed -i "s/\(^Version:\).*/\1 $(VERSION).$(RELEASE)-$(OPENSTACK_RELEASE)py$(PYTHON_VERSION)/" debbuild/DEBIAN/control
@dpkg -b debbuild/ .
@LIBDIR=`ls -1d debbuild/usr/lib*/python*`; mv $$LIBDIR/site-packages $$LIBDIR/dist-packages
@sed -i "s/\(^Version:\).*/\1 $(VERSION).$(RELEASE)-ubuntu$(OPENSTACK_RELEASE)py$(PYTHON_VERSION)/" debbuild/DEBIAN/control
@dpkg -b debbuild/ .
tgz-nova : tgz-nova-gridcentric
tgz-nova : tgz-nova-api-gridcentric
tgz-nova : tgz-novaclient-gridcentric
tgz-nova : tgz-nova-compute-gridcentric
.PHONY : tgz-nova
tgz-horizon : tgz-horizon-gridcentric
.PHONY : tgz-horizon
tgz : tgz-nova tgz-horizon
.PHONY : tgz
tgz-% : build-%
tar -cvzf $*_$(VERSION).$(RELEASE)-$(OPENSTACK_RELEASE)py$(PYTHON_VERSION).tgz -C dist/$* .
# Runs pylint on the code base.
pylint-%.txt :
cd $* && pylint --rcfile=pylintrc gridcentric 2>&1 > $@ || true
pylint : pylint-nova.txt pylint-horizon.txt
.PHONY: pylint
# Executes the units tests and generated an Junit XML report.
test-%.xml : test-%
test-% :
cd $* && PYTHONPATH=$(NOVA_PATH):$(VMS_PATH)/src/python nosetests \
--with-xunit --xunit-file=$(CURDIR)/[email protected] gridcentric || true
test : test-nova test-horizon
.PHONY : test
clean :
rm -f vms.db
rm -rf build
rm -rf dist
rm -f test-*.xml
rm -f pylint-*.txt
rm -rf *.deb debbuild
rm -rf *.tgz
rm -rf nova/build horizon/build
.PHONY : clean