Skip to content

Commit 9dd8ba2

Browse files
Download chartjs only once in makefile (#1524)
### WHAT is this pull request doing? Currently we download chart.js twice, and check sha256sum twice. Since we run make multi-threaded, it is possible that the file is deleted before the step is completed, meaning the package can end up without the correct files. This changes that to only download chart.js once, to make sure the file can not be deleted between build steps This also adds an exit if the sha256sum fails. ### HOW can this pull request be tested? run `make js`, verify output
1 parent 829f667 commit 9dd8ba2

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

Makefile

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -63,17 +63,20 @@ lib: shard.yml shard.lock
6363
bin static/js/lib man1 static/js/lib/chunks:
6464
mkdir -p $@
6565

66-
static/js/lib/chart.js: | static/js/lib
66+
.PHONY: chart.js.tgz
67+
chart.js.tgz:
6768
curl --fail --retry 5 -sL -o chart.js.tgz https://github.com/chartjs/Chart.js/releases/download/v4.0.1/chart.js-4.0.1.tgz && \
68-
echo "461dae2edc0eda7beeb16c7030ab630ab5129aedd3fc6de9a036f6dfe488556f chart.js.tgz" | sha256sum -c - && \
69-
tar -zxOf chart.js.tgz package/dist/chart.js > $@ ; \
70-
(rm -f chart.js.tgz && echo "removed chart.js.tgz")
69+
echo "461dae2edc0eda7beeb16c7030ab630ab5129aedd3fc6de9a036f6dfe488556f chart.js.tgz" | sha256sum -c - || (rm -f chart.js.tgz && exit 1)
7170

72-
static/js/lib/chunks/helpers.segment.js: | static/js/lib/chunks
73-
curl --fail --retry 5 -sL -o chart.js.tgz https://github.com/chartjs/Chart.js/releases/download/v4.0.1/chart.js-4.0.1.tgz && \
74-
echo "461dae2edc0eda7beeb16c7030ab630ab5129aedd3fc6de9a036f6dfe488556f chart.js.tgz" | sha256sum -c - && \
75-
tar -zxOf chart.js.tgz package/dist/chunks/helpers.segment.js > $@ ; \
76-
(rm -f chart.js.tgz && echo "removed chart.js.tgz")
71+
.PHONY: after-chartjs
72+
after-chartjs: static/js/lib/chart.js static/js/lib/chunks/helpers.segment.js
73+
rm -f chart.js.tgz
74+
75+
static/js/lib/chart.js: | static/js/lib chart.js.tgz
76+
tar -zxOf chart.js.tgz package/dist/chart.js > $@
77+
78+
static/js/lib/chunks/helpers.segment.js: | static/js/lib/chunks chart.js.tgz
79+
tar -zxOf chart.js.tgz package/dist/chunks/helpers.segment.js > $@
7780

7881
static/js/lib/luxon.js: | static/js/lib
7982
curl --fail --retry 5 -sLo $@ https://moment.github.io/luxon/es6/luxon.mjs && \
@@ -111,7 +114,7 @@ MANPAGES := man1/lavinmq.1 man1/lavinmqctl.1 man1/lavinmqperf.1
111114
man: $(MANPAGES)
112115

113116
.PHONY: js
114-
js: $(JS)
117+
js: $(JS) after-chartjs
115118

116119
.PHONY: deps
117120
deps: js lib

0 commit comments

Comments
 (0)