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 PP=$(shell $(PYTHON) setup.py -q show_pythonpath)
13 RUNPP=$(PYTHON) setup.py run_with_pythonpath
14 TAHOE=$(PYTHON) bin/tahoe
16 .PHONY: make-version build
18 # The 'darcsver' setup.py command comes in the 'darcsver' package:
19 # http://pypi.python.org/pypi/darcsver It is necessary only if you want to
20 # automatically produce a new _version.py file from the current darcs history.
22 $(PYTHON) ./setup.py darcsver --count-all-patches
24 # We want src/allmydata/_version.py to be up-to-date, but it's a fairly
25 # expensive operation (about 6 seconds on a just-before-0.7.0 tree, probably
26 # because of the 332 patches since the last tag), and we've removed the need
27 # for an explicit 'build' step by removing the C code from src/allmydata and
28 # by running everything in place. It would be neat to do:
30 #src/allmydata/_version.py: _darcs/patches
31 # $(MAKE) make-version
33 # since that would update the embedded version string each time new darcs
34 # patches were pulled, but without an obligatory 'build' step this rule
35 # wouldn't be run frequently enough anyways.
37 # So instead, I'll just make sure that we update the version at least once
38 # when we first start using the tree, and again whenever an explicit
39 # 'make-version' is run, since then at least the developer has some means to
40 # update things. It would be nice if 'make clean' deleted any
41 # automatically-generated _version.py too, so that 'make clean; make all'
42 # could be useable as a "what the heck is going on, get me back to a clean
43 # state', but we need 'make clean' to work on non-darcs trees without
44 # destroying useful information.
49 src/allmydata/_version.py:
52 # c.f. ticket #455, there is a problem in the intersection of setuptools,
53 # twisted's setup.py, and nevow's setup.py . A Tahoe build, to satisfy its
54 # dependencies, may try to build both Twisted and Nevow. If both of these
55 # occur during the same invocation of 'setup.py develop', then the Nevow
56 # build will fail with an "ImportError: No module named components". Running
57 # the build a second time will succeed. Until there is a new version of
58 # setuptools which properly sandboxes sys.modules (or a new version of nevow
59 # which doesn't import twisted during its build, or a new version of twisted
60 # which doesn't import itself during its build), we just build tahoe twice
61 # and ignore the errors from the first pass. Updated 16-Sep-2008: now we need
64 build: src/allmydata/_version.py
65 $(PYTHON) setup.py build
68 # 'make install' will do the following:
69 # build+install tahoe (probably to /usr/lib/pythonN.N/site-packages)
70 # 'make install PREFIX=/usr/local/stow/tahoe-N.N' will do the same, but to
71 # a different location
73 install: src/allmydata/_version.py
76 $(PYTHON) ./setup.py install --single-version-externally-managed \
77 --prefix=$(PREFIX) --record=./tahoe.files
79 $(PYTHON) ./setup.py install --single-version-externally-managed
85 .PHONY: signal-error-deps test test-coverage quicktest quicktest-coverage
86 .PHONY: coverage-output get-old-coverage-coverage coverage-delta-output
92 @echo "ERROR: Not all of Tahoe's dependencies are in place. Please see docs/install.html for help on installing dependencies."
98 $(PYTHON) setup.py -q check_auto_deps || $(MAKE) signal-error-deps
101 $(MAKE) check-auto-deps
104 # you can use 'make test TEST=allmydata.test.test_introducer' to run just
105 # test_introducer. TEST=allmydata.test.test_client.Basic.test_permute works
109 # use 'make test TRIALARGS=--reporter=bwverbose' from buildbot, to
110 # suppress the ansi color sequences
112 test: build src/allmydata/_version.py
113 $(PYTHON) setup.py test $(TRIALARGS) -s $(TEST)
115 fuse-test: .built .checked-deps
116 $(RUNPP) -d contrib/fuse -p -c runtests.py
118 test-coverage: build src/allmydata/_version.py
120 $(TAHOE) debug trial --reporter=bwverbose-coverage $(TEST)
123 $(TAHOE) debug trial $(TRIALARGS) $(TEST)
125 # code-coverage: install the "coverage" package from PyPI, do "make
126 # quicktest-coverage" to do a unit test run with coverage-gathering enabled,
127 # then use "make coverate-output-text" for a brief report, or "make
128 # coverage-output" for a pretty HTML report. Also see "make .coverage.el" and
129 # misc/coding_tools/coverage.el for emacs integration.
133 $(TAHOE) debug trial --reporter=bwverbose-coverage $(TEST)
134 # on my laptop, "quicktest" takes 239s, "quicktest-coverage" takes 304s
136 # --include appeared in coverage-3.4
137 COVERAGE_OMIT=--include '$(CURDIR)/src/allmydata/*' --omit '$(CURDIR)/src/allmydata/test/*'
140 coverage html -i -d coverage-html $(COVERAGE_OMIT)
141 cp .coverage coverage-html/coverage.data
142 @echo "now point your browser at coverage-html/index.html"
144 ## use these two targets to compare this coverage against the previous run.
145 ## The deltas only work if the old test was run in the same directory, since
146 ## it compares absolute filenames.
147 #get-old-figleaf-coverage:
148 # wget --progress=dot -O old.figleaf http://allmydata.org/tahoe-figleaf/current/figleaf.pickle
150 #figleaf-delta-output:
151 # $(RUNPP) -p -c "misc/figleaf2html -d coverage-html -r src -x misc/figleaf.excludes -o old.figleaf"
152 # cp .figleaf coverage-html/figleaf.pickle
153 # @echo "now point your browser at coverage-html/index.html"
155 .PHONY: upload-coverage .coverage.el pyflakes count-lines
156 .PHONY: check-memory check-memory-once check-speed check-grid
157 .PHONY: repl test-darcs-boringfile test-clean clean find-trailing-spaces
159 .coverage.el: .coverage
160 $(PYTHON) misc/coding_tools/coverage2el.py
162 # 'upload-coverage' is meant to be run with an UPLOAD_TARGET=host:/dir setting
166 $(error UPLOAD_HOST must be set when using UPLOAD_TARGET)
169 $(error COVERAGEDIR must be set when using UPLOAD_TARGET)
173 rsync -a coverage-html/ $(UPLOAD_TARGET)
174 ssh $(UPLOAD_HOST) make update-tahoe-coverage COVERAGEDIR=$(COVERAGEDIR)
177 echo "this target is meant to be run with UPLOAD_TARGET=host:/path/"
183 $(PYTHON) -OOu `which pyflakes` src/allmydata |sort |uniq
185 $(PYTHON) misc/coding_tools/check-umids.py `find src/allmydata -name '*.py'`
189 @find src -name '*.py' |grep -v /build/ |wc --lines
191 @cat `find src -name '*.py' |grep -v /build/` |wc --lines
193 @grep TODO `find src -name '*.py' |grep -v /build/` | wc --lines
197 $(RUNPP) -p -c "src/allmydata/test/check_memory.py upload"
198 $(RUNPP) -p -c "src/allmydata/test/check_memory.py upload-self"
199 $(RUNPP) -p -c "src/allmydata/test/check_memory.py upload-POST"
200 $(RUNPP) -p -c "src/allmydata/test/check_memory.py download"
201 $(RUNPP) -p -c "src/allmydata/test/check_memory.py download-GET"
202 $(RUNPP) -p -c "src/allmydata/test/check_memory.py download-GET-slow"
203 $(RUNPP) -p -c "src/allmydata/test/check_memory.py receive"
205 check-memory-once: .built
207 $(RUNPP) -p -c "src/allmydata/test/check_memory.py $(MODE)"
209 # The check-speed target uses a pre-established client node to run a canned
210 # set of performance tests against a test network that is also
211 # pre-established (probably on a remote machine). Provide it with the path to
212 # a local directory where this client node has been created (and populated
213 # with the necessary FURLs of the test network). This target will start that
214 # client with the current code and then run the tests. Afterwards it will
217 # The 'sleep 5' is in there to give the new client a chance to connect to its
218 # storageservers, since check_speed.py has no good way of doing that itself.
221 if [ -z '$(TESTCLIENTDIR)' ]; then exit 1; fi
222 @echo "stopping any leftover client code"
223 -$(TAHOE) stop $(TESTCLIENTDIR)
224 $(TAHOE) start $(TESTCLIENTDIR)
226 $(PYTHON) src/allmydata/test/check_speed.py $(TESTCLIENTDIR)
227 $(TAHOE) stop $(TESTCLIENTDIR)
229 # The check-grid target also uses a pre-established client node, along with a
230 # long-term directory that contains some well-known files. See the docstring
231 # in src/allmydata/test/check_grid.py to see how to set this up.
233 if [ -z '$(TESTCLIENTDIR)' ]; then exit 1; fi
234 $(PYTHON) src/allmydata/test/check_grid.py $(TESTCLIENTDIR) bin/tahoe
236 bench-dirnode: .built
237 $(RUNPP) -p -c src/allmydata/test/bench_dirnode.py
239 # 'make repl' is a simple-to-type command to get a Python interpreter loop
240 # from which you can type 'import allmydata'
244 test-darcs-boringfile:
246 $(PYTHON) misc/build_helpers/test-darcs-boringfile.py
249 find . |grep -vEe "_darcs|allfiles.tmp|src/allmydata/_(version|appname).py" |sort >allfiles.tmp.old
252 find . |grep -vEe "_darcs|allfiles.tmp|src/allmydata/_(version|appname).py" |sort >allfiles.tmp.new
253 diff allfiles.tmp.old allfiles.tmp.new
256 rm -rf build _trial_temp _test_memory .checked-deps .built
257 rm -f `find src *.egg -name '*.so' -or -name '*.pyc'`
258 rm -rf src/allmydata_tahoe.egg-info
260 rm -rf `ls -d *.egg | grep -vEe"setuptools-|setuptools_darcs-|darcsver-"`
262 rm -rf misc/dependencies/build misc/dependencies/temp
263 rm -rf misc/dependencies/tahoe_deps.egg-info
264 rm -f bin/tahoe bin/tahoe.pyscript
266 find-trailing-spaces:
267 $(PYTHON) misc/coding_tools/find-trailing-spaces.py -r src
269 # The test-desert-island target grabs the tahoe-deps tarball, unpacks it,
270 # does a build, then asserts that the build did not try to download anything
271 # as it ran. Invoke this on a new tree, or after a 'clean', to make sure the
272 # support/lib/ directory is gone.
274 fetch-and-unpack-deps:
275 test -f tahoe-deps.tar.gz || wget http://allmydata.org/source/tahoe/deps/tahoe-deps.tar.gz
277 tar xzf tahoe-deps.tar.gz
280 $(MAKE) fetch-and-unpack-deps
281 $(MAKE) 2>&1 | tee make.out
282 $(PYTHON) misc/build_helpers/check-build.py make.out no-downloads
286 .PHONY: tarballs upload-tarballs
289 $(PYTHON) setup.py sdist --formats=bztar,gztar,zip
290 $(PYTHON) setup.py sdist --sumo --formats=bztar,gztar,zip
293 @if [ "X${BB_BRANCH}" == "Xtrunk" ] || [ "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
297 VER=$(shell $(PYTHON) misc/build_helpers/get-version.py)
298 DEBCOMMENTS="'make deb' build"
305 .PHONY: setup-deb deb-ARCH is-known-debian-arch
306 .PHONY: deb-etch deb-lenny deb-sid
307 .PHONY: deb-edgy deb-feisty deb-gutsy deb-hardy deb-intrepid deb-jaunty
309 # we use misc/debian_helpers/$TAHOE_ARCH/debian
312 $(MAKE) deb-ARCH ARCH=etch TAHOE_ARCH=etch
314 $(MAKE) deb-ARCH ARCH=lenny TAHOE_ARCH=lenny
316 $(MAKE) deb-ARCH ARCH=sid TAHOE_ARCH=sid
319 $(MAKE) deb-ARCH ARCH=edgy TAHOE_ARCH=etch
321 $(MAKE) deb-ARCH ARCH=feisty TAHOE_ARCH=lenny
323 $(MAKE) deb-ARCH ARCH=gutsy TAHOE_ARCH=lenny
325 $(MAKE) deb-ARCH ARCH=hardy TAHOE_ARCH=lenny
326 deb-intrepid: # py2.5
327 $(MAKE) deb-ARCH ARCH=intrepid TAHOE_ARCH=lenny
329 $(MAKE) deb-ARCH ARCH=jaunty TAHOE_ARCH=lenny
333 # we know how to handle the following debian architectures
334 KNOWN_DEBIAN_ARCHES := etch lenny sid edgy feisty gutsy hardy intrepid jaunty
336 ifeq ($(findstring x-$(ARCH)-x,$(foreach arch,$(KNOWN_DEBIAN_ARCHES),"x-$(arch)-x")),)
337 is-known-debian-arch:
338 @echo "ARCH must be set when using setup-deb or deb-ARCH"
339 @echo "I know how to handle:" $(KNOWN_DEBIAN_ARCHES)
342 is-known-debian-arch:
350 setup-deb: is-known-debian-arch
352 ln -s misc/debian_helpers/$(TAHOE_ARCH)/debian debian
353 chmod +x debian/rules
355 # etch (current debian stable) has python-simplejson-1.3, which doesn't
357 # sid (debian unstable) currently has python-simplejson 1.7.1
358 # edgy has 1.3, which doesn't support indent=
359 # feisty has 1.4, which supports indent= but emits a deprecation warning
362 # we need 1.4 or newer
364 deb-ARCH: is-known-debian-arch setup-deb
365 fakeroot debian/rules binary
367 @echo "The newly built .deb packages are in the parent directory from here."
369 .PHONY: increment-deb-version
370 .PHONY: deb-etch-head deb-lenny-head deb-sid-head
371 .PHONY: deb-edgy-head deb-feisty-head deb-gutsy-head deb-hardy-head deb-intrepid-head deb-jaunty-head
373 # The buildbot runs the following targets after each change, to produce
374 # up-to-date tahoe .debs. These steps do not create .debs for anything else.
376 increment-deb-version: make-version
377 debchange --newversion $(VER) $(DEBCOMMENTS)
379 $(MAKE) setup-deb ARCH=etch TAHOE_ARCH=etch
380 $(MAKE) increment-deb-version
381 fakeroot debian/rules binary
383 $(MAKE) setup-deb ARCH=lenny TAHOE_ARCH=lenny
384 $(MAKE) increment-deb-version
385 fakeroot debian/rules binary
387 $(MAKE) setup-deb ARCH=sid TAHOE_ARCH=lenny
388 $(MAKE) increment-deb-version
389 fakeroot debian/rules binary
392 $(MAKE) setup-deb ARCH=edgy TAHOE_ARCH=etch
393 $(MAKE) increment-deb-version
394 fakeroot debian/rules binary
396 $(MAKE) setup-deb ARCH=feisty TAHOE_ARCH=lenny
397 $(MAKE) increment-deb-version
398 fakeroot debian/rules binary
400 $(MAKE) setup-deb ARCH=gutsy TAHOE_ARCH=lenny
401 $(MAKE) increment-deb-version
402 fakeroot debian/rules binary
404 $(MAKE) setup-deb ARCH=hardy TAHOE_ARCH=lenny
405 $(MAKE) increment-deb-version
406 fakeroot debian/rules binary
408 $(MAKE) setup-deb ARCH=intrepid TAHOE_ARCH=lenny
409 $(MAKE) increment-deb-version
410 fakeroot debian/rules binary
412 $(MAKE) setup-deb ARCH=jaunty TAHOE_ARCH=lenny
413 $(MAKE) increment-deb-version
414 fakeroot debian/rules binary
416 # new experimental debian-packaging-building target
417 .PHONY: EXPERIMENTAL-deb
418 EXPERIMENTAL-deb: is-known-debian-arch
419 $(PYTHON) misc/build_helpers/build-deb.py $(ARCH)