Merge lp:~rockstar/launchpad/js-no-bigger-than-512k into lp:launchpad

Proposed by Paul Hummer
Status: Merged
Approved by: Brad Crittenden
Approved revision: not available
Merged at revision: not available
Proposed branch: lp:~rockstar/launchpad/js-no-bigger-than-512k
Merge into: lp:launchpad
Diff against target: 49 lines (+23/-0)
3 files modified
Makefile (+1/-0)
buildout.cfg (+1/-0)
lib/lp/scripts/utilities/jssize.py (+21/-0)
To merge this branch: bzr merge lp:~rockstar/launchpad/js-no-bigger-than-512k
Reviewer Review Type Date Requested Status
Brad Crittenden (community) code Approve
Review via email: mp+19751@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Paul Hummer (rockstar) wrote :

Hi there-

  This branch adds a real quick script to assert that the generated javascript
doesn't exceed 512K. If it does, Windmill does odd things. I'm still
investigating why, but this is a stopgap so we don't waste so much time trying
to figure out why windmill tests are failing spuriously.

Cheers,
Paul

Revision history for this message
Brad Crittenden (bac) wrote :

Looks great Paul with the following three changes we discussed on IRC:

1) Add #!/usr/bin/python2.5 to the script
2) Update copyright year to 2010
3) MAX_FILE_SIZE = 512 * 1024

Thanks for this script -- it'll certainly help us until we can figure out the root cause of the JS problem.

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Makefile'
2--- Makefile 2010-02-19 18:45:21 +0000
3+++ Makefile 2010-02-19 22:38:24 +0000
4@@ -137,6 +137,7 @@
5 -b $(LP_BUILT_JS_ROOT) \
6 $(shell $(HERE)/utilities/yui-deps.py) \
7 lib/canonical/launchpad/icing/lazr/build/lazr.js
8+ ${SHHH} bin/jssize
9
10 eggs:
11 # Usually this is linked via link-external-sourcecode, but in
12
13=== modified file 'buildout.cfg'
14--- buildout.cfg 2009-12-14 21:55:56 +0000
15+++ buildout.cfg 2010-02-19 22:38:24 +0000
16@@ -75,6 +75,7 @@
17 jsbuild=lazr.js.build:main
18 jslint=lazr.js.jslint:main
19 tracereport=zc.zservertracelog.tracereport:main
20+ jssize=lp.scripts.utilities.jssize:main
21
22 [iharness]
23 recipe = zc.recipe.egg
24
25=== added file 'lib/lp/scripts/utilities/jssize.py'
26--- lib/lp/scripts/utilities/jssize.py 1970-01-01 00:00:00 +0000
27+++ lib/lp/scripts/utilities/jssize.py 2010-02-19 22:38:24 +0000
28@@ -0,0 +1,21 @@
29+#!/usr/bin/env python2.5
30+# Copyright 2010 Canonical Ltd. This software is licensed under the
31+# GNU Affero General Public License version 3 (see the file LICENSE).
32+
33+"""Script to check the size of the generated javascript.
34+
35+This script tests to ensure optimized javascript never gets over a certain
36+size. If it gets too big, Windmill has issues. This is a hack until we can
37+find out why Windmill has such issues.
38+"""
39+
40+import os
41+
42+FILE_NAME = 'lib/canonical/launchpad/icing/build/launchpad.js'
43+MAX_FILE_SIZE = 512 * 1024
44+
45+def main():
46+ size = os.path.getsize(FILE_NAME)
47+ if size > MAX_FILE_SIZE:
48+ raise Exception(
49+ 'launchpad.js is greater than %d bytes' % MAX_FILE_SIZE)