Merge lp:~rharding/launchpad/yuiv5 into lp:launchpad

Proposed by Richard Harding on 2012-08-13
Status: Merged
Approved by: Richard Harding on 2012-08-13
Approved revision: no longer in the source branch.
Merged at revision: 15800
Proposed branch: lp:~rharding/launchpad/yuiv5
Merge into: lp:launchpad
Diff against target: 168 lines (+30/-31)
5 files modified
Makefile (+20/-2)
buildout-templates/bin/combo-rootdir.in (+7/-1)
buildout.cfg (+0/-24)
lib/lp/app/templates/base-layout-macros.pt (+3/-3)
versions.cfg (+0/-1)
To merge this branch: bzr merge lp:~rharding/launchpad/yuiv5
Reviewer Review Type Date Requested Status
Robert Collins (community) 2012-08-13 Approve on 2012-08-13
Review via email: mp+119406@code.launchpad.net

Commit Message

Move YUI libary to Makefile and generate side by side installs so yui_version feature flag functions.

Description of the Change

= Summary =

This is another attempt to get side by side versions of YUI to install and
hook into the existing yui_version feature flag.

== Pre Implementation ==

Discussed moving things out of the buildout with lifeless. We're hitting
friction with having one version of YUI in versions.cfg (which is for python
packages) and doing multiple versions of YUI at once for testing.

== Implementation Notes ==

We move the versions of YUI supported into the Makefile as YUI_VERSIONS.
There's a default version which is symlinked to the usual build/js/yui target.
This get overridden by the feature flag and allows setting other versions
we've got packaged. Currently, we only allow 3.3.0 (default) and 3.5.1.

The download cache contains both versions, all systems have unzip installed as
part of lp-deps.

== Q/A ==

Make sure we can switch to using the 3.5.1 JS via the feature flag below and see all the combo load urls sprout paths in the query string that mention 3.5.1 and yet still return blobs of JS.

js.yui_version default 1 yui-3.5.1

Note: at the start of this work all JS tests were made to pass with 3.5.1.
Since this has taken time to get going, some tests are failing.

https://bugs.launchpad.net/launchpad/+bug/1036313

Since this work is behind a feature flag, it is safe to land and the list of
failing tests can be updated as a next step.

== Tests ==

All tests currently pass with YUI 3.3.0. Note that our current test system
only runs tests against the default YUI version. Tests against the other
versions must be manually run by altering the build/js/yui symlink to the
version you want to test.

== LoC Qualification ==

Just barely negative LoC

To post a comment you must log in.
Robert Collins (lifeless) wrote :

This looks good to me. Does it pass ec2?

review: Approve
Richard Harding (rharding) wrote :

> This looks good to me. Does it pass ec2?

Will find out once I get an ok on the code review.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Makefile'
2--- Makefile 2012-08-09 06:46:51 +0000
3+++ Makefile 2012-08-13 18:31:24 +0000
4@@ -34,6 +34,10 @@
5 ! -path 'lib/lp/services/*'
6 endef
7
8+JS_BUILD_DIR := build/js
9+YUI_VERSIONS := 3.3.0 3.5.1
10+YUI_BUILDS := $(patsubst %,$(JS_BUILD_DIR)/yui-%, $(YUI_VERSIONS))
11+YUI_DEFAULT := $(JS_BUILD_DIR)/yui-3.3.0
12 JS_YUI := $(shell utilities/yui-deps.py $(JS_BUILD:raw=))
13 JS_LP := $(shell find -L $(JS_LP_PATHS) -name '*.js' ! -name '.*.js')
14 JS_ALL := $(JS_YUI) $(JS_LP)
15@@ -171,10 +175,24 @@
16 jsbuild_watch:
17 $(PY) bin/watch_jsbuild
18
19+$(JS_BUILD_DIR):
20+ mkdir -p $@
21+
22+$(YUI_BUILDS): $(JS_BUILD_DIR)
23+ for V in $(YUI_VERSIONS); do \
24+ mkdir $(JS_BUILD_DIR)/yui-$$V $(JS_BUILD_DIR)/yui-$$V-tmp; \
25+ unzip -q download-cache/dist/yui_$$V.zip -d $(JS_BUILD_DIR)/yui-$$V-tmp; \
26+ mv $(JS_BUILD_DIR)/yui-$$V-tmp/yui/build/* $(JS_BUILD_DIR)/yui-$$V/; \
27+ rm -rf $(JS_BUILD_DIR)/yui-$$V-tmp; \
28+ done
29+
30 $(JS_LP): jsbuild_widget_css
31 $(JS_YUI):
32 cp -a lib/canonical/launchpad/icing/yui_2.7.0b/build build/js/yui2
33
34+# YUI_DEFAULT is one of the targets in YUI_BUILDS which expands all of our YUI
35+# versions for us.
36+$(JS_ALL): $(YUI_DEFAULT)
37 $(JS_OUT): $(JS_ALL)
38 ifeq ($(JS_BUILD), min)
39 cat $^ | bin/lpjsmin > $@
40@@ -187,7 +205,7 @@
41 utilities/check-js-deps
42
43 jsbuild: $(PY) $(JS_OUT)
44- bin/combo-rootdir build/js
45+ bin/combo-rootdir build/js $(YUI_DEFAULT)
46
47 eggs:
48 # Usually this is linked via link-external-sourcecode, but in
49@@ -470,7 +488,7 @@
50 if [ ! -d /srv/launchpad.dev ]; then \
51 mkdir /srv/launchpad.dev; \
52 chown $(SUDO_UID):$(SUDO_GID) /srv/launchpad.dev; \
53- fi
54+ fi
55
56 enable-apache-launchpad: copy-apache-config copy-certificates
57 a2ensite local-launchpad
58
59=== modified file 'buildout-templates/bin/combo-rootdir.in'
60--- buildout-templates/bin/combo-rootdir.in 2012-07-13 01:55:27 +0000
61+++ buildout-templates/bin/combo-rootdir.in 2012-08-13 18:31:24 +0000
62@@ -10,11 +10,17 @@
63 exit 1
64 fi
65
66+if [ -z "$2" ]; then
67+ echo "$0: Need yui build version to use as default as second argument"
68+ exit 1
69+fi
70+
71 BUILD_DIR=$1
72+YUI_VERSION=$2
73
74 # Populate YUI.
75 if [ ! -h $BUILD_DIR/yui ]; then
76- ln -sf yui-${versions:yui} $BUILD_DIR/yui
77+ ln -sf `basename $YUI_VERSION` $BUILD_DIR/yui
78 fi
79
80 # And YUI 2, for now.
81
82=== modified file 'buildout.cfg'
83--- buildout.cfg 2012-07-25 21:09:38 +0000
84+++ buildout.cfg 2012-08-13 18:31:24 +0000
85@@ -3,7 +3,6 @@
86
87 [buildout]
88 parts =
89- yui-default
90 scripts
91 filetemplates
92 tags
93@@ -14,7 +13,6 @@
94 unzip = true
95 eggs-directory = eggs
96 download-cache = download-cache
97-yui-directory = build/js
98 relative-paths = true
99
100 # Disable this option temporarily if you want buildout to find software
101@@ -37,28 +35,6 @@
102 [configuration]
103 instance_name = development
104
105-[yui]
106-recipe = plone.recipe.command
107-command =
108- mkdir -p ${buildout:yui-directory}/yui-${:yui_version}
109- rm -rf ${buildout:yui-directory}/yui-${:yui_version}/*
110- tar -zxf download-cache/dist/yui-${:yui_version}.tar.gz \
111- --wildcards --strip-components 2 \
112- -C ${buildout:yui-directory}/yui-${:yui_version} \
113- '*/build'
114-
115-[yui-default]
116-<= yui
117-yui_version = ${versions:yui}
118-
119-[yui-3.4]
120-<= yui
121-yui_version = 3.4.1
122-
123-[yui-3.5]
124-<=yui
125-yui_version = 3.5.0pr1
126-
127 [filetemplates]
128 recipe = z3c.recipe.filetemplate
129 source-directory = buildout-templates
130
131=== modified file 'lib/lp/app/templates/base-layout-macros.pt'
132--- lib/lp/app/templates/base-layout-macros.pt 2012-08-10 04:48:36 +0000
133+++ lib/lp/app/templates/base-layout-macros.pt 2012-08-13 18:31:24 +0000
134@@ -88,8 +88,7 @@
135 tal:content="string:var cookie_scope = '${request/lp:cookie_scope}';"></script>
136
137 <tal:js-loader condition="request/features/js.combo_loader.enabled">
138- <script type="text/javascript"
139- tal:attributes="src string:${combo_url}/?yui/yui/yui-min.js&amp;lp/meta.js&amp;yui/loader/loader-min.js"></script>
140+ <script type="text/javascript" tal:attributes="src string:${combo_url}/?${yui_version}/yui/yui-min.js&amp;lp/meta.js&amp;${yui_version}/loader/loader-min.js"></script>
141 <script type="text/javascript" tal:content="string:
142 var raw = null;
143 if (LP.devmode) {
144@@ -98,10 +97,11 @@
145 YUI.GlobalConfig = {
146 combine: true,
147 comboBase: '${combo_url}/?',
148- root: 'yui/',
149+ root: '${yui_version}/',
150 filter: raw,
151 debug: ${yui_console_debug},
152 fetchCSS: false,
153+ maxURLLength: 2000,
154 groups: {
155 lp: {
156 combine: true,
157
158=== modified file 'versions.cfg'
159--- versions.cfg 2012-08-10 18:10:08 +0000
160+++ versions.cfg 2012-08-13 18:31:24 +0000
161@@ -146,7 +146,6 @@
162 wsgi-jsonrpc = 0.2.8
163 wsgi-xmlrpc = 0.2.7
164 wsgiref = 0.1.2
165-yui = 3.3.0
166 z3c.coverage = 1.1.2
167 z3c.csvvocabulary = 1.0.0
168 z3c.etestbrowser = 1.0.4