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 build: src/allmydata/_version.py
53 $(PYTHON) setup.py build
56 # 'make install' will do the following:
57 # build+install tahoe (probably to /usr/lib/pythonN.N/site-packages)
58 # 'make install PREFIX=/usr/local/stow/tahoe-N.N' will do the same, but to
59 # a different location
61 install: src/allmydata/_version.py
64 $(PYTHON) ./setup.py install --single-version-externally-managed \
65 --prefix=$(PREFIX) --record=./tahoe.files
67 $(PYTHON) ./setup.py install --single-version-externally-managed
73 .PHONY: signal-error-deps test check test-coverage quicktest quicktest-coverage
74 .PHONY: coverage-output get-old-coverage-coverage coverage-delta-output
77 # you can use 'make test TEST=allmydata.test.test_introducer' to run just
78 # test_introducer. TEST=allmydata.test.test_client.Basic.test_permute works
82 # use 'make test TRIALARGS=--reporter=bwverbose' from buildbot, to
83 # suppress the ansi color sequences
85 # It is unnecessary to have this depend on build or src/allmydata/_version.py,
86 # since 'setup.py test' always updates the version and builds before testing.
88 $(PYTHON) setup.py test $(TRIALARGS) -s $(TEST)
94 $(RUNPP) -d contrib/fuse -p -c runtests.py
96 test-coverage: build src/allmydata/_version.py
98 $(TAHOE) debug trial --reporter=bwverbose-coverage $(TEST)
101 $(TAHOE) debug trial $(TRIALARGS) $(TEST)
103 # code-coverage: install the "coverage" package from PyPI, do "make
104 # quicktest-coverage" to do a unit test run with coverage-gathering enabled,
105 # then use "make coverate-output-text" for a brief report, or "make
106 # coverage-output" for a pretty HTML report. Also see "make .coverage.el" and
107 # misc/coding_tools/coverage.el for emacs integration.
111 $(TAHOE) debug trial --reporter=bwverbose-coverage $(TEST)
112 # on my laptop, "quicktest" takes 239s, "quicktest-coverage" takes 304s
114 # --include appeared in coverage-3.4
115 COVERAGE_OMIT=--include '$(CURDIR)/src/allmydata/*' --omit '$(CURDIR)/src/allmydata/test/*'
118 coverage html -i -d coverage-html $(COVERAGE_OMIT)
119 cp .coverage coverage-html/coverage.data
120 @echo "now point your browser at coverage-html/index.html"
122 .PHONY: upload-coverage .coverage.el pyflakes count-lines
123 .PHONY: check-memory check-memory-once check-speed check-grid
124 .PHONY: repl test-darcs-boringfile test-clean clean find-trailing-spaces
126 .coverage.el: .coverage
127 $(PYTHON) misc/coding_tools/coverage2el.py
129 # 'upload-coverage' is meant to be run with an UPLOAD_TARGET=host:/dir setting
133 $(error UPLOAD_HOST must be set when using UPLOAD_TARGET)
136 $(error COVERAGEDIR must be set when using UPLOAD_TARGET)
140 rsync -a coverage-html/ $(UPLOAD_TARGET)
141 ssh $(UPLOAD_HOST) make update-tahoe-coverage COVERAGEDIR=$(COVERAGEDIR)
144 echo "this target is meant to be run with UPLOAD_TARGET=host:/path/"
150 $(PYTHON) -OOu `which pyflakes` src/allmydata static misc/build_helpers bin/tahoe-script.template twisted setup.py |sort |uniq
152 $(PYTHON) misc/coding_tools/check-umids.py `find src/allmydata -name '*.py'`
156 @find src -name '*.py' |grep -v /build/ |wc --lines
158 @cat `find src -name '*.py' |grep -v /build/` |wc --lines
160 @grep TODO `find src -name '*.py' |grep -v /build/` | wc --lines
164 $(RUNPP) -p -c "src/allmydata/test/check_memory.py upload"
165 $(RUNPP) -p -c "src/allmydata/test/check_memory.py upload-self"
166 $(RUNPP) -p -c "src/allmydata/test/check_memory.py upload-POST"
167 $(RUNPP) -p -c "src/allmydata/test/check_memory.py download"
168 $(RUNPP) -p -c "src/allmydata/test/check_memory.py download-GET"
169 $(RUNPP) -p -c "src/allmydata/test/check_memory.py download-GET-slow"
170 $(RUNPP) -p -c "src/allmydata/test/check_memory.py receive"
172 check-memory-once: .built
174 $(RUNPP) -p -c "src/allmydata/test/check_memory.py $(MODE)"
176 # The check-speed target uses a pre-established client node to run a canned
177 # set of performance tests against a test network that is also
178 # pre-established (probably on a remote machine). Provide it with the path to
179 # a local directory where this client node has been created (and populated
180 # with the necessary FURLs of the test network). This target will start that
181 # client with the current code and then run the tests. Afterwards it will
184 # The 'sleep 5' is in there to give the new client a chance to connect to its
185 # storageservers, since check_speed.py has no good way of doing that itself.
188 if [ -z '$(TESTCLIENTDIR)' ]; then exit 1; fi
189 @echo "stopping any leftover client code"
190 -$(TAHOE) stop $(TESTCLIENTDIR)
191 $(TAHOE) start $(TESTCLIENTDIR)
193 $(PYTHON) src/allmydata/test/check_speed.py $(TESTCLIENTDIR)
194 $(TAHOE) stop $(TESTCLIENTDIR)
196 # The check-grid target also uses a pre-established client node, along with a
197 # long-term directory that contains some well-known files. See the docstring
198 # in src/allmydata/test/check_grid.py to see how to set this up.
200 if [ -z '$(TESTCLIENTDIR)' ]; then exit 1; fi
201 $(PYTHON) src/allmydata/test/check_grid.py $(TESTCLIENTDIR) bin/tahoe
203 bench-dirnode: .built
204 $(RUNPP) -p -c src/allmydata/test/bench_dirnode.py
206 # 'make repl' is a simple-to-type command to get a Python interpreter loop
207 # from which you can type 'import allmydata'
211 test-darcs-boringfile:
213 $(PYTHON) misc/build_helpers/test-darcs-boringfile.py
216 find . |grep -vEe "_darcs|allfiles.tmp|src/allmydata/_(version|appname).py" |sort >allfiles.tmp.old
219 find . |grep -vEe "_darcs|allfiles.tmp|src/allmydata/_(version|appname).py" |sort >allfiles.tmp.new
220 diff allfiles.tmp.old allfiles.tmp.new
223 rm -rf build _trial_temp _test_memory .built
224 rm -f `find src *.egg -name '*.so' -or -name '*.pyc'`
225 rm -rf src/allmydata_tahoe.egg-info
227 rm -rf `ls -d *.egg | grep -vEe"setuptools-|setuptools_darcs-|darcsver-"`
229 rm -rf misc/dependencies/build misc/dependencies/temp
230 rm -rf misc/dependencies/tahoe_deps.egg-info
231 rm -f bin/tahoe bin/tahoe.pyscript
233 find-trailing-spaces:
234 $(PYTHON) misc/coding_tools/find-trailing-spaces.py -r src
236 # The test-desert-island target grabs the tahoe-deps tarball, unpacks it,
237 # does a build, then asserts that the build did not try to download anything
238 # as it ran. Invoke this on a new tree, or after a 'clean', to make sure the
239 # support/lib/ directory is gone.
241 fetch-and-unpack-deps:
242 test -f tahoe-deps.tar.gz || wget http://tahoe-lafs.org/source/tahoe/deps/tahoe-deps.tar.gz
244 tar xzf tahoe-deps.tar.gz
247 $(MAKE) fetch-and-unpack-deps
248 $(MAKE) 2>&1 | tee make.out
249 $(PYTHON) misc/build_helpers/check-build.py make.out no-downloads
253 .PHONY: tarballs upload-tarballs
256 $(PYTHON) setup.py sdist --formats=bztar,gztar,zip
257 $(PYTHON) setup.py sdist --sumo --formats=bztar,gztar,zip
260 @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
264 VER=$(shell $(PYTHON) misc/build_helpers/get-version.py)
265 DEBCOMMENTS="'make deb' build"
272 .PHONY: setup-deb deb-ARCH is-known-debian-arch
273 .PHONY: deb-etch deb-lenny deb-sid
274 .PHONY: deb-edgy deb-feisty deb-gutsy deb-hardy deb-intrepid deb-jaunty
276 # we use misc/debian_helpers/$TAHOE_ARCH/debian
279 $(MAKE) deb-ARCH ARCH=etch TAHOE_ARCH=etch
281 $(MAKE) deb-ARCH ARCH=lenny TAHOE_ARCH=lenny
283 $(MAKE) deb-ARCH ARCH=sid TAHOE_ARCH=sid
286 $(MAKE) deb-ARCH ARCH=edgy TAHOE_ARCH=etch
288 $(MAKE) deb-ARCH ARCH=feisty TAHOE_ARCH=lenny
290 $(MAKE) deb-ARCH ARCH=gutsy TAHOE_ARCH=lenny
292 $(MAKE) deb-ARCH ARCH=hardy TAHOE_ARCH=lenny
293 deb-intrepid: # py2.5
294 $(MAKE) deb-ARCH ARCH=intrepid TAHOE_ARCH=lenny
296 $(MAKE) deb-ARCH ARCH=jaunty TAHOE_ARCH=lenny
300 # we know how to handle the following debian architectures
301 KNOWN_DEBIAN_ARCHES := etch lenny sid edgy feisty gutsy hardy intrepid jaunty
303 ifeq ($(findstring x-$(ARCH)-x,$(foreach arch,$(KNOWN_DEBIAN_ARCHES),"x-$(arch)-x")),)
304 is-known-debian-arch:
305 @echo "ARCH must be set when using setup-deb or deb-ARCH"
306 @echo "I know how to handle:" $(KNOWN_DEBIAN_ARCHES)
309 is-known-debian-arch:
317 setup-deb: is-known-debian-arch
319 ln -s misc/debian_helpers/$(TAHOE_ARCH)/debian debian
320 chmod +x debian/rules
322 # etch (current debian stable) has python-simplejson-1.3, which doesn't
324 # sid (debian unstable) currently has python-simplejson 1.7.1
325 # edgy has 1.3, which doesn't support indent=
326 # feisty has 1.4, which supports indent= but emits a deprecation warning
329 # we need 1.4 or newer
331 deb-ARCH: is-known-debian-arch setup-deb
332 fakeroot debian/rules binary
334 @echo "The newly built .deb packages are in the parent directory from here."
336 .PHONY: increment-deb-version
337 .PHONY: deb-etch-head deb-lenny-head deb-sid-head
338 .PHONY: deb-edgy-head deb-feisty-head deb-gutsy-head deb-hardy-head deb-intrepid-head deb-jaunty-head
340 # The buildbot runs the following targets after each change, to produce
341 # up-to-date tahoe .debs. These steps do not create .debs for anything else.
343 increment-deb-version: make-version
344 debchange --newversion $(VER) $(DEBCOMMENTS)
346 $(MAKE) setup-deb ARCH=etch TAHOE_ARCH=etch
347 $(MAKE) increment-deb-version
348 fakeroot debian/rules binary
350 $(MAKE) setup-deb ARCH=lenny TAHOE_ARCH=lenny
351 $(MAKE) increment-deb-version
352 fakeroot debian/rules binary
354 $(MAKE) setup-deb ARCH=sid TAHOE_ARCH=lenny
355 $(MAKE) increment-deb-version
356 fakeroot debian/rules binary
359 $(MAKE) setup-deb ARCH=edgy TAHOE_ARCH=etch
360 $(MAKE) increment-deb-version
361 fakeroot debian/rules binary
363 $(MAKE) setup-deb ARCH=feisty TAHOE_ARCH=lenny
364 $(MAKE) increment-deb-version
365 fakeroot debian/rules binary
367 $(MAKE) setup-deb ARCH=gutsy TAHOE_ARCH=lenny
368 $(MAKE) increment-deb-version
369 fakeroot debian/rules binary
371 $(MAKE) setup-deb ARCH=hardy TAHOE_ARCH=lenny
372 $(MAKE) increment-deb-version
373 fakeroot debian/rules binary
375 $(MAKE) setup-deb ARCH=intrepid TAHOE_ARCH=lenny
376 $(MAKE) increment-deb-version
377 fakeroot debian/rules binary
379 $(MAKE) setup-deb ARCH=jaunty TAHOE_ARCH=lenny
380 $(MAKE) increment-deb-version
381 fakeroot debian/rules binary
383 # new experimental debian-packaging-building target
384 .PHONY: EXPERIMENTAL-deb
385 EXPERIMENTAL-deb: is-known-debian-arch
386 $(PYTHON) misc/build_helpers/build-deb.py $(ARCH)