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)'
90 -python ./src/allmydata/test/check_magicfolder_smoke.py kill
91 -rm -rf smoke_magicfolder/
92 python ./src/allmydata/test/check_magicfolder_smoke.py
94 # code coverage: install the "coverage" package from PyPI, do "make test-coverage" to
95 # do a unit test run with coverage-gathering enabled, then use "make coverage-output" to
96 # generate an HTML report. Also see "make .coverage.el" and misc/coding_tools/coverage.el
97 # for Emacs integration.
99 # This might need to be python-coverage on Debian-based distros.
102 COVERAGEARGS=--branch --source=src/allmydata
104 # --include appeared in coverage-3.4
105 COVERAGE_OMIT=--include '$(CURDIR)/src/allmydata/*' --omit '$(CURDIR)/src/allmydata/test/*'
107 .PHONY: test-coverage
110 $(TAHOE) '@$(COVERAGE)' run $(COVERAGEARGS) @tahoe debug trial $(TRIALARGS) $(TEST)
112 .PHONY: coverage-output
115 coverage html -i -d coverage-html $(COVERAGE_OMIT)
116 cp .coverage coverage-html/coverage.data
117 @echo "now point your browser at coverage-html/index.html"
119 .coverage.el: .coverage
120 $(PYTHON) misc/coding_tools/coverage2el.py
124 code-checks: build version-and-path check-interfaces check-miscaptures -find-trailing-spaces -check-umids pyflakes
126 .PHONY: version-and-path
128 $(TAHOE) --version-and-path
130 .PHONY: check-interfaces
132 $(TAHOE) @misc/coding_tools/check-interfaces.py 2>&1 |tee violations.txt
135 .PHONY: check-miscaptures
137 $(PYTHON) misc/coding_tools/check-miscaptures.py $(SOURCES) 2>&1 |tee miscaptures.txt
142 $(PYFLAKES) $(SOURCES) |sort |uniq
147 $(PYTHON) misc/coding_tools/check-umids.py `find $(SOURCES) -name '*.py' -not -name 'old.py'`
152 -$(PYTHON) misc/coding_tools/check-umids.py `find $(SOURCES) -name '*.py' -not -name 'old.py'`
156 doc-checks: check-rst
160 @for x in `find *.rst docs -name "*.rst"`; do rst2html -v $${x} >/dev/null; done 2>&1 |grep -v 'Duplicate implicit target name:'
166 @find src -name '*.py' |grep -v /build/ |wc -l
168 @cat `find src -name '*.py' |grep -v /build/` |wc -l
170 @grep TODO `find src -name '*.py' |grep -v /build/` | wc -l
172 @grep XXX `find src -name '*.py' |grep -v /build/` | wc -l
177 $(TAHOE) @src/allmydata/test/check_memory.py upload
178 $(TAHOE) @src/allmydata/test/check_memory.py upload-self
179 $(TAHOE) @src/allmydata/test/check_memory.py upload-POST
180 $(TAHOE) @src/allmydata/test/check_memory.py download
181 $(TAHOE) @src/allmydata/test/check_memory.py download-GET
182 $(TAHOE) @src/allmydata/test/check_memory.py download-GET-slow
183 $(TAHOE) @src/allmydata/test/check_memory.py receive
185 .PHONY: check-memory-once
186 check-memory-once: .built
188 $(TAHOE) @src/allmydata/test/check_memory.py $(MODE)
190 # The check-speed target uses a pre-established client node to run a canned
191 # set of performance tests against a test network that is also
192 # pre-established (probably on a remote machine). Provide it with the path to
193 # a local directory where this client node has been created (and populated
194 # with the necessary FURLs of the test network). This target will start that
195 # client with the current code and then run the tests. Afterwards it will
198 # The 'sleep 5' is in there to give the new client a chance to connect to its
199 # storageservers, since check_speed.py has no good way of doing that itself.
203 if [ -z '$(TESTCLIENTDIR)' ]; then exit 1; fi
204 @echo "stopping any leftover client code"
205 -$(TAHOE) stop $(TESTCLIENTDIR)
206 $(TAHOE) start $(TESTCLIENTDIR)
208 $(TAHOE) @src/allmydata/test/check_speed.py $(TESTCLIENTDIR)
209 $(TAHOE) stop $(TESTCLIENTDIR)
211 # The check-grid target also uses a pre-established client node, along with a
212 # long-term directory that contains some well-known files. See the docstring
213 # in src/allmydata/test/check_grid.py to see how to set this up.
216 if [ -z '$(TESTCLIENTDIR)' ]; then exit 1; fi
217 $(TAHOE) @src/allmydata/test/check_grid.py $(TESTCLIENTDIR) bin/tahoe
219 .PHONY: bench-dirnode
220 bench-dirnode: .built
221 $(TAHOE) @src/allmydata/test/bench_dirnode.py
223 # the provisioning tool runs as a stand-alone webapp server
224 .PHONY: run-provisioning-tool
225 run-provisioning-tool: .built
226 $(TAHOE) @misc/operations_helpers/provisioning/run.py
228 # 'make repl' is a simple-to-type command to get a Python interpreter loop
229 # from which you can type 'import allmydata'
234 .PHONY: test-get-ignore
237 $(PYTHON) misc/build_helpers/test-git-ignore.py
241 find . |grep -vEe "allfiles.tmp|src/allmydata/_(version|appname).py" |sort >allfiles.tmp.old
244 find . |grep -vEe "allfiles.tmp|src/allmydata/_(version|appname).py" |sort >allfiles.tmp.new
245 diff allfiles.tmp.old allfiles.tmp.new
247 # It would be nice if 'make clean' deleted any automatically-generated
248 # _version.py too, so that 'make clean; make all' could be useable as a
249 # "what the heck is going on, get me back to a clean state', but we need
250 # 'make clean' to work on non-checkout trees without destroying useful information.
251 # Use 'make distclean' instead to delete all generated files.
254 rm -rf build _trial_temp _test_memory .built
255 rm -f `find src *.egg -name '*.so' -or -name '*.pyc'`
257 rm -rf `ls -d *.egg | grep -vEe"setuptools-|setuptools_darcs-|darcsver-"`
259 rm -rf misc/dependencies/build misc/dependencies/temp
260 rm -rf misc/dependencies/tahoe_deps.egg-info
261 rm -f bin/tahoe bin/tahoe.pyscript
266 rm -rf src/allmydata_tahoe.egg-info
267 rm -f src/allmydata/_version.py
268 rm -f src/allmydata/_appname.py
271 .PHONY: find-trailing-spaces
272 find-trailing-spaces:
273 $(PYTHON) misc/coding_tools/find-trailing-spaces.py -r $(SOURCES)
276 .PHONY: -find-trailing-spaces
277 -find-trailing-spaces:
278 -$(PYTHON) misc/coding_tools/find-trailing-spaces.py -r $(SOURCES)
281 # The test-desert-island target grabs the tahoe-deps tarball, unpacks it,
282 # does a build, then asserts that the build did not try to download anything
283 # as it ran. Invoke this on a new tree, or after a 'clean', to make sure the
284 # support/lib/ directory is gone.
286 .PHONY: fetch-and-unpack-deps
287 fetch-and-unpack-deps:
288 test -f tahoe-deps.tar.gz || wget https://tahoe-lafs.org/source/tahoe-lafs/deps/tahoe-lafs-deps.tar.gz
290 tar xzf tahoe-lafs-deps.tar.gz
292 .PHONY: test-desert-island
294 $(MAKE) fetch-and-unpack-deps
295 $(MAKE) 2>&1 | tee make.out
296 $(PYTHON) misc/build_helpers/check-build.py make.out no-downloads
298 .PHONY: test-pip-install
300 $(PYTHON) misc/build_helpers/test-pip-install.py
306 $(PYTHON) setup.py sdist --formats=bztar,gztar,zip
307 $(PYTHON) setup.py sdist --sumo --formats=bztar,gztar,zip
309 .PHONY: upload-tarballs
311 @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