-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
196 lines (145 loc) · 5.58 KB
/
Makefile
File metadata and controls
196 lines (145 loc) · 5.58 KB
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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
# Copyright 2008-2015 Canonical
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# For further info, check http://launchpad.net/filesync-server
PYTHON = python
MAKEFLAGS:=$(MAKEFLAGS) --no-print-directory
HERE:=$(shell pwd)
PYTHONPATH:=$(HERE):$(HERE)/lib:${PYTHONPATH}
# use protobuf cpp
PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=cpp
START_SUPERVISORD = lib/ubuntuone/supervisor/start-supervisord.py
export PYTHONPATH
export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION
export ROOTDIR ?= $(HERE)
export CONFIG = $(HERE)/configs/development.yaml
SOURCEDEPS_TAG = .sourcecode/sourcedeps-tag
SOURCEDEPS_DIR ?= ../sourcedeps
SOURCEDEPS_SOURCECODE_DIR = $(SOURCEDEPS_DIR)/sourcecode
TARGET_SOURCECODE_DIR = $(HERE)/.sourcecode
BUILD_DEPLOY_SOURCEDEPS=storm zope.interface ubuntuone-storage-protocol
TESTFLAGS=
TAR_EXTRA = --exclude 'tmp/*' --exclude tags
ifneq ($(strip $(STRIP_BZR)),)
TAR_EXTRA += --exclude .bzr
endif
sourcedeps: $(SOURCEDEPS_TAG)
clean-sourcedeps:
rm -rf .sourcecode/*
$(SOURCEDEPS_TAG):
ifndef EXPORT_FROM_BZR
$(MAKE) link-sourcedeps
endif
$(MAKE) build-sourcedeps
touch $(SOURCEDEPS_TAG)
DB_TAG=tmp/db1/.s.PGSQL.5432.lock
build: link-sourcedeps build-sourcedeps version
link-sourcedeps:
@echo "Checking out external source dependencies..."
build/link-external-sourcecode \
-p $(SOURCEDEPS_SOURCECODE_DIR)/ \
-t $(TARGET_SOURCECODE_DIR) \
-c build/config-manager.txt
# no need to link sourcedeps before building them, as rollout process
# handles config-manager.txt automatically
build-for-deployment: build-deploy-sourcedeps version
build-sourcedeps: build-deploy-sourcedeps
@echo "Building client clientdefs.py"
@cd .sourcecode/ubuntuone-client/ubuntuone/ && sed \
-e 's|\@localedir\@|/usr/local/share/locale|g' \
-e 's|\@libexecdir\@|/usr/local/libexec|g' \
-e 's|\@GETTEXT_PACKAGE\@|ubuntuone-client|g' \
-e 's|\@VERSION\@|0.0.0|g' < clientdefs.py.in > clientdefs.py
build-deploy-sourcedeps:
@echo "Building Python extensions"
@for sourcedep in $(BUILD_DEPLOY_SOURCEDEPS) ; do \
d=".sourcecode/$$sourcedep" ; \
if test -e "$$d/setup.py" ; then \
(cd "$$d" && $(PYTHON) \
setup.py build build_ext --inplace > /dev/null) ; \
fi ; \
done
@echo "Generating twistd plugin cache"
@$(PYTHON) -c "from twisted.plugin import IPlugin, getPlugins; list(getPlugins(IPlugin));"
tarball: build-for-deployment
tar czf ../filesync-server.tgz $(TAR_EXTRA) .
raw-test:
./test $(TESTFLAGS)
test: sourcedeps clean lint version start-base start-dbus raw-test stop
ci-test:
$(MAKE) test TESTFLAGS="-1 $(TESTFLAGS)"
clean: stop
rm -rf tmp/* _trial_temp
lint:
dev-scripts/lint.sh
etags: sourcedeps
# Generate tags for emacs
ctags-exuberant -e -R --language-force=python -f tags lib src
tags: sourcedeps
# Generate tags for vim
ctags-exuberant -R --language-force=python -f tags lib src
version:
build/makeversion.sh
start: build start-base start-filesync-dummy-group load-sample-data publish-api-port
start-oauth: build start-base start-filesync-oauth-group load-sample-data publish-api-port
start-oauth-heapy:
USE_HEAPY=1 $(MAKE) start-oauth
start-base:
$(MAKE) start-db && $(MAKE) start-supervisor && $(MAKE) start-dbus && \
$(MAKE) start-statsd && $(MAKE) start-s4 && $(MAKE) start-storage-proxy || \
( $(MAKE) stop ; exit 1 )
stop: stop-filesync-dummy-group stop-supervisor stop-db stop-statsd stop-dbus
$(DB_TAG):
lib/backends/db/scripts/dev/start-database.sh
start-db: $(DB_TAG) schema
schema:
./lib/backends/db/scripts/schema --all
stop-db:
lib/backends/db/scripts/dev/stop-database.sh
start-dbus:
dev-scripts/start-dbus.sh
stop-dbus:
dev-scripts/stop-dbus.sh
start-supervisor:
@python dev-scripts/supervisor-config-dev.py
-@$(START_SUPERVISORD) dev-scripts/supervisor-dev.conf.tpl \
dev-scripts/metrics-processors.conf.tpl
stop-supervisor:
-@dev-scripts/supervisorctl-dev shutdown
start-statsd:
-@dev-scripts/supervisorctl-dev start graphite
-@dev-scripts/supervisorctl-dev start statsd
stop-statsd:
-@dev-scripts/supervisorctl-dev stop statsd
-@dev-scripts/supervisorctl-dev stop graphite
start-%-group:
-@dev-scripts/supervisorctl-dev start $*:
stop-%-group:
-@dev-scripts/supervisorctl-dev stop $*:
start-%:
-@dev-scripts/supervisorctl-dev start $*
stop-%:
-@dev-scripts/supervisorctl-dev stop $*
publish-api-port:
python -c 'from config import config; print >> file("tmp/filesyncserver.port", "w"), config.api_server.tcp_port; print >> file("tmp/filesyncserver.port.ssl", "w"), config.ssl_proxy.port; print >> file("tmp/filesyncserver-status.port", "w"), config.api_server.status_port'
load-sample-data:
DJANGO_SETTINGS_MODULE=backends.django_settings $(PYTHON) dev-scripts/load_sample_data.py
.PHONY: sourcedeps link-sourcedeps build-sourcedeps build-deploy-sourcedeps \
build clean version lint test ci-test schema \
build-for-deployment clean-sourcedeps tarball \
start stop load-sample-data publish-api-port \
start-supervisor stop-supervisor \
start-dbus stop-dbus \
start-oauth start-oauth-heapy start-statsd stop-statsd