Merge lp:~allenap/txlongpoll/bootstrap-without-net into lp:txlongpoll

Proposed by Gavin Panella
Status: Merged
Approved by: Gavin Panella
Approved revision: 84
Merged at revision: 78
Proposed branch: lp:~allenap/txlongpoll/bootstrap-without-net
Merge into: lp:txlongpoll
Diff against target: 252 lines (+107/-61)
4 files modified
Makefile (+59/-41)
README (+35/-8)
buildout.cfg (+12/-11)
setup.py (+1/-1)
To merge this branch: bzr merge lp:~allenap/txlongpoll/bootstrap-without-net
Reviewer Review Type Date Requested Status
Raphaël Badin (community) Approve
Review via email: mp+81323@code.launchpad.net

Commit message

Many changes related to improving deployment of txlongpoll as a working service.

Description of the change

Several fixes relating to making deployment easier for the LOSAs, and
reliably repeatable:

- Make txlongpoll bootstrappable locally, without network, and build
  from cache.

- `make build` now only builds what's needed to _run_ txlongpoll.

- `make bin/test` installs the test runner and dependencies.

- `make tags TAGS` builds tag files.

- Build with relative paths to make deployment a bit easier, which
  goes in hand with the next change...

- `make build-update-paths` is for the use of people deploying
  txlongpoll, i.e. the LOSAs. They will build txlongpoll on one
  machine and sync it to another, but at a different fs location.
  `make build-update-paths` fixes the last few remaining absolute
  paths in the buildout. I suspect that the need to do this indicates
  a deficiency or bug in buildout or one of the recipes.

- Updated the README to reflect much of the above.

- Depend on txAMQP >= 0.5 because lower versions cause test failures.

To post a comment you must log in.
82. By Gavin Panella

Correct README.

83. By Gavin Panella

Get rid of ez_setup.py and instead get it from the download cache.

84. By Gavin Panella

Update README to explain how to run online.

Revision history for this message
Raphaël Badin (rvb) wrote :

Looks good.

[0]

146 +- Remove the --setup-source and --download-base options in Makefile to
147 + allow bootstrap.py to download setuptools.
148 +
149 +- Comment out the ``install-from-cache = true`` line in buildout.cfg
150 + to allow bin/buildout to download dependencies.

I wish it would be more straight forward to do this (like running make with a simple option) but I'm not sure it's feasible/simple.

[0]

47 +TAGS: bin/tags
48 + bin/tags --ctags-emacs
49 +
50 +
51 +tags: bin/tags
52 + bin/tags --ctags-vi

Just curious here, is this standard (the name of the targets I mean)?

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Makefile'
2--- Makefile 2011-11-04 14:35:34 +0000
3+++ Makefile 2011-11-07 12:07:26 +0000
4@@ -2,54 +2,71 @@
5 # GNU Affero General Public License version 3 (see the file LICENSE).
6
7 PYTHON = python
8-PY = $(PWD)/bin/py
9-
10-BUILDOUT_CFG = buildout.cfg
11-
12-# Do not add bin/buildout to this list. It is impossible to get
13-# buildout to tell us all the files it would build, since each egg's
14-# setup.py doesn't tell us that information.
15-#
16-# NB: It's important BUILDOUT_BIN only mentions things genuinely
17-# produced by buildout.
18-BUILDOUT_BIN = $(PY) bin/tags bin/test bin/txlongpoll
19+
20+BOOTSTRAP_BIN := bootstrap.py
21+BOOTSTRAP = PYTHONPATH= $(PYTHON) $(BOOTSTRAP_BIN)
22+
23+BUILDOUT_BIN := bin/buildout
24+BUILDOUT_CFG := buildout.cfg
25+BUILDOUT = PYTHONPATH= $(BUILDOUT_BIN) -qc $(BUILDOUT_CFG)
26
27
28 default: check
29
30
31+build: bin/twistd
32+
33+
34+# When a built tree is moved this updates absolute paths.
35+build-update-paths:
36+ $(BUILDOUT)
37+
38+
39+check: bin/test
40+ bin/test -vv
41+
42+
43+dist: $(BUILDOUT_BIN)
44+ $(BUILDOUT) setup setup.py egg_info -r sdist
45+
46+
47+TAGS: bin/tags
48+ bin/tags --ctags-emacs
49+
50+
51+tags: bin/tags
52+ bin/tags --ctags-vi
53+
54+
55 download-cache:
56- mkdir download-cache
57-
58-
59-bin/buildout: download-cache
60- $(PYTHON) bootstrap.py
61+ mkdir -p download-cache
62+
63+
64+eggs:
65+ mkdir -p eggs
66+
67+
68+$(BUILDOUT_BIN): download-cache eggs
69+ $(BOOTSTRAP) \
70+ --setup-source=download-cache/dist/ez_setup.py \
71+ --download-base=download-cache/dist \
72+ --eggs=eggs --version=1.5.2
73 touch --no-create $@
74
75
76-$(PY): bin/buildout $(BUILDOUT_CFG) setup.py
77- PYTHONPATH=. ./bin/buildout -c $(BUILDOUT_CFG)
78-
79-
80-$(subst $(PY),,$(BUILDOUT_BIN)): $(PY)
81-
82-
83-build: $(BUILDOUT_BIN)
84-
85-
86-update-paths: bin/buildout
87- bin/buildout -oN
88-
89-
90-dist: $(PY)
91- $(PY) setup.py egg_info -r sdist
92-
93-
94-check: bin/test
95- ./bin/test -vv
96-
97-
98-clean_buildout:
99+bin/twistd: $(BUILDOUT_BIN) $(BUILDOUT_CFG) setup.py
100+ $(BUILDOUT) install runtime
101+
102+
103+bin/test: $(BUILDOUT_BIN) $(BUILDOUT_CFG) setup.py
104+ $(BUILDOUT) install test
105+
106+
107+bin/tags: $(BUILDOUT_BIN) $(BUILDOUT_CFG) setup.py
108+ $(BUILDOUT) install tags
109+
110+
111+clean_buildout:
112 $(RM) -r bin
113 $(RM) -r parts
114 $(RM) -r develop-eggs
115@@ -65,10 +82,11 @@
116
117
118 clean: clean_buildout
119+ find txlongpoll twisted -name '*.py[co]' -print0 | xargs -r0 $(RM)
120
121 clean_all: clean_buildout clean_eggs
122
123
124 .PHONY: \
125- build check clean clean_all clean_buildout \
126- clean_eggs default dist update-paths
127+ build build-update-paths check clean clean_all clean_buildout \
128+ clean_eggs default dist
129
130=== modified file 'README'
131--- README 2011-10-04 13:03:49 +0000
132+++ README 2011-11-07 12:07:26 +0000
133@@ -1,23 +1,50 @@
134 Generic long poll server used by Launchpad and Landscape.
135
136
137+Dependencies
138+------------
139+
140+By default txlongpoll attempts to build without going to the network;
141+instead it tries to find all dependencies from download-cache/dist,
142+and you must download all the dependencies yourself.
143+
144+If you prefer to use resources from the 'net, PyPI for example, then:
145+
146+- Remove the --setup-source and --download-base options in Makefile to
147+ allow bootstrap.py to download setuptools.
148+
149+- Comment out the ``install-from-cache = true`` line in buildout.cfg
150+ to allow bin/buildout to download dependencies.
151+
152+To run the tests you may also need lp:rabbitfixture (bzr branch
153+lp:rabbitfixture). Build an sdist tarball and drop it into
154+download-cache/dist. You may also need to do the same for
155+testresources-0.2.4_r58 until it reaches PyPI.
156+
157+txlongpoll needs a recent RabbitMQ with support for rejection. Maverick's
158+1.8.0 is not sufficient, but 2.1.1 works fine, so >= Natty is OK.
159+
160+
161 Building
162 --------
163
164-txlongpoll needs a recent RabbitMQ with support for rejection. Maverick's
165-1.8.0 is not sufficient, but 2.1.1 works fine, so >= Natty is OK.
166-
167-You also need to get lp:rabbitfixture, build it and drop the egg in
168-./download-cache/dist in order for txlongpoll to build. You will also possibly
169-need to do the same for testresources-0.2.4_r58 until it reaches PyPI.
170-
171 $ make build
172
173+will build only those parts needed to run txlongpoll. No support for
174+tags or testing.
175+
176
177 Testing
178 -------
179
180- $ bin/test
181+ $ make check
182+
183+will build all the test-related parts of txlongpoll and then do a full
184+test run, but
185+
186+ $ make bin/test
187+
188+will just do the first part.
189
190
191 Running
192
193=== modified file 'buildout.cfg'
194--- buildout.cfg 2011-11-04 14:31:08 +0000
195+++ buildout.cfg 2011-11-07 12:07:26 +0000
196@@ -2,10 +2,7 @@
197 # GNU Affero General Public License version 3 (see the file LICENSE).
198
199 [buildout]
200-parts =
201- interpreter
202- test
203- tags
204+parts = runtime
205 use-dependency-links = false
206 unzip = true
207 include-site-packages = false
208@@ -13,20 +10,24 @@
209 develop = .
210 download-cache = download-cache
211 eggs-directory = eggs
212-# Relative paths are required for deployment.
213+# Relative paths are useful when deploying built trees.
214 relative-paths = true
215+# Disable this option temporarily if you want buildout to find
216+# software dependencies *other* than those in our download-cache.
217+# Once you have the desired software, reenable this option.
218+install-from-cache = true
219+
220+[runtime]
221+recipe = zc.recipe.egg:scripts
222+eggs = txlongpoll
223+entry-points = twistd=twisted.scripts.twistd:run
224+interpreter = py
225
226 [test]
227 recipe = zc.recipe.testrunner
228 eggs = txlongpoll [test]
229 defaults = '--tests-pattern ^tests --exit-with-status'.split()
230
231-[interpreter]
232-recipe = zc.recipe.egg:scripts
233-interpreter = py
234-eggs = txlongpoll
235-entry-points = twistd=twisted.scripts.twistd:run
236-
237 [tags]
238 recipe = z3c.recipe.tag:tags
239 eggs = txlongpoll
240
241=== modified file 'setup.py'
242--- setup.py 2011-11-04 14:51:49 +0000
243+++ setup.py 2011-11-07 12:07:26 +0000
244@@ -22,7 +22,7 @@
245 'oops_twisted >= 0.0.3',
246 'setproctitle',
247 'Twisted',
248- 'txamqp',
249+ 'txAMQP >= 0.5',
250 'zope.interface',
251 ],
252 extras_require=dict(

Subscribers

People subscribed via source and target branches

to all changes: