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
15 .PHONY: make-version build
17 # The 'darcsver' setup.py command comes in the 'darcsver' package:
18 # http://pypi.python.org/pypi/darcsver It is necessary only if you want to
19 # automatically produce a new _version.py file from the current darcs history.
21 $(PYTHON) ./setup.py darcsver --count-all-patches
23 # We want src/allmydata/_version.py to be up-to-date, but it's a fairly
24 # expensive operation (about 6 seconds on a just-before-0.7.0 tree, probably
25 # because of the 332 patches since the last tag), and we've removed the need
26 # for an explicit 'build' step by removing the C code from src/allmydata and
27 # by running everything in place. It would be neat to do:
29 #src/allmydata/_version.py: _darcs/patches
30 # $(MAKE) make-version
32 # since that would update the embedded version string each time new darcs
33 # patches were pulled, but without an obligatory 'build' step this rule
34 # wouldn't be run frequently enough anyways.
36 # So instead, I'll just make sure that we update the version at least once
37 # when we first start using the tree, and again whenever an explicit
38 # 'make-version' is run, since then at least the developer has some means to
39 # update things. It would be nice if 'make clean' deleted any
40 # automatically-generated _version.py too, so that 'make clean; make all'
41 # could be useable as a "what the heck is going on, get me back to a clean
42 # state', but we need 'make clean' to work on non-darcs trees without
43 # destroying useful information.
48 src/allmydata/_version.py:
51 # c.f. ticket #455, there is a problem in the intersection of setuptools,
52 # twisted's setup.py, and nevow's setup.py . A Tahoe build, to satisfy its
53 # dependencies, may try to build both Twisted and Nevow. If both of these
54 # occur during the same invocation of 'setup.py develop', then the Nevow
55 # build will fail with an "ImportError: No module named components". Running
56 # the build a second time will succeed. Until there is a new version of
57 # setuptools which properly sandboxes sys.modules (or a new version of nevow
58 # which doesn't import twisted during its build, or a new version of twisted
59 # which doesn't import itself during its build), we just build tahoe twice
60 # and ignore the errors from the first pass. Updated 16-Sep-2008: now we need
63 build: src/allmydata/_version.py
64 $(PYTHON) setup.py build
67 # 'make install' will do the following:
68 # build+install tahoe (probably to /usr/lib/pythonN.N/site-packages)
69 # 'make install PREFIX=/usr/local/stow/tahoe-N.N' will do the same, but to
70 # a different location
72 install: src/allmydata/_version.py
75 $(PYTHON) ./setup.py install --single-version-externally-managed \
76 --prefix=$(PREFIX) --record=./tahoe.files
78 $(PYTHON) ./setup.py install --single-version-externally-managed
84 .PHONY: signal-error-deps test test-figleaf quicktest quicktest-figleaf
85 .PHONY: figleaf-output get-old-figleaf-coverage figleaf-delta-output
91 @echo "ERROR: Not all of Tahoe's dependencies are in place. Please see docs/install.html for help on installing dependencies."
97 $(PYTHON) setup.py -q check_auto_deps || $(MAKE) signal-error-deps
100 $(MAKE) check-auto-deps
103 # you can use 'make test TEST=allmydata.test.test_introducer' to run just
104 # test_introducer. TEST=allmydata.test.test_client.Basic.test_permute works
108 # use 'make test TRIALARGS=--reporter=bwverbose' from buildbot, to
109 # suppress the ansi color sequences
111 test: build src/allmydata/_version.py
112 $(PYTHON) setup.py test $(TRIALARGS) -s $(TEST)
114 fuse-test: .built .checked-deps
115 $(RUNPP) -d contrib/fuse -p -c runtests.py
117 test-figleaf: build src/allmydata/_version.py
119 $(PYTHON) setup.py trial --reporter=bwverbose-figleaf -s $(TEST)
122 $(PYTHON) misc/run-with-pythonpath.py trial $(TRIALARGS) $(TEST)
126 $(PYTHON) misc/run-with-pythonpath.py trial --reporter=bwverbose-figleaf $(TEST)
129 $(RUNPP) -p -c "misc/figleaf2html -d coverage-html -r src -x misc/figleaf.excludes"
130 cp .figleaf coverage-html/figleaf.pickle
131 @echo "now point your browser at coverage-html/index.html"
133 # use these two targets to compare this coverage against the previous run.
134 # The deltas only work if the old test was run in the same directory, since
135 # it compares absolute filenames.
136 get-old-figleaf-coverage:
137 wget --progress=dot -O old.figleaf http://allmydata.org/tahoe-figleaf/current/figleaf.pickle
139 figleaf-delta-output:
140 $(RUNPP) -p -c "misc/figleaf2html -d coverage-html -r src -x misc/figleaf.excludes -o old.figleaf"
141 cp .figleaf coverage-html/figleaf.pickle
142 @echo "now point your browser at coverage-html/index.html"
144 # after doing test-figleaf and figleaf-output, point your browser at
145 # coverage-html/index.html
147 .PHONY: upload-figleaf .figleaf.el pyflakes count-lines
148 .PHONY: check-memory check-memory-once check-speed check-grid
149 .PHONY: repl test-darcs-boringfile test-clean clean find-trailing-spaces
151 # 'upload-figleaf' is meant to be run with an UPLOAD_TARGET=host:/dir setting
155 $(error UPLOAD_HOST must be set when using UPLOAD_TARGET)
158 $(error COVERAGEDIR must be set when using UPLOAD_TARGET)
162 rsync -a coverage-html/ $(UPLOAD_TARGET)
163 ssh $(UPLOAD_HOST) make update-tahoe-figleaf COVERAGEDIR=$(COVERAGEDIR)
166 echo "this target is meant to be run with UPLOAD_TARGET=host:/path/"
170 .figleaf.el: .figleaf
171 $(RUNPP) -p -c "misc/figleaf2el.py .figleaf src"
174 $(PYTHON) -OOu `which pyflakes` src/allmydata |sort |uniq
178 @find src -name '*.py' |grep -v /build/ |wc --lines
180 @cat `find src -name '*.py' |grep -v /build/` |wc --lines
182 @grep TODO `find src -name '*.py' |grep -v /build/` | wc --lines
186 $(RUNPP) -p -c "src/allmydata/test/check_memory.py upload"
187 $(RUNPP) -p -c "src/allmydata/test/check_memory.py upload-self"
188 $(RUNPP) -p -c "src/allmydata/test/check_memory.py upload-POST"
189 $(RUNPP) -p -c "src/allmydata/test/check_memory.py download"
190 $(RUNPP) -p -c "src/allmydata/test/check_memory.py download-GET"
191 $(RUNPP) -p -c "src/allmydata/test/check_memory.py download-GET-slow"
192 $(RUNPP) -p -c "src/allmydata/test/check_memory.py receive"
194 check-memory-once: .built
196 $(RUNPP) -p -c "src/allmydata/test/check_memory.py $(MODE)"
198 # The check-speed target uses a pre-established client node to run a canned
199 # set of performance tests against a test network that is also
200 # pre-established (probably on a remote machine). Provide it with the path to
201 # a local directory where this client node has been created (and populated
202 # with the necessary FURLs of the test network). This target will start that
203 # client with the current code and then run the tests. Afterwards it will
206 # The 'sleep 5' is in there to give the new client a chance to connect to its
207 # storageservers, since check_speed.py has no good way of doing that itself.
210 if [ -z '$(TESTCLIENTDIR)' ]; then exit 1; fi
211 @echo "stopping any leftover client code"
212 -$(PYTHON) bin/tahoe stop $(TESTCLIENTDIR)
213 $(PYTHON) bin/tahoe start $(TESTCLIENTDIR)
215 $(PYTHON) src/allmydata/test/check_speed.py $(TESTCLIENTDIR)
216 $(PYTHON) bin/tahoe stop $(TESTCLIENTDIR)
218 # The check-grid target also uses a pre-established client node, along with a
219 # long-term directory that contains some well-known files. See the docstring
220 # in src/allmydata/test/check_grid.py to see how to set this up.
222 if [ -z '$(TESTCLIENTDIR)' ]; then exit 1; fi
223 $(PYTHON) src/allmydata/test/check_grid.py $(TESTCLIENTDIR) bin/tahoe
225 bench-dirnode: .built
226 $(RUNPP) -p -c src/allmydata/test/bench_dirnode.py
228 # 'make repl' is a simple-to-type command to get a Python interpreter loop
229 # from which you can type 'import allmydata'
233 test-darcs-boringfile:
235 $(PYTHON) misc/test-darcs-boringfile.py
238 find . |grep -vEe "_darcs|allfiles.tmp|src/allmydata/_(version|auto_deps|appname).py" |sort >allfiles.tmp.old
241 find . |grep -vEe "_darcs|allfiles.tmp|src/allmydata/_(version|auto_deps|appname).py" |sort >allfiles.tmp.new
242 diff allfiles.tmp.old allfiles.tmp.new
245 rm -rf build _trial_temp _test_memory .checked-deps .built
246 rm -f `find src/allmydata -name '*.so' -or -name '*.pyc'`
247 rm -rf src/allmydata_tahoe.egg-info
250 rm -rf misc/dependencies/build misc/dependencies/temp
251 rm -rf misc/dependencies/tahoe_deps.egg-info
252 rm -f bin/tahoe bin/tahoe-script.py
254 find-trailing-spaces:
255 $(PYTHON) misc/find-trailing-spaces.py -r src
257 # The test-desert-island target grabs the tahoe-deps tarball, unpacks it,
258 # does a build, then asserts that the build did not try to download anything
259 # as it ran. Invoke this on a new tree, or after a 'clean', to make sure the
260 # support/lib/ directory is gone.
262 fetch-and-unpack-deps:
263 test -f tahoe-deps.tar.gz || wget http://allmydata.org/source/tahoe/deps/tahoe-deps.tar.gz
265 tar xf tahoe-deps.tar.gz
268 $(MAKE) fetch-and-unpack-deps
269 $(MAKE) 2>&1 | tee make.out
270 $(PYTHON) misc/check-build.py make.out no-downloads
274 .PHONY: tarballs upload-tarballs
277 $(PYTHON) setup.py sdist --formats=bztar,gztar,zip
278 $(PYTHON) setup.py sdist --sumo --formats=bztar,gztar,zip
281 for f in dist/allmydata-tahoe-*; do \
282 flappclient --furlfile ~/.tahoe-tarball-upload.furl upload-file $$f; \
287 VER=$(shell $(PYTHON) misc/get-version.py)
288 DEBCOMMENTS="'make deb' build"
295 .PHONY: setup-deb deb-ARCH is-known-debian-arch
296 .PHONY: deb-etch deb-lenny deb-sid
297 .PHONY: deb-edgy deb-feisty deb-gutsy deb-hardy deb-intrepid deb-jaunty
299 # we use misc/$TAHOE_ARCH/debian
302 $(MAKE) deb-ARCH ARCH=etch TAHOE_ARCH=etch
304 $(MAKE) deb-ARCH ARCH=lenny TAHOE_ARCH=lenny
306 $(MAKE) deb-ARCH ARCH=sid TAHOE_ARCH=sid
309 $(MAKE) deb-ARCH ARCH=edgy TAHOE_ARCH=etch
311 $(MAKE) deb-ARCH ARCH=feisty TAHOE_ARCH=lenny
313 $(MAKE) deb-ARCH ARCH=gutsy TAHOE_ARCH=lenny
315 $(MAKE) deb-ARCH ARCH=hardy TAHOE_ARCH=lenny
316 deb-intrepid: # py2.5
317 $(MAKE) deb-ARCH ARCH=intrepid TAHOE_ARCH=lenny
319 $(MAKE) deb-ARCH ARCH=jaunty TAHOE_ARCH=lenny
323 # we know how to handle the following debian architectures
324 KNOWN_DEBIAN_ARCHES := etch lenny sid edgy feisty gutsy hardy intrepid jaunty
326 ifeq ($(findstring x-$(ARCH)-x,$(foreach arch,$(KNOWN_DEBIAN_ARCHES),"x-$(arch)-x")),)
327 is-known-debian-arch:
328 @echo "ARCH must be set when using setup-deb or deb-ARCH"
329 @echo "I know how to handle:" $(KNOWN_DEBIAN_ARCHES)
332 is-known-debian-arch:
340 setup-deb: is-known-debian-arch
342 ln -s misc/$(TAHOE_ARCH)/debian debian
343 chmod +x debian/rules
345 # etch (current debian stable) has python-simplejson-1.3, which doesn't
347 # sid (debian unstable) currently has python-simplejson 1.7.1
348 # edgy has 1.3, which doesn't support indent=
349 # feisty has 1.4, which supports indent= but emits a deprecation warning
352 # we need 1.4 or newer
354 deb-ARCH: is-known-debian-arch setup-deb
355 fakeroot debian/rules binary
357 @echo "The newly built .deb packages are in the parent directory from here."
359 .PHONY: increment-deb-version
360 .PHONY: deb-etch-head deb-lenny-head deb-sid-head
361 .PHONY: deb-edgy-head deb-feisty-head deb-gutsy-head deb-hardy-head deb-intrepid-head deb-jaunty-head
363 # The buildbot runs the following targets after each change, to produce
364 # up-to-date tahoe .debs. These steps do not create .debs for anything else.
366 increment-deb-version: make-version
367 debchange --newversion $(VER) $(DEBCOMMENTS)
369 $(MAKE) setup-deb ARCH=etch TAHOE_ARCH=etch
370 $(MAKE) increment-deb-version
371 fakeroot debian/rules binary
373 $(MAKE) setup-deb ARCH=lenny TAHOE_ARCH=lenny
374 $(MAKE) increment-deb-version
375 fakeroot debian/rules binary
377 $(MAKE) setup-deb ARCH=sid TAHOE_ARCH=lenny
378 $(MAKE) increment-deb-version
379 fakeroot debian/rules binary
382 $(MAKE) setup-deb ARCH=edgy TAHOE_ARCH=etch
383 $(MAKE) increment-deb-version
384 fakeroot debian/rules binary
386 $(MAKE) setup-deb ARCH=feisty TAHOE_ARCH=lenny
387 $(MAKE) increment-deb-version
388 fakeroot debian/rules binary
390 $(MAKE) setup-deb ARCH=gutsy TAHOE_ARCH=lenny
391 $(MAKE) increment-deb-version
392 fakeroot debian/rules binary
394 $(MAKE) setup-deb ARCH=hardy TAHOE_ARCH=lenny
395 $(MAKE) increment-deb-version
396 fakeroot debian/rules binary
398 $(MAKE) setup-deb ARCH=intrepid TAHOE_ARCH=lenny
399 $(MAKE) increment-deb-version
400 fakeroot debian/rules binary
402 $(MAKE) setup-deb ARCH=jaunty TAHOE_ARCH=lenny
403 $(MAKE) increment-deb-version
404 fakeroot debian/rules binary
406 # new experimental debian-packaging-building target
407 .PHONY: EXPERIMENTAL-deb
408 EXPERIMENTAL-deb: is-known-debian-arch
409 $(PYTHON) misc/build-deb.py $(ARCH)
412 # These targets provide for windows native builds
413 .PHONY: windows-exe windows-installer windows-installer-upload
416 $(RUNPP) -c "$(MAKE) -C windows windows-exe"
419 $(RUNPP) -c "$(MAKE) -C windows windows-installer"
421 windows-installer-upload:
422 $(RUNPP) -c "$(MAKE) -C windows windows-installer-upload"
425 # These targets provide for mac native builds
426 .PHONY: mac-exe mac-upload mac-cleanup mac-dbg
430 VERSION=$(VER) $(RUNPP) -c "$(MAKE) -C mac build"
433 VERSION=$(VER) $(MAKE) -C mac diskimage
436 VERSION=$(VER) $(MAKE) -C mac upload
439 VERSION=$(VER) $(MAKE) -C mac cleanup
442 cd mac && $(PP) $(PYTHON)w allmydata_tahoe.py