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)'
88 -python ./src/allmydata/test/check_magicfolder_smoke.py kill
89 -rm -rf smoke_magicfolder/
90 python ./src/allmydata/test/check_magicfolder_smoke.py
92 # code coverage: install the "coverage" package from PyPI, do "make test-coverage" to
93 # do a unit test run with coverage-gathering enabled, then use "make coverage-output" to
94 # generate an HTML report. Also see "make .coverage.el" and misc/coding_tools/coverage.el
95 # for Emacs integration.
97 # This might need to be python-coverage on Debian-based distros.
100 COVERAGEARGS=--branch --source=src/allmydata
102 # --include appeared in coverage-3.4
103 COVERAGE_OMIT=--include '$(CURDIR)/src/allmydata/*' --omit '$(CURDIR)/src/allmydata/test/*'
105 .PHONY: test-coverage
108 $(TAHOE) '@$(COVERAGE)' run $(COVERAGEARGS) @tahoe debug trial $(TRIALARGS) $(TEST)
110 .PHONY: coverage-output
113 coverage html -i -d coverage-html $(COVERAGE_OMIT)
114 cp .coverage coverage-html/coverage.data
115 @echo "now point your browser at coverage-html/index.html"
117 .coverage.el: .coverage
118 $(PYTHON) misc/coding_tools/coverage2el.py
122 code-checks: build version-and-path check-interfaces check-miscaptures -find-trailing-spaces -check-umids pyflakes
124 .PHONY: version-and-path
126 $(TAHOE) --version-and-path
128 .PHONY: check-interfaces
130 $(TAHOE) @misc/coding_tools/check-interfaces.py 2>&1 |tee violations.txt
133 .PHONY: check-miscaptures
135 $(PYTHON) misc/coding_tools/check-miscaptures.py $(SOURCES) 2>&1 |tee miscaptures.txt
140 @$(PYTHON) -OOu `which pyflakes` $(SOURCES) |sort |uniq
145 $(PYTHON) misc/coding_tools/check-umids.py `find $(SOURCES) -name '*.py' -not -name 'old.py'`
150 -$(PYTHON) misc/coding_tools/check-umids.py `find $(SOURCES) -name '*.py' -not -name 'old.py'`
154 doc-checks: check-rst
158 @for x in `find *.rst docs -name "*.rst"`; do rst2html -v $${x} >/dev/null; done 2>&1 |grep -v 'Duplicate implicit target name:'
164 @find src -name '*.py' |grep -v /build/ |wc -l
166 @cat `find src -name '*.py' |grep -v /build/` |wc -l
168 @grep TODO `find src -name '*.py' |grep -v /build/` | wc -l
170 @grep XXX `find src -name '*.py' |grep -v /build/` | wc -l
175 $(TAHOE) @src/allmydata/test/check_memory.py upload
176 $(TAHOE) @src/allmydata/test/check_memory.py upload-self
177 $(TAHOE) @src/allmydata/test/check_memory.py upload-POST
178 $(TAHOE) @src/allmydata/test/check_memory.py download
179 $(TAHOE) @src/allmydata/test/check_memory.py download-GET
180 $(TAHOE) @src/allmydata/test/check_memory.py download-GET-slow
181 $(TAHOE) @src/allmydata/test/check_memory.py receive
183 .PHONY: check-memory-once
184 check-memory-once: .built
186 $(TAHOE) @src/allmydata/test/check_memory.py $(MODE)
188 # The check-speed target uses a pre-established client node to run a canned
189 # set of performance tests against a test network that is also
190 # pre-established (probably on a remote machine). Provide it with the path to
191 # a local directory where this client node has been created (and populated
192 # with the necessary FURLs of the test network). This target will start that
193 # client with the current code and then run the tests. Afterwards it will
196 # The 'sleep 5' is in there to give the new client a chance to connect to its
197 # storageservers, since check_speed.py has no good way of doing that itself.
201 if [ -z '$(TESTCLIENTDIR)' ]; then exit 1; fi
202 @echo "stopping any leftover client code"
203 -$(TAHOE) stop $(TESTCLIENTDIR)
204 $(TAHOE) start $(TESTCLIENTDIR)
206 $(TAHOE) @src/allmydata/test/check_speed.py $(TESTCLIENTDIR)
207 $(TAHOE) stop $(TESTCLIENTDIR)
209 # The check-grid target also uses a pre-established client node, along with a
210 # long-term directory that contains some well-known files. See the docstring
211 # in src/allmydata/test/check_grid.py to see how to set this up.
214 if [ -z '$(TESTCLIENTDIR)' ]; then exit 1; fi
215 $(TAHOE) @src/allmydata/test/check_grid.py $(TESTCLIENTDIR) bin/tahoe
217 .PHONY: bench-dirnode
218 bench-dirnode: .built
219 $(TAHOE) @src/allmydata/test/bench_dirnode.py
221 # the provisioning tool runs as a stand-alone webapp server
222 .PHONY: run-provisioning-tool
223 run-provisioning-tool: .built
224 $(TAHOE) @misc/operations_helpers/provisioning/run.py
226 # 'make repl' is a simple-to-type command to get a Python interpreter loop
227 # from which you can type 'import allmydata'
232 .PHONY: test-get-ignore
235 $(PYTHON) misc/build_helpers/test-git-ignore.py
239 find . |grep -vEe "allfiles.tmp|src/allmydata/_(version|appname).py" |sort >allfiles.tmp.old
242 find . |grep -vEe "allfiles.tmp|src/allmydata/_(version|appname).py" |sort >allfiles.tmp.new
243 diff allfiles.tmp.old allfiles.tmp.new
245 # It would be nice if 'make clean' deleted any automatically-generated
246 # _version.py too, so that 'make clean; make all' could be useable as a
247 # "what the heck is going on, get me back to a clean state', but we need
248 # 'make clean' to work on non-checkout trees without destroying useful information.
249 # Use 'make distclean' instead to delete all generated files.
252 rm -rf build _trial_temp _test_memory .built
253 rm -f `find src *.egg -name '*.so' -or -name '*.pyc'`
255 rm -rf `ls -d *.egg | grep -vEe"setuptools-|setuptools_darcs-|darcsver-"`
257 rm -rf misc/dependencies/build misc/dependencies/temp
258 rm -rf misc/dependencies/tahoe_deps.egg-info
259 rm -f bin/tahoe bin/tahoe.pyscript
264 rm -rf src/allmydata_tahoe.egg-info
265 rm -f src/allmydata/_version.py
266 rm -f src/allmydata/_appname.py
269 .PHONY: find-trailing-spaces
270 find-trailing-spaces:
271 $(PYTHON) misc/coding_tools/find-trailing-spaces.py -r $(SOURCES)
274 .PHONY: -find-trailing-spaces
275 -find-trailing-spaces:
276 -$(PYTHON) misc/coding_tools/find-trailing-spaces.py -r $(SOURCES)
279 # The test-desert-island target grabs the tahoe-deps tarball, unpacks it,
280 # does a build, then asserts that the build did not try to download anything
281 # as it ran. Invoke this on a new tree, or after a 'clean', to make sure the
282 # support/lib/ directory is gone.
284 .PHONY: fetch-and-unpack-deps
285 fetch-and-unpack-deps:
286 test -f tahoe-deps.tar.gz || wget https://tahoe-lafs.org/source/tahoe-lafs/deps/tahoe-lafs-deps.tar.gz
288 tar xzf tahoe-lafs-deps.tar.gz
290 .PHONY: test-desert-island
292 $(MAKE) fetch-and-unpack-deps
293 $(MAKE) 2>&1 | tee make.out
294 $(PYTHON) misc/build_helpers/check-build.py make.out no-downloads
296 .PHONY: test-pip-install
298 $(PYTHON) misc/build_helpers/test-pip-install.py
304 $(PYTHON) setup.py sdist --formats=bztar,gztar,zip
305 $(PYTHON) setup.py sdist --sumo --formats=bztar,gztar,zip
307 .PHONY: upload-tarballs
309 @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