~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to Makefile

  • Committer: Gary Poster
  • Date: 2009-04-21 21:01:16 UTC
  • mto: (8329.1.1 buildout2)
  • mto: This revision was merged to the branch mainline in revision 8489.
  • Revision ID: gary.poster@canonical.com-20090421210116-18no9ed8exo6mgs4
checkpoint: this initial buildout variant has several parts working, including run, start, stop, and harness.

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