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 twisted setup.py
15 .PHONY: make-version build
17 # This is necessary only if you want to automatically produce a new
18 # _version.py file from the current git/darcs 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.
31 $(PYTHON) setup.py build
37 .PHONY: signal-error-deps test check test-coverage quicktest quicktest-coverage
38 .PHONY: coverage-output get-old-coverage-coverage coverage-delta-output
41 # you can use 'make test TEST=allmydata.test.test_introducer' to run just
42 # test_introducer. TEST=allmydata.test.test_client.Basic.test_permute works
46 # It is unnecessary to have this depend on build or src/allmydata/_version.py,
47 # since 'setup.py test' always updates the version and builds before testing.
49 $(PYTHON) setup.py test $(TRIALARGS) -s $(TEST)
54 quicktest: make-version
55 $(TAHOE) debug trial $(TRIALARGS) $(TEST)
57 # "make tmpfstest" may be a faster way of running tests on Linux. It works best when you have
58 # at least 330 MiB of free physical memory (to run the whole test suite). Since it uses sudo
59 # to mount/unmount the tmpfs filesystem, it might prompt for your password.
61 time make _tmpfstest 'TMPDIR=$(shell mktemp -d --tmpdir=.)'
63 _tmpfstest: make-version
64 sudo mount -t tmpfs -o size=400m tmpfs '$(TMPDIR)'
65 -$(TAHOE) debug trial --rterrors '--temp-directory=$(TMPDIR)/_trial_temp' $(TRIALARGS) $(TEST)
66 sudo umount '$(TMPDIR)'
70 # code coverage: install the "coverage" package from PyPI, do "make test-coverage" to
71 # do a unit test run with coverage-gathering enabled, then use "make coverage-output" to
72 # generate an HTML report. Also see "make .coverage.el" and misc/coding_tools/coverage.el
73 # for Emacs integration.
75 # This might need to be python-coverage on Debian-based distros.
78 COVERAGEARGS=--branch --source=src/allmydata
80 # --include appeared in coverage-3.4
81 COVERAGE_OMIT=--include '$(CURDIR)/src/allmydata/*' --omit '$(CURDIR)/src/allmydata/test/*'
85 $(TAHOE) '@$(COVERAGE)' run $(COVERAGEARGS) @tahoe debug trial $(TRIALARGS) $(TEST)
89 coverage html -i -d coverage-html $(COVERAGE_OMIT)
90 cp .coverage coverage-html/coverage.data
91 @echo "now point your browser at coverage-html/index.html"
93 .PHONY: upload-coverage .coverage.el pyflakes count-lines
94 .PHONY: check-memory check-memory-once check-speed check-grid
95 .PHONY: repl test-darcs-boringfile test-clean clean find-trailing-spaces
97 .coverage.el: .coverage
98 $(PYTHON) misc/coding_tools/coverage2el.py
101 code-checks: build version-and-path check-interfaces check-miscaptures -find-trailing-spaces -check-umids pyflakes
104 $(TAHOE) --version-and-path
107 $(TAHOE) @misc/coding_tools/check-interfaces.py 2>&1 |tee violations.txt
111 $(PYTHON) misc/coding_tools/check-miscaptures.py $(SOURCES) 2>&1 |tee miscaptures.txt
115 @$(PYTHON) -OOu `which pyflakes` $(SOURCES) |sort |uniq
119 $(PYTHON) misc/coding_tools/check-umids.py `find $(SOURCES) -name '*.py' -not -name 'old.py'`
123 -$(PYTHON) misc/coding_tools/check-umids.py `find $(SOURCES) -name '*.py' -not -name 'old.py'`
126 doc-checks: check-rst
129 @for x in `find *.rst docs -name "*.rst"`; do rst2html -v $${x} >/dev/null; done 2>&1 |grep -v 'Duplicate implicit target name:'
134 @find src -name '*.py' |grep -v /build/ |wc -l
136 @cat `find src -name '*.py' |grep -v /build/` |wc -l
138 @grep TODO `find src -name '*.py' |grep -v /build/` | wc -l
140 @grep XXX `find src -name '*.py' |grep -v /build/` | wc -l
144 $(TAHOE) @src/allmydata/test/check_memory.py upload
145 $(TAHOE) @src/allmydata/test/check_memory.py upload-self
146 $(TAHOE) @src/allmydata/test/check_memory.py upload-POST
147 $(TAHOE) @src/allmydata/test/check_memory.py download
148 $(TAHOE) @src/allmydata/test/check_memory.py download-GET
149 $(TAHOE) @src/allmydata/test/check_memory.py download-GET-slow
150 $(TAHOE) @src/allmydata/test/check_memory.py receive
152 check-memory-once: .built
154 $(TAHOE) @src/allmydata/test/check_memory.py $(MODE)
156 # The check-speed target uses a pre-established client node to run a canned
157 # set of performance tests against a test network that is also
158 # pre-established (probably on a remote machine). Provide it with the path to
159 # a local directory where this client node has been created (and populated
160 # with the necessary FURLs of the test network). This target will start that
161 # client with the current code and then run the tests. Afterwards it will
164 # The 'sleep 5' is in there to give the new client a chance to connect to its
165 # storageservers, since check_speed.py has no good way of doing that itself.
168 if [ -z '$(TESTCLIENTDIR)' ]; then exit 1; fi
169 @echo "stopping any leftover client code"
170 -$(TAHOE) stop $(TESTCLIENTDIR)
171 $(TAHOE) start $(TESTCLIENTDIR)
173 $(TAHOE) @src/allmydata/test/check_speed.py $(TESTCLIENTDIR)
174 $(TAHOE) stop $(TESTCLIENTDIR)
176 # The check-grid target also uses a pre-established client node, along with a
177 # long-term directory that contains some well-known files. See the docstring
178 # in src/allmydata/test/check_grid.py to see how to set this up.
180 if [ -z '$(TESTCLIENTDIR)' ]; then exit 1; fi
181 $(TAHOE) @src/allmydata/test/check_grid.py $(TESTCLIENTDIR) bin/tahoe
183 bench-dirnode: .built
184 $(TAHOE) @src/allmydata/test/bench_dirnode.py
186 # the provisioning tool runs as a stand-alone webapp server
187 run-provisioning-tool: .built
188 $(TAHOE) @misc/operations_helpers/provisioning/run.py
190 # 'make repl' is a simple-to-type command to get a Python interpreter loop
191 # from which you can type 'import allmydata'
197 $(PYTHON) misc/build_helpers/test-git-ignore.py
200 find . |grep -vEe "allfiles.tmp|src/allmydata/_(version|appname).py" |sort >allfiles.tmp.old
203 find . |grep -vEe "allfiles.tmp|src/allmydata/_(version|appname).py" |sort >allfiles.tmp.new
204 diff allfiles.tmp.old allfiles.tmp.new
206 # It would be nice if 'make clean' deleted any automatically-generated
207 # _version.py too, so that 'make clean; make all' could be useable as a
208 # "what the heck is going on, get me back to a clean state', but we need
209 # 'make clean' to work on non-checkout trees without destroying useful information.
210 # Use 'make distclean' instead to delete all generated files.
212 rm -rf build _trial_temp _test_memory .built
213 rm -f `find src *.egg -name '*.so' -or -name '*.pyc'`
215 rm -rf `ls -d *.egg | grep -vEe"setuptools-|setuptools_darcs-|darcsver-"`
217 rm -rf misc/dependencies/build misc/dependencies/temp
218 rm -rf misc/dependencies/tahoe_deps.egg-info
219 rm -f bin/tahoe bin/tahoe.pyscript
222 rm -rf src/allmydata_tahoe.egg-info
223 rm -f src/allmydata/_version.py
224 rm -f src/allmydata/_appname.py
226 find-trailing-spaces:
227 $(PYTHON) misc/coding_tools/find-trailing-spaces.py -r $(SOURCES)
230 -find-trailing-spaces:
231 -$(PYTHON) misc/coding_tools/find-trailing-spaces.py -r $(SOURCES)
234 # The test-desert-island target grabs the tahoe-deps tarball, unpacks it,
235 # does a build, then asserts that the build did not try to download anything
236 # as it ran. Invoke this on a new tree, or after a 'clean', to make sure the
237 # support/lib/ directory is gone.
239 fetch-and-unpack-deps:
240 test -f tahoe-deps.tar.gz || wget https://tahoe-lafs.org/source/tahoe-lafs/deps/tahoe-lafs-deps.tar.gz
242 tar xzf tahoe-lafs-deps.tar.gz
245 $(MAKE) fetch-and-unpack-deps
246 $(MAKE) 2>&1 | tee make.out
247 $(PYTHON) misc/build_helpers/check-build.py make.out no-downloads
251 .PHONY: tarballs upload-tarballs
254 $(PYTHON) setup.py sdist --formats=bztar,gztar,zip
255 $(PYTHON) setup.py sdist --sumo --formats=bztar,gztar,zip
258 @if [ "X${BB_BRANCH}" = "Xmaster" ] || [ "X${BB_BRANCH}" = "X" ]; then for f in dist/allmydata-tahoe-*; 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