2 # NOTE: this Makefile requires GNU make
11 # setup.py will extend sys.path to include our support/lib/... directory
12 # itself. It will also create it in the beginning of the 'develop' command.
14 TAHOE=$(PYTHON) bin/tahoe
15 SOURCES=src/allmydata src/buildtest static misc bin/tahoe-script.template setup.py
16 APPNAME=allmydata-tahoe
18 # This is necessary only if you want to automatically produce a new
19 # _version.py file from the current git history (without doing a build).
22 $(PYTHON) ./setup.py update_version
27 src/allmydata/_version.py:
30 # It is unnecessary to have this depend on build or src/allmydata/_version.py,
31 # since 'setup.py build' always updates the version.
34 $(PYTHON) setup.py build
37 # Build OS X pkg packages.
38 .PHONY: build-osx-pkg test-osx-pkg upload-osx-pkg
40 misc/build_helpers/build-osx-pkg.sh $(APPNAME)
43 $(PYTHON) misc/build_helpers/test-osx-pkg.py
46 @echo "uploading to ~tahoe-tarballs/OS-X-packages/ via flappserver"
47 @if [ "X${BB_BRANCH}" = "Xmaster" ] || [ "X${BB_BRANCH}" = "X" ]; then \
48 flappclient --furlfile ~/.tahoe-osx-pkg-upload.furl upload-file tahoe-lafs-*-osx.pkg; \
50 echo not uploading tahoe-lafs-osx-pkg because this is not trunk but is branch \"${BB_BRANCH}\" ; \
55 # you can use 'make test TEST=allmydata.test.test_introducer' to run just
56 # test_introducer. TEST=allmydata.test.test_client.Basic.test_permute works
60 # It is unnecessary to have this depend on build or src/allmydata/_version.py,
61 # since 'setup.py test' always updates the version and builds before testing.
64 $(PYTHON) setup.py test $(TRIALARGS) -s $(TEST)
71 quicktest: make-version
72 $(TAHOE) debug trial $(TRIALARGS) $(TEST)
74 # "make tmpfstest" may be a faster way of running tests on Linux. It works best when you have
75 # at least 330 MiB of free physical memory (to run the whole test suite). Since it uses sudo
76 # to mount/unmount the tmpfs filesystem, it might prompt for your password.
79 time make _tmpfstest 'TMPDIR=$(shell mktemp -d --tmpdir=.)'
82 _tmpfstest: make-version
83 sudo mount -t tmpfs -o size=400m tmpfs '$(TMPDIR)'
84 -$(TAHOE) debug trial --rterrors '--temp-directory=$(TMPDIR)/_trial_temp' $(TRIALARGS) $(TEST)
85 sudo umount '$(TMPDIR)'
89 # code coverage: install the "coverage" package from PyPI, do "make test-coverage" to
90 # do a unit test run with coverage-gathering enabled, then use "make coverage-output" to
91 # generate an HTML report. Also see "make .coverage.el" and misc/coding_tools/coverage.el
92 # for Emacs integration.
94 # This might need to be python-coverage on Debian-based distros.
97 COVERAGEARGS=--branch --source=src/allmydata
99 # --include appeared in coverage-3.4
100 COVERAGE_OMIT=--include '$(CURDIR)/src/allmydata/*' --omit '$(CURDIR)/src/allmydata/test/*'
102 .PHONY: test-coverage
105 $(TAHOE) '@$(COVERAGE)' run $(COVERAGEARGS) @tahoe debug trial $(TRIALARGS) $(TEST)
107 .PHONY: coverage-output
110 coverage html -i -d coverage-html $(COVERAGE_OMIT)
111 cp .coverage coverage-html/coverage.data
112 @echo "now point your browser at coverage-html/index.html"
114 .coverage.el: .coverage
115 $(PYTHON) misc/coding_tools/coverage2el.py
119 code-checks: build version-and-path check-interfaces check-miscaptures -find-trailing-spaces -check-umids pyflakes
121 .PHONY: version-and-path
123 $(TAHOE) --version-and-path
125 .PHONY: check-interfaces
127 $(TAHOE) @misc/coding_tools/check-interfaces.py 2>&1 |tee violations.txt
130 .PHONY: check-miscaptures
132 $(PYTHON) misc/coding_tools/check-miscaptures.py $(SOURCES) 2>&1 |tee miscaptures.txt
137 $(PYFLAKES) $(SOURCES) |sort |uniq
142 $(PYTHON) misc/coding_tools/check-umids.py `find $(SOURCES) -name '*.py' -not -name 'old.py'`
147 -$(PYTHON) misc/coding_tools/check-umids.py `find $(SOURCES) -name '*.py' -not -name 'old.py'`
151 doc-checks: check-rst
155 @for x in `find *.rst docs -name "*.rst"`; do rst2html -v $${x} >/dev/null; done 2>&1 |grep -v 'Duplicate implicit target name:'
161 @find src -name '*.py' |grep -v /build/ |wc -l
163 @cat `find src -name '*.py' |grep -v /build/` |wc -l
165 @grep TODO `find src -name '*.py' |grep -v /build/` | wc -l
167 @grep XXX `find src -name '*.py' |grep -v /build/` | wc -l
172 $(TAHOE) @src/allmydata/test/check_memory.py upload
173 $(TAHOE) @src/allmydata/test/check_memory.py upload-self
174 $(TAHOE) @src/allmydata/test/check_memory.py upload-POST
175 $(TAHOE) @src/allmydata/test/check_memory.py download
176 $(TAHOE) @src/allmydata/test/check_memory.py download-GET
177 $(TAHOE) @src/allmydata/test/check_memory.py download-GET-slow
178 $(TAHOE) @src/allmydata/test/check_memory.py receive
180 .PHONY: check-memory-once
181 check-memory-once: .built
183 $(TAHOE) @src/allmydata/test/check_memory.py $(MODE)
185 # The check-speed target uses a pre-established client node to run a canned
186 # set of performance tests against a test network that is also
187 # pre-established (probably on a remote machine). Provide it with the path to
188 # a local directory where this client node has been created (and populated
189 # with the necessary FURLs of the test network). This target will start that
190 # client with the current code and then run the tests. Afterwards it will
193 # The 'sleep 5' is in there to give the new client a chance to connect to its
194 # storageservers, since check_speed.py has no good way of doing that itself.
198 if [ -z '$(TESTCLIENTDIR)' ]; then exit 1; fi
199 @echo "stopping any leftover client code"
200 -$(TAHOE) stop $(TESTCLIENTDIR)
201 $(TAHOE) start $(TESTCLIENTDIR)
203 $(TAHOE) @src/allmydata/test/check_speed.py $(TESTCLIENTDIR)
204 $(TAHOE) stop $(TESTCLIENTDIR)
206 # The check-grid target also uses a pre-established client node, along with a
207 # long-term directory that contains some well-known files. See the docstring
208 # in src/allmydata/test/check_grid.py to see how to set this up.
211 if [ -z '$(TESTCLIENTDIR)' ]; then exit 1; fi
212 $(TAHOE) @src/allmydata/test/check_grid.py $(TESTCLIENTDIR) bin/tahoe
214 .PHONY: bench-dirnode
215 bench-dirnode: .built
216 $(TAHOE) @src/allmydata/test/bench_dirnode.py
218 # the provisioning tool runs as a stand-alone webapp server
219 .PHONY: run-provisioning-tool
220 run-provisioning-tool: .built
221 $(TAHOE) @misc/operations_helpers/provisioning/run.py
223 # 'make repl' is a simple-to-type command to get a Python interpreter loop
224 # from which you can type 'import allmydata'
229 .PHONY: test-get-ignore
232 $(PYTHON) misc/build_helpers/test-git-ignore.py
236 find . |grep -vEe "allfiles.tmp|src/allmydata/_(version|appname).py" |sort >allfiles.tmp.old
239 find . |grep -vEe "allfiles.tmp|src/allmydata/_(version|appname).py" |sort >allfiles.tmp.new
240 diff allfiles.tmp.old allfiles.tmp.new
242 # It would be nice if 'make clean' deleted any automatically-generated
243 # _version.py too, so that 'make clean; make all' could be useable as a
244 # "what the heck is going on, get me back to a clean state', but we need
245 # 'make clean' to work on non-checkout trees without destroying useful information.
246 # Use 'make distclean' instead to delete all generated files.
249 rm -rf build _trial_temp _test_memory .built
250 rm -f `find src *.egg -name '*.so' -or -name '*.pyc'`
252 rm -rf `ls -d *.egg | grep -vEe"setuptools-|setuptools_darcs-|darcsver-"`
254 rm -rf misc/dependencies/build misc/dependencies/temp
255 rm -rf misc/dependencies/tahoe_deps.egg-info
256 rm -f bin/tahoe bin/tahoe.pyscript
261 rm -rf src/allmydata_tahoe.egg-info
262 rm -f src/allmydata/_version.py
263 rm -f src/allmydata/_appname.py
266 .PHONY: find-trailing-spaces
267 find-trailing-spaces:
268 $(PYTHON) misc/coding_tools/find-trailing-spaces.py -r $(SOURCES)
271 .PHONY: -find-trailing-spaces
272 -find-trailing-spaces:
273 -$(PYTHON) misc/coding_tools/find-trailing-spaces.py -r $(SOURCES)
276 # The test-desert-island target grabs the tahoe-deps tarball, unpacks it,
277 # does a build, then asserts that the build did not try to download anything
278 # as it ran. Invoke this on a new tree, or after a 'clean', to make sure the
279 # support/lib/ directory is gone.
281 .PHONY: fetch-and-unpack-deps
282 fetch-and-unpack-deps:
283 test -f tahoe-deps.tar.gz || wget https://tahoe-lafs.org/source/tahoe-lafs/deps/tahoe-lafs-deps.tar.gz
285 tar xzf tahoe-lafs-deps.tar.gz
287 .PHONY: test-desert-island
289 $(MAKE) fetch-and-unpack-deps
290 $(MAKE) 2>&1 | tee make.out
291 $(PYTHON) misc/build_helpers/check-build.py make.out no-downloads
293 .PHONY: test-pip-install
295 $(PYTHON) misc/build_helpers/test-pip-install.py
301 $(PYTHON) setup.py sdist --formats=bztar,gztar,zip
302 $(PYTHON) setup.py sdist --sumo --formats=bztar,gztar,zip
304 .PHONY: upload-tarballs
306 @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