2 # NOTE: this Makefile requires GNU make
9 # setup.py will extend sys.path to include our support/lib/... directory
10 # itself. It will also create it in the beginning of the 'develop' command.
12 TAHOE=$(PYTHON) bin/tahoe
13 SOURCES=src/allmydata src/buildtest static misc bin/tahoe-script.template setup.py
14 APPNAME=allmydata-tahoe
16 # This is necessary only if you want to automatically produce a new
17 # _version.py file from the current git history (without doing a build).
20 $(PYTHON) ./setup.py update_version
25 src/allmydata/_version.py:
28 # It is unnecessary to have this depend on build or src/allmydata/_version.py,
29 # since 'setup.py build' always updates the version.
32 $(PYTHON) setup.py build
35 # Build OS X pkg packages.
36 .PHONY: build-osx-pkg test-osx-pkg upload-osx-pkg
38 misc/build_helpers/build-osx-pkg.sh $(APPNAME)
41 $(PYTHON) misc/build_helpers/test-osx-pkg.py
44 @echo "uploading to ~tahoe-tarballs/OS-X-packages/ via flappserver"
45 @if [ "X${BB_BRANCH}" = "Xmaster" ] || [ "X${BB_BRANCH}" = "X" ]; then \
46 flappclient --furlfile ~/.tahoe-osx-pkg-upload.furl upload-file tahoe-lafs-*-osx.pkg; \
48 echo not uploading tahoe-lafs-osx-pkg because this is not trunk but is branch \"${BB_BRANCH}\" ; \
53 # you can use 'make test TEST=allmydata.test.test_introducer' to run just
54 # test_introducer. TEST=allmydata.test.test_client.Basic.test_permute works
58 # It is unnecessary to have this depend on build or src/allmydata/_version.py,
59 # since 'setup.py test' always updates the version and builds before testing.
62 $(PYTHON) setup.py test $(TRIALARGS) -s $(TEST)
69 quicktest: make-version
70 $(TAHOE) debug trial $(TRIALARGS) $(TEST)
72 # "make tmpfstest" may be a faster way of running tests on Linux. It works best when you have
73 # at least 330 MiB of free physical memory (to run the whole test suite). Since it uses sudo
74 # to mount/unmount the tmpfs filesystem, it might prompt for your password.
77 time make _tmpfstest 'TMPDIR=$(shell mktemp -d --tmpdir=.)'
80 _tmpfstest: make-version
81 sudo mount -t tmpfs -o size=400m tmpfs '$(TMPDIR)'
82 -$(TAHOE) debug trial --rterrors '--temp-directory=$(TMPDIR)/_trial_temp' $(TRIALARGS) $(TEST)
83 sudo umount '$(TMPDIR)'
87 # code coverage: install the "coverage" package from PyPI, do "make test-coverage" to
88 # do a unit test run with coverage-gathering enabled, then use "make coverage-output" to
89 # generate an HTML report. Also see "make .coverage.el" and misc/coding_tools/coverage.el
90 # for Emacs integration.
92 # This might need to be python-coverage on Debian-based distros.
95 COVERAGEARGS=--branch --source=src/allmydata
97 # --include appeared in coverage-3.4
98 COVERAGE_OMIT=--include '$(CURDIR)/src/allmydata/*' --omit '$(CURDIR)/src/allmydata/test/*'
100 .PHONY: test-coverage
103 $(TAHOE) '@$(COVERAGE)' run $(COVERAGEARGS) @tahoe debug trial $(TRIALARGS) $(TEST)
105 .PHONY: coverage-output
108 coverage html -i -d coverage-html $(COVERAGE_OMIT)
109 cp .coverage coverage-html/coverage.data
110 @echo "now point your browser at coverage-html/index.html"
112 .coverage.el: .coverage
113 $(PYTHON) misc/coding_tools/coverage2el.py
117 code-checks: build version-and-path check-interfaces check-miscaptures -find-trailing-spaces -check-umids pyflakes
119 .PHONY: version-and-path
121 $(TAHOE) --version-and-path
123 .PHONY: check-interfaces
125 $(TAHOE) @misc/coding_tools/check-interfaces.py 2>&1 |tee violations.txt
128 .PHONY: check-miscaptures
130 $(PYTHON) misc/coding_tools/check-miscaptures.py $(SOURCES) 2>&1 |tee miscaptures.txt
135 @$(PYTHON) -OOu `which pyflakes` $(SOURCES) |sort |uniq
140 $(PYTHON) misc/coding_tools/check-umids.py `find $(SOURCES) -name '*.py' -not -name 'old.py'`
145 -$(PYTHON) misc/coding_tools/check-umids.py `find $(SOURCES) -name '*.py' -not -name 'old.py'`
149 doc-checks: check-rst
153 @for x in `find *.rst docs -name "*.rst"`; do rst2html -v $${x} >/dev/null; done 2>&1 |grep -v 'Duplicate implicit target name:'
159 @find src -name '*.py' |grep -v /build/ |wc -l
161 @cat `find src -name '*.py' |grep -v /build/` |wc -l
163 @grep TODO `find src -name '*.py' |grep -v /build/` | wc -l
165 @grep XXX `find src -name '*.py' |grep -v /build/` | wc -l
170 $(TAHOE) @src/allmydata/test/check_memory.py upload
171 $(TAHOE) @src/allmydata/test/check_memory.py upload-self
172 $(TAHOE) @src/allmydata/test/check_memory.py upload-POST
173 $(TAHOE) @src/allmydata/test/check_memory.py download
174 $(TAHOE) @src/allmydata/test/check_memory.py download-GET
175 $(TAHOE) @src/allmydata/test/check_memory.py download-GET-slow
176 $(TAHOE) @src/allmydata/test/check_memory.py receive
178 .PHONY: check-memory-once
179 check-memory-once: .built
181 $(TAHOE) @src/allmydata/test/check_memory.py $(MODE)
183 # The check-speed target uses a pre-established client node to run a canned
184 # set of performance tests against a test network that is also
185 # pre-established (probably on a remote machine). Provide it with the path to
186 # a local directory where this client node has been created (and populated
187 # with the necessary FURLs of the test network). This target will start that
188 # client with the current code and then run the tests. Afterwards it will
191 # The 'sleep 5' is in there to give the new client a chance to connect to its
192 # storageservers, since check_speed.py has no good way of doing that itself.
196 if [ -z '$(TESTCLIENTDIR)' ]; then exit 1; fi
197 @echo "stopping any leftover client code"
198 -$(TAHOE) stop $(TESTCLIENTDIR)
199 $(TAHOE) start $(TESTCLIENTDIR)
201 $(TAHOE) @src/allmydata/test/check_speed.py $(TESTCLIENTDIR)
202 $(TAHOE) stop $(TESTCLIENTDIR)
204 # The check-grid target also uses a pre-established client node, along with a
205 # long-term directory that contains some well-known files. See the docstring
206 # in src/allmydata/test/check_grid.py to see how to set this up.
209 if [ -z '$(TESTCLIENTDIR)' ]; then exit 1; fi
210 $(TAHOE) @src/allmydata/test/check_grid.py $(TESTCLIENTDIR) bin/tahoe
212 .PHONY: bench-dirnode
213 bench-dirnode: .built
214 $(TAHOE) @src/allmydata/test/bench_dirnode.py
216 # the provisioning tool runs as a stand-alone webapp server
217 .PHONY: run-provisioning-tool
218 run-provisioning-tool: .built
219 $(TAHOE) @misc/operations_helpers/provisioning/run.py
221 # 'make repl' is a simple-to-type command to get a Python interpreter loop
222 # from which you can type 'import allmydata'
227 .PHONY: test-get-ignore
230 $(PYTHON) misc/build_helpers/test-git-ignore.py
234 find . |grep -vEe "allfiles.tmp|src/allmydata/_(version|appname).py" |sort >allfiles.tmp.old
237 find . |grep -vEe "allfiles.tmp|src/allmydata/_(version|appname).py" |sort >allfiles.tmp.new
238 diff allfiles.tmp.old allfiles.tmp.new
240 # It would be nice if 'make clean' deleted any automatically-generated
241 # _version.py too, so that 'make clean; make all' could be useable as a
242 # "what the heck is going on, get me back to a clean state', but we need
243 # 'make clean' to work on non-checkout trees without destroying useful information.
244 # Use 'make distclean' instead to delete all generated files.
247 rm -rf build _trial_temp _test_memory .built
248 rm -f `find src *.egg -name '*.so' -or -name '*.pyc'`
250 rm -rf `ls -d *.egg | grep -vEe"setuptools-|setuptools_darcs-|darcsver-"`
252 rm -rf misc/dependencies/build misc/dependencies/temp
253 rm -rf misc/dependencies/tahoe_deps.egg-info
254 rm -f bin/tahoe bin/tahoe.pyscript
259 rm -rf src/allmydata_tahoe.egg-info
260 rm -f src/allmydata/_version.py
261 rm -f src/allmydata/_appname.py
264 .PHONY: find-trailing-spaces
265 find-trailing-spaces:
266 $(PYTHON) misc/coding_tools/find-trailing-spaces.py -r $(SOURCES)
269 .PHONY: -find-trailing-spaces
270 -find-trailing-spaces:
271 -$(PYTHON) misc/coding_tools/find-trailing-spaces.py -r $(SOURCES)
274 # The test-desert-island target grabs the tahoe-deps tarball, unpacks it,
275 # does a build, then asserts that the build did not try to download anything
276 # as it ran. Invoke this on a new tree, or after a 'clean', to make sure the
277 # support/lib/ directory is gone.
279 .PHONY: fetch-and-unpack-deps
280 fetch-and-unpack-deps:
281 test -f tahoe-deps.tar.gz || wget https://tahoe-lafs.org/source/tahoe-lafs/deps/tahoe-lafs-deps.tar.gz
283 tar xzf tahoe-lafs-deps.tar.gz
285 .PHONY: test-desert-island
287 $(MAKE) fetch-and-unpack-deps
288 $(MAKE) 2>&1 | tee make.out
289 $(PYTHON) misc/build_helpers/check-build.py make.out no-downloads
291 .PHONY: test-pip-install
293 $(PYTHON) misc/build_helpers/test-pip-install.py
299 $(PYTHON) setup.py sdist --formats=bztar,gztar,zip
300 $(PYTHON) setup.py sdist --sumo --formats=bztar,gztar,zip
302 .PHONY: upload-tarballs
304 @if [ "X${BB_BRANCH}" = "Xmaster" ] || [ "X${BB_BRANCH}" = "X" ]; then for f in dist/$(APPNAME)-*; do flappclient --furlfile ~/.tahoe-tarball-upload.furl upload-file $$f; done ; else echo not uploading tarballs because this is not trunk but is branch \"${BB_BRANCH}\" ; fi