Merge ~twom/launchpad:sassy-css-fix-review-pop-over into launchpad:master

Proposed by Tom Wardill
Status: Merged
Approved by: Tom Wardill
Approved revision: 5c512e1098fcc2fda57cc400adcce935eaefab78
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~twom/launchpad:sassy-css-fix-review-pop-over
Merge into: launchpad:master
Diff against target: 32 lines (+8/-2)
2 files modified
Makefile (+2/-1)
lib/lp/scripts/utilities/js/jsbuild.py (+6/-1)
Reviewer Review Type Date Requested Status
Colin Watson (community) Approve
Review via email: mp+385678@code.launchpad.net

Commit message

Make CSS generation repeatable

Description of the change

`scandir` isn't guaranteed to be consistent in ordering, so sort it by name to ensure we include the same files in the same order.
Also disable compressed output to make it easier to debug while this issue is happening.

To post a comment you must log in.
Revision history for this message
Colin Watson (cjwatson) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/Makefile b/Makefile
2index 262d9a3..1d81830 100644
3--- a/Makefile
4+++ b/Makefile
5@@ -185,7 +185,8 @@ css_combine: jsbuild_widget_css
6 # Compile the base.css file separately for tests
7 SASS_BINARY_PATH=$(NODE_SASS_BINARY) $(YARN) run node-sass --include-path $(WD)/$(ICING) --follow --output $(WD)/$(ICING)/ $(WD)/$(ICING)/css/base.scss
8 # Compile the combo.css for the main site
9- SASS_BINARY_PATH=$(NODE_SASS_BINARY) $(YARN) run node-sass --include-path $(WD)/$(ICING) --output-style compressed --follow --output $(WD)/$(ICING) $(WD)/$(ICING)/combo.scss
10+ # XXX 2020-06-12 twom This should have `--output-style compressed`. Removed for debugging purposes
11+ SASS_BINARY_PATH=$(NODE_SASS_BINARY) $(YARN) run node-sass --include-path $(WD)/$(ICING) --follow --output $(WD)/$(ICING) $(WD)/$(ICING)/combo.scss
12
13 css_watch: jsbuild_widget_css
14 ${SHHH} bin/sprite-util create-image
15diff --git a/lib/lp/scripts/utilities/js/jsbuild.py b/lib/lp/scripts/utilities/js/jsbuild.py
16index a1bdd2f..8424adc 100644
17--- a/lib/lp/scripts/utilities/js/jsbuild.py
18+++ b/lib/lp/scripts/utilities/js/jsbuild.py
19@@ -352,7 +352,12 @@ class Builder:
20 combined_css.update()
21
22 def do_build(self):
23- for entry in scandir.scandir(self.src_dir):
24+ # We need this to be both repeatable and in the desired order
25+ dir_list = sorted(
26+ scandir.scandir(self.src_dir),
27+ key=lambda x: x.name.lower(),
28+ reverse=True)
29+ for entry in dir_list:
30 if not entry.is_dir():
31 continue
32 self.build_assets(entry.name)

Subscribers

People subscribed via source and target branches

to status/vote changes: