Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 60c059e

Browse filesBrowse files
Trotttargos
authored andcommitted
tools: make license-builder.sh comply with shellcheck 0.8.0
Fixes for SC2312 added in shellcheck 0.8.0. PR-URL: #41258 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
1 parent a53fa20 commit 60c059e
Copy full SHA for 60c059e

File tree

Expand file treeCollapse file tree

1 file changed

+72
-52
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+72
-52
lines changed
Open diff view settings
Collapse file

‎tools/license-builder.sh‎

Copy file name to clipboardExpand all lines: tools/license-builder.sh
+72-52Lines changed: 72 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@ echo "$licensehead" > "$tmplicense"
1111

1212
# addlicense <library> <location> <license text>
1313
addlicense() {
14+
licenseTextTrimmed=$(echo "$3" | sed -e 's/^/ /' -e 's/^ $//' -e 's/ *$//' | sed -e '/./,$!d' | sed -e '/^$/N;/^\n$/D')
1415

1516
echo "
1617
- ${1}, located at ${2}, is licensed as follows:
1718
\"\"\"
18-
$(echo "$3" | sed -e 's/^/ /' -e 's/^ $//' -e 's/ *$//' | sed -e '/./,$!d' | sed -e '/^$/N;/^\n$/D')
19+
${licenseTextTrimmed}
1920
\"\"\"\
2021
" >> "$tmplicense"
2122

@@ -29,89 +30,108 @@ fi
2930

3031

3132
# Dependencies bundled in distributions
32-
addlicense "Acorn" "deps/acorn" "$(cat "${rootdir}"/deps/acorn/acorn/LICENSE)"
33-
addlicense "c-ares" "deps/cares" "$(tail -n +3 "${rootdir}"/deps/cares/LICENSE.md)"
34-
addlicense "cjs-module-lexer" "deps/cjs-module-lexer" "$(cat "${rootdir}"/deps/cjs-module-lexer/LICENSE)"
33+
licenseText="$(cat "${rootdir}"/deps/acorn/acorn/LICENSE)"
34+
addlicense "Acorn" "deps/acorn" "$licenseText"
35+
licenseText="$(tail -n +3 "${rootdir}"/deps/cares/LICENSE.md)"
36+
addlicense "c-ares" "deps/cares" "$licenseText"
37+
licenseText="$(cat "${rootdir}"/deps/cjs-module-lexer/LICENSE)"
38+
addlicense "cjs-module-lexer" "deps/cjs-module-lexer" "$licenseText"
3539
if [ -f "${rootdir}/deps/icu/LICENSE" ]; then
3640
# ICU 57 and following. Drop the BOM
37-
addlicense "ICU" "deps/icu" \
38-
"$(sed -e '1s/^[^a-zA-Z ]*ICU/ICU/' -e :a \
39-
-e 's/<[^>]*>//g;s/ / /g;s/ +$//;/</N;//ba' "${rootdir}"/deps/icu/LICENSE)"
41+
licenseText="$(sed -e '1s/^[^a-zA-Z ]*ICU/ICU/' -e :a -e 's/<[^>]*>//g;s/ / /g;s/ +$//;/</N;//ba' "${rootdir}"/deps/icu/LICENSE)"
42+
addlicense "ICU" "deps/icu" "$licenseText"
4043
elif [ -f "${rootdir}/deps/icu/license.html" ]; then
4144
# ICU 56 and prior
42-
addlicense "ICU" "deps/icu" \
43-
"$(sed -e '1,/ICU License - ICU 1\.8\.1 and later/d' -e :a \
44-
-e 's/<[^>]*>//g;s/ / /g;s/ +$//;/</N;//ba' "${rootdir}"/deps/icu/license.html)"
45+
licenseText="$(sed -e '1,/ICU License - ICU 1\.8\.1 and later/d' -e :a -e 's/<[^>]*>//g;s/ / /g;s/ +$//;/</N;//ba' "${rootdir}"/deps/icu/license.html)"
46+
addlicense "ICU" "deps/icu" "$licenseText"
4547
elif [ -f "${rootdir}/deps/icu-small/LICENSE" ]; then
4648
# ICU 57 and following. Drop the BOM
47-
addlicense "ICU" "deps/icu-small" \
48-
"$(sed -e '1s/^[^a-zA-Z ]*ICU/ICU/' -e :a \
49-
-e 's/<[^>]*>//g;s/ / /g;s/ +$//;/</N;//ba' "${rootdir}"/deps/icu-small/LICENSE)"
49+
licenseText="$(sed -e '1s/^[^a-zA-Z ]*ICU/ICU/' -e :a -e 's/<[^>]*>//g;s/ / /g;s/ +$//;/</N;//ba' "${rootdir}"/deps/icu-small/LICENSE)"
50+
addlicense "ICU" "deps/icu-small" "$licenseText"
5051
elif [ -f "${rootdir}/deps/icu-small/license.html" ]; then
5152
# ICU 56 and prior
52-
addlicense "ICU" "deps/icu-small" \
53-
"$(sed -e '1,/ICU License - ICU 1\.8\.1 and later/d' -e :a \
54-
-e 's/<[^>]*>//g;s/ / /g;s/ +$//;/</N;//ba' "${rootdir}"/deps/icu-small/license.html)"
53+
licenseText="$(sed -e '1,/ICU License - ICU 1\.8\.1 and later/d' -e :a -e 's/<[^>]*>//g;s/ / /g;s/ +$//;/</N;//ba' "${rootdir}"/deps/icu-small/license.html)"
54+
addlicense "ICU" "deps/icu-small" "$licenseText"
5555
else
5656
echo "Could not find an ICU license file."
5757
exit 1
5858
fi
5959

60-
addlicense "libuv" "deps/uv" "$(cat "${rootdir}"/deps/uv/LICENSE)"
61-
addlicense "llhttp" "deps/llhttp" "$(cat deps/llhttp/LICENSE-MIT)"
62-
addlicense "corepack" "deps/corepack" "$(cat "${rootdir}"/deps/corepack/LICENSE.md)"
63-
addlicense "OpenSSL" "deps/openssl" "$(cat "${rootdir}"/deps/openssl/openssl/LICENSE.txt)"
64-
addlicense "Punycode.js" "lib/punycode.js" \
65-
"$(curl -sL https://raw.githubusercontent.com/bestiejs/punycode.js/HEAD/LICENSE-MIT.txt)"
66-
addlicense "V8" "deps/v8" "$(cat "${rootdir}"/deps/v8/LICENSE)"
67-
addlicense "SipHash" "deps/v8/src/third_party/siphash" \
68-
"$(sed -e '/You should have received a copy of the CC0/,$d' -e 's/^\/\* *//' -e 's/^ \* *//' deps/v8/src/third_party/siphash/halfsiphash.cc)"
69-
addlicense "zlib" "deps/zlib" \
70-
"$(sed -e '/The data format used by the zlib library/,$d' -e 's/^\/\* *//' -e 's/^ *//' "${rootdir}"/deps/zlib/zlib.h)"
60+
licenseText="$(cat "${rootdir}"/deps/uv/LICENSE)"
61+
addlicense "libuv" "deps/uv" "$licenseText"
62+
licenseText="$(cat deps/llhttp/LICENSE-MIT)"
63+
addlicense "llhttp" "deps/llhttp" "$licenseText"
64+
licenseText="$(cat "${rootdir}"/deps/corepack/LICENSE.md)"
65+
addlicense "corepack" "deps/corepack" "$licenseText"
66+
licenseText="$(cat "${rootdir}"/deps/openssl/openssl/LICENSE.txt)"
67+
addlicense "OpenSSL" "deps/openssl" "$licenseText"
68+
licenseText="$(curl -sL https://raw.githubusercontent.com/bestiejs/punycode.js/HEAD/LICENSE-MIT.txt)"
69+
addlicense "Punycode.js" "lib/punycode.js" "$licenseText"
70+
licenseText="$(cat "${rootdir}"/deps/v8/LICENSE)"
71+
addlicense "V8" "deps/v8" "$licenseText"
72+
licenseText="$(sed -e '/You should have received a copy of the CC0/,$d' -e 's/^\/\* *//' -e 's/^ \* *//' deps/v8/src/third_party/siphash/halfsiphash.cc)"
73+
addlicense "SipHash" "deps/v8/src/third_party/siphash" "$licenseText"
74+
licenseText="$(sed -e '/The data format used by the zlib library/,$d' -e 's/^\/\* *//' -e 's/^ *//' "${rootdir}"/deps/zlib/zlib.h)"
75+
addlicense "zlib" "deps/zlib" "$licenseText"
7176

7277
# npm
73-
addlicense "npm" "deps/npm" "$(cat "${rootdir}"/deps/npm/LICENSE)"
78+
licenseText="$(cat "${rootdir}"/deps/npm/LICENSE)"
79+
addlicense "npm" "deps/npm" "$licenseText"
7480

7581
# Build tools
76-
addlicense "GYP" "tools/gyp" "$(cat "${rootdir}"/tools/gyp/LICENSE)"
77-
addlicense "inspector_protocol" "tools/inspector_protocol" "$(cat "${rootdir}"/tools/inspector_protocol/LICENSE)"
78-
addlicense "jinja2" "tools/inspector_protocol/jinja2" "$(cat "${rootdir}"/tools/inspector_protocol/jinja2/LICENSE)"
79-
addlicense "markupsafe" "tools/inspector_protocol/markupsafe" "$(cat "${rootdir}"/tools/inspector_protocol/markupsafe/LICENSE)"
82+
licenseText="$(cat "${rootdir}"/tools/gyp/LICENSE)"
83+
addlicense "GYP" "tools/gyp" "$licenseText"
84+
licenseText="$(cat "${rootdir}"/tools/inspector_protocol/LICENSE)"
85+
addlicense "inspector_protocol" "tools/inspector_protocol" "$licenseText"
86+
licenseText="$(cat "${rootdir}"/tools/inspector_protocol/jinja2/LICENSE)"
87+
addlicense "jinja2" "tools/inspector_protocol/jinja2" "$licenseText"
88+
licenseText="$(cat "${rootdir}"/tools/inspector_protocol/markupsafe/LICENSE)"
89+
addlicense "markupsafe" "tools/inspector_protocol/markupsafe" "$licenseText"
8090

8191
# Testing tools
82-
addlicense "cpplint.py" "tools/cpplint.py" \
83-
"$(sed -e '/^$/,$d' -e 's/^#$//' -e 's/^# //' "${rootdir}"/tools/cpplint.py | tail -n +3)"
84-
addlicense "ESLint" "tools/node_modules/eslint" "$(cat "${rootdir}"/tools/node_modules/eslint/LICENSE)"
85-
addlicense "gtest" "deps/googletest" "$(cat "${rootdir}"/deps/googletest/LICENSE)"
92+
licenseText="$(sed -e '/^$/,$d' -e 's/^#$//' -e 's/^# //' "${rootdir}"/tools/cpplint.py | tail -n +3)"
93+
addlicense "cpplint.py" "tools/cpplint.py" "$licenseText"
94+
licenseText="$(cat "${rootdir}"/tools/node_modules/eslint/LICENSE)"
95+
addlicense "ESLint" "tools/node_modules/eslint" "$licenseText"
96+
licenseText="$(cat "${rootdir}"/deps/googletest/LICENSE)"
97+
addlicense "gtest" "deps/googletest" "$licenseText"
8698

8799
# nghttp2
88-
addlicense "nghttp2" "deps/nghttp2" "$(cat "${rootdir}"/deps/nghttp2/COPYING)"
100+
licenseText="$(cat "${rootdir}"/deps/nghttp2/COPYING)"
101+
addlicense "nghttp2" "deps/nghttp2" "$licenseText"
89102

90103
# large_pages
91-
addlicense "large_pages" "src/large_pages" "$(sed -e '/SPDX-License-Identifier/,$d' -e 's/^\/\///' "${rootdir}"/src/large_pages/node_large_page.h)"
104+
licenseText="$(sed -e '/SPDX-License-Identifier/,$d' -e 's/^\/\///' "${rootdir}"/src/large_pages/node_large_page.h)"
105+
addlicense "large_pages" "src/large_pages" "$licenseText"
92106

93107
# deep_freeze
94-
addlicense "caja" "lib/internal/freeze_intrinsics.js" "$(sed -e '/SPDX-License-Identifier/,$d' -e 's/^\/\///' "${rootdir}"/lib/internal/freeze_intrinsics.js)"
108+
licenseText="$(sed -e '/SPDX-License-Identifier/,$d' -e 's/^\/\///' "${rootdir}"/lib/internal/freeze_intrinsics.js)"
109+
addlicense "caja" "lib/internal/freeze_intrinsics.js" "$licenseText"
95110

96111
# brotli
97-
addlicense "brotli" "deps/brotli" "$(cat "${rootdir}"/deps/brotli/LICENSE)"
112+
licenseText="$(cat "${rootdir}"/deps/brotli/LICENSE)"
113+
addlicense "brotli" "deps/brotli" "$licenseText"
98114

99-
addlicense "HdrHistogram" "deps/histogram" "$(cat "${rootdir}"/deps/histogram/LICENSE.txt)"
115+
licenseText="$(cat "${rootdir}"/deps/histogram/LICENSE.txt)"
116+
addlicense "HdrHistogram" "deps/histogram" "$licenseText"
100117

101-
addlicense "highlight.js" "doc/api_assets/highlight.pack.js" \
102-
"$(curl -sL https://raw.githubusercontent.com/highlightjs/highlight.js/63f367c46f2eeb6f9b7a3545e325eeeb917f9942/LICENSE)"
118+
licenseText="$(curl -sL https://raw.githubusercontent.com/highlightjs/highlight.js/63f367c46f2eeb6f9b7a3545e325eeeb917f9942/LICENSE)"
119+
addlicense "highlight.js" "doc/api_assets/highlight.pack.js" "$licenseText"
103120

104-
addlicense "node-heapdump" "src/heap_utils.cc" \
105-
"$(curl -sL https://raw.githubusercontent.com/bnoordhuis/node-heapdump/0ca52441e46241ffbea56a389e2856ec01c48c97/LICENSE)"
121+
licenseText="$(curl -sL https://raw.githubusercontent.com/bnoordhuis/node-heapdump/0ca52441e46241ffbea56a389e2856ec01c48c97/LICENSE)"
122+
addlicense "node-heapdump" "src/heap_utils.cc" "$licenseText"
106123

107-
addlicense "rimraf" "lib/internal/fs/rimraf.js" \
108-
"$(curl -sL https://raw.githubusercontent.com/isaacs/rimraf/0e365ac4e4d64a25aa2a3cc026348f13410210e1/LICENSE)"
124+
licenseText="$(curl -sL https://raw.githubusercontent.com/isaacs/rimraf/0e365ac4e4d64a25aa2a3cc026348f13410210e1/LICENSE)"
125+
addlicense "rimraf" "lib/internal/fs/rimraf.js" "$licenseText"
109126

110-
addlicense "uvwasi" "deps/uvwasi" "$(cat "${rootdir}"/deps/uvwasi/LICENSE)"
111-
addlicense "ngtcp2" "deps/ngtcp2/ngtcp2/" "$(cat "${rootdir}"/deps/ngtcp2/LICENSE_ngtcp2)"
112-
addlicense "nghttp3" "deps/ngtcp2/nghttp3/" "$(cat "${rootdir}"/deps/ngtcp2/LICENSE_nghttp3)"
127+
licenseText="$(cat "${rootdir}"/deps/uvwasi/LICENSE)"
128+
addlicense "uvwasi" "deps/uvwasi" "$licenseText"
129+
licenseText="$(cat "${rootdir}"/deps/ngtcp2/LICENSE_ngtcp2)"
130+
addlicense "ngtcp2" "deps/ngtcp2/ngtcp2/" "$licenseText"
131+
licenseText="$(cat "${rootdir}"/deps/ngtcp2/LICENSE_nghttp3)"
132+
addlicense "nghttp3" "deps/ngtcp2/nghttp3/" "$licenseText"
113133

114-
addlicense "node-fs-extra" "lib/internal/fs/cp" \
115-
"$(curl -sL https://raw.githubusercontent.com/jprichardson/node-fs-extra/b34da2762a4865b025cac06d02d6a2f1f1027b65/LICENSE)"
134+
licenseText="$(curl -sL https://raw.githubusercontent.com/jprichardson/node-fs-extra/b34da2762a4865b025cac06d02d6a2f1f1027b65/LICENSE)"
135+
addlicense "node-fs-extra" "lib/internal/fs/cp" "$licenseText"
116136

117137
mv "$tmplicense" "$licensefile"

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.