-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
167 lines (140 loc) · 5.15 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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
#!/usr/bin/make -f
# The path to core and client code.
CORE_PATH ?=
CLIENT_PATH ?=
# 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 ?= 0.0
RELEASE ?= 1
# The python version.
PYTHON_PATH := $(shell which python)
PYTHON ?= $(shell readlink $(PYTHON_PATH))
# This matches the OpenStack release version.
OPENSTACK_RELEASE ?= folsom
# The timestamp release for the extensions.
TIMESTAMP := $(shell date "+%Y-%m-%dT%H:%M:%S%:z")
# **** TARGETS ****
all : package
.PHONY : all
# Package the extensions.
package : deb tgz pip rpm
.PHONY : package
# Build the python egg files.
build-nova : build-python-canary
build-nova : build-canary-api
build-nova : build-canary-host
.PHONY : build-nova
build-novaclient : build-canary-novaclient
.PHONY: build-novaclient
build-horizon : build-canary-horizon
.PHONY : build-horizon
build : build-nova build-novaclient build-horizon
.PHONY : build
build-python-canary :
@rm -rf $(CORE_PATH)/build/ dist/python-canary
@cd $(CORE_PATH) && PACKAGE=canary VERSION=$(VERSION).$(RELEASE) \
$(PYTHON) setup.py install --prefix=$(CURDIR)/dist/python-canary/usr
@sed -i -e "s/'.*' ##TIMESTAMP##/'$(TIMESTAMP)' ##TIMESTAMP##/" \
`find dist/python-canary/ -name extension.py`
PHONY: build-python-canary
build-canary-api : build-python-canary
@rm -rf $(CORE_PATH)/build/ dist/canary-api
@mkdir -p dist/canary-api
@cd $(CORE_PATH) && PACKAGE=api VERSION=$(VERSION).$(RELEASE) \
$(PYTHON) setup.py install --prefix=$(CURDIR)/dist/canary-api/usr
.PHONY: build-canary-api
build-canary-novaclient :
@rm -rf $(CLIENT_PATH)/build/ dist/canary-novaclient
@mkdir -p $(CURDIR)/dist/canary-novaclient/usr/lib/python/site-packages
@cd $(CLIENT_PATH) && PACKAGE=novaclient VERSION=$(VERSION).$(RELEASE) \
PYTHONPATH=$(CURDIR)/dist/canary-novaclient/usr/lib/$(PYTHON)/site-packages \
$(PYTHON) setup.py install --prefix=$(CURDIR)/dist/canary-novaclient/usr
.PHONY: build-canary-novaclient
build-canary-host : build-python-canary
@rm -rf $(CORE_PATH)/build/ dist/canary-host
@cd $(CORE_PATH) && PACKAGE=host DESTDIR=$(CURDIR)/dist/canary-host/ VERSION=$(VERSION).$(RELEASE) \
$(PYTHON) setup.py install --prefix=$(CURDIR)/dist/canary-host/usr
@$(INSTALL_DIR) dist/canary-host/etc/init
@$(INSTALL_DATA) $(CORE_PATH)/etc/init/canary.conf dist/canary-host/etc/init
@$(INSTALL_DIR) dist/canary-host/etc/init.d
@$(INSTALL_BIN) $(CORE_PATH)/etc/init.d/canary dist/canary-host/etc/init.d
.PHONY: build-canary-host
build-canary-horizon : build-python-canary
@rm -rf $(CORE_PATH)/build/ dist/canary-horizon
@mkdir -p dist/canary-horizon
@cd $(CORE_PATH) && PACKAGE=horizon DESTDIR=$(CURDIR)/dist/canary-horizon VERSION=$(VERSION).$(RELEASE) \
$(PYTHON) setup.py install --prefix=$(CURDIR)/dist/canary-horizon/usr
.PHONY: build-canary-horizon
deb-nova : deb-python-canary
deb-nova : deb-canary-api
deb-nova : deb-canary-host
.PHONY : deb-nova
deb-novaclient : deb-canary-novaclient
.PHONY : deb-novaclient
deb-horizon : deb-canary-horizon
.PHONY : deb-horizon
deb : deb-nova deb-novaclient deb-horizon
.PHONY : deb
deb-% : build-%
@rm -rf debbuild && $(INSTALL_DIR) debbuild
@rsync -ruav packagers/deb/$*/ debbuild
@rsync -ruav dist/$*/ debbuild
@rm -rf debbuild/etc/init.d
@sed -i "s/VERSION/$(VERSION).$(RELEASE)-$(OPENSTACK_RELEASE)/g" debbuild/DEBIAN/control
@dpkg -b debbuild/ .
@rm -rf debbuild && $(INSTALL_DIR) debbuild
@rsync -ruav packagers/deb/$*/ debbuild
@rsync -ruav dist/$*/ debbuild
@rm -rf debbuild/etc/init.d
@LIBDIR=`ls -1d debbuild/usr/lib*/$(PYTHON)`; \
if [ -d $$LIBDIR/site-packages ]; then \
mv $$LIBDIR/site-packages $$LIBDIR/dist-packages; \
fi
@sed -i "s/VERSION/$(VERSION).$(RELEASE)-ubuntu$(OPENSTACK_RELEASE)/g" debbuild/DEBIAN/control
@dpkg -b debbuild/ .
tgz-nova : tgz-python-canary
tgz-nova : tgz-canary-api
tgz-nova : tgz-canary-host
.PHONY : tgz-nova
tgz-novaclient : tgz-canary-novaclient
.PHONY : tgz-novaclient
tgz-horizon : tgz-canary-horizon
.PHONY : tgz-horizon
tgz : tgz-nova tgz-novaclient tgz-horizon
.PHONY : tgz
tgz-% : build-%
@tar -cvzf $*_$(VERSION).$(RELEASE)-$(OPENSTACK_RELEASE).tgz -C dist/$* .
pip : pip-canary-novaclient
.PHONY: pip
pip-canary-novaclient :
@rm -rf $(CLIENT_PATH)/build/
@cd $(CLIENT_PATH) && PACKAGE=novaclient VERSION=$(VERSION).$(RELEASE) \
$(PYTHON) setup.py sdist
@cp $(CLIENT_PATH)/dist/canary_python_novaclient_ext*.tar.gz .
.PHONY: pip-canary-novaclient
rpm-nova : rpm-python-canary
rpm-nova : rpm-canary-api
rpm-nova : rpm-canary-host
.PHONY : rpm-nova
rpm-novaclient : rpm-canary-novaclient
.PHONY : rpm-novaclient
rpm-horizon : rpm-canary-horizon
.PHONY : rpm-horizon
rpm : rpm-nova rpm-novaclient
.PHONY : rpm
rpm-%: build-%
@rm -rf dist/$*/etc/init
@rpmbuild -bb --buildroot $(CURDIR)/rpmbuild/BUILDROOT \
--define="%_topdir $(CURDIR)/rpmbuild" --define="%version $(VERSION).$(RELEASE)" \
--define="%release $(OPENSTACK_RELEASE)" packagers/rpm/$*.spec
@cp rpmbuild/RPMS/noarch/*.rpm .
.PHONY : rpm
clean :
rm -rf MANIFEST build dist
rm -rf *.deb debbuild
rm -rf *.tgz *.tar.gz
rm -rf *.rpm rpmbuild
.PHONY : clean