~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to Makefile

merge from original buildout branch

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
 
4
4
PYTHON_VERSION=2.4
5
5
PYTHON=python${PYTHON_VERSION}
6
 
IPYTHON=$(PYTHON) $(shell which ipython)
7
 
PYTHONPATH:=$(shell pwd)/lib:$(shell pwd)/lib/mailman:${PYTHONPATH}
 
6
WD:=$(shell pwd)
 
7
PY=$(WD)/bin/py
 
8
PYTHONPATH:=$(WD)/lib:$(WD)/lib/mailman:${PYTHONPATH}
8
9
VERBOSITY=-vv
9
10
 
10
11
TESTFLAGS=-p $(VERBOSITY)
11
12
TESTOPTS=
12
13
 
13
 
SHHH=${PYTHON} utilities/shhh.py
 
14
SHHH=${PY} utilities/shhh.py
14
15
STARTSCRIPT=runlaunchpad.py
15
16
HERE:=$(shell pwd)
16
17
 
28
29
WADL_XSL = lib/launchpadlib/wadl-to-refhtml.xsl
29
30
API_INDEX = lib/canonical/launchpad/apidoc/index.html
30
31
 
31
 
APPSERVER_ENV = \
32
 
  LPCONFIG=${LPCONFIG} \
33
 
  PYTHONPATH=$(PYTHONPATH) \
34
 
  STORM_CEXTENSIONS=1
35
 
 
36
32
EXTRA_JS_FILES=lib/canonical/launchpad/icing/MochiKit.js \
37
33
                                $(shell $(HERE)/utilities/yui-deps.py) \
38
34
                                lib/canonical/launchpad/icing/lazr/build/lazr.js
48
44
        $(MAKE) -C database/schema newsampledata
49
45
 
50
46
hosted_branches:
51
 
        $(PYTHON) ./utilities/make-dummy-hosted-branches
 
47
        $(PY) ./utilities/make-dummy-hosted-branches
52
48
 
53
49
$(WADL_FILE): $(BZR_VERSION_INFO)
54
 
        LPCONFIG=$(LPCONFIG) $(PYTHON) ./utilities/create-lp-wadl.py > $@
 
50
        LPCONFIG=$(LPCONFIG) $(PY) ./utilities/create-lp-wadl.py > $@
55
51
 
56
52
$(API_INDEX): $(WADL_FILE) $(WADL_XSL)
57
53
        $(XSLTPROC) $(WADL_XSL) $(WADL_FILE) > $@
67
63
check_merge:
68
64
        [ `PYTHONPATH= bzr status -S database/schema/ | \
69
65
                grep -v "\(^P\|pending\|security.cfg\|Makefile\|unautovacuumable\)" | wc -l` -eq 0 ]
70
 
        ${PYTHON} lib/canonical/tests/test_no_conflict_marker.py
 
66
        ${PY} lib/canonical/tests/test_no_conflict_marker.py
71
67
 
72
68
check_db_merge:
73
 
        ${PYTHON} lib/canonical/tests/test_no_conflict_marker.py
 
69
        ${PY} lib/canonical/tests/test_no_conflict_marker.py
74
70
 
75
71
# This can be removed once we move to zc.buildout and we have versioned
76
72
# dependencies, but for now we run both Launchpad and all other
81
77
 
82
78
check: build
83
79
        # Run all tests. test_on_merge.py takes care of setting up the
84
 
        # database..
85
 
        env PYTHONPATH=$(PYTHONPATH) \
86
 
        ${PYTHON} -t ./test_on_merge.py $(VERBOSITY)
 
80
        # database.
 
81
        ${PY} -t ./test_on_merge.py $(VERBOSITY)
87
82
 
88
83
lint:
89
84
        @bash ./utilities/lint.sh
92
87
        @bash ./utilities/lint.sh -v
93
88
 
94
89
xxxreport:
95
 
        ${PYTHON} -t ./utilities/xxxreport.py -f csv -o xxx-report.csv ./
 
90
        ${PY} -t ./utilities/xxxreport.py -f csv -o xxx-report.csv ./
96
91
 
97
92
check-configs:
98
 
        ${PYTHON} utilities/check-configs.py
 
93
        ${PY} utilities/check-configs.py
99
94
 
100
95
pagetests: build
101
 
        env PYTHONPATH=$(PYTHONPATH) ${PYTHON} test.py test_pages
 
96
        env PYTHONPATH=$(PYTHONPATH) bin/test test_pages
102
97
 
103
98
inplace: build
104
99
 
105
100
build: $(BZR_VERSION_INFO) compile apidoc
106
101
 
107
102
compile:
 
103
        $(PYTHON) bootstrap.py
 
104
        ./bin/buildout configuration:instance_name=${LPCONFIG}
108
105
        ${SHHH} $(MAKE) -C sourcecode build PYTHON=${PYTHON} \
109
106
            PYTHON_VERSION=${PYTHON_VERSION} LPCONFIG=${LPCONFIG}
110
 
        ${SHHH} LPCONFIG=${LPCONFIG} PYTHONPATH=$(PYTHONPATH) \
111
 
                 $(PYTHON) -t buildmailman.py
 
107
        ${SHHH} LPCONFIG=${LPCONFIG} $(PY) -t buildmailman.py
112
108
        ${SHHH} sourcecode/lazr-js/tools/build.py \
113
109
                -n launchpad -s lib/canonical/launchpad/javascript \
114
110
                -b lib/canonical/launchpad/icing/build $(EXTRA_JS_FILES)
115
111
 
116
 
runners:
117
 
        echo "#!/bin/sh" > bin/runzope;
118
 
        echo "exec $(PYTHON) $(STARTSCRIPT) -C $(CONFFILE)" >> bin/runzope;
119
 
        chmod +x bin/runzope
120
 
        echo "#!/bin/sh" > bin/zopectl;
121
 
        echo "$(PYTHON) $(PWD)/src/zdaemon/zdctl.py \
122
 
              -S schema.xml \
123
 
              -C zdaemon.conf -d \$$*" >> bin/zopectl
124
 
        chmod +x bin/zopectl
125
 
 
126
112
test_build: build
127
 
        $(PYTHON) test.py $(TESTFLAGS) $(TESTOPTS)
 
113
        bin/test $(TESTFLAGS) $(TESTOPTS)
128
114
 
129
115
test_inplace: inplace
130
 
        $(PYTHON) test.py $(TESTFLAGS) $(TESTOPTS)
 
116
        bin/test $(TESTFLAGS) $(TESTOPTS)
131
117
 
132
118
ftest_build: build
133
 
        env PYTHONPATH=$(PYTHONPATH) \
134
 
            $(PYTHON) test.py -f $(TESTFLAGS) $(TESTOPTS)
 
119
        bin/test -f $(TESTFLAGS) $(TESTOPTS)
135
120
 
136
121
ftest_inplace: inplace
137
 
        env PYTHONPATH=$(PYTHONPATH) \
138
 
            $(PYTHON) test.py -f $(TESTFLAGS) $(TESTOPTS)
 
122
        bin/test -f $(TESTFLAGS) $(TESTOPTS)
139
123
 
140
124
run: inplace stop
141
125
        $(RM) thread*.request
142
 
        $(APPSERVER_ENV) $(PYTHON) -t $(STARTSCRIPT) \
143
 
                 -r librarian,google-webservice -C $(CONFFILE)
 
126
        bin/run -r librarian,google-webservice -C $(CONFFILE)
144
127
 
145
128
start-gdb: inplace stop support_files
146
129
        $(RM) thread*.request
147
 
        $(APPSERVER_ENV) nohup gdb -x run.gdb --args $(PYTHON) -t $(STARTSCRIPT) \
 
130
        nohup gdb -x run.gdb --args bin/run \
148
131
                -r librarian,google-webservice -C $(CONFFILE) \
149
132
                > ${LPCONFIG}-nohup.out 2>&1 &
150
133
 
151
134
run_all: inplace stop hosted_branches
152
135
        $(RM) thread*.request
153
 
        $(APPSERVER_ENV) $(PYTHON) -t $(STARTSCRIPT) \
154
 
                 -r librarian,buildsequencer,sftp,mailman,codebrowse,google-webservice \
 
136
        bin/run -r librarian,buildsequencer,sftp,mailman,codebrowse,google-webservice \
155
137
                 -C $(CONFFILE)
156
138
 
157
139
run_codebrowse: build
158
 
        BZR_PLUGIN_PATH=bzrplugins PYTHONPATH=lib $(PYTHON) sourcecode/launchpad-loggerhead/start-loggerhead.py -f
 
140
        BZR_PLUGIN_PATH=bzrplugins $(PY) sourcecode/launchpad-loggerhead/start-loggerhead.py -f
159
141
 
160
142
start_codebrowse: build
161
 
        BZR_PLUGIN_PATH=$(shell pwd)/bzrplugins PYTHONPATH=lib $(PYTHON) sourcecode/launchpad-loggerhead/start-loggerhead.py
 
143
        BZR_PLUGIN_PATH=$(shell pwd)/bzrplugins $(PY) sourcecode/launchpad-loggerhead/start-loggerhead.py
162
144
 
163
145
stop_codebrowse:
164
 
        PYTHONPATH=lib $(PYTHON) sourcecode/launchpad-loggerhead/stop-loggerhead.py
 
146
        $(PY) sourcecode/launchpad-loggerhead/stop-loggerhead.py
165
147
 
166
148
pull_branches: support_files
167
149
        # Mirror the hosted branches in the development upload area to the
168
150
        # mirrored area.
169
 
        $(PYTHON) cronscripts/supermirror-pull.py upload
 
151
        $(PY) cronscripts/supermirror-pull.py upload
170
152
 
171
153
scan_branches:
172
154
        # Scan branches from the filesystem into the database.
173
 
        $(PYTHON) cronscripts/branch-scanner.py
 
155
        $(PY) cronscripts/branch-scanner.py
174
156
 
175
157
sync_branches: pull_branches scan_branches
176
158
 
183
165
# properly. We also should really wait until services are running before
184
166
# exiting, as running 'make stop' too soon after running 'make start'
185
167
# will not work as expected.
 
168
# XXX $(PY) -t
186
169
start: inplace stop support_files
187
 
        $(APPSERVER_ENV) nohup $(PYTHON) -t $(STARTSCRIPT) -C $(CONFFILE) \
188
 
                 > ${LPCONFIG}-nohup.out 2>&1 &
 
170
        nohup bin/run -C $(CONFFILE) > ${LPCONFIG}-nohup.out 2>&1 &
189
171
 
190
172
# This is a stripped down version of the "start" target for use on
191
173
# production servers - removes running 'make build' because we already
193
175
# don't want to run 'make stop' because it takes unnecessary time
194
176
# even if the service is already stopped, and bzr_version_info is not
195
177
# needed either because it's run as part of 'make build'.
 
178
# XXX $(PY) -t
196
179
initscript-start:
197
 
        $(APPSERVER_ENV) nohup $(PYTHON) -t $(STARTSCRIPT) -C $(CONFFILE) \
198
 
                 > ${LPCONFIG}-nohup.out 2>&1 &
 
180
        nohup bin/run -C $(CONFFILE) > ${LPCONFIG}-nohup.out 2>&1 &
199
181
 
200
182
# Kill launchpad last - other services will probably shutdown with it,
201
183
# so killing them after is a race condition.
202
184
stop: build
203
 
        @ $(APPSERVER_ENV) ${PYTHON} \
204
 
            utilities/killservice.py librarian buildsequencer launchpad mailman
 
185
        bin/killservice librarian buildsequencer launchpad mailman
205
186
 
206
187
shutdown: scheduleoutage stop
207
188
        $(RM) +maintenancetime.txt
213
194
        sleep ${MINS_TO_SHUTDOWN}m
214
195
 
215
196
harness:
216
 
        $(APPSERVER_ENV) $(PYTHON) -i lib/canonical/database/harness.py
 
197
        bin/harness
217
198
 
218
199
iharness:
219
 
        $(APPSERVER_ENV) $(IPYTHON) -i lib/canonical/database/harness.py
 
200
        bin/iharness
220
201
 
221
202
rebuildfti:
222
203
        @echo Rebuilding FTI indexes on launchpad_dev database
223
 
        $(PYTHON) database/schema/fti.py -d launchpad_dev --force
224
 
 
225
 
debug:
226
 
        $(APPSERVER_ENV) \
227
 
                 $(PYTHON) -i -c \ "from zope.app import Application;\
228
 
                    app = Application('Data.fs', 'site.zcml')()"
 
204
        $(PY) database/schema/fti.py -d launchpad_dev --force
229
205
 
230
206
clean:
231
207
        $(MAKE) -C sourcecode/pygettextpo clean
233
209
            -name '*.o' -o -name '*.so' -o -name '*.la' -o \
234
210
            -name '*.lo' -o -name '*.py[co]' -o -name '*.dll' \) \
235
211
            -print0 | xargs -r0 $(RM)
 
212
        $(RM) -r bin
 
213
        $(RM) -r parts
 
214
        $(RM) .installed.cfg
236
215
        $(RM) -r build
237
216
        $(RM) thread*.request
238
217
        $(RM) -r lib/mailman /var/tmp/mailman/* /var/tmp/fatsam.appserver
253
232
 
254
233
zcmldocs:
255
234
        mkdir -p doc/zcml/namespaces.zope.org
256
 
        PYTHONPATH=$(shell pwd)/src:$(PYTHONPATH) $(PYTHON) \
257
 
            ./sourcecode/zope/src/zope/configuration/stxdocs.py \
 
235
        bin/stxdocs \
258
236
            -f sourcecode/zope/src/zope/app/zcmlfiles/meta.zcml \
259
237
            -o doc/zcml/namespaces.zope.org
260
238
 
262
240
 
263
241
# Generate launchpad.pot by extracting message ids from the source
264
242
launchpad.pot:
265
 
        $(PYTHON) sourcecode/zope/utilities/i18nextract.py \
266
 
            -d launchpad -p lib/canonical/launchpad \
267
 
            -o locales
 
243
        bin/i18nextract.py
268
244
 
269
245
install: reload-apache
270
246
 
285
261
        /etc/init.d/apache2 reload
286
262
 
287
263
static:
288
 
        $(PYTHON) scripts/make-static.py
289
 
 
290
 
TAGS:
291
 
        ctags -e -R --exclude='*yui/2.6.0*' --exclude='*-min.js' lib/canonical && \
292
 
                ctags -e --exclude=lib/canonical -a -R lib/
293
 
 
294
 
tags:
295
 
        ctags -R --exclude='*yui/2.6.0*' --exclude='*-min.js' lib/canonical && \
296
 
                ctags --exclude=lib/canonical -a -R lib/
 
264
        $(PY) scripts/make-static.py
 
265
 
 
266
TAGS: compile
 
267
        # emacs tags
 
268
        bin/tags -e
 
269
 
 
270
tags: compile
 
271
        # vi tags
 
272
        bin/tags -v
 
273
 
 
274
ID: compile
 
275
        # idutils ID file
 
276
        bin/tags -i
297
277
 
298
278
.PHONY: apidoc check tags TAGS zcmldocs realclean clean debug stop\
299
279
        start run ftest_build ftest_inplace test_build test_inplace pagetests\